Skip to main content

Module mls

Module mls 

Source
Expand description

MLS (Message Layer Security) integration for end-to-end encryption.

This module provides end-to-end encryption support using the MLS protocol. Messages can be encrypted before sending and decrypted after receiving, providing forward secrecy and post-compromise security.

§Architecture

The MLS integration uses a storage-agnostic design:

  • Apps provide a storage implementation via the MlsStorage trait
  • The SDK handles all MLS protocol operations
  • Encrypted messages are transported using the existing transport layer

§Usage

ⓘ
use offline_protocol::mls::{MlsManager, MlsStorage};

// Create storage (apps implement this for platform-native secure storage)
let storage = MySecureStorage::new();

// Create the MLS manager
let mls = MlsManager::new("user123", storage)?;

// Generate a key package to share with others
let key_package = mls.generate_key_package()?;

// Encrypt a message for another user
let encrypted = mls.encrypt_for_user("bob", b"Hello!")?;

Modules§

metadata_keys
Metadata keys for MLS-encrypted messages.

Structs§

EncryptedMessage
The sealed-envelope types, re-exported so that every path into them keeps working and there is still exactly one definition of each.
GroupId
The sealed-envelope types, re-exported so that every path into them keeps working and there is still exactly one definition of each.
GroupInfo
Information about an MLS group.
GroupMetadata
Metadata about an MLS group (stored separately from MLS state).
InMemoryStorage
In-memory storage implementation for testing.
KeyPackageBundle
A bundle containing a key package and metadata for distribution.
MlsManager
Main MLS manager for end-to-end encryption.
WelcomeMessage
The sealed-envelope types, re-exported so that every path into them keeps working and there is still exactly one definition of each.

Enums§

MlsError
Errors that can occur during MLS operations.
MlsMessageType
The sealed-envelope types, re-exported so that every path into them keeps working and there is still exactly one definition of each.
StorageError
Errors that can occur during storage operations.

Traits§

MlsProtocolExt
Extension trait for integrating MLS with the protocol.
MlsStorage
Trait for MLS key material storage.

Functions§

create_manager
Creates an MLS manager with the given storage.
decode_from_transport
Decodes an encrypted message from a base64-encoded string.
encode_for_transport
Converts an MLS encrypted message to a base64-encoded string for transport.

Type Aliases§

MlsResult
Result type alias for MLS operations.