Skip to main content

Crate de_mls

Crate de_mls 

Source
Expand description

§DE-MLS: Decentralized MLS Chat Protocol

A library for building decentralized, end-to-end encrypted chat applications using the MLS (Messaging Layer Security) protocol with consensus-based membership management.

§Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                         Your Application                            │
└───────────────────────────────┬─────────────────────────────────────┘
                                │
                       ┌────────┴────────┐
                       │      app        │
                       │ (reference impl,│
                       │   optional)     │
                       └────────┬────────┘
                                │
        ┌───────────────────────┼───────────────────────┐
        ▼                       ▼                       ▼
┌───────────────┐      ┌───────────────┐      ┌───────────────┐
│     core      │      │   mls_crypto  │      │      ds       │
│  (protocol)   │      │ (encryption)  │      │ (transport)   │
└───────────────┘      └───────────────┘      └───────────────┘

§Modules

  • core - Protocol implementation (message processing, consensus integration)
  • mls_crypto - MLS cryptographic operations (OpenMLS wrapper)
  • ds - Delivery service abstraction (Waku transport)
  • app - Reference application layer (multi-conversation management, state machine)
  • protos - Protobuf message definitions

§Getting Started

Most developers should start with the core module documentation, which explains:

  • What traits you need to implement (core::SessionEvent)
  • Core operations (start conversation, join, send messages)
  • The ProcessResult matching flow

If you want a ready-to-use solution, see app::User which provides complete conversation management with state machine and epoch handling.

§Quick Example

use de_mls::app::User;

// Build a user from your own `Identity` impl plus the default plug-in
// bundle. The library is identity-agnostic — anything implementing
// `de_mls::identity::Identity` works (wallet, Ed25519, account id, …).
let mut user = User::new_with_plugins(&identity, plugins, transport);

// Start a conversation (as steward).
user.start_conversation("de-mls-test", true).await?;

// Send a message.
user.send_app_message("de-mls-test", b"Hello, world!".to_vec()).await?;

// Drain lifecycle + per-session events on your polling cycle.
for event in user.drain_lifecycle_events() { /* … */ }

Modules§

app
Reference application layer. Reference application layer — wires crate::core into a working chat app with consensus, state machine, peer scoring, and freeze/commit timing.
core
Protocol implementation. Reusable core for building DE-MLS chat applications.
defaults
Reference implementations of the library’s plug-in traits — in-memory MLS / peer-score storage, default consensus + per-conversation plug-in bundles, and a reference key-package provider. Production integrators swap one or more for their own implementations. Reference implementations of the library’s plug-in traits.
ds
Delivery service: transport-agnostic messaging. Enable the waku feature for the Waku relay implementation. Delivery service — transport-agnostic messaging layer.
identity
User-level identity, decoupled from MLS state. User-level identity, decoupled from MLS state.
mls_crypto
MLS cryptographic operations: OpenMLS wrapper for encryption/decryption. MLS cryptographic operations for DE-MLS.
protos
Protobuf message definitions.