# MoonBit Ecosystem Audit & Positioning

## Dated `mooncakes.io` Catalog Audit (2026-12-02)

Before designing `Ridge-Lab/moonmls`, we audited the live `mooncakes.io` registry index (**4,201** published modules as of `2026-12-02`) for any MLS, TreeKEM, or end-to-end encrypted group messaging protocol implementations:

- **RFC 9420 MLS implementations on `mooncakes.io`**: **0 / 4,201**
- **Related cryptographic building blocks found**:
  - `cc06b/mooncry` (`0.95.0`, Apache-2.0): Comprehensive pure-MoonBit cryptographic primitives (hashes, HKDF, AEAD, X25519/X448/P-256, Ed25519/Ed448/ECDSA-P256, RFC 9180 HPKE). Compiles cleanly on `moonc 1.0.0-rc1` across all 4 targets.
  - `wx-se884/hpke`: Standalone RFC 9180 HPKE implementation (primitive layer only; no group key agreement).
  - `gaato/dave` / Discord DAVE media-frame crypto utilities: Application-specific frame helpers, not a general RFC 9420 MLS protocol engine.

## Architectural Reuse Instead of Reinvention

Rather than duplicating elliptic-curve arithmetic or AEAD ciphers already solved in `mooncakes.io`, `Ridge-Lab/moonmls` **reuses `cc06b/mooncry@0.95.0`** as its cryptographic foundation and invests 100% of its engineering depth into the missing protocol layer:

- LBBT Ratchet Tree + TreeKEM O(log N) key agreement
- RFC 9420 strict canonical TLS wire codec
- Secret Tree forward-secret hash ratchets & replay protection
- Key Schedule, PSK chaining, Transcript Hashes, & MLS-Exporter
- Stateful Group engine (`Welcome`, `Proposals`, `Commits`, `External Join`, `PrivateMessage`)
- Full 16/16 IETF RFC 9420 interoperability verification

## Comparison with Industry Reference Implementations

| Property | `Ridge-Lab/moonmls` (MoonBit) | OpenMLS (Rust) | Go-MLS / MLSpp (C++) |
| --- | --- | --- | --- |
| Primary Language | Pure MoonBit (`1.0.0-rc1`) | Rust | Go / C++ |
| Multi-target (`wasm-gc`, `wasm`, `js`, `native`) | All 4 targets out of the box | Native + wasm32 (separate build) | Native only / wasm via Emscripten |
| Zero-upload Browser Interactive TreeKEM Studio | Included (`web/`, GitHub Pages) | External demo | None |
| Official IETF `mlswg/mls-implementations` Vectors | **16 / 16 suites passing** (CS1/2/3/4/6) | Full | Full |
| External Join (RFC 9420 §12.4.3.2) | Supported | Supported | Supported |
| Target Role | First production-grade RFC 9420 E2EE group protocol engine for MoonBit & Wasm apps | Rust production MLS | Go/C++ production MLS |
