Status Draft. Protocol version 1 (sv1) of Sloppy Voice v2
Date 2026-12-04
Depends on 00 (overview and conventions), 04 (crypto conventions, labelled signatures, label registries), 13 (MLS profile: groups, epochs, leaves, commits, resync), 15 (calls, participants, data channels, routing, SFU signalling, call.epoch_ready and call.epoch_switch, diagnostics). Uses 07 (DeviceCertificate, sv_device credential), 16 (voice-dc/1 route header, audio engine), 17 (video-dc/1, sfu-rtp/1) and 20 (indicator copy) by reference.
Decisions used D-008, D-012, D-013, D-021, D-034, D-037, D-041, D-042, D-043, D-045, D-046, D-050, D-055, D-056, D-061, D-065, D-066, D-080, D-094
Owns The SFrame profile for secure calls; the KID layout and the joinNonce rule; encryptor instances and SFrame counters; the per-epoch media key state and its retention, hold and erasure rules; the SFrame replay window; the application of SFrame to voice-dc/1, video-dc/1 and sfu-rtp/1 (including SfuFrameMetadata and the clear-prefix table); MediaAttestation (format, the media.attestation control-channel message, verification) and the receiver's stream playback state; every media.* code; the media_attestation diagnostics report kind; the timers 500 ms (attestation interval), 3 s (unattested limit), 10 s (old-key retention) and 200 ms (unknown-epoch hold)

Conformance

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 (RFC 2119, RFC 8174) when, and only when, they appear in all capitals, as shown here.

This document places requirements on these roles:

Role Conformance class (00 §1.5) Sections that apply
Sender: a client device that sends media in a call Full client, Web client; Bot client when it sends media in a secure call 3–6, 8, 9.2–9.6, 10, 11
Receiver: a client device that receives media in a call Full client, Web client; Bot client when it receives media in a secure call 3–8, 9.2, 9.5–9.8, 10, 11
Relay Server (every server runs one, D-066) 8.1, 8.6, 9.6
SFU adapter and SFU SFU-capable server 8.4, 8.6
Call control (the hosting server's call logic) Server 8.4.2, 8.4.6

A Bot client that joins a call in a secure context MUST implement this whole document (00 §1.5); it is a sender and a receiver like any other device. Every requirement on "a client" applies to both senders and receivers.

Rationale notes start with "Rationale:" and are informative. "UX:" notes describe what the user sees; document 20 owns the exact copy and they defer to it. Examples are informative unless the text says otherwise; the test vectors of §13 are normative. Where this document restates RFC 9605 for convenience and the two differ, RFC 9605 governs and the difference is an error in this document. All JSON follows 00 §7: I-JSON, lowerCamelCase members, snake_case enum values, base64url without padding, integers at most 2^53 − 1, durations in integer milliseconds ending in Ms. Binary structures follow 04 §3.2 (TLS presentation language, as in RFC 9420).

1. Scope

1.1 In scope

This document specifies how media in a secure call (a call in a secure context, SM-11; §8.5 says how a client decides) is end-to-end encrypted and authenticated:

  • the SFrame (RFC 9605) profile: cipher suite, header encoding, keys derived from the context's own MLS group with the MLS key schedule of RFC 9605 §5.2, usage limits (§3);
  • the KID layout, the joinNonce rule, encryptor instances and counters (§4), and why no key and nonce pair is ever reused (§5);
  • the per-epoch key state of a device in a call: installing keys after a commit, choosing the epoch to send in, resolving a received frame's epoch, holding frames of an unknown newer epoch, keeping and erasing old keys (§6);
  • replay protection (§7);
  • how SFrame is applied on each transport: voice-dc/1 and video-dc/1 on the relay, with the cleartext route header as authenticated SFrame metadata, and sfu-rtp/1 through WebRTC encoded transforms, with an authenticated clear prefix (§8);
  • MediaAttestation: what senders sign, how they send it, how receivers verify it late, and when a receiver stops playing a source (§9);
  • that insecure calls use the same framing with no SFrame and no attestations (§8.6);
  • the media.* codes, the counters other documents report, and the media_attestation diagnostics report (§10);
  • test vectors (§13).

1.2 Out of scope

Topic Owner
call.epoch_ready, call.epoch_switch, mediaEpoch, the server's switch rule, lease snapshots and ticks, the data-channel layout, control-channel envelope, routing, SFU signalling, auto-rejoin, /v1/diagnostics and the diagnostics consent setting 15
The voice-dc/1 frame, route header, gen, sequence numbers, timestamps, jitter buffer, concealment, the transmit gate and keysOk as an input to it 16
The video-dc/1 fragment format and its frame header, fragmentation and reassembly, the sfu-rtp/1 RTP profile, codec negotiation, simulcast and SVC, keyframes, video presentation 17
MLS groups, epochs, leaves, commits, external commits, resync, self-update, group generations, mls.epoch_ack 13
The sv_device credential, DeviceCertificate and device signing key (DSK) 07
Labelled signatures, label registries, Ed25519 verification rules 04
Indicator copy ("not being heard"), connection-details views 20
Platform key storage (including web Workers) 08

This document defines no HTTP endpoint and no WebSocket event. Its only wire message is the control-channel message media.attestation (§9.5).

1.3 Terminology

The terms of 00 §2 apply exactly, in particular Call, Participant (pid), MLS group, Epoch, Leaf, Device signing key (DSK), SFrame, MediaAttestation, Media profile, Lease tick and Auto-rejoin, and the terms of 15 §1.3 and 16 §2 (Route, Control channel, Media process, Source, Route header). This document adds:

Term Definition
Secure call For a client, a call whose Call security is secure (15 §2.5.1), or whose context the client itself holds to be secure: from the Channel object or its secure-state pins for a channel (09 §13), or from its own computation for a DM or group DM (12 §11.1). §8.5 gives the rule. Every other call is an insecure call.
Context group The MLS group of the call's context (00 §2.7). There is no separate per-call group (D-041).
sourceId A 4-bit number naming a media source: 0 microphone, 1 screen video, 2 screen or application sound, 3 webcam, 4–15 reserved (§4.2).
Encryptor instance One SFrame sender state: one joinNonce, and one counter per KID. A media process has one main encryptor instance; an SFU session adds its own (§4.4).
joinNonce A fresh random 32-bit value identifying one encryptor instance. The main encryptor instance uses the media process's joinNonce (16 §4.5.1).
Stream The frames of one source of one encryptor instance of one participant: the tuple (pid, sourceId, joinNonce). A stream spans epochs.
Media epoch secret sframe_epoch_secret of RFC 9605 §5.2: the MLS exporter output with label SFrame 1.0 Base Key, computed in one epoch of the context group (§3.3).
EpochMediaState Everything a device keeps for one epoch of a secure call: the media epoch secret, the leaf roster snapshot and derived keys (§6.1).
Installed epoch An epoch for which a device holds an EpochMediaState.
Sending epoch The epoch whose keys a sender currently encrypts with (§6.3).
Frame The unit SFrame protects: one Opus packet (voice-dc/1, or source 2 on sfu-rtp/1), or one encoded video frame (video-dc/1, sfu-rtp/1).
SFrame ciphertext The output of SFrame encryption as RFC 9605 §4.2 defines it: SFrame header, encrypted data and authentication tag.
Metadata The RFC 9605 metadata input: bytes authenticated (not encrypted) with the frame. Defined per transport in §8.
Frame hash The 8-byte truncated hash of one protected frame that MediaAttestations carry (§9.2).
Batch The consecutive counters of one KID that one MediaAttestation covers (§9.3).
Attested A received frame whose frame hash matches a valid MediaAttestation (§9.7).
Stopped A stream whose frames a receiver has stopped playing because of a MediaAttestation failure (§9.8).
Highest attested counter (Ha) For one (epoch, KID) at one receiver, the highest counter of an accepted frame that is attested (§7).
Stop list The counters and frame hashes of the frames a stream had played without attestation when it was stopped (§9.8).

2. Design summary (informative)

 sender device                                                         receiver device
 ─────────────                                                         ───────────────
 MLS epoch e of the context group                                     MLS epoch e (same group)
   │ MLS-Exporter("SFrame 1.0 Base Key", "", 16)                         │
   ▼                                                                     ▼
 sframe_epoch_secret(e) ──HKDF-Expand(leaf)──► sender_base_key ◄── same derivation for any leaf
                                                   │
 KID = joinNonce | sourceId | leaf | e mod 16 ─────┤ derive_key_salt(KID)  (RFC 9605 §4.4.2)
                                                   ▼
 Opus packet / video frame ──► SFrame encrypt(CTR, KID, metadata) ──► header ‖ ct ‖ tag
                                    ▲ metadata = route header (relay)
                                    │          = SfuFrameMetadata (SFU)
                                    │
 every ≤ 500 ms per KID: MediaAttestation = DSK signature over
   (group, epoch, call, KID, first..last CTR, 8-byte hash of each frame)
                 │ reliable sv-control channel                      play at once; verify late;
                 └───────────────────────────────────────────────►  mismatch or > 3 s unattested ⇒ stop source
  1. Keys. Every member of the context group can compute every sender's SFrame keys for every epoch it holds (RFC 9605 §5.2). Servers, relays and SFUs, which hold no MLS secrets, can't (D-008, D-041).
  2. KID. The KID carries the sender's leaf index and the epoch's low 4 bits, as RFC 9605 §5.2 requires, and a 36-bit context_id made of a random per-encryptor joinNonce and the sourceId. Because SFrame keys and salts are derived from the KID, a sender that restarts, crashes or rejoins within one epoch gets fresh keys and can start its counter at 0 again (§5).
  3. Rotation. On every commit, each participant installs the new epoch's keys and tells call control it is ready (15 §9). Senders switch when call control says so, or after 2 s. Receivers keep old keys for 10 s after the switch and hold frames of an epoch they don't know yet for up to 200 ms. A frame that still can't be decrypted is lost and concealed (D-042).
  4. Transports. On data channels the cleartext route header is the SFrame metadata, so it is authenticated, and a video frame is encrypted whole before it is fragmented. On the SFU path, SFrame runs in a WebRTC encoded transform and a codec-defined clear prefix stays readable for the SFU and is authenticated.
  5. Sender authentication. SFrame keys are shared by all members, so SFrame alone can't stop one member forging another's media. MediaAttestations, signed with each device's DSK, let receivers detect forgery within seconds without delaying playback (D-043).
  6. No user decisions. Nothing in this document prompts, and its only warning is W9 when a server presents the call of a secure context as insecure (§8.5). Rotations, holds, lost frames and attestation failures are silent; failures become diagnostics (00 §4.12.5).

3. SFrame profile

3.1 Parameters

Parameter Value
SFrame specification RFC 9605
Cipher suite AES_128_GCM_SHA256_128, value 0x0004. It is the only suite in sv1 (00 §7.15, D-041). There is no negotiation.
AEAD AES-128-GCM with a 128-bit tag
Nk (key length) 16 bytes
Nn (nonce and salt length) 12 bytes
Nt (tag length) 16 bytes
Hash for HKDF SHA-256
Key schedule MLS-based, RFC 9605 §5.2, over the context group
E (epoch bits in the KID) 4
S (leaf-index bits in the KID) 16
context_id width 36 bits: 32-bit joinNonce, 4-bit sourceId (§4.1)
KID width used 56 bits; KIDs are always less than 2^56
Counter range used 0 to 2^32 − 1 per KID (§3.6)

A receiver MUST treat a frame whose SFrame header can't be parsed under RFC 9605 §4.3, whose KID is 2^56 or more, or whose counter is 2^32 or more as invalid (§4.5), with the code media.malformed_frame.

3.2 SFrame header

The SFrame header is encoded exactly as RFC 9605 §4.3 specifies:

  0 1 2 3 4 5 6 7
 +-+-+-+-+-+-+-+-+----------------+----------------+
 |X|  K  |Y|  C  |  KID (0-8 B)   |  CTR (0-8 B)   |
 +-+-+-+-+-+-+-+-+----------------+----------------+
  • If the KID is less than 8, X = 0 and K is the KID; otherwise X = 1, K is the KID's length in bytes minus 1, and the KID follows in that many bytes, big-endian.
  • The counter (CTR) is encoded the same way with Y and C, after the KID bytes.
sframe-header = config-byte kid-bytes ctr-bytes
config-byte   = OCTET          ; X (bit 7), K (bits 6-4), Y (bit 3), C (bits 2-0)
kid-bytes     = 0*8OCTET       ; present only when X = 1; length K + 1
ctr-bytes     = 0*8OCTET       ; present only when Y = 1; length C + 1
  1. Senders MUST encode the KID and the counter in the fewest bytes possible (no leading zero bytes; the short form when the value is less than 8).
  2. Receivers MUST accept any encoding RFC 9605 permits. Because the header bytes as received are part of the AEAD associated data and of the frame hash (§9.2), an encoding difference can't be exploited.
  3. With the KID layout of §4, a KID usually takes 7 bytes and the header is 8 to 12 bytes. The total SFrame overhead per frame is therefore at most 1 + 8 + 4 + 16 = 29 bytes (header, at most 4 counter bytes under §3.6, and the tag), which 16 §4.8 and 17 budget for.

3.3 Keys from the MLS group

For each epoch e of the context group, a device computes, while it is in epoch e (that is, before its MLS state advances past e):

sframe_epoch_secret(e) = MLS-Exporter("SFrame 1.0 Base Key", "", 16)

This is the exporter label that 04 §8.6 registers for this document; 16 is AEAD.Nk for suite 0x0004. For a leaf index L (0 ≤ L < 65,536):

sender_base_key(e, L) = HKDF-Expand(sframe_epoch_secret(e), uint32(L), 16)

where uint32(L) is the 4-byte big-endian encoding of L. For a KID K whose leaf field is L (§4.1), the key and salt are derived as RFC 9605 §4.4.2 specifies:

sframe_secret = HKDF-Extract("", sender_base_key(e, L))
sframe_key    = HKDF-Expand(sframe_secret, "SFrame 1.0 Secret key "  || uint64(K) || uint16(0x0004), 16)
sframe_salt   = HKDF-Expand(sframe_secret, "SFrame 1.0 Secret salt " || uint64(K) || uint16(0x0004), 12)
  1. HKDF uses SHA-256. HKDF-Extract("", x) uses an empty salt, which RFC 5869 treats as 32 zero bytes.
  2. The labels are the ASCII strings shown, including the single trailing space before the KID bytes, with no terminator. They are defined by RFC 9605, not by this specification, so they don't carry the sv1 prefix (04 §8.6 item 2).
  3. A device computes sframe_epoch_secret(e) for every epoch it enters while it holds a seat in a secure call of that context (15 §2.6), and for the current epoch when it joins or rejoins the call. It MUST NOT compute it in any other situation (it has no use for it) and MUST NOT store it anywhere except in the EpochMediaState (§6.1). In particular it MUST NOT be written to the key archive, a HistoryShare or any backup (08, 14).
  4. sender_base_key and the per-KID key and salt MAY be computed lazily, when the first frame needs them, and MAY be cached and evicted at any time; they can always be recomputed from the media epoch secret while it is held.

Rationale: this is the RFC 9605 §5.2 key schedule unchanged. Using the context's own group means joins, leaves, removals, device revocations and resets rotate media keys through the same commits that rotate message keys (D-041), with no second key-agreement protocol. The exporter is one-way, so the long-lived history keys of 14 (sv1 history) reveal nothing about media keys.

3.4 Encryption

To protect a frame, an encryptor instance with sending epoch e, KID K and next counter CTR for K computes, as RFC 9605 §4.4.3 specifies:

nonce      = sframe_salt XOR uint96(CTR)            ; uint96 = 12-byte big-endian
header     = encode_sframe_header(K, CTR)           ; §3.2
aad        = header || metadata                     ; metadata per §8
ciphertext = AES-128-GCM-Encrypt(sframe_key, nonce, aad, plaintext)   ; includes the 16-byte tag
output     = header || ciphertext                   ; the SFrame ciphertext

and then increments the counter for K by 1. Rules:

  1. A counter value is used at most once per KID, ever (§5). The counter is incremented when the frame is encrypted, whether or not the frame is later sent.
  2. Counters start at 0 for each KID and increase by exactly 1 per encrypted frame, so the counters of one KID have no gaps. MediaAttestation relies on this (§9.3).
  3. plaintext is never empty: an Opus packet has at least its TOC byte, and an encoded video frame at least one byte after any clear prefix (§8.4). A sender MUST NOT encrypt an empty plaintext.
  4. A frame is encrypted once. The identical SFrame ciphertext is sent on every relay connection that carries it: to the call's relay, and in a planned relay migration to both relays (15 §6.9).

3.5 Decryption

A receiver that has resolved a frame's epoch e (§6.4) and checked its KID (§4.5) decrypts it with RFC 9605 §4.4.4:

(K, CTR)   = parse SFrame header
nonce      = sframe_salt(e, K) XOR uint96(CTR)
aad        = header-as-received || metadata
plaintext  = AES-128-GCM-Decrypt(sframe_key(e, K), nonce, aad, ciphertext)
  1. A tag failure makes the frame undecryptable (§6.7). The receiver MUST NOT pass any of its bytes to a decoder.
  2. The receiver MUST apply the counter check of §7 before decrypting (as a cheap pre-check) and the freshness check of §7 right after the tag has verified, and MUST update the replay state only after both have passed.
  3. Only authenticated plaintext reaches the Opus decoder (16) or the video decoder (17).

3.6 Usage limits per key

Each KID's key is used by exactly one encryptor instance in one epoch (§5). For each KID, a sender:

  1. MUST NOT encrypt more than 2^32 frames (counters 0 to 2^32 − 1);
  2. MUST NOT encrypt more than 2^36 bytes of plaintext in total;
  3. when either total reaches half of its limit (2^31 frames or 2^35 bytes) and the epoch hasn't changed, MUST start a self-update commit in the context group (13 §14.1) at its next opportunity, so that the call moves to a new epoch and the KID is retired;
  4. if a limit is reached anyway, MUST stop sending that source until it holds keys for a newer sending epoch. For source 0 this closes the transmit gate with keysOk false (16 §7.2) and the code media.key_exhausted (§10.1).

Rationale: AES-GCM is safe far beyond these numbers for deterministic nonces; 2^36 bytes keeps the confidentiality advantage of AES-128-GCM below about 2^-57, the margin TLS 1.3 uses. A microphone at 50 frames per second takes 2.7 years to reach 2^32 frames; a screen share at 8 Mbit/s reaches 2^35 bytes after about 9.5 hours. Because calls have no length limit (D-013) and a quiet DM may stay in one epoch for days, the limit has to be enforced, and an ordinary self-update is the cheapest way to get a new epoch without a glitch (§6).

4. KID layout and joinNonce

4.1 Layout

The KID follows RFC 9605 §5.2 with E = 4 and S = 16 (D-041, 00 HP-5):

context_id = (joinNonce << 4) | sourceId                         ; 36 bits
KID        = (context_id << (S + E)) + (leaf_index << E) + (epoch mod 2^E)
           = (joinNonce << 24) | (sourceId << 20) | (leaf_index << 4) | (epoch mod 16)
 bit 55                          24 23    20 19                       4 3      0
 +--------------------------------+--------+--------------------------+--------+
 |        joinNonce (32)          |sourceId|      leaf_index (16)     |epoch&15|
 |                                |  (4)   |                          |  (4)   |
 +--------------------------------+--------+--------------------------+--------+
Field Bits Meaning
joinNonce 55–24 The encryptor instance's joinNonce (§4.3, §4.4).
sourceId 23–20 The source (§4.2).
leaf_index 19–4 The sender device's leaf index in the context group in the frame's epoch. 13 keeps every leaf index below 65,536 (13 §17.1).
epoch residue 3–0 The low 4 bits of the MLS epoch whose keys protect the frame.

Bits 63–56 of the 64-bit KID are always 0. In JSON a KID is a decimal string (00 §7.2), because it can exceed 2^53 − 1:

kid-string = "0" / ( %x31-39 0*16DIGIT )     ; decimal, no leading zeros, value < 2^56

4.2 Source IDs

sourceId Source Media profiles Lease list (15 §4.1)
0 Microphone voice-dc/1 audio
1 Screen video video-dc/1, sfu-rtp/1 video
2 Screen or application sound voice-dc/1, sfu-rtp/1 audio
3 Webcam video-dc/1, sfu-rtp/1 video
4–15 Reserved — —

This document is the registry. A sender MUST NOT use a reserved value. A receiver MUST treat a frame whose KID names a reserved value as invalid (§4.5), and nobody forwards or plays such frames (15 §4.1). A future document that assigns a value MUST also assign its lease list in 15.

4.3 The joinNonce rule

  1. A device MUST choose a fresh joinNonce for every encryptor instance it starts: at every call join, every rejoin (planned or unplanned), every start or restart of its media process (16 §2), including the restart that follows its own MLS resync during a call (15 §12.4), and every new SFU session (§4.4). Every one of these, and nothing else, starts an encryptor instance.
  2. The value MUST come from a generator that meets 04 §13 item 1 (the operating system's CSPRNG, or a generator seeded from it that is safe across process forks and virtual-machine snapshots, such as crypto.getRandomValues on the web), drawn at the moment the instance starts.
  3. No reuse within an epoch. A device MUST NOT use the same joinNonce in two encryptor instances in the same epoch of the same group. For each group, it keeps the set of joinNonce values it has used in that group's current epoch, whether or not it is still in a call: leaving a call, or the call ending, doesn't clear the set. If a fresh draw is already in the set, it draws again.
  4. The set survives restarts with the MLS state. A device that persists its MLS group state (13) MUST persist this set with it, and MUST have written a joinNonce to the set in persistent storage before it encrypts the first frame under it in a given epoch. This includes an encryptor instance that keeps running across an epoch change: before the instance encrypts its first frame under a new sending epoch (§6.3 item 6), the device adds the instance's joinNonce to the new epoch's set and persists it. A device that loses its MLS state, or keeps it only in memory (for example a web client in shared-computer mode, 08), can't come back to the same epoch: it resyncs into a new epoch by external commit (13 §10.5), and the set starts empty.
  5. A device MAY discard a group's set only when its MLS state for that group advances to a later epoch (the new epoch's set then starts with the joinNonce values of the encryptor instances still running, item 4), or when it leaves the group or the group's generation is retired (13 §4.2).
  6. In insecure calls the media process still chooses a joinNonce, which 16 uses only for its stream generation gen (16 §4.5.1). Items 3 and 4 don't apply there.

Rationale: the random joinNonce makes every encryptor instance's keys different from every other's, so no counter has to survive a crash, a rejoin or an operating system killing the app (D-041). The persisted set turns the probabilistic guarantee into a deterministic one (§5), at the cost of one small write per call join and per epoch change, which a client already makes when it updates its MLS state. The set is tied to the epoch, not to the call, because a second call in the same context, or Move voice here back to the same device, can happen within one epoch.

4.4 Encryptor instances and counters

  1. One owner per KID. Every KID is owned by exactly one encryptor instance, which holds the only counter for it. A device MUST NOT let two pieces of software (threads, workers, processes, WebRTC transforms) encrypt under one KID unless they share that one counter atomically.
  2. The main encryptor instance of a media process uses the media process's joinNonce (16 §4.5.1). It protects every voice-dc/1 and video-dc/1 frame the media process sends, for all its sources, on its relay connections. On these data channels a receiver checks that the low 12 bits of the KID's joinNonce equal the route header's gen (16 §4.6, 17).
  3. An SFU encryptor instance. Each SFU session (15 §8) that publishes sources gets its own encryptor instance with its own fresh joinNonce, chosen when the session is created and replaced when the session is replaced (15 §8.3 items 3–5). It protects only frames published through that SFU session, in the WebRTC encoded transforms of that session. All simulcast encodings and SVC layers of one source pass through one counter.
  4. A device MUST NOT protect one source through two encryptor instances under the same joinNonce. During a video route switch (15 §7.2), a source is sent by the main instance on the relay and by the SFU instance on the SFU at the same time; their different joinNonce values give them different KIDs, so they never share a counter.
  5. The sources of one encryptor instance have different KIDs (the sourceId field differs), so audio and video can be encrypted on different threads without sharing a counter.

Rationale: the RTP pipeline of a WebRTC implementation runs its encoded transform in its own thread or worker, separately from the data-channel pipeline. Sharing one counter between them would need cross-thread atomics that browsers expose only to cross-origin-isolated pages. A second joinNonce costs nothing and removes the problem. The SFU path has no route header, so it carries no gen to check against; receivers there identify the stream from the KID alone.

4.5 Decomposing and checking a KID

A receiver decomposes the KID K of every frame:

joinNonce  = (K >> 24) & 0xFFFFFFFF
sourceId   = (K >> 20) & 0xF
leaf_index = (K >> 4)  & 0xFFFF
residue    =  K        & 0xF

and MUST treat the frame as invalid (dropped silently, counted as media.malformed_frame for check 1 and media.kid_mismatch otherwise, §10.2, and not treated as loss by the jitter buffer) if any of these holds:

  1. K ≥ 2^56, or sourceId is reserved (4–15);
  2. sourceId differs from the source the transport names: the route header's sourceId (16 §4.3, 17) on data channels, or the Track's sourceId on the SFU (15 §8.2);
  3. on data channels, the low 12 bits of joinNonce differ from the route header's gen (16 §4.5.1, 17);
  4. after the epoch is resolved (§6.4), the leaf leaf_index of that epoch's roster snapshot (§6.1) is blank, or its sv_device credential (07) names a device ID other than the did of the participant that sent the frame, or an account other than that participant's addr. The participant that sent the frame is the route header's pid on data channels and the Track's pid on the SFU; its did and addr come from the call roster (15 §2.5.2).

Check 4 uses the receiver's own MLS state, not the Participant's leafIndex (15 §2.5.2), which is only a hint: after a resync it can be stale for a moment. A frame whose epoch is unknown is held (§6.5) and checked when its epoch is installed. Other documents' KID checks (16, 17) restate this section informatively; where they differ, this section governs.

Bounding state. For each (pid, sourceId), a receiver keeps replay and attestation state (§7, §9) for at most 4 streams (joinNonce values) at a time. When a frame of a fifth stream decrypts successfully, the receiver makes room by evicting, in this order of preference:

  1. among the streams none of whose frames is attested, the one whose newest accepted frame is oldest;
  2. otherwise, among the streams whose newest accepted frame is more than 10,000 ms old, the one whose newest accepted frame is oldest.

If neither exists, it keeps its four streams and drops the new frame as invalid (media.stream_limit, §10.1); it never evicts a stream that has attested frames and recent traffic in favour of one that has neither. Evicted streams can't be resumed (§9.8) and their late frames are rejected (§7, rule 4).

Rationale: checks 2 and 3 tie the KID to the cleartext the relay routes by, and check 4 ties the leaf, and therefore the keys, to the device the call roster says is speaking. Together they stop a frame being re-labelled as another participant's or another source's. The cap bounds what a misbehaving member can make a receiver store; an honest device has one main instance and at most one SFU instance at a time. The eviction order means that a member who injects frames under fresh joinNonce values (which it can, because it can derive any KID's keys) only displaces its own unattested streams, never the real sender's.

5. Nonce safety

This section is the argument that no SFrame key and nonce pair is ever used twice. It is normative in the sense that an implementation MUST preserve every property it relies on.

Claim. Two different frames are never encrypted under the same sframe_key with the same nonce, except with negligible probability.

Argument.

  1. Key and nonce are functions of four inputs. sframe_key and sframe_salt are determined by (sframe_epoch_secret(e), L, K) (§3.3), and the nonce by the salt and CTR (§3.4). Reusing a (key, nonce) pair for two different frames needs the same media epoch secret, the same leaf L, the same KID K and the same counter CTR, except with probability about 2^-128 that two different inputs give the same 16-byte key and 12-byte salt.
  2. Same media epoch secret means the same epoch of the same group. The exporter output differs between epochs, between groups and between generations of a group (13 §4.2). If a group forks (13 §15), the two branches of epoch e have different epoch secrets, so their keys differ. Two epochs whose numbers have the same low 4 bits have different epoch secrets, so their equal KIDs still give different keys.
  3. Same leaf in the same epoch means the same device. In one epoch a leaf index names one leaf, and every leaf belongs to one device (00 HP-1 item 6). Two devices of the same account have different leaves.
  4. Same KID from the same device in the same epoch means the same encryptor instance and source. The KID contains the joinNonce and the sourceId. By §4.3 items 3 and 4, a device never uses one joinNonce for two encryptor instances in one epoch, even across a crash, an operating-system kill, an auto-rejoin (D-012, 15 §10), a planned migration, Move voice here back to the same device, or a new call in the same context within the same epoch.
  5. Same encryptor instance and KID means one counter. §4.4 item 1 gives each KID exactly one counter, and §3.4 items 1 and 2 never repeat a counter value; §3.6 stops before the counter could wrap.
  6. Hence the four inputs never all repeat for two different frames.

Defence in depth. If item 4's persistence fails (for example a storage bug), the random 32-bit joinNonce still makes a repeat unlikely: with n encryptor instances started by one device in one epoch, the probability that two share a joinNonce is at most n(n − 1)/2^33, for example about 1.2 × 10^-6 for 100 restarts within one epoch. Even then a repeat needs the counters of both instances to overlap.

What isn't relied on. The argument doesn't rely on clocks, on the server, on the relay, on call IDs or on pid assignment, all of which a server controls.

Rationale: a repeated nonce under AES-GCM leaks the XOR of two plaintexts and the GHASH key to anyone who sees both ciphertexts, including the relay, a non-member. The KID layout of D-041 was chosen so that no counter state needs to survive anything; §4.3 item 4 closes the remaining gap.

6. Epoch keys and rotation

This section applies only to secure calls. The control messages that coordinate a switch (call.epoch_ready, call.epoch_switch, and the epoch member of lease ticks) belong to 15 §9; this section defines what a device does with keys around them (D-042).

6.1 EpochMediaState

For each installed epoch e of the context group, a device in a secure call keeps an EpochMediaState:

Item Contents
groupId, epoch The context group's group_id (including its generation, 13 §4.1) and e.
Media epoch secret sframe_epoch_secret(e) (§3.3).
Roster snapshot For every non-blank leaf of epoch e: leaf index, the DSK (the leaf's signature_key, 07), the DeviceCertificate's did, and the canonical address of the IdentityCertificate. Taken from the ratchet tree of epoch e when the state is created.
Key cache Derived sender_base_key, sframe_key and sframe_salt values (optional, evictable).
Replay state Per KID, §7.
Timers installedAt; the retention deadline (§6.6).

The roster snapshot lets a receiver check KIDs (§4.5) and verify MediaAttestations (§9.7) for an epoch after its MLS state has moved on, because RFC 9420 clients keep only the current tree.

6.2 Installing keys

  1. On processing a commit. When a device holding a seat in a secure call processes a commit that creates epoch e (13), it creates the EpochMediaState for e while its MLS state is still in e (before it processes any later commit). It can then decrypt frames of e from every sender. It then posts call.epoch_ready for e (15 §3.7, §9.2). It MUST NOT post call.epoch_ready for an epoch whose EpochMediaState it hasn't created.
  2. On joining or rejoining a call. A device creates the EpochMediaState for the group's current epoch (the one its MLS state is in) when it is admitted (15 §3.3), and posts call.epoch_ready for it as soon as its relay session is up (15 §9.2 item 3).
  3. Several commits at once. A device that processes several commits in a row (for example after a reconnect) MUST create an EpochMediaState for each epoch it passes through, while it is in that epoch, and then posts call.epoch_ready for the newest. It never skips an intermediate epoch: call control counts a post for a later epoch as readiness for every earlier one (15 §9.3 item 3), so it may switch the call to any of them.
  4. Commits it can't process. If a device can't process a commit (13 §15.4), it installs nothing; it resyncs as 13 specifies and installs the epoch its resync creates.

6.3 The sending epoch

Each sender keeps, per secure call:

  • I: the set of installed epochs, with the time each was installed on its monotonic clock;
  • M: the highest media epoch it has learned from call control: the join response's call.mediaEpoch, any call.epoch_switch, and the epoch of any lease tick (15 §9.4);
  • s: its current sending epoch, initially undefined.

Whenever any of these changes, and when a timer below expires, the sender computes a candidate s':

# Condition Candidate
1 I contains an epoch at or below M the highest such epoch
2 I contains epochs installed at least 2,000 ms ago the highest such epoch, if higher than row 1
3 I contains no epoch at or below M (the device joined the group in an epoch later than the call's M, for example by the external commit that let it into the channel) the lowest epoch in I, if no row 2 candidate is higher

and sets s = max(s, s'). The sending epoch never decreases. If s is then lower than N − 15, where N is the newest epoch in I, the sender sets s to N at once, so that its sending epoch always stays within the 16 epochs a receiver keeps (§6.4, §6.6 item 3).

  1. Row 1 is the coordinated switch: call control raised M because every required device is ready, or because 2 s passed (15 §9.3).
  2. Row 2 is the sender's own 2 s cap (D-042): a sender never waits longer than 2,000 ms after processing a commit, whatever call control does.
  3. Row 3 lets a device that has just joined the group send at once in the only epoch it has. Receivers that have already processed its commit decrypt its frames at once; others hold them for up to 200 ms (§6.5). This is the same situation as row 2 for every other sender.
  4. A sender that is behind. If M is higher than every epoch in I, the sender keeps sending in s (its newest epoch) and fetches the commits it is missing (13). If 8,000 ms pass (D-080) after it first learned of such an M and it still holds no epoch at or above M, its transmit gate closes (keysOk false, 16 §7.2, 15 §9.5) with the code media.keys_unavailable until it installs one. This keeps the invariant: a sender with keysOk true sends only in an epoch that every connected receiver still holds. Receivers keep an epoch for 10,000 ms after they learn a newer M (§6.6); a sender learns M from the same signals (call.epoch_switch over the WebSocket, the epoch of lease ticks), so its last frame in the old epoch leaves 2,000 ms of margin for the difference in when the two learned M and for network delay.
  5. keysOk (16 §7.2, 15 §10.6 condition d) is true exactly when s is defined, the sender holds sframe_epoch_secret(s), item 4 hasn't closed the gate, §3.6 item 4 hasn't stopped the source, and, in a DM or group DM call, the roster snapshot of s contains no leaf whose identity key is the pending key of a contact pin in state verified_blocked (07 §16.5). In that last case the sender MUST NOT send any source in s or a later epoch whose roster contains such a leaf; it keeps sending in an earlier epoch only while row 1 to 3 and item 4 still allow that epoch, and then its gate closes. It reopens as soon as the user accepts or verifies the new key (07 §16.5), with live audio only (D-012). The talk indicator shows "not being heard" (reason waiting_for_keys, 16 §7.10) next to the blocking W2 that 07 and 20 already show; no other warning is added.
  6. On a change of s, the sender closes the open MediaAttestation batch of every KID of the old epoch and sends those attestations (§9.3), then encrypts every following frame under the new epoch's KIDs, with counters starting at 0. It MUST NOT encrypt any frame under the old epoch after the change. It MAY erase its own sending keys for the old epoch at once; the receive keys of that epoch stay under §6.6.

UX: a switch is inaudible. A user who joins a secure call can speak and be heard at once in the common case; if their device can't send yet, the talk indicator shows "not being heard" with the reason waiting_for_keys (16, 20), never a warning.

6.4 Resolving a frame's epoch

A receiver keeps, per secure call, the set R of epochs with an EpochMediaState. Let N be the newest epoch in R. §6.6 keeps R within [N − 15, N], so no two epochs in R have the same low 4 bits.

For a frame whose KID has residue r:

  1. If an epoch e in R has e mod 16 = r, the frame belongs to e. Check the KID (§4.5 item 4) and decrypt with e's keys (§3.5).
  2. Otherwise the frame belongs to an epoch the receiver doesn't hold. The receiver treats it as belonging to the target epoch e* = N + ((r − N) mod 16), the next epoch with that residue, and holds it (§6.5).

A receiver that holds frames of an unknown epoch for more than 1,000 ms in total within one call SHOULD check for commits it has missed (13 §7.6) at most once every 5 s.

Rationale: the 4-bit residue is enough because a receiver never holds more than 16 consecutive epochs and senders never run more than one epoch ahead of call control for more than 2 s. A frame from an epoch the receiver has already erased also lands in rule 2; it is held for at most 200 ms and then lost, which is harmless.

6.5 The hold for unknown newer epochs

  1. A receiver holds a frame of an unknown epoch, undecrypted, for at most 200 ms on its audio clock (D-042, 16 §11.3), and never past the frame's playout deadline (16 §9.5, 17).
  2. When the receiver installs an epoch (§6.2), it processes the held frames whose target epoch is that epoch, in the order they arrived, exactly as if they had just arrived: KID check, counter check, decryption, freshness check (§7, which uses the time each frame arrived).
  3. A held frame whose target epoch isn't installed when its hold expires is undecryptable (§6.7), with the code media.unknown_epoch.
  4. Capacity. A receiver holds at most 32 frames per stream and at most 4 MiB of frames per call. When a limit would be exceeded, the oldest held frame is discarded as undecryptable.
  5. For video on the SFU path, the hold happens inside the encoded transform: the frame is passed on (decrypted) or dropped within 200 ms.

6.6 Old-key retention and erasure

For each epoch x in R other than N:

  1. Let T(x) be the first moment, on the receiver's audio clock, at which the receiver has learned a media epoch M (§6.3: the join response's call.mediaEpoch, a call.epoch_switch, or the epoch of a lease tick) newer than x.
  2. The receiver keeps x's EpochMediaState for 10,000 ms after T(x) (D-042, D-080), then erases it.
  3. The receiver erases x's EpochMediaState at once, without waiting, when any of these happens: x < N − 15 (§6.4); the receiver leaves the call or the call ends (15 §2.6); the context group's generation changes (13 §4.2), which erases every EpochMediaState of the old generation; the receiver's device is removed from the group.
  4. The receiver never erases the EpochMediaState of N, or of its own sending epoch s, while it is in the call.
  5. Erasure means overwriting the media epoch secret, every derived key and salt, and the replay state with zeros or releasing them through a key-handling API that does so (08), and discarding held frames of that epoch. The roster snapshot is discarded with them.

The 10 s retention of an old epoch x starts when the receiver learns that call control has switched the call past x (a mediaEpoch newer than x), as 00 HP-5 states (D-080, refining D-042). Rationale: frames of a newer epoch can arrive up to 2 s before the switch (§6.3 rows 2 and 3), and a lagging sender measures its own 8 s limit (§6.3 item 4) from the switch; starting both clocks from the same event keeps the invariant of §6.3 item 4, and a quiet call that carries no frames still erases old keys 10 s after the switch. In the normal case senders switch on the same event, so the switch and the first frame of the newer epoch coincide.

Rationale: 10 s comfortably covers a sender that switches 2 s late, plus network delay, plus a sender that is behind for a few seconds (§6.3 item 4), while keeping the window in which a removed member's old keys matter short. The erasure on generation change is needed because epoch numbers restart in a new group generation.

6.7 Undecryptable frames are lost

A frame is undecryptable when its tag fails, when its target epoch is still unknown after the hold, when it fails the counter or freshness check (§7), or when its keys were erased. An undecryptable frame:

  1. is treated exactly as if it had never arrived (D-042): it doesn't enter a jitter buffer, and audio concealment covers its slot (16 §9.5); a lost video frame leads to 17's normal recovery, such as a keyframe request;
  2. is counted (§10.2), and is never shown to the user;
  3. isn't recorded for MediaAttestation (§9.7): only frames that decrypted successfully are checked against attestations.

6.8 Joins, removals, resync and group changes

Event (13, 15) Effect on media keys
A device joins the group (external commit or Welcome) and the call Members create the EpochMediaState for the new epoch on processing the commit and post call.epoch_ready. The joiner can't decrypt frames of earlier epochs: it hears each sender from the moment that sender switches, at most about 2 s after the commit.
A member is removed (kick, ban, leave, device revocation, identity change, eviction) Call control revokes the removed participant's lease at once, so honest relays, SFUs and receivers stop forwarding to and playing from it within 4 s (15 §4.8, D-037), independently of the commit. When the Remove commit is processed, the new epoch's keys are unknown to the removed device, and senders move to them within 2 s.
A participant's own device resyncs (13 §10.5) It gets a new leaf in a new epoch. Its new KIDs carry the new leaf index. 15 §12.4 treats the resync as a planned migration in which the client restarts its media process, so it starts a new encryptor instance with a fresh joinNonce (§4.3 item 1) and its streams restart (16 §9.1). The new leaf and epoch would give new keys even without that restart.
A self-update commit (13 §14.1), including one triggered by §3.6 An ordinary rotation.
The group generation changes during a call (13 §4.2 cases G-b and G-c) Call control ends the call with reason group_restarted (15 §12.5), a planned migration that keeps mic and push-to-talk state. The device erases every EpochMediaState of the old generation (§6.6 item 3), ends every encryptor instance, joins the new generation's group and then the new call with a new media process. A call never spans two generations (15 §9.1), so within one call epoch numbers, M and the residues of §6.4 are never ambiguous.
A contact's identity key changes in a secure DM or group DM call (07 §16.5, 12 §11.5) The old leaves are removed by commit like any removal. When another participant's commit admits the new key, a user who had verified the contact stops sending from the first epoch containing a leaf with the pending key (§6.3 item 5), and doesn't play that leaf's streams (§9.8 item 5) until they accept or verify the new key. A user who hadn't verified the contact accepts the new key at once (07) and nothing changes for media.
The call ends, or the device leaves it Every EpochMediaState of the call is erased, and every encryptor instance ends.

6.9 Test vectors: epoch resolution

These vectors are normative for §6.4 and §6.6. Times are in milliseconds on the receiver's audio clock.

Vector R1. R = {40, 41, 42}, so N = 42.

Frame residue r Rule Result
10 42 mod 16 = 10 epoch 42
9 41 mod 16 = 9 epoch 41
8 40 mod 16 = 8 epoch 40
11 not in R hold, target 42 + ((11 − 42) mod 16) = 42 + 1 = 43
7 not in R hold, target 42 + ((7 − 42) mod 16) = 42 + 13 = 55

Vector R2. Continuing R1, with the frames' playout deadlines later than the times shown.

Time Event Result
1,000 Residue-11 frame A arrives Held, target 43
1,000 Residue-7 frame B arrives Held, target 55
1,150 Epoch 43 installed A is decrypted at 1,150; R = {40, 41, 42, 43}
1,160 Residue-11 frame C arrives Rule 1: epoch 43, decrypted at once
1,200 B's hold expires; 55 isn't installed B is undecryptable (media.unknown_epoch)

Vector R3. R = {27, 28, …, 42} (16 epochs). Installing 43 erases 27 at once (27 < 43 − 15), whatever its retention deadline.

Vector R4. R = {41, 42}. A call.epoch_switch naming 42 arrives at 5,000; T(41) = 5,000 (frames of 42 that a joiner sent from 3,500 on don't start the clock). Epoch 41 is erased at 15,000. A frame of 41 arriving at 14,990 decrypts; one arriving at 15,010 is held as target 57 and then lost. A sender that learned of 42 at 5,000 but couldn't install it stops sending in 41 at 13,000 (§6.3 item 4).

7. Replay protection

Every receiver keeps a replay state for each (epoch, KID) it has accepted frames under, inside that epoch's EpochMediaState:

  • H: the highest counter recorded under the KID (undefined before the first);
  • Ha: the highest attested counter (§1.3; undefined before the first attested frame);
  • a record of the accepted counters c with c > H − 4096, each with the time it was accepted (audio clock), its frame hash (§9.2) and whether it is attested (§9.7).

Counter check. A frame with counter c under a KID passes the counter check exactly when one of these holds:

  1. H is undefined, or c > H; or
  2. all of: c > H − 4096; c isn't in the record; and the smallest recorded counter greater than c was accepted less than 1,000 ms ago.

Freshness check (voice-dc/1 and video-dc/1 only). The route header and the video frame header carry the frame's capture timestamp (16 §4.5.3, 17 §6.4), and both are authenticated metadata. For each stream, the receiver computes for every accepted frame i its delay D_i = a_i − ts_i, where a_i is the frame's arrival time on the audio clock in milliseconds (for a held frame, when it arrived, not when it was decrypted) and ts_i is its timestamp converted to milliseconds (divided by 48 for audio, by 90 for video) and extended with serial-number arithmetic as 16 and 17 compare timestamps. It keeps

Dref(t) = min over the stream's accepted frames i of ( D_i + (t − a_i) / 10 )

which it can maintain incrementally: Dref ← min(Dref + (t − t_prev) / 10, D_new) at each accepted frame. A frame whose tag verifies but whose D exceeds Dref(a) + 1,000 ms is stale. The first frame of a stream sets Dref.

Rules:

  1. The receiver applies the counter check before decryption, and drops a frame that fails it without decrypting it. It applies the freshness check right after the tag has verified, because the timestamp is authenticated only then.
  2. It adds c to the record, raises H, and updates Dref, only after the frame's tag has verified and the frame has passed the freshness check (§3.5 item 2), so a frame forged by a non-member can't move the window.
  3. A frame that fails either check is undecryptable (§6.7), with the code media.replay. Duplicates that a jitter buffer has already removed by sequence number (16 §8.2, 17) never reach these checks.
  4. When an epoch is erased (§6.6), its replay state goes with it, and later frames of that epoch can't be decrypted at all. When a stream's state is evicted (§4.5), fresh state would have H undefined and would accept old frames again, so a receiver MUST remember the last 64 evicted joinNonce values per (pid, sourceId) and drop, as media.replay, any later frame that carries one of them.
  5. Ha. When a recorded frame becomes attested (§9.7 step 6), the receiver raises Ha to its counter if that is higher.
  6. Rollback after a stop. When a stream enters stopped (§9.8), for every KID of the stream the receiver removes from the record every counter above Ha that isn't attested (keeping its counter and frame hash in the stop list, §9.8) and sets H to the highest counter still recorded (undefined if none).

Rationale: counters only advance while a sender is sending, so a window measured in counters alone would let a relay hold back part of a talkspurt and deliver it after a long silence, when the jitter buffer has forgotten the stream and would play it as new speech. The 1-second rule of the counter check bounds reordering below H to what real networks cause. The freshness check covers frames above H, such as the held-back tail of a talkspurt: their capture timestamps show how late they are, whatever their counters. Dref creeps up by a tenth of the elapsed time, so a held-back frame is caught whenever it is more than about 1.1 s late, while an honest path whose delay rises for good by J > 1 s loses that stream for about 10 × (J − 1 s) before Dref catches up; smaller rises, such as a planned move to a new relay (15 §6.9), lose nothing. The rollback stops one forged frame with a far-future counter (accepted under rule 1 of the counter check, because a member can produce a valid tag) from pushing H so high that every genuine frame afterwards fails as a replay: the stream stops within 3 s (§9.7 item 10), and the rollback lets the genuine frames through again. 4,096 counters cover more than a second of the busiest source (three simulcast layers at 60 frames per second each).

On sfu-rtp/1 the RTP timestamp isn't authenticated (§8.4.3), so the freshness check doesn't apply there; an SFU can hold back part of a screen or webcam stream, or of screen sound, and deliver it late; the counter check still limits reordering below H. Microphone audio never travels through the SFU (15 §7.1).

8. Applying SFrame on each transport

8.1 Common rules

  1. Every frame of a secure call is protected. In a secure call, every frame of every source on every route is an SFrame ciphertext. A receiver MUST drop, as invalid, any frame in a secure call that isn't (on data channels: the route header's C flag is 0, 16 §4.4; on the SFU path: the frame doesn't parse as §8.4.4 requires).
  2. Encrypt once. A frame is encrypted once by its encryptor instance, and the identical bytes are sent on every route that carries it (§3.4 item 4, 16 §4.6).
  3. Relays and SFUs never decrypt. They hold no media keys (00 §3.1). They MUST forward SFrame ciphertexts and their metadata unchanged, apart from the RTP-level rewriting that an SFU normally does on the SFU path, which never touches the encoded frame (§8.4).
  4. The metadata is authenticated, not encrypted. Its bytes are part of the AEAD associated data, so any change to them makes the frame undecryptable. They are visible to relays and SFUs, which need them for routing.
  5. One key per epoch for all routes. There is no per-route key. Route changes between the relay and the SFU, and moves to a new relay, don't affect keys (15 §6.9, §7.3).
  6. Servers carry every frame. Clients MUST NOT send media to each other directly (D-094). Every frame travels on a relay connection (voice-dc/1, video-dc/1) or an SFU session (sfu-rtp/1) of the hosting server, so the server enforces leases on every path (15 §4.5, §4.7).

8.2 voice-dc/1 (sources 0 and 2 on data channels)

A voice-dc/1 frame message (16 §4.3) in a secure call:

Part Content
Octets 0–11 The route header, with the C flag set. It is the SFrame metadata.
Octets 12– The SFrame ciphertext of exactly one Opus packet: SFrame header, encrypted Opus packet, 16-byte tag.
  1. The sender builds the complete route header first (including the S and E flags, sequence number and timestamp), then encrypts with metadata = those 12 octets exactly, then appends the SFrame ciphertext.
  2. The KID's sourceId equals the route header's sourceId; its leaf is the sender's leaf in the sending epoch; the low 12 bits of its joinNonce equal the route header's gen (16 §4.6).
  3. The relay forwards the frame message bytes unchanged; which listeners get the frame is decided by leases and subscriptions (15 §4.5, §6.6), not by anything in the frame, so every receiver gets the bytes the sender encrypted.
  4. The receiver validates the route header (16 §4.9.1), resolves the epoch (§6.4), checks the KID (§4.5) and the counter check (§7), decrypts with metadata = octets 0–11 as received, and then applies the freshness check (§7) to the route header's timestamp.

Test vector: §13.3.

8.3 video-dc/1 (sources 1 and 3 on data channels)

17 defines the video-dc/1 fragment format. This document requires of it, and 17 MUST provide:

  1. a video frame header: a fixed-length sequence of octets that is identical in every fragment of one frame, contains at least the sender's pid, the sourceId, the stream generation gen (the low 12 bits of the main encryptor instance's joinNonce, as in 16 §4.5.1), a per-stream frame number, the 90 kHz timestamp, a keyframe indication and a C flag with the meaning of 16 §4.4;
  2. per-fragment fields (such as a fragment index and count) kept outside that header.

Then, in a secure call:

  1. The plaintext is one complete encoded video frame, as the encoder produced it. A layered encoding that 17 sends as several frames (for example one per SVC spatial layer) is protected one frame at a time, each with its own counter.
  2. The sender builds the video frame header, encrypts the whole frame with metadata = the video frame header octets exactly, and only then splits the SFrame ciphertext into fragments as 17 specifies (00 HP-5: "video is fragmented after encryption").
  3. The receiver reassembles all fragments of the frame first (17), then resolves the epoch, checks the KID and applies the counter check, decrypts the reassembled SFrame ciphertext with the video frame header as metadata, and then applies the freshness check (§7) to the frame header's timestamp.
  4. Per-fragment fields aren't authenticated. A relay that alters them only makes the reassembled ciphertext wrong, which fails decryption; the frame is lost and 17's recovery (a keyframe request) applies.
  5. A frame of which any fragment is missing can't be decrypted and is lost; there is no partial decryption.

Rationale: encrypting before fragmenting keeps exactly one SFrame operation, one counter value and one frame hash per video frame, whatever the fragment size, and lets fragments be retransmitted (15 §6.4) without any cryptographic state.

8.4 sfu-rtp/1 (sources 1, 2 and 3 through the SFU)

8.4.1 Model

On the SFU path, media travels as RTP produced by the WebRTC stack. SFrame is applied to each encoded frame between the encoder and the RTP packetizer, and between the depacketizer and the decoder, using WebRTC encoded transforms (W3C WebRTC Encoded Transform: RTCRtpScriptTransform, or an equivalent hook in a native WebRTC stack). The SFU forwards RTP packets whose payloads carry the transformed frames, and never sees plaintext.

The SFU must still do its job: choose simulcast encodings and SVC layers per receiver (17), detect keyframes, and the RTP packetizer must still build a valid payload format. Some codecs need a few bytes at the start of each frame left readable for that. These bytes are the clear prefix. They stay unencrypted and are authenticated as part of the SFrame metadata.

8.4.2 Codecs and clear prefixes

In a secure call, only these codecs may be used on the SFU path:

Codec codec value Clear prefix length Notes
Opus (source 2 only) 1 0 The Opus RTP payload format (RFC 7587) needs no payload inspection.
VP8 2 10 octets for a keyframe, 3 octets otherwise. A frame is a keyframe when bit 0 of its first octet (the VP8 frame tag's key_frame bit, RFC 6386 §9.1) is 0. The 3-octet frame tag, and for keyframes the start code and dimensions, which packetizers and SFUs read to detect keyframes.
VP9 3 0 The VP9 payload descriptor is built from encoder information outside the frame, so no frame bytes need to be readable.

The codec values are this document's own registry (§12). They are unrelated to the codec octets of 17 §5.1, which name codecs in the video-dc/1 frame header only; an implementation MUST NOT copy one into the other.

  1. Call control, the SFU adapter and clients MUST NOT negotiate any other video codec for a secure call's SFU session. 17 owns codec negotiation for sfu-rtp/1 and MUST respect this list. When a secure call's SFU offer lists allowed and other video codecs, call control answers with the allowed ones only, and no error results. An offer or publish list of a secure call that leaves no allowed video codec for a published video source is an unusable SDP: call control answers 400 sfu.bad_sdp (15 §8.2), and the client handles it as 15 §8.3 item 6 says. Nothing about it is shown to the user beyond video being unavailable.
  2. H.264, H.265 and AV1 aren't allowed in secure calls on the SFU path in v1: their RTP packetizers parse the frame's internal structure (NAL units, OBUs) and would fail on encrypted data. They remain available on the video-dc/1 path, where the whole frame is opaque, if 17 allows them there, and in insecure calls.
  3. If a frame is shorter than its clear prefix plus 1 octet, the sender MUST NOT send it, and a receiver MUST treat it as invalid.

Proposed decision (the same as 17 §12.4's): in secure calls on the SFU path, video uses only VP8 and VP9. Rationale: they are the only codecs whose packetizers work on encrypted payloads on every v1 platform; the cost is that phones that encode only H.264 in hardware use software VP8 for secure calls through an SFU. Revisit when the generic SFrame RTP payload format (draft-ietf-avtcore-rtp-sframe) is published and supported, which would make every codec work with an empty clear prefix.

8.4.3 SfuFrameMetadata

The SFrame metadata on the SFU path is the TLS-presentation encoding (04 §3.2) of:

struct {
    uint8  version;        /* 1 */
    uint8  codec;          /* §8.4.2 */
    opaque clear_prefix<V>;
} SfuFrameMetadata;
Field Meaning
version 1. A receiver treats any other value as invalid.
codec The codec of the frame, from the negotiated payload type (§8.4.2 values). Binds the frame to its codec, so a frame can't be replayed as another codec.
clear_prefix The clear prefix octets (§8.4.2), possibly empty.

17 §12.6 and its test vectors use this structure as the SFrame metadata on the SFU route; it is never the bare clear prefix.

Rationale: the clear prefix is the only part of the encoded frame that the SFU and the packetizers read, so it is the only part that needs to be both readable and authenticated: an SFU that alters it can only make frames undecryptable, never change what a receiver renders. The VP8 and VP9 payload descriptors and the Dependency Descriptor header extension, including its layer IDs, are unauthenticated forwarding hints (00 HP-5's Dependency Descriptor clause is met by keeping them readable). They are built by the packetizer after the transform and negotiated separately on each leg to and from the SFU, which may rewrite them, so a sender and a receiver can't be relied on to see the same values; authenticating them would make every frame undecryptable whenever they differ. A modified hint can only make the SFU forward the wrong layers or make frames undecodable, which an SFU can do anyway by dropping packets; the decoded picture always comes from the authenticated, decrypted bitstream.

8.4.4 Sender and receiver procedures

Sender, in the encoded transform, for each encoded frame F of a published source:

  1. If the source isn't covered by the device's lease (15 §4.6), drop F.
  2. p = clear prefix length for the codec (§8.4.2); P = the first p octets of F; B = the rest.
  3. Build metadata = SfuFrameMetadata (§8.4.3).
  4. Encrypt B with the SFU encryptor instance (§4.4 item 3), KID with the source's sourceId, giving the SFrame ciphertext X (§3.4).
  5. Replace the frame's data with P || X. Every other property of the frame is left unchanged.

Receiver, in the encoded transform of each received track, whose pid and sourceId come from the session's Track list (15 §8.2):

  1. Determine the codec from the frame's payload type, and p from §8.4.2 using the frame's first octet (VP8). If the frame is shorter than p + 1 octets plus the minimum SFrame overhead, it is invalid.
  2. P = the first p octets; X = the rest. Parse the SFrame header at the start of X.
  3. Check the KID (§4.5: sourceId against the Track, leaf against the Track's participant; there is no gen check on this path), resolve the epoch (§6.4) and apply the counter check (§7; there is no freshness check on this path).
  4. Build metadata = SfuFrameMetadata from the codec and P, and decrypt.
  5. On success, replace the frame's data with P || plaintext and pass it on to the decoder. On failure, drop the frame (do not pass it to the decoder); it is lost (§6.7). For video, 17's normal recovery (a keyframe request) follows.

8.4.5 Platform notes (informative)

  • The W3C SFrameTransform interface applies SFrame to the whole frame with no metadata and no clear prefix, so it can't implement this section; web clients use RTCRtpScriptTransform (or the older insertable-streams API where that is the only one available) with the SFrame code of the client.
  • SFrame keys used in a script transform can be WebCrypto CryptoKey objects derived inside the transform's worker; the salt must be available as bytes to compute the nonce, which is acceptable because the salt protects nothing without the key. Web clients keep the media epoch secret in the same Worker as their MLS state where possible (08, D-065).
  • Native WebRTC stacks offer a frame transformer hook (for example libwebrtc's FrameTransformerInterface) that runs per RTP sender and receiver. One transformer per sender gives one counter per source, as §4.4 requires.

8.4.6 Duties of call control and the SFU

  1. Call control and the SFU adapter MUST NOT configure the SFU to modify, re-encode, transcode or reassemble encoded frames of a secure call. Forwarding, layer dropping, simulcast switching, and RTP header rewriting (SSRC, sequence numbers, timestamps) are allowed.
  2. Call control MUST NOT ask for, and the SFU MUST NOT use, any SFU feature that decodes media of a secure call (recording, mixing, transcription, thumbnails).

8.5 Which calls are secure

A client decides for itself whether a call is secure; it doesn't take the hosting server's word for a downgrade (SM-12, D-056). It treats a call as secure when the Call's security is secure (15 §2.5.1), or when its own view of the call's context is secure:

  • for a channel: the Channel object's security, or a secure-state pin it holds for the channel or its community (09 §13);
  • for a 1:1 DM or a group DM: the security it computes itself from IdentityStates it verified, and its secure-state pin for a group DM (12 §11.1).
  1. In a call it treats as secure, a client MUST NOT send any plaintext media frame (C flag 0, or an SFU frame without SFrame), MUST NOT send media at all unless it holds the context group's MLS state, and MUST drop as invalid every received frame that isn't an SFrame ciphertext (§8.1 item 1).
  2. If the Call's security says insecure for a context the client treats as secure, the client sends no media in that call and plays none of it. For a channel or community it raises W9 (09 §13, D-056). For a DM or group DM it follows 12 §11.1: a pinned secure group DM raises W9; for a 1:1 DM it refetches the participants' IdentityStates and takes part in the call only if its own computation then says the DM is insecure.
  3. Call control and relays don't apply this section; they follow the Call's security.

Rationale: SFrame protects media only if both ends use it. A malicious or broken hosting server that presented the call of a secure context as insecure would otherwise collect plaintext voice and video from every client that believed it. 20 derives a call's lock state from the same rule (20 §8.2).

8.6 Insecure calls

Insecure calls use the same framing with no SFrame and no MediaAttestations (00 HP-5, D-021):

  1. voice-dc/1 and video-dc/1 frames carry plaintext payloads with the C flag 0 (16 §4.6, 17). The route header is protected only by DTLS, hop by hop.
  2. On the SFU path, no encoded transform is installed; frames are plain RTP payloads.
  3. Senders MUST NOT send media.attestation messages. A receiver MUST ignore any media.attestation it receives in an insecure call and counts it (media.attestation_unexpected, §10.2). A relay SHOULD drop media.attestation messages in insecure calls instead of forwarding them (15 owns relay forwarding).
  4. A receiver MUST drop, as invalid, a frame with the C flag set in an insecure call (16 §4.9.1); a modified client can't make other clients spend effort on unverifiable ciphertext.
  5. The media process still chooses a joinNonce for its stream generation (§4.3 item 6). No other part of this document applies.
  6. Every client and server involved can read and alter insecure media. That is the defined property of insecure contexts (00 §5.1), not a weakness of this document.

A call never changes mode while running: when a context becomes secure, its insecure call ends and a new secure call starts (15 §12.1), with new media processes and new joinNonce values.

9. MediaAttestation

9.1 Purpose and limits

SFrame keys come from the context group, so every member can compute every sender's keys (§3.3). SFrame therefore proves only that a frame came from some member. A member who also controls a relay or SFU path could inject frames under another member's KID. MediaAttestation closes that gap without delaying playback (D-043):

  • every sender signs, with its own DSK, a short list of hashes of the frames it actually encrypted, every 500 ms per KID;
  • receivers play frames at once and check them against these signatures afterwards;
  • a frame that turns out not to be the sender's, or that stays unattested for more than 3 s, makes the receiver stop playing that source.

What it gives: a forged frame can't play for longer than the time until the next attestation of the real sender reaches the receiver (normally under 1 s), or 3 s if the attacker also suppresses the real sender's attestations, and such episodes are limited per participant and source (§9.8, §14 item 2). What it doesn't give: it doesn't stop the forged audio that already played, it doesn't stop a relay dropping or delaying media, and it never produces a warning (00 §4.12.5).

9.2 Frame hash

For every frame it encrypts, a sender computes, and for every frame it decrypts, a receiver computes:

struct {
    opaque metadata<V>;            /* the SFrame metadata of the frame (§8) */
    opaque sframe_ciphertext<V>;   /* SFrame header || encrypted data || tag */
} FrameHashInput;

frame_hash = first 8 octets of SHA-256(FrameHashInput)
Transport metadata sframe_ciphertext
voice-dc/1 The 12-octet route header (§8.2) Octets 12 to the end of the frame message
video-dc/1 The video frame header (§8.3) The reassembled SFrame ciphertext
sfu-rtp/1 The SfuFrameMetadata encoding (§8.4.3) X: the frame data after the clear prefix (§8.4.4)

The hash is over the bytes as sent and as received; because a frame is encrypted once and forwarded unchanged (§8.1), every receiver computes the same hash as the sender, whatever route delivered it.

The frame hash covers the frame's SFrame metadata as well as its SFrame ciphertext (00 HP-5, D-080). Rationale: AES-GCM isn't key-committing, so a member who knows the key can change the associated data (for example a route header's timestamp or flags) and recompute a matching tag over unchanged ciphertext; hashing the metadata makes such a change detectable at no cost.

9.3 Sender: batches

For each KID it encrypts under, an encryptor instance keeps one open batch: the first counter of the batch and the frame hashes of the batch's frames in counter order.

  1. Every frame encrypted under the KID belongs to exactly one batch, including frames that were then dropped and never sent. Because counters have no gaps (§3.4 item 2), a batch covers every counter from its first to its last.
  2. The sender closes the open batch at the earliest of:
    • 500 ms after the first frame of the batch was encrypted (D-043), on the sender's monotonic clock;
    • the batch reaching 256 frames;
    • the KID being retired: the sending epoch changes (§6.3 item 6), the source stops, the encryptor instance ends, or the device leaves the call.
  3. A sender SHOULD also close the batch right after encrypting a frame that ends a talkspurt (the E flag of 16 §4.4) or the last frame before a source pauses, so that receivers verify the end of a talkspurt quickly.
  4. On closing a batch, the sender builds and signs a MediaAttestation (§9.4) and sends it (§9.6) within 50 ms. Batches of one KID are consecutive: the next batch starts at the counter after the last one.
  5. A sender with no frames encrypted under a KID since its last batch sends nothing for that KID.
  6. A sender MUST NOT delay sending any frame because of attestation work.
  7. When the device leaves the call (15 §3.4), it SHOULD send the attestations of its open batches before closing its connections.
  8. A sender keeps every attestation it sent in the last 4,000 ms, for the re-sends of §9.6 item 2. After an unexpected drop (15 §10.1), it SHOULD send those it still holds, closing first any batch the drop left open, on its new relay connection as soon as the rejoin completes, even though they belong to its previous encryptor instance; receivers still hold that instance's records and use them to withdraw a stop (§9.8).

9.4 Signed content

A MediaAttestation's signature is a labelled signature (04 §7) by the sender device's DSK with the label media-attest, which 04 §7.3 registers for this document:

struct {
    uint8  version;           /* 1 */
    opaque group_id<V>;       /* the context group's group_id, UTF-8 (13 §4.1) */
    uint64 epoch;             /* the full MLS epoch of the KID's keys */
    opaque call_id[16];       /* the call's callId, 16-octet binary UUID (RFC 9562) */
    uint64 kid;               /* the KID (§4.1) */
    uint64 first_counter;
    uint64 last_counter;
    opaque frame_hashes<V>;   /* 8 × (last_counter − first_counter + 1) octets, in counter order */
} MediaAttestationContent;

sig = SignLabelled(DSK, "media-attest", MediaAttestationContent)
    = Ed25519-Sign(DSK, "sv1 sig" || 0x00 || "media-attest" || 0x00 || MediaAttestationContent)

The content follows 04 §7.2: it starts with a version, binds the group (and with it the hosting server, the context and the group generation), the epoch, the call, the stream (through the KID) and the exact frames, and every variable-length field is length-prefixed. The signer is identified by the KID's leaf, not by any field: a receiver looks the DSK up itself (§9.7).

Rationale (D-080): binding group_id and epoch as well as the call ID means a valid attestation can't be replayed into another context, another group generation or another epoch with the same residue, even by a server that controls call IDs.

9.5 The media.attestation message

A MediaAttestation travels as a control-channel message (15 §6.5) with t = media.attestation. The relay sets from to the sender's pid (15 §6.5).

d members:

Member Type Required Meaning and constraints
v integer Yes Format version, 1. A receiver ignores a message with any other value.
callId string Yes The call's callId (UUIDv7, lowercase hyphenated).
epoch integer Yes The MLS epoch of the KID's keys. Its low 4 bits MUST equal the KID's residue.
src integer Yes The KID's sourceId, 0–3. Repeated in clear so that a relay can route the message without parsing the KID.
kid string Yes The KID, as kid-string (§4.1).
first integer Yes First counter of the batch, 0 to 2^32 − 1.
last integer Yes Last counter of the batch; first ≤ last ≤ first + 255 and last ≤ 2^32 − 1.
hashes string Yes base64url (04 §3.1) of the frame hashes, exactly 8 × (last − first + 1) octets.
sig string Yes base64url of the 64-octet labelled signature (§9.4).

Senders MUST NOT add other members. Receivers ignore unknown members (00 §7.2), which aren't signed. The serialized message is at most 3,600 octets; receivers drop larger ones.

Example (the batch of §13.5):

{ "t": "media.attestation", "from": 513,
  "d": { "v": 1, "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "epoch": 42, "src": 2,
         "kid": "40317029791563866", "first": 1000, "last": 1003,
         "hashes": "3A1kHQTta0z15ThCKBPFrqVShRH4hZMMQCxfrstJQFw",
         "sig": "sY6BiR_rEVDdYnaFowVthpHfwRkdgzkxFZY1HmDr5jgupp0p-WhIeNhGGH516XV_KsIyO2MIVSTJSkV0YDiBCQ" } }

9.6 Where attestations travel

  1. The sender sends every attestation on the sv-control channel of every relay connection of the call that it has open (both relays during a planned relay migration, 15 §6.9), whatever route the frames took. This includes sources that travel through the SFU, because SFU sessions have no control channel (15 §8.1, D-080).
  2. After a rejoin, the sender re-sends its recent attestations as §9.3 item 8 says.
  3. The relay forwards it as 15 §4.5 and §6.5 specify: unchanged apart from from, to every listener except the sender, whether or not those listeners subscribed to the source on the relay. This is what lets a receiver that gets a source from the SFU, or from the relay without a relay subscription, verify it.
  4. A receiver may get one attestation on several relay connections, or again after a re-send. It ignores a copy that is identical to one it processed in the last 10,000 ms. A copy that differs from an earlier one with the same (from, kid, epoch, first, last) is processed on its own (§9.7): an invalid copy, such as one a relay altered, is only counted (§9.7 step 4) and can't hide a valid copy that arrives on another relay connection; two validly signed copies with different hashes are equivocation (§9.7 step 5).
  5. Attestations are best-effort control traffic for the relay: rate limits of 15 §6.5 apply. At the maximum rate (four active sources, each closing a batch every 500 ms), a sender produces 8 attestations per second.

9.7 Receiver: verification

Records. For each frame of a secure call that a receiver accepts (decrypts successfully and passes the checks of §7), it records under the frame's (epoch, KID): the counter, the frame hash (§9.2), the time of acceptance on its audio clock, whether the frame was played (or scheduled for playout), and an attested flag, initially false. Records live in the replay state of §7 and go with it.

On receiving a media.attestation from participant P (the message's from):

  1. Mode. In an insecure call, ignore it (media.attestation_unexpected, §8.6).

  2. Structure. Check every constraint of §9.5, that callId is this call's, and that src equals the KID's sourceId. If any fails, ignore the message and count media.attestation_invalid.

  3. Attribution.

    • If the receiver holds the EpochMediaState of epoch and P is in the call roster (15 §2.5.2), the leaf named by the KID in that epoch's roster snapshot MUST be the device of participant P (same did and addr, §4.5 item 4). If it isn't, the receiver ignores the message and counts media.kid_mismatch; this attestation isn't about any stream of P, so nothing is stopped.
    • If the receiver holds no EpochMediaState for epoch and epoch is newer than every epoch it has installed, or if P isn't in the call roster yet (16 §4.9.1), the attestation is pending (below).
    • Otherwise (epoch is older than every installed epoch, or was erased), it ignores the message and counts attest.ignored: no frame the attestation could cover can still be accepted.

    Pending attestations. A receiver keeps a pending attestation, unverified, for at most 4,000 ms after receiving it, and keeps at most 16 per (from, src); when a 17th arrives, it drops the oldest. When it installs an epoch (§6.2), it first processes the held frames of that epoch (§6.5 item 2) and then that epoch's pending attestations, from this step. When a participant's roster entry arrives, it processes that participant's pending attestations, from this step. A pending attestation that expires or is dropped is counted in attest.ignored. Rationale: frames held for an unknown epoch (§6.5) or an unknown participant (16 §4.9.1) are accepted after the hold, and the attestation covering them can easily arrive first, for example right after a joiner's first talkspurt (§6.3 row 3); discarding it would stop an honest stream 3 s later.

  4. Signature. Rebuild MediaAttestationContent from the message and the receiver's own group_id and call ID, and verify sig with VerifyLabelled (04 §7.1, with the strict Ed25519 rules of 04 §4.3) under the DSK from the roster snapshot. If it fails, the receiver ignores the message, counts media.attestation_invalid, and reports it if §10.3 allows. An invalid attestation stops nothing (D-080): anyone on the path, including a relay that isn't a member, can produce one, so it says nothing about the sender. The frames it claims to cover stay unattested and fall under item 10.

  5. Equivocation. If an earlier valid attestation for the same (epoch, KID) gave a different hash for any counter in [first, last], the sender has signed two different frames under one counter. The stream (P, src, the KID's joinNonce) is stopped with media.attestation_mismatch (§9.8).

  6. Comparison. For every recorded frame under (epoch, KID) whose counter is in [first, last], and every entry of the stream's stop list (§9.8) under that KID in that range, compare its hash with the attested hash for that counter. Any difference stops the stream with media.attestation_mismatch. Each matching recorded frame becomes attested (§7 rule 5), and each matching stop-list entry is marked attested, before any stop this step causes takes effect.

  7. Keep it. The receiver keeps the attestation for 4,000 ms after receiving it (for a pending one, after it first arrived). A frame under that (epoch, KID) accepted later with a counter in its range is compared at acceptance, as in step 6.

Timing.

  1. A receiver MUST NOT delay playback of any frame to wait for its attestation. Verification is late by design (D-043).

  2. A receiver SHOULD verify each attestation within 500 ms of receiving it (or of processing it, if it was pending). A frame counts as attested at the time its attestation was received or, for a pending one, processed, provided that the verification then succeeds.

  3. Unattested limit. Every frame that the receiver played, or scheduled for playout, while its stream was playing MUST be attested within 3,000 ms of its acceptance, on the receiver's audio clock (16 §11.3). If one isn't, the stream is stopped with media.unattested. Frames accepted while the stream is stopped, and frames at or below the play floor (§9.8), never cause a media.unattested stop.

  4. Route disruptions. When the deadline of item 10 passes for a frame and any of these holds, the receiver doesn't stop the stream because of that frame; the frame stays unattested, and a late attestation still compares with it:

    • the receiver's own call is reconnecting (16 §7.2), or left that state less than 3,000 ms ago;
    • the frame arrived on a relay connection that the receiver has since closed or declared failed (15 §6.7).

    The frames excused this way for one (pid, sourceId) may add up to at most 3,000 ms of played media in any 60 s; beyond that, item 10 applies to them as usual. When the receiver's own call enters migrating (a new call replaces it, 16 §7.2), it discards every record and every stored and pending attestation of the old call; no stop results.

  5. When a participant's seat is removed (15 §2.6), the receiver discards that participant's records, stop lists and pending attestations; no stop results.

9.8 Receiver: stream playback state

Each stream (pid, sourceId, joinNonce) of a secure call is playing or stopped. For each (pid, sourceId) the receiver also keeps a stop history: the time of every stop of any of that pair's streams in the last 60 s, and whether it is counted (below).

A new stream starts playing, unless its (pid, sourceId) has a stop in the last 60 s that hasn't been withdrawn. Then the new stream starts stopped, with no Hstop for any KID, and plays only after a clean attestation.

State Event Action Next state
playing A failure of §9.7 that stops a stream: media.attestation_mismatch (including equivocation) or media.unattested Stop rendering the stream at once: audio fades out within 20 ms and its buffer is discarded (16 §9.5); video stops showing new frames of the source (17). Build the stream's stop list: the counter and frame hash of every frame of the stream that was played and isn't attested; keep it for 5,000 ms. Roll back the replay state of every KID of the stream (§7 rule 6) and record Hstop(KID) = its H after the rollback. Add the stop to the pair's stop history. Count it (§10.2). stopped
stopped A frame of the stream is accepted Record it and compare it with stored attestations (§9.7 step 7). Don't play it. stopped
stopped A media.attestation_mismatch failure Count it. The stream's latest stop becomes counted. Roll back again and set Hstop(KID) to the new H for every KID of the stream. stopped
stopped A clean attestation: one that verifies, whose recorded frames all match, and that covers at least one frame accepted after the latest failure whose counter is above Hstop of its KID (or whose KID had no Hstop) If the pair has 3 counted stops within the last 60 s, wait until 60 s after the third of those, and then require another clean attestation. Otherwise set the play floor of every KID of the stream to its current H. playing
playing A frame is accepted whose counter is at or below its KID's play floor Record and verify it, but don't play it. playing
any The participant leaves the call, the stream's state is evicted (§4.5), or the call ends Discard the stream's state. The pair's stop history is discarded only when the participant leaves the call. —

Counted stops and withdrawal. A media.attestation_mismatch stop always counts. A media.unattested stop counts unless it is withdrawn: within 5,000 ms after the stop, every entry of its stop list becomes attested with a matching hash (§9.7 step 6), which shows that those frames were genuine and their attestations only late. A withdrawn stop doesn't count toward the budget, isn't reported (§10.3), and no longer makes new streams of the pair start stopped. A stop that isn't withdrawn within 5,000 ms counts from then on; if a stop-list entry gets a different attested hash, the stream fails with media.attestation_mismatch and the stop counts at once.

  1. "Stop playing a source" (00 HP-5) means exactly the playing → stopped transition: the receiver keeps decrypting and checking the stream, but nothing of it reaches the speakers or the screen.
  2. Frames accepted while stopped are never played, even after the stream returns to playing; the play floor guarantees this for frames that arrive late. So recovering from a stop can never make old media play late.
  3. Unattested frames accepted while stopped don't cause further stops; they are counted.
  4. A stop affects only that stream, and new streams of the same (pid, sourceId) as stated above. The participant's other sources, and every other participant, are unaffected.
  5. A contact's changed identity in a DM. In a DM or group DM call, a receiver doesn't play the streams of a leaf whose identity key is the pending key of a contact pin in state verified_blocked (07 §16.5) until the user accepts or verifies the new key. It still decrypts, records and verifies them. This isn't a stop and counts nothing; W2 (07, 20) already tells the user why.
  6. A new stream doesn't displace an attested one. In a secure call, a new stream of a (pid, sourceId) doesn't retire an existing stream of that pair that has attested frames (the gen handover of 16 §9.1 and 17 §6.9) until one of the new stream's frames is attested. Until then the receiver keeps both, accepts frames of both, and plays each under the rules above. Audio mixes both (16 §9.1). Video shows one stream per source, so 17 §6.9 keeps showing the existing stream, and records but doesn't show the new one, until the handover. An honest rejoin hands over within one attestation interval; a stream that a member invents under a fresh joinNonce can't silence the real one.

Rationale: a stop that never ended would let a relay silence a speaker for good by withholding attestations for 3 s; it can always silence someone by dropping their frames, but it shouldn't be able to make a receiver do it permanently after the relay behaves again. Resuming needs evidence that the real sender's frames are arriving and match. The budget of 3 counted stops per (pid, sourceId) per minute bounds how often a member colluding with a relay can make forged media play, and keeping it per (pid, sourceId) rather than per stream means a fresh joinNonce, which any member can invent, doesn't buy a fresh budget: after a stop, a new stream of the same source plays only once it is attested. Late attestations caused by network trouble lead to a withdrawn stop, which costs the listener a moment of silence but never the 60 s wait. The rollback (§7 rule 6) means a forged frame with a far-future counter can silence the real sender for at most about 3 s.

UX: nothing is shown. The participant's speaking indicator simply goes quiet, or their video stops updating, as it would during packet loss. No warning, toast or badge is ever shown for MediaAttestation failures (D-043, D-055, 00 §4.12.5). A connection-details view that the user opens on purpose MAY show the counters of §10.2.

An attestation whose signature doesn't verify stops nothing (00 HP-5, D-080); only a validly signed attestation that contradicts a received frame (a mismatch or equivocation), or frames left unattested for 3 s, stop a stream. Rationale: an invalid signature can come from anyone on the path, including a relay that isn't a member, which could otherwise silence media it doesn't carry, such as a source on the SFU path; the frames such a message claims to cover still have to be attested by the real sender within 3 s.

9.9 Test vectors: verification timelines

These vectors are normative for §7, §9.7 and §9.8. Each has one stream, pid 3, sourceId 0, one KID, and no earlier stops. Frame n is accepted at time 20 × n ms unless stated otherwise. All attestations verify unless stated otherwise.

Vector A1: a forged frame, recovery, and suppressed attestations.

Time (ms) Event Result State
0–480 Frames 0–24 accepted Played playing
560 Attestation [0, 24], hashes match 0–24 attested playing
500–980 Frames 25–49 accepted Played playing
995 Forged frame with counter 50 (valid tag, produced by a member through the relay) accepted Played playing
1,000 Genuine frame 50 arrives Counter check fails (50 is recorded): dropped, media.replay playing
1,020–1,480 Frames 51–74 accepted Played playing
1,060 Attestation [25, 49] 25–49 attested playing
1,565 Attestation [50, 74]; its hash for 50 differs from the recorded forged frame's Frames 51–74 attested, so Ha = 74. Stop, media.attestation_mismatch (counted). Rollback: the unattested records 75–78 (accepted by 1,560) leave the record for the stop list; H = Hstop = 74 stopped
1,580–2,060 Frames 79–103 accepted Recorded, not played stopped
2,065 Attestation [75, 99]; stop-list entries 75–78 and recorded frames 79–99 match; frames 79–99 were accepted after the stop and are above 74 Clean: resume; play floor = 103 playing
2,080 Frame 104 accepted Played playing
2,100 onwards The relay drops every later attestation — playing
5,080 Frame 104 is still unattested 3,000 ms after acceptance Stop, media.unattested; the second stop of the pair within 60 s. Hstop = 99 stopped
10,080 No attestation of frames 104 onwards has arrived The 5,080 stop isn't withdrawn: it counts stopped

Vector A2: a forged far-future counter.

Time (ms) Event Result State
0–580 Frames 0–29 accepted Played playing
560 Attestation [0, 24] 0–24 attested; Ha = 24 playing
590 Forged frame with counter 4,294,967,295 (valid tag) accepted Played; H = 4,294,967,295 playing
600–3,580 Genuine frames 30–179 arrive Counter check fails (each is at most H − 4,096): dropped, media.replay playing
1,060 Attestation [25, 49] Recorded frames 25–29 attested; Ha = 29 playing
3,590 The forged frame is still unattested Stop, media.unattested. Rollback: the forged counter leaves the record for the stop list; H = Hstop = 29 stopped
3,600–4,060 Genuine frames 180–203 accepted (c > H) Recorded, not played stopped
4,065 Attestation [175, 199]; recorded frames 180–199 match, were accepted after the stop and are above 29 Clean: resume; play floor = 203 playing
4,080 Frame 204 accepted Played playing
8,590 The forged frame was never attested The stop counts (one counted stop in 60 s) playing

Vector A3: an attestation that arrives before its epoch. The receiver holds epochs 41 and 42. The sender has just joined the group in epoch 43 and sends in it at once (§6.3 row 3). The frames' playout deadlines are later than the times shown.

Time (ms) Event Result State
0, 20, 40 Frames 0–2 under epoch 43 arrive (frame 2 carries the E flag) Held, target 43 (§6.5) —
70 Attestation [0, 2] for epoch 43 arrives 43 isn't installed and is newer than every installed epoch: pending —
150 Epoch 43 installed Frames 0–2 decrypted and accepted, new stream: played. Then the pending attestation is processed: frames 0–2 attested playing
3,150 — No media.unattested stop: every played frame is attested playing

10. Errors and diagnostics

10.1 The media.* codes

This document owns the media area (00 §7.5). Every media.* code names a local condition in the media engine: it is counted (§10.2), reported in diagnostics (§10.3, 15 §14.3 call_failure.code), and used in problem objects that bot SDKs and client libraries surface to their own callers. No HTTP endpoint returns a media.* code. The HTTP status is the one to use if the condition is ever carried in a problem object.

Code HTTP status retryable userAction Meaning Where it appears
media.keys_unavailable 409 true wait The device holds no SFrame keys for the epoch it must send in: it is joining, it is behind call control by more than 8 s, it is resyncing, or a verified contact's changed key blocks sending (§6.3). The "not being heard" reason waiting_for_keys (16, 20); call_failure.code; bot SDKs.
media.key_exhausted 409 true wait A KID reached its usage limit before a new epoch (§3.6). As above.
media.decrypt_failed 400 false none A frame's SFrame tag didn't verify. Counters.
media.unknown_epoch 400 false none A held frame's epoch wasn't installed within 200 ms (§6.5). Counters.
media.replay 400 false none A frame failed the counter check or the freshness check (§7). Counters.
media.kid_mismatch 400 false none A frame or attestation's KID doesn't match the transport, the roster or the sender (§4.5, §9.7 step 3). Counters.
media.malformed_frame 400 false none An SFrame ciphertext that doesn't parse, a counter of 2^32 or more, a C flag that doesn't match the call's mode, or an SFU frame shorter than its clear prefix (§3.1, §8). Counters.
media.stream_limit 400 false none A frame of a new stream arrived while a (pid, sourceId) already had 4 streams that couldn't be evicted (§4.5). Counters.
media.attestation_invalid 400 false none A MediaAttestation is malformed or its signature doesn't verify (§9.7 steps 2 and 4). It stops nothing. Counters; report.
media.attestation_mismatch 400 false none A received frame's hash differs from the sender's attestation, or the sender attested two different hashes for one counter (§9.7 steps 5 and 6). Counters; stop; report.
media.unattested 400 false none A frame played while its stream was playing wasn't attested within 3 s (§9.7 item 10). Counters; stop; report if counted.
media.attestation_unexpected 400 false none A media.attestation arrived in an insecure call (§8.6). Counters.

Example problem object, as a bot SDK might surface it to its caller:

{
  "type": "urn:sloppyv:error:media.keys_unavailable",
  "code": "media.keys_unavailable",
  "title": "Media keys aren't ready yet",
  "status": 409,
  "detail": "The device can't send in this secure call until it holds keys for the call's current epoch.",
  "retryable": true,
  "retryAfterMs": 1000,
  "userAction": "wait"
}

No media.* code defines data.

A client MUST NOT show any of these codes, or any text derived from them, as a security warning (D-055). The only user-visible effect of any of them is the "not being heard" state for media.keys_unavailable and media.key_exhausted, through 16 and 20.

10.2 Counters

A client keeps these counters per call, from the moment it joins until it leaves:

Counter Counts Feeds
undecryptable.decryptFailed Frames whose tag failed 15 Sample undecryptableFrames; 16 AudioStats decryptFailures for sources 0 and 2
undecryptable.unknownEpoch Held frames whose hold expired As above
undecryptable.replay Frames that failed the counter or freshness check As above
invalid.kidMismatch, invalid.malformed, invalid.streamLimit Invalid frames (§4.5, §10.1) 16 AudioStats invalidDrops for audio
held, heldReleased Frames held (§6.5), and those later decrypted Diagnostics only
attest.sent, attest.received, attest.pending, attest.ignored, attest.invalid Attestations Diagnostics only
stops.mismatch, stops.unattested Stream stops by reason (§9.8) 15 Sample attestationFailures (the sum); 16 AudioStats attestationStops for audio streams
stops.withdrawn, unattested.excused Withdrawn unattested stops (§9.8); frames excused by §9.7 item 11 Diagnostics only
resumes stopped → playing transitions Diagnostics only
attestationUnexpected §8.6 item 3 Diagnostics only

Counters never contain KIDs, counters of frames, nonces, hashes or key material (15 §14.2).

10.3 The media_attestation report

The diagnostics report kind media_attestation (15 §14.4) carries one MediaAttestation failure. A client sends it with POST /v1/diagnostics (15 §14.3) to the call's hosting server, using its session there, only when all of these hold:

  1. the diagnostics setting (15 §14.2) is failures or full;

  2. the failure is one of these, with this reason:

    Failure reason
    An attestation attributed to a stream (§9.7 step 3) whose signature doesn't verify (§9.7 step 4); it stops nothing invalid
    A playing → stopped transition caused by a frame hash that differs from a valid attestation (§9.7 step 6) mismatch
    A playing → stopped transition caused by two valid attestations with different hashes for one counter (§9.7 step 5) equivocation
    A playing → stopped transition caused by the unattested limit (§9.7 item 10), once the stop counts (it wasn't withdrawn within 5,000 ms, §9.8), and only when it is at least the third counted stop in the call unattested

    Failures while a stream is already stopped aren't reported;

  3. no media_attestation report has been sent for the same (callId, sender pid, sourceId) in the last 10 minutes, and fewer than 10 have been sent for the call.

data members:

Member Type Required Meaning
reason string Yes invalid, mismatch, equivocation or unattested. The server ignores unknown values.
senderPid integer Yes The pid whose stream was stopped, or to whose stream the invalid attestation was attributed.
sourceId integer Yes 0–3.
route string Yes The route on which the stream's frames arrived at the time of the failure: relay or sfu. The server stores an unknown value as other.
playedUnverifiedMs integer Yes How long, in milliseconds of media, the frames of the stop list (§9.8) were played; 0 for invalid.
stopsInCall integer Yes The number of counted stops in this call so far, for all streams.
POST https://b.com/v1/diagnostics

{ "reportId": "01938f61-2c3d-7e4f-8a5b-6c7d8e9fa0b1", "kind": "media_attestation",
  "client": "sloppyvoice-desktop/1.0.3", "platform": "desktop",
  "createdAt": "2026-12-04T18:31:02.118Z",
  "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "callId": "01938f40-5a6b-7c8d-9e0f-102132435465",
  "data": { "reason": "mismatch", "senderPid": 3, "sourceId": 0, "route": "relay",
            "playedUnverifiedMs": 20, "stopsInCall": 1 } }

The report carries no KID, counter, hash, nonce or key (15 §14.2). It is a diagnostic for the operator: the hosting server never acts on it automatically, never forwards it, and never shows it to members.

Rationale: positive failures (a bad signature, a mismatching hash) are rare and are evidence of a bug or an attack worth an operator's attention. Single unattested stops are usually network trouble and would only be noise; withdrawn ones are network trouble by definition.

11. Timers and limits

Item Value Clock Section
Sender epoch-switch cap 2,000 ms after installing the epoch Sender's monotonic clock 6.3 (D-042; 15 §9)
Sender behind call control before its gate closes 8,000 ms after learning the newer M Sender's monotonic clock 6.3 item 4 (D-080; 15 §9.5)
Hold for frames of an unknown newer epoch 200 ms, never past the playout deadline Audio clock 6.5 (D-042)
Hold capacity 32 frames per stream; 4 MiB per call — 6.5
Old-key retention 10,000 ms after T(x) (learning a newer M) Audio clock 6.6 (D-042, D-080)
Installed epochs kept at most 16 consecutive — 6.4, 6.6
Missed-commit check while holding after 1,000 ms of holds; at most once per 5 s Monotonic 6.4
Replay window 4,096 counters — 7
Reordering tolerance below H 1,000 ms Audio clock 7
Freshness tolerance D ≤ Dref + 1,000 ms; Dref creeps by 1/10 of elapsed time Audio clock 7
Evicted joinNonce values remembered 64 per (pid, sourceId) — 7
Concurrent streams per (pid, sourceId) 4; an attested stream is evictable only after 10,000 ms without frames — 4.5
Attestation batch closed ≤ 500 ms after its first frame, or at 256 frames Sender's monotonic clock 9.3 (D-043)
Attestation send delay after closing ≤ 50 ms — 9.3
Sent attestations kept for re-sending 4,000 ms Sender's monotonic clock 9.3, 9.6
Attestation message size ≤ 3,600 octets — 9.5
Duplicate attestation memory 10,000 ms Audio clock 9.6
Stored attestations 4,000 ms after receipt Audio clock 9.7
Pending attestations 4,000 ms after receipt; 16 per (from, src) Audio clock 9.7
Verification latency SHOULD ≤ 500 ms after receipt — 9.7
Unattested limit 3,000 ms after acceptance Audio clock 9.7 (D-043)
Route-disruption excuse 3,000 ms after leaving reconnecting; at most 3,000 ms of played media per (pid, sourceId) per 60 s Audio clock 9.7 item 11
Stop list kept, and withdrawal window 5,000 ms after the stop Audio clock 9.8
Stop budget 3 counted stops per (pid, sourceId) per 60 s Audio clock 9.8
New streams start stopped while the (pid, sourceId) has a stop that isn't withdrawn in the last 60 s Audio clock 9.8
Usage limits per KID 2^32 frames, 2^36 plaintext bytes; self-update at half — 3.6
media_attestation reports 1 per (call, pid, source) per 10 min; 10 per call Wall 10.3

12. Registrations and cross-references

12.1 Registrations

This document registers nothing new in 04's registries; it uses these entries, which 04 already lists for it:

Registry (owner) Entry Use here
MLS exporter labels (04 §8.6) SFrame 1.0 Base Key, empty context, 16 octets §3.3
Labelled-signature labels (04 §7.3) media-attest §9.4

It defines these registries and values, which it owns:

Registry Values Section
sourceId 0 microphone, 1 screen video, 2 screen or application sound, 3 webcam, 4–15 reserved 4.2
SfuFrameMetadata codec (unrelated to 17 §5.1's video-dc/1 octets) 1 Opus, 2 VP8, 3 VP9; 0 and 4–255 reserved 8.4.2
Control-channel message types media.attestation 9.5
Error codes the media.* codes of §10.1 10.1
Diagnostics report kind data media_attestation 10.3

SFrame's own labels (SFrame 1.0 Secret key , SFrame 1.0 Secret salt ) are defined by RFC 9605 and aren't sv1 labels.

12.2 Cross-document dependencies

This document relies on, or asks for, these points in other documents. None needs the owner.

Document Point
15 §8.2: a secure call's SFU offer or publish list that leaves no allowed video codec is answered with sfu.bad_sdp (§8.4.2). The relay forwards media.attestation as 15 §4.5 and §6.5 say; §9.6 item 2 re-sends what a drop lost.
16 §9.5: playback after an attestation stop follows §9.8 (stopped streams, play floor, new streams starting stopped).
22 The forgery bound of §14 item 2 and the residual risks of §7 (SFU path) and §14 item 4.

13. Test vectors

All values are hexadecimal (04 §3.3) unless marked base64url. The outputs in §13.2 to §13.6 were computed with an independent implementation of the formulas in §3, §4 and §9 (HKDF-SHA256, AES-128-GCM and Ed25519 from a standard library). The MLS exporter output is an input here, because it depends on a whole MLS group; 13 provides MLS vectors. Implementers SHOULD also check their SFrame code against the vectors of RFC 9605 Appendix C; if those and §13.2–§13.3 can't both be met, report it as an error in this document.

13.1 KID computation and SFrame headers

joinNonce sourceId leaf epoch context_id KID KID (decimal, kid-string) Header, CTR 0 Header, CTR 1003
8f3c1fff 2 5 42 8f3c1fff2 8f3c1fff20005a 40317029791563866 e08f3c1fff20005a e98f3c1fff20005a03eb
00000001 0 0 0 10 01000000 16777216 b001000000 b90100000003eb
ffffffff 3 65535 15 ffffffff3 ffffffff3fffff 72057594025345023 e0ffffffff3fffff e9ffffffff3fffff03eb
00000000 0 0 7 0 07 7 70 7903eb
0000a5a5 1 300 1000 a5a51 a5a51012c8 711438897864 c0a5a51012c8 c9a5a51012c803eb

Row 3 is the largest KID the layout can produce. Row 4 shows the short KID form (X = 0). Decomposing row 1's KID 8f3c1fff20005a (§4.5): joinNonce = 8f3c1fff (so gen = fff), sourceId = 2, leaf = 5, residue = 10 (= 42 mod 16).

13.2 Key derivation

Item Value
sframe_epoch_secret (input: MLS-Exporter output in epoch 42) 000102030405060708090a0b0c0d0e0f
leaf 5 (uint32 = 00000005)
sender_base_key 12013f63851f5f11224c2661e5123748
sframe_secret 461ff3f99b60e95bdb6600879941b92773a77658305868bc5e3f4166cbfed0a6
KID 8f3c1fff20005a (row 1 of §13.1)
key label 534672616d6520312e3020536563726574206b657920008f3c1fff20005a0004
sframe_key 19b418f840dae62fe1373d5b9c059bf6
salt label 534672616d6520312e30205365637265742073616c7420008f3c1fff20005a0004
sframe_salt bca39316acf1d454015ca49d

13.3 voice-dc/1 frames in a secure call

Four consecutive application-sound frames (source 2) from pid 513 under the keys of §13.2, counters 1000 to 1003. The last route header is exactly 16 §4.11 vector 2. The Opus plaintexts are illustrative octets, not decodable audio.

CTR Route header (metadata) SFrame header Nonce Plaintext Encrypted data and tag
1000 108002012ffffffcfffff100 e98f3c1fff20005a03e8 bca39316acf1d454015ca775 fc4b1d7e9a 32742c0a69e9830a39f118ff894c63bbc66e01e156
1001 108002012ffffffdfffff4c0 e98f3c1fff20005a03e9 bca39316acf1d454015ca774 fc4c2e8fab 74d37250b4eab4977d17502b8761a6d4e7191f5b5b
1002 108002012ffffffefffff880 e98f3c1fff20005a03ea bca39316acf1d454015ca777 fc4d3f90bc b498067b95ea859f917add43acf88fa3d2ffd4e9c0
1003 10a002012ffffffffffffc40 e98f3c1fff20005a03eb bca39316acf1d454015ca776 fc4e40a1cd f26581b7bcfaa43e5a17fe88c294301d1727ad3274

The AEAD associated data is the SFrame header followed by the route header, for example for CTR 1003: e98f3c1fff20005a03eb10a002012ffffffffffffc40. The complete frame message for CTR 1003 (43 octets) is:

10a002012ffffffffffffc40 e98f3c1fff20005a03eb f26581b7bcfaa43e5a17fe88c294301d1727ad3274

A receiver that changes any octet of the route header (for example clears the E flag, 0xa0 → 0x80) gets a tag failure.

13.4 Frame hashes

FrameHashInput for each frame of §13.3 is 0c ‖ route header ‖ 1f ‖ SFrame ciphertext (both lengths fit the 1-octet variable-length-integer form: 12 and 31).

CTR frame_hash
1000 dc0d641d04ed6b4c
1001 f5e538422813c5ae
1002 a5528511f885930c
1003 402c5faecb49405c

A forged frame for CTR 1003 with the same route header and the plaintext fc00000000, encrypted under the same key, has encrypted data and tag f22bc116712abf23873530bb100d3b4e3e9494cf83 and frame hash b1d9c91326b90e00, which doesn't match the attested 402c5faecb49405c.

13.5 MediaAttestation

The device signing key is the Ed25519 key of RFC 8032 §7.1 TEST 1 (a test key that no production device may use).

Item Value
DSK seed 9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60
DSK public key d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a
group_id sv1:b.com:ch:01938a11-2b3c-7d4e-8f90-112233445566:1 (51 octets)
epoch 42
call_id 01938f405a6b7c8d9e0f102132435465 (callId 01938f40-5a6b-7c8d-9e0f-102132435465)
kid 008f3c1fff20005a (as uint64)
first_counter, last_counter 1000, 1003
frame_hashes dc0d641d04ed6b4cf5e538422813c5aea5528511f885930c402c5faecb49405c

MediaAttestationContent (134 octets):

01
33 7376313a622e636f6d3a63683a30313933386131312d326233632d376434652d386639302d3131323233333434353536363a31
000000000000002a
01938f405a6b7c8d9e0f102132435465
008f3c1fff20005a
00000000000003e8
00000000000003eb
20 dc0d641d04ed6b4cf5e538422813c5aea5528511f885930c402c5faecb49405c

The signing input is "sv1 sig" ‖ 00 ‖ "media-attest" ‖ 00 ‖ the content: 155 octets, starting 7376312073696700 6d656469612d617474657374 00 01 33 …

Item Value
Signature b18e81891feb1150dd627685a3056d8691dfc1191d8339311596351e60ebe6382ea69d29f9684878d846187e75e9757f2ac2323b63085524c94a457460388109
hashes (base64url) 3A1kHQTta0z15ThCKBPFrqVShRH4hZMMQCxfrstJQFw
sig (base64url) sY6BiR_rEVDdYnaFowVthpHfwRkdgzkxFZY1HmDr5jgupp0p-WhIeNhGGH516XV_KsIyO2MIVSTJSkV0YDiBCQ

The media.attestation message carrying it is the example of §9.5.

13.6 sfu-rtp/1 VP8 keyframe

An SFU encryptor instance with joinNonce 11223344, source 1 (screen video), leaf 5, epoch 42, the epoch secret of §13.2, counter 0.

Item Value
KID 1122334410005a (decimal 4822678184656986)
sframe_key 13fe5e6ed0027520e2163aab15e03f34
sframe_salt 7cbc77780e85c97f71874459
Encoded frame (input) 9046029d012a8002e001 ‖ 0011223344556677
Clear prefix (keyframe: bit 0 of 90 is 0, so 10 octets) 9046029d012a8002e001 (frame tag; start code 9d012a; 640 × 480)
SfuFrameMetadata (version 1, codec VP8 = 2, prefix length 10, prefix) 01 02 0a 9046029d012a8002e001
SFrame header e01122334410005a
Nonce 7cbc77780e85c97f71874459
AEAD associated data e01122334410005a ‖ 01020a9046029d012a8002e001
Encrypted data and tag d7d0aa45c8e84eef27a0a87ec293ac0fdf89e56d98296592
Transformed frame (output, 42 octets) 9046029d012a8002e001 e01122334410005a d7d0aa45c8e84eef27a0a87ec293ac0fdf89e56d98296592
frame_hash (over 0d ‖ SfuFrameMetadata ‖ 20 ‖ SFrame header, encrypted data and tag) cc55121c82b9a3a6

13.7 Replay checks

Normative for §7.

Counter check (one KID; times are when the frame arrives, audio clock, ms; every frame shown has a valid tag and is fresh):

Time Counter H before Decision Reason
0 10 — Accept First frame
20 12 10 Accept c > H
40 11 12 Accept Not recorded; the next higher recorded counter (12) was accepted 20 ms ago
60 11 12 Reject Recorded
80 13 12 Accept c > H
1,500 9 13 Reject The next higher recorded counter (10) was accepted 1,500 ms ago (≥ 1,000)
1,600 5,000 13 Accept c > H
1,620 904 5,000 Reject 904 ≤ 5,000 − 4,096
1,640 905 5,000 Accept 905 > 904; not recorded; 5,000 was accepted 40 ms ago

Freshness check (one voice-dc/1 stream; a is the arrival time and ts the timestamp in ms, both as §7 defines them; D = a − ts; every frame has a valid tag and passes the counter check):

a ts D Dref(a) before Decision
0 1,000 −1,000 — Accept (first frame); Dref = −1,000
20 1,020 −1,000 −998 Accept; Dref = −1,000
40 1,040 −1,000 −998 Accept; Dref = −1,000
30,040 1,060 28,980 2,000 Reject: 28,980 > 2,000 + 1,000. The relay held this tail frame back for 30 s; media.replay
30,060 31,060 −1,000 2,002 Accept: a new talkspurt; Dref = −1,000
30,080 to 39,980 (every 20 ms) −1,000 about −998 Accept
40,000 39,500 500 −998 Reject: the path's delay rose by 1,500 ms for good; 500 > 2
40,020 to 44,960 (every 20 ms) 500 −996 to −502 Reject
44,980 44,480 500 −500 Accept: 500 ≤ −500 + 1,000; Dref = −500

14. Security considerations

  1. Who can decrypt. In a secure call, only devices that are members of the context group in the relevant epoch can derive media keys. The hosting server, its relay and SFU, the home servers, push services and the network hold no MLS secret and can't decrypt (00 §5.2). They still see metadata (item 12). This is the property behind the closed lock in calls (00 §5.5).
  2. Members can forge each other's media for a short time. SFrame keys are group-shared (RFC 9605 §5.2 and its security considerations), so any member can encrypt a frame under any other member's KID. Injecting it also needs control of a forwarding path: the relay or SFU, which carry all media (D-094). A hosting-server operator who is also a member of one of its secure channels is the realistic attacker. MediaAttestation limits the damage: a forged frame plays until the real sender's next attestation reaches the receiver, normally well under 1 s; if the attacker also drops the real sender's attestations, until the unattested limit of 3 s. After a stop, the budget is kept per (pid, sourceId), across every joinNonce (§9.8): new streams of that source don't play until they are attested, a fresh joinNonce buys no fresh budget, and an invented stream can't displace or evict the real one (§4.5, §9.8 item 6). So per participant and source the attacker gets at most 3 counted episodes of about 3 s per minute, plus up to 3 s of media per minute excused as route disruptions, which an attacker who controls the relay can also provoke (§9.7 item 11). Forged media that already played can't be taken back.
  3. Non-participating members. Every member of a secure channel's group can decrypt the channel's calls, whether or not they are in the call. The relay forwards media only to listeners, so a member outside the call needs the relay's help to get the frames. Calls are therefore as confidential as the channel's membership, which the hosting server decides (00 §5.3). The same holds for bots that are members (W6, D-061).
  4. Removed members. A removed participant's lease is revoked at once, and the relay and SFU, which carry all media (D-094), stop forwarding to it within 4 s (15 §4.8). Cryptographic exclusion follows the Remove commit and the switch (at most 2 s later). The commit normally comes within 3 s (D-037), but it depends on some member device committing the server's Remove proposals under 13's commit duty, and this document adds no deadline of its own: media senders keep sending in the current epoch meanwhile, because stopping would silence the call. Until the commit, senders use keys the removed device holds, so a removed member colluding with the relay or SFU could keep hearing for that interval, which has no fixed upper bound if no member device commits. A self-update that §3.6 triggers also covers pending proposals (RFC 9420 requires a commit to include them). This is the accepted consequence of D-037's server-first removal.
  5. No media history, and forward secrecy. Media keys are never archived, handed over or backed up (§3.3 item 3), and the protocol never records calls. A joiner can't decrypt media from before its join. Old-epoch keys are erased 10 s after the switch (§6.6). A device compromised during an epoch exposes that epoch's media of every sender; post-compromise security comes from later commits, including weekly self-updates (13 §14.1) and §3.6's limits. The long-lived history keys of 14 don't reveal media keys, because the MLS exporter is one-way per label.
  6. Nonce reuse can't happen under the rules of §4 (§5). Implementations MUST NOT "simplify" §4.3 by persisting counters instead of joinNonce sets, by deriving joinNonce from anything predictable, or by sharing a KID between pipelines (§4.4). AES-GCM nonce reuse would expose plaintext XORs and the GHASH key to the relay.
  7. Replay and late play. On data channels through the relay, the counter check with its 1-second reordering bound, the freshness check on the authenticated capture timestamp (§7), and the play floor after a stop (§9.8) mean that a relay can't replay a frame, and can't make held-back speech play more than about 1.1 s late, whether the held frames are below or above the highest counter received. A relay can still delay a whole stream uniformly, or drop anything; neither lets it change what was said. On the SFU path the capture timestamp isn't authenticated, so an SFU can deliver part of a video or screen-sound stream late (§7); microphone audio never takes that path.
  8. Associated data and key commitment. AES-GCM isn't key-committing, so a key holder can alter associated data while keeping a valid tag. The frame hash therefore covers the metadata as well as the ciphertext (§9.2), so a member can't alter another member's route header or clear prefix without detection.
  9. Truncated hashes. 8-octet frame hashes are enough: to slip a forged frame past an attestation, an attacker must find, before the frame's playout deadline, a frame whose hash equals the one the real sender will attest, a second-preimage search of about 2^64 work. Collisions (about 2^32 work) don't help, because the real sender, not the attacker, chooses the attested frames.
  10. Secure calls aren't deniable among members. A MediaAttestation is a transferable signature by a device's DSK over hashes of exact ciphertexts. A member who keeps the ciphertexts, the attestations and the epoch's keys can later prove to a third party which device sent which media. This matches SealedMessage signatures in 14. Document 22 decides whether users need to be told.
  11. Web and bot clients. A web client's media keys are only as safe as the origin that serves its code (D-065); the encoded-transform worker runs that code. Bots that join secure calls hold media keys like any member.
  12. Metadata visible to relays and SFUs. Who sends which source when, frame sizes and timing, counters (frame counts), the KID's leaf index (stable for a device within a group, so it links the device's streams across rejoins even though joinNonce changes), the epoch residue (which shows rotations), attestation timing, VP8 keyframe flags and dimensions, and SVC or simulcast layer identifiers. Secure calls use constant-bitrate Opus (16 §5.5) so audio packet sizes don't reveal speech; video sizes still reveal motion and scene changes. This is within 00 §5.4.
  13. Resource exhaustion. A member could send frames under many KIDs or with far-future counters. Per-stream caps (§4.5), the hold limits (§6.5), the replay window and rollback (§7), the 4,000 ms attestation store and the 16 pending attestations per sender and source (§9.7) bound memory; key derivation per new KID is two HMAC computations; verification is at most 8 signatures per second per sender. A relay or SFU can always deny service by dropping traffic; nothing here pretends otherwise.
  14. SFUs in secure calls. The SFU sees only ciphertext and authenticated clear prefixes. SFU features that need media (recording, transcription, mixing, thumbnails) are impossible in secure calls, by design (§8.4.6).
  15. Insecure calls give no protection against the servers involved (§8.6, 00 §5.1). A secure account in an insecure call uses no keys there (SM-5). A hosting server can't turn a secure context's call into an insecure one for a client that knows the context is secure: the client decides from its own view and pins (§8.5), and refuses to send or play media otherwise (W9 for channels, D-056).
  16. Diagnostics carry counters and reasons only, never KIDs, counters of frames, hashes, nonces or keys (§10.2, §10.3, 15 §14.2), and they go only to the hosting server under the user's diagnostics setting.

15. Open questions

This document has no open questions. Coordination items with other documents, which don't need the owner, are listed in §12.2.

16. References

16.1 Normative

  • RFC 2119, RFC 8174 — requirement key words
  • RFC 9605 — Secure Frame (SFrame): Lightweight Authenticated Encryption for Real-Time Media (§4.3 header, §4.4 key derivation and encryption, §5.2 MLS key schedule)
  • RFC 9420 — The Messaging Layer Security (MLS) Protocol (exporter, epochs, leaves)
  • RFC 5869 — HKDF; RFC 2104 — HMAC; FIPS 180-4 — SHA-256
  • NIST SP 800-38D — Galois/Counter Mode (AES-GCM)
  • RFC 8032 — Ed25519
  • RFC 4648 — base64url; RFC 5234 — ABNF; RFC 8259 — JSON; RFC 7493 — I-JSON; RFC 9562 — UUIDs; RFC 9457 — problem details
  • RFC 6716 — Opus; RFC 7587 — RTP payload format for Opus
  • RFC 6386 — VP8 data format (frame tag, keyframe header); RFC 7741 — RTP payload format for VP8; RFC 9628 — RTP payload format for VP9
  • RFC 8831 — WebRTC data channels; RFC 8825 — WebRTC overview
  • W3C WebRTC Encoded Transform (RTCRtpScriptTransform, RTCEncodedVideoFrame, RTCEncodedAudioFrame)
  • Sloppy Voice v2 documents: 00 (overview and conventions), 04 (crypto conventions), 07 (identity), 13 (MLS profile), 15 (calls), 16 (audio), 17 (video)

16.2 Informative

  • RFC 9750 — The Messaging Layer Security (MLS) Architecture
  • RFC 6562 — Guidelines for the use of variable bit rate audio with secure RTP (speech leakage through packet sizes)
  • RFC 8446 §5.5 — limits on key usage (TLS 1.3); draft-irtf-cfrg-aead-limits — usage limits on AEAD algorithms
  • draft-ietf-avtcore-rtp-sframe — RTP payload format for SFrame (§8.4.2)
  • RTP Dependency Descriptor header extension (AV1 RTP payload specification, Appendix A)
  • W3C WebRTC 1.0; W3C Web Cryptography API
  • 08 (platform key storage), 14 (SealedMessage signatures), 20 (indicator copy), 21 (SFU adapters), 22 (threat model)
  • spec/DECISIONS.md — decision log (D-041, D-042, D-043, D-080)
  • The project brief, §5 — the old voice and video design