# RFC 9420 Conformance Matrix & Scope Boundaries

This document tracks `Ridge-Lab/moonmls` conformance against IETF **RFC 9420** (*The Messaging Layer Security (MLS) Protocol*) and the official IETF MLS Working Group test vectors (`mlswg/mls-implementations` @ `66e31c515528f7e69c4ad440fcedb733f4b0bf33`).

## Section-by-Section Conformance

| RFC 9420 Section | Feature | Status | Verification Evidence |
| --- | --- | --- | --- |
| §2.1.2 | Minimal QUIC Variable-Length Integers (`< 2^30`, no 8-byte prefix) | Implemented | `deserialization.json` (14/14), `verify_faults.mjs` faults 06–09 |
| §5.1–§5.2 | KDF (`ExpandWithLabel`, `DeriveSecret`, `DeriveTreeSecret`, `RefHash`), `SignWithLabel`, `EncryptWithLabel` | Implemented | `crypto-basics.json` (5/5 across CS1/2/3/4/6) |
| §5.3 | Credentials (`BasicCredential` + wire support for `X509`) | Partial (see boundaries) | `tree-validation.json`, `messages.json` |
| §6.1–§6.3 | `FramedContent`, `PublicMessage` (`membership_tag`, forbid Application), `PrivateMessage` (`reuse_guard`, SenderData AEAD, zero-padding check) | Implemented | `message-protection.json` (5/5), `security_test.mbt`, `verify_faults.mjs` |
| §7.1–§7.9 | LBBT Ratchet Tree, `resolution`, `tree_hash`, `parent_hash` validation, leaf signatures, `UpdatePath`, `Add`/`Update`/`Remove` | Implemented | `tree-math.json` (10/10), `tree-operations.json` (5/5), `tree-validation.json` (70/70), `treekem.json` (22/22 quick, 55/55 full) |
| §8.1–§8.5 | Key Schedule, Confirmed & Interim Transcript Hashes, External & Resumption PSK chain, `MLS-Exporter`, External HPKE key pair | Implemented | `key-schedule.json` (5/5), `psk_secret.json` (55/55), `transcript-hashes.json` (5/5) |
| §9 | Secret Tree lazy derivation with parent secret erasure, Handshake/Application ratchets, out-of-order window, replay rejection | Implemented | `secret-tree.json` (15/15), `group_test.mbt`, `verify_faults.mjs` |
| §10 | `KeyPackage` generation, `RefHash`, §10.1 verification (`init_key != encryption_key`) | Implemented | `security_test.mbt`, `messages.json` |
| §12.1 | Proposals (`Add`, `Update`, `Remove`, `PreSharedKey`, `ReInit` wire/stage, `ExternalInit`, `GroupContextExtensions`) | Implemented | `messages.json` (300/300), `passive-client-handling-commit.json` (65/65) |
| §12.4.1–§12.4.3.1 | `Commit`, `Welcome`, `GroupInfo`, multi-member passive client synchronization | Implemented | `welcome.json` (5/5), `passive-client-welcome.json` (40/40), `passive-client-handling-commit.json` (65/65), `passive-client-random.json` (200 epochs) |
| §12.4.3.2 | External Join (`Group::join_external`, `NewMemberCommit`, `ExternalInit`) | Implemented | `group_test.mbt`, `passive-client-handling-commit.json`, `web/studio.test.mjs` |
| Appendix C | Left-Balanced Binary Tree math | Implemented | `tree-math.json` (10/10), `treemath/treemath_test.mbt` |

## Explicit Scope Boundaries (Honest Engineering Disclosure)

1. **CipherSuites `0x0005` (P-521) and `0x0007` (P-384) are out of scope in `0.1.0`**:
   - `cc06b/mooncry@0.95.0` provides X25519, X448, P-256, Ed25519, Ed448, ECDSA P-256, AES-128/256-GCM, ChaCha20-Poly1305, SHA-256, and SHA-512, which cover RFC 9420 **CS1, CS2, CS3, CS4, and CS6**.
   - P-384 and P-521 elliptic curve primitives are not yet provided by `mooncry`, so CS5 and CS7 return an explicit `MlsError("unsupported cipher suite ...")` and are transparently reported as `skipped(CS5/7)` in `verify_ietf_vectors.mjs`.
2. **X.509 Certificate Chain Validation**:
   - `X509` credentials are fully encoded/decoded on the wire and carried in `LeafNode` / `TranscriptHash` signatures, while PKI root-CA chain validation is left to the host application.
3. **External Proposals (`Sender::External`) & Branch/ReInit Higher-Level Orchestration**:
   - `ReInit` and `ExternalInit` wire structures are fully supported (`messages.json` 300/300) and `ExternalInit` / `NewMemberCommit` is fully executable via `Group::join_external`. Application-level `ReInit` group migration orchestration and `ExternalSenders` policy hooks are planned for `0.2.0`.
4. **Entropy Source**:
   - Core MoonBit functions accept caller-provided seed/reuse-guard byte buffers to stay pure and target-independent across `wasm-gc`, `wasm`, `js`, and `native`. Production deployments must pass cryptographically secure random bytes (e.g., Web Crypto `crypto.getRandomValues`, Node `crypto.randomBytes`, or OS CSPRNG).
