Skip to main content

Pure Python MLS implementation with CLI. Still maturing the application messaging CLI commands.

Project description

pure-mls

pure-mls is a zero-dependency, pure Python implementation of the Messaging Layer Security (MLS) protocol (RFC 9420). This project provides a production-grade cryptographic state machine for secure group messaging.

๐Ÿš€ Features & Interoperability

pure-mls has achieved full cryptographic interoperability with the IETF standard, passing 100% of the Passive Client Welcome and PSK Resolution test vectors (OpenMLS benchmark):

  • RFC 9420 Compliant: Full implementation of the TreeKEM and Key Schedule lifecycle.
  • IETF Vector Verification: 100% pass rate on interoperability suites.
  • Transports: Verified E2E over WebSockets, MQTT (IoT), WebRTC (P2P), and gRPC.

๐Ÿง  Philosophy: "Sound of Silence"

The goal is Absolute Purity:

  • No compiled bindings (no Rust, C++ or FFI).
  • Operates natively in any Python 3.12+ environment.
  • Suitable for zero-friction edge computing and standard backend runtimes.
  • Built on principles of Plausible Deniability and Zero-Knowledge.

The Linter Protocol

We strictly enforce the "Sound of Silence" code standard via ruff in the pyproject.toml file:

  • Zero-Warning State: 100% clean status under Ruff's most rigorous rules.
  • Pure Tabulations (\t) for minimal character footprint (W191 allowance).
  • Zero dead code allowed.

๐Ÿ—บ๏ธ Architecture (Project Map)

pure-mls/
โ”œโ”€โ”€ README.md               # This file
โ”œโ”€โ”€ CHANGELOG.md            # Version history registry
โ”œโ”€โ”€ pyproject.toml          # Dependencies (uv) and Sound of Silence config (Ruff)
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ pure_mls/
โ”‚       โ”œโ”€โ”€ group.py        # [API] State Machine (MLSGroup)
โ”‚       โ”œโ”€โ”€ tree.py         # Nodes and RatchetTree structure
โ”‚       โ”œโ”€โ”€ tls.py          # RFC 9420 / TLS 1.3 Wire Format Primitives
โ”‚       โ”œโ”€โ”€ extensions.py   # MLS Extensions Framework
โ”‚       โ”œโ”€โ”€ proposals.py    # Group Operations (Add, Update, Remove)
โ”‚       โ”œโ”€โ”€ epoch.py        # Immutable states (Epochs)
โ”‚       โ”œโ”€โ”€ keys.py         # Ed25519 Identities and X25519 KEMs
โ”‚       โ”œโ”€โ”€ keyschedule.py  # Secret Derivation (Application_Key)
โ”‚       โ””โ”€โ”€ hpke.py         # Hybrid Public Key Encryption Base Mode
โ””โ”€โ”€ tests/
    โ”œโ”€โ”€ test_ietf_vectors.py # 100% RFC 9420 Interop (IETF/OpenMLS)
    โ”œโ”€โ”€ test_group.py       # State Machine unit tests
    โ”œโ”€โ”€ test_e2e_websockets.py # E2E local Websockets
    โ”œโ”€โ”€ test_e2e_mqtt.py    # E2E broker.hivemq.com (IoT)
    โ”œโ”€โ”€ test_e2e_webrtc.py  # E2E Data Channels P2P (aiortc)
    โ””โ”€โ”€ test_e2e_grpc.py    # E2E Backend Swarm (Proto Hub)

๐Ÿ“š Documentation & Guides

We believe in making cryptography accessible. For a fast, pragmatic, and irreverent introduction to MLS, check our Primate Survival Guide:

For a deeper dive into the architecture, mathematics, and philosophy of the protocol, explore the Human Journey:

Contributors: We welcome translations! Feel free to PR your language following the 02_MLS_JOURNEY_XX.md format.

๐Ÿ”Œ API Quickstart

The central state machine is MLSGroup. Install it in your brain:

from pure_mls.group import MLSGroup
from pure_mls.keys import SignatureKey, KemKey

# 1. Each participant generates their own persistent identity keys
alice_sig, alice_kem = SignatureKey(), KemKey()
bob_sig, bob_kem = SignatureKey(), KemKey()

# 2. Alice initializes the Sovereign Group
alice_group = MLSGroup.create(b"grupo-soberano", alice_sig, alice_kem)

# 3. Alice receives Bob's `KeyPackage` (his public keys + identity) over the network
bob_kp = MLSGroup.create_key_package(bob_sig, bob_kem)
alice_next, welcome, update = alice_group.add_member(bob_kp)

# 4. Bob decrypts the Welcome (sealed with HPKE to his KEM key) and joins
bob_group = MLSGroup.join(welcome, bob_sig, bob_kem)

# The Underlying Mathematical Truth:
assert alice_next.application_key == bob_group.application_key

License

This project is licensed under the GNU General Public License v3.0 (GPLv3).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pure_mls-3.0.4.2.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pure_mls-3.0.4.2-py3-none-any.whl (48.9 kB view details)

Uploaded Python 3

File details

Details for the file pure_mls-3.0.4.2.tar.gz.

File metadata

  • Download URL: pure_mls-3.0.4.2.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pure_mls-3.0.4.2.tar.gz
Algorithm Hash digest
SHA256 3b0030fd29a12287398e095ca393ed9452809df580a0dc0c4153da69cc10a11d
MD5 f238661dc1d05f2a26c03c82bea5df9b
BLAKE2b-256 5e74ebbab112e38b0b9ee9d6042e261a352cf6b64cb24e28cafb37d94c48f5e5

See more details on using hashes here.

File details

Details for the file pure_mls-3.0.4.2-py3-none-any.whl.

File metadata

  • Download URL: pure_mls-3.0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 48.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pure_mls-3.0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9a97048f3afffc9c247ed0af54f03ef8892ecd397d22c13467a83711ba16f5b9
MD5 2bbe2b9f4f963e65ac6f523d33a36052
BLAKE2b-256 71ef5ba5fa9dbe43511669faaa8e72524768db143a2407bf0b53c2c9f1842a9a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page