Expand description
The storage seam, and the one rule that makes it safe.
§Persist before emit
A leaf node MUST have its MLS state durable before it emits a frame whose production advanced that state. The failure this prevents is not a delivery hiccup: a device that answers and then loses power before its ratchet state reaches flash comes back and reuses an AEAD nonce, which is a confidentiality failure in a protocol whose whole claim is the AEAD boundary.
This crate does not ask firmware to remember that. Every operation that
advances state writes through this trait and only then returns the bytes to
send, so a store that returns an error produces no frame at all. The
ordering is not documented here and implemented elsewhere; it is the reason
LeafDevice hands back frames rather than exposing
the MLS group it seals with.
§What an implementation owes
LeafStore::store must be durable and atomic per entry: after it
returns Ok, a power cut must leave the new value readable, and it must
never leave a torn one. mls-rs asks the same of its own storage provider,
in the same words, for the same reason. A flash driver that buffers a write
and reports success satisfies the type and breaks the rule.
§What it bounds, and what it does not
This crate bounds how much a store holds: peers, unspent key packages and prior-epoch records each have a ceiling. It does not bound how often a store is written, and an inbound key package costs a handful of writes to a part whose flash has a finite number of them. A device exposed to strangers wants its pairing window controlled by firmware rather than left open, which is the same conclusion the authorization obligation reaches from the other direction.
§Where the key material should live
Everything written through this trait is secret: the identity private key, MLS group state, key package private keys. On a part with secure key storage this trait is how that storage is reached, which is R12 in the threat model. A device that keeps them in general flash yields them to anyone holding the device.
Structs§
- Memory
Store - A store that keeps everything in memory.
Enums§
- Store
Error - What a store can fail with.
Constants§
- KEY_
TYPE_ GROUP_ EPOCH - Key type for MLS prior-epoch records.
- KEY_
TYPE_ GROUP_ STATE - Key type for MLS group state.
- KEY_
TYPE_ IDENTITY - Key type for the device’s own identity material.
- KEY_
TYPE_ KEY_ PACKAGE - Key type for key package private material.
- KEY_
TYPE_ PEER - Key type for what a peer told us it can parse.
- KEY_
TYPE_ PEER_ INDEX - Key type for the list of peers this device holds records for.
Traits§
- Leaf
Store - Durable storage for a leaf node’s secret material and MLS state.