offline-protocol-mls 0.30.0

MLS (Message Layer Security) integration for end-to-end encryption in the Offline Protocol SDK
Documentation
//! MLS (Message Layer Security) integration for the Offline Protocol SDK.
//!
//! This crate provides end-to-end encryption using the MLS protocol via OpenMLS.
//! It supports both 1:1 encrypted messaging and group messaging with forward secrecy
//! and post-compromise security.
//!
//! # Architecture
//!
//! The crate is designed with a storage-agnostic approach:
//! - Apps implement the [`MlsStorage`] trait for platform-native secure storage
//! - [`storage_conformance::run`] is the gate an implementation has to pass
//! - The [`MlsManager`] handles all MLS operations (key generation, encryption, decryption)
//! - Groups are used for both 1:1 sessions (2-person groups) and multi-party chats
//!
//! # Example
//!
//! ```ignore
//! use offline_protocol_mls::{MlsManager, MlsStorage};
//!
//! // Implement MlsStorage for your platform (iOS Keychain, Android Keystore, etc.)
//! let storage = MyPlatformStorage::new();
//!
//! // Create the MLS manager
//! let manager = MlsManager::new("user123", Box::new(storage))?;
//!
//! // Generate a key package to share with others
//! let key_package = manager.generate_key_package()?;
//!
//! // Create a 1:1 session and send an encrypted message
//! let ciphertext = manager.encrypt_for_user("bob", b"Hello, Bob!")?;
//! ```

#![deny(unsafe_code)]
#![warn(missing_docs)]

pub mod discovery;
pub mod error;
pub mod group;
pub mod identity_assertion;
pub mod invite;
pub mod manager;
pub mod provider;
pub mod session;
pub mod storage;
mod storage_adapter;
pub mod storage_conformance;
pub mod types;

// `LeafSource` rides here with `MlsError` because it is a public field type on
// a public variant: matching on `LeafAddressMismatch { context, .. }` should not
// need a deeper path than the error it came out of.
pub use error::{LeafSource, MlsError, Result};
pub use identity_assertion::verify_identity_assertion;
pub use manager::{is_mls_framed, MlsManager, PushKeyPackage, MAX_PUSH_KEY_PACKAGES};
pub use session::SealMark;
pub use storage::{MlsStorage, StorageError};
pub use types::{
    EncryptedMessage, GroupId, GroupInfo, GroupMetadata, GroupRole, KeyPackageBundle,
    MlsMessageType, ParseGroupRoleError, WelcomeMessage,
};