Skip to main content

Crate offline_protocol_mls

Crate offline_protocol_mls 

Source
Expand description

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
  • 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

ⓘ
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!")?;

Re-exports§

pub use error::LeafSource;
pub use error::MlsError;
pub use error::Result;
pub use manager::is_mls_framed;
pub use manager::MlsManager;
pub use manager::PushKeyPackage;
pub use manager::MAX_PUSH_KEY_PACKAGES;
pub use storage::MlsStorage;
pub use storage::StorageError;
pub use types::EncryptedMessage;
pub use types::GroupId;
pub use types::GroupInfo;
pub use types::GroupMetadata;
pub use types::GroupRole;
pub use types::KeyPackageBundle;
pub use types::MlsMessageType;
pub use types::ParseGroupRoleError;
pub use types::WelcomeMessage;

Modules§

discovery
DiscoveryRecordV1: a signed, non-authoritative claim that a username points at an address.
error
Error types for MLS operations.
group
MLS group management.
invite
The invite payload: a self-verifying {address, pubkey, petname?, sig?} blob for QR codes and links.
manager
Main MLS manager - the primary interface for MLS operations.
provider
Custom OpenMLS provider implementation.
session
1:1 session management using MLS groups.
storage
Storage trait definitions for MLS key material.
types
Types for MLS operations.