1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! 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!")?;
//! ```
// `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 ;
pub use verify_identity_assertion;
pub use ;
pub use SealMark;
pub use ;
pub use ;