Skip to main content

Module voice

Module voice 

Source
Expand description

Voice media encryption (ADR-0018): an end-to-end layer over WebRTC whose keys come only from post-quantum or hybrid primitives, authenticated by the members’ composite keys.

member key (ML-DSA-65 + Ed25519) ──signs──▶ KeyPackage { X-Wing public key, voice session }
                                 ──signs──▶ SenderKeys { epoch, KID, H(wrapped) per recipient }
sender base key (32 random bytes, one per epoch)
    ──HPKE base mode (X-Wing, HKDF-SHA256, AES-256-GCM)──▶ WrappedKey, one per recipient
    ──SFrame (RFC 9605, AES_256_GCM_SHA512_128)──────────▶ sealed frames

Everything here is sans-IO. The host relays key packages, sender keys and wrapped keys as opaque bytes; it cannot read frames or substitute keys without breaking a member signature. The trust root is the roster’s member public keys, which the host serves.

Structs§

FrameOpener
Opens one sender’s frames for one KID, rejecting replays.
FrameSealer
Seals this participant’s frames under one base key and KID. The counter starts at zero and never repeats; after FRAMES_PER_KEY frames it refuses and the sender rekeys.
GroupKeys
A participant’s key state for one voice session.
Header
An SFrame header (RFC 9605 §4.3).
KeyPackage
A participant’s voice key for one session in one voice channel.
PackageExpectation
What a receiver expects of a peer’s key package.
RecipientEntry
One recipient of a sender’s epoch key.
Rekey
What a rekey sends: one signed sender-keys message for everyone and one wrapped key each.
RekeyTarget
One recipient’s share of a Rekey.
SenderKey
An SFrame base key (32 bytes). Zeroized on drop, never printed, never on the wire unwrapped.
SenderKeys
The signed statement of one sender’s epoch (see the module table).
SenderKeysExpectation
What a recipient expects of a sender-keys message.
SignedKeyPackage
A key package whose signature was made here or verified.
SignedSenderKeys
A sender-keys message whose signature was made here or verified.
VoiceIdentity
A voice session’s X-Wing key pair. The secret is the 32-byte X-Wing seed, zeroized on drop and never printed. It lives only as long as the voice session; it is never stored.
VoicePublicKey
An X-Wing encapsulation key (ML-KEM-768 ‖ X25519, 1 216 bytes), validated on parse.
VoiceSessionId
One participation in a voice channel. A member draws a fresh one on every join, so KIDs and epochs never repeat across joins.
WrapContext
Who wraps, for which channel and epoch: bound into the HPKE info.
WrappedKey
A base key wrapped to one recipient: X-Wing enc ‖ AES-256-GCM ciphertext ‖ tag.

Enums§

VoiceError
A voice key or frame operation failed.

Constants§

BASE_KEY_LEN
An SFrame base key: 32 bytes.
FRAMES_PER_KEY
Frames one base key may seal before the sender must rekey (2^32: far beyond a session’s length at 50 frames a second, and well inside AES-GCM’s limits for distinct nonces).
HEADER_MAX
Longest header: config byte, 8-byte KID, 8-byte CTR.
KEM_CIPHERTEXT_LEN
X-Wing ciphertext (HPKE enc) length.
KEM_PUBLIC_LEN
X-Wing encapsulation (public) key length.
KEY_PACKAGE_BYTES_LEN
Canonical bytes of a key package (all fields are fixed width): 1 306 bytes.
KEY_PACKAGE_WIRE_LEN
A key package on the wire: canonical bytes ‖ composite signature, 4 680 bytes.
MAX_RECIPIENTS
Most recipients one sender-keys message names (a mesh of 32 participants).
RECIPIENT_ENTRY_LEN
One recipient entry: member id ‖ voice session ‖ SHA3-256 of the wrapped key.
REPLAY_WINDOW
Counters a receiver accepts behind the highest one seen (out-of-order delivery).
SENDER_KEYS_BYTES_MAX
Largest canonical sender-keys message: 2 090 bytes.
SENDER_KEYS_FIXED_LEN
Canonical bytes of a sender-keys message without its recipients.
SENDER_KEYS_WIRE_MAX
Largest sender-keys message on the wire: u32 length ‖ bytes ‖ signature, 5 468 bytes.
SFRAME_CIPHER_SUITE
The SFrame cipher suite: AES_256_GCM_SHA512_128.
SFRAME_OVERHEAD_MAX
Most bytes SFrame adds to a frame: the longest header and the tag.
SUITE_V1
The voice suite of protocol version 1: X-Wing KEM, HPKE (HKDF-SHA256, AES-256-GCM), SFrame AES_256_GCM_SHA512_128. Unknown suites are rejected (ADR-0011 agility rules).
TAG_LEN
AES-256-GCM tag length (HPKE and SFrame).
WRAPPED_KEY_LEN
A wrapped sender key: enc ‖ AES-256-GCM(base key) ‖ tag, 1 168 bytes.

Functions§

derive_key_salt
RFC 9605 §4.4.2 derive_key_salt for suite 0x0005.
kid_for
The KID of a sender’s epoch: the first 3 bytes of SHA3-256("zaun/v1/voice-kid" ‖ session) above the 32-bit epoch.