Expand description
Cryptographic primitives for EventService transport.
The controller supplies a fresh random secret for every committed group
epoch. Confidential event objects never use that secret directly as an AEAD
key: they derive session-scoped sender/track keys, bind publisher/track/
session/membership-version/epoch/sequence into AAD, and use an injective
counter nonce within each CSPRNG-generated session key domain. The module
retains legacy low-level wrap helpers for compatibility, but the surviving
EventService path distributes epochs exclusively through per-member HyKEM/COSE
grants in group_key.
Key commitment provides fast wrong-key rejection before AES-256-GCM
decryption. Publisher signature transcripts bind the plaintext and epoch
coordinates and are consumed by the mandatory Ed25519 + ML-DSA-65 composite
attestation in events.
Enums§
- Event
Privacy - Privacy mode for event transport.
Functions§
- build_
epoch_ event_ sig_ message - Hybrid-attested event transcript. Session, epoch coordinates, and sequence are signed, so possession of the symmetric epoch key is not publisher identity evidence.
- build_
epoch_ object_ aad - Canonical authenticated coordinates kept inside the application payload/AAD; a stock relay need not understand any of them.
- build_
event_ sig_ message - Build the signing message for EventEnvelopeV2.
- build_
topic_ aad - Build length-prefixed AAD binding the keyed routing leaf + epoch (EV3).
- build_
wrap_ aad - Build length-prefixed AAD for group key wrapping.
- check_
key_ commitment - Check key commitment for fast rejection before AEAD.
- decrypt_
epoch_ event - decrypt_
event_ full - Decrypt an event with full AAD binding (tag + ciphertext + prefix).
- decrypt_
event_ keyed - Decrypt an event encrypted with
encrypt_event_keyed(keyed-topic + epoch AAD). The caller must supply the samekeyed_leaf+epochused at encrypt time — a mismatch (cross-topic or cross-epoch replay) fails AEAD auth. - derive_
event_ nonce - Return the injective 96-bit nonce for one sequence in a session-scoped key
domain. The session prefix is carried through the wire object and is also
bound into the AEAD key; it avoids a fixed nonce label while preserving the
only property AES-GCM needs: uniqueness for each
(key, nonce)pair. Sequence zero is reserved as the pre-publication state. - derive_
sender_ track_ key - Derive an AEAD key unique to one
(epoch secret, sender, track, session)domain. The CSPRNG session prevents a restarted or concurrent publisher from reusing a key when its in-memory sequence restarts. - derive_
wrap_ key - Derive a wrap key from DH shared secret + pubkey XOR salt.
- encrypt_
epoch_ event - encrypt_
event - Encrypt an EventEnvelopeV2 payload with a group key.
- encrypt_
event_ keyed - Encrypt an event with the keyed-topic + epoch bound into the AAD (EV3
confidential profile). Otherwise identical to
encrypt_event. - key_
commitment - Compute key commitment:
keyed_mac(group_key, nonce)[0..16]. - unwrap_
group_ key - Unwrap a group key blob.
- wrap_
group_ key - Wrap a group key for a specific subscriber.