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 (W191allowance). - 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:
- ๐ฆ The Primate Survival Guide to pure-mls (EN)
- ๐ฆ Guรญa del Primate Sobreviviendo a pure-mls (ES)
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)
# 5. Alice removes Bob from the group
alice_next_epoch, remove_commit = alice_next.remove_member(bob_group.committer_index)
# The Underlying Mathematical Truth:
assert alice_next.application_key == bob_group.application_key
assert alice_next_epoch.application_key != bob_group.application_key # Bob is out!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pure_mls-3.0.5.1.tar.gz.
File metadata
- Download URL: pure_mls-3.0.5.1.tar.gz
- Upload date:
- Size: 42.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cfccb1ebf6eae229952d87941c8cb3cdee58461fc10d20a18b994913e6c98a9
|
|
| MD5 |
c48d47fc613a7d0a08d8dc43d31a3ca0
|
|
| BLAKE2b-256 |
112db34dfc0b1ea8f84be89b4137e717434062af23d7ee2fc28a2debfecbe514
|
File details
Details for the file pure_mls-3.0.5.1-py3-none-any.whl.
File metadata
- Download URL: pure_mls-3.0.5.1-py3-none-any.whl
- Upload date:
- Size: 49.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b089dc46d3f7b63633fcfa6e8c3a8114359e01525bba88a7d9e080953e0a82a
|
|
| MD5 |
b713289052dd0404e739456ac8dad1b1
|
|
| BLAKE2b-256 |
9bd46e87ccc978653a6e280aff8752b6997b08ea825a1248314e1094fccdf5a1
|