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 group chat applications using the MLS (Messaging Layer Security) protocol with consensus-based membership management.

§Architecture

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

§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-group 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::GroupEventHandler)
  • Core operations (create group, join, send messages)
  • The ProcessResult → DispatchAction flow

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

§Quick Example

use de_mls::core::{DefaultProvider, GroupEventHandler};
use de_mls::app::User;

// Create a user with an Ethereum private key
let user: User<DefaultProvider> = User::with_private_key(
    "0xac0974...",  // Private key
    consensus,      // Consensus service
    handler,        // Your GroupEventHandler implementation
)?;

// Create a group (as steward)
user.create_group("my-group", true).await?;

// Send a message
user.send_message("my-group", b"Hello, world!").await?;

Modules§

app
Reference application layer: multi-group management and state machine. Reference application layer for DE-MLS.
core
Protocol implementation: message processing, consensus, and group operations. Core library for DE-MLS group management.
ds
Delivery service: transport-agnostic messaging. Enable the waku feature for the Waku relay implementation. Delivery Service — transport-agnostic messaging layer.
mls_crypto
MLS cryptographic operations: OpenMLS wrapper for encryption/decryption. MLS cryptographic operations for DE-MLS.
protos
Protobuf message definitions.