Status Draft. Protocol version 1 (sv1) of Sloppy Voice v2. Normative unless marked informative.
Date 2026-12-04
Depends on 00 (architecture contract), 04 (crypto conventions, HPKE), 07 (DeviceCertificate and its dbk claim), 08 (AccountVault, key archive and shared_keys record formats, box keys), 13 (MLS profile). Also references 03, 09, 10, 11, 12, 15, 19 and 20.
Decisions used D-007 (as revised 2026-12-04; it supersedes D-039 and D-070), D-008, D-017, D-018, D-021, D-023, D-025, D-027, D-028, D-032, D-033, D-034, D-035, D-036, D-037, D-038, D-040, D-049, D-050, D-054, D-055, D-056, D-057, D-059, D-061 (as amended), D-063, D-069, D-071, D-086, D-077
Owns The K_hist, ekid, K_msg and kc derivations; the SealedMessage format and its verification; the server acceptance rules for SealedMessages; the visibility rule for secure contexts (visibleFromSeq) and its enforcement, including participants re-added after an identity change (12 §11.5); manual history sharing: the HistoryShare object, its procedure, its server acceptance rules and the VisibilityGrant; the endpoints under /v1/contexts/{ctx}/history/; the history.shared event; the key-archive append rules, including shared message keys; the report verification procedure; every history.* and sealed.* event and error code.

Conformance. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY" and "OPTIONAL" are to be interpreted as described in BCP 14 (RFC 2119, RFC 8174) when, and only when, they appear in all capitals. This document applies to these conformance classes (00 §1.5):

  • Server: §5 (acceptance rules), §7.7 (HistoryShare acceptance), §8 (API), §9 (events), §10 (visibility and VisibilityGrants), §11 (bots), §13 (report verification) and §15 (errors).
  • Full client, Web client: everything except the server-only rules. Processing the HistoryShares addressed to the account (§7.8) is REQUIRED; offering the share action (§7.6) is OPTIONAL.
  • Bot client: a secure bot implements §3, §4, §6, §7.8 and §12 like a full client. It never creates a HistoryShare (§11).

Rationale notes start with "Rationale:" or "Why:" and are informative. Examples are informative unless stated otherwise. Where an example and the normative text disagree, the normative text wins.

1. Scope

This document specifies how secure application content is protected end to end, which earlier content each account is served, and how a member can deliberately share earlier messages with one other member. In detail:

  1. The key derivations from the MLS group (13): the history key K_hist(e) per epoch, its public identifier ekid(e), the per-message key K_msg and the key commitment kc (D-038).
  2. The SealedMessage: the one wire form of every piece of secure application content. That covers its JSON members, its binary header, its AEAD, its signature, sealing on the sender, and verification and decryption on the receiver.
  3. The server acceptance rules: what a hosting server checks before it stores and sequences a SealedMessage, including the epoch grace window and the content freeze of 13.
  4. Visibility (D-007 as revised): in a secure context an account is served content only from the start of its current membership (visibleFromSeq). This covers newcomers, bots (D-061 as amended), accounts that join after a context became secure, and participants re-added after an identity change (12 §11.5).
  5. Manual history sharing (D-007 as revised): the HistoryShare, its creation and verification, its server acceptance rules, the VisibilityGrant, the /v1/contexts/{ctx}/history/ API and the history.shared event.
  6. The key-archive append rules: what every enrolled device writes to the AccountVault, and when, including the shared message keys it receives (D-054).
  7. The report verification procedure that 10 uses for key-reveal reports (D-040, D-077).

It does not cover:

  • the content schema inside a SealedMessage (text, formatting, replies, attachment references, edit and reaction payloads): 11;
  • the message object, the posting endpoint and the timeline API that carry SealedMessages: 11;
  • the AccountVault record format, record IDs and the vault API: 08;
  • the Report object, the report queue and the report workflow: 10;
  • MLS group mechanics, commits, the handshake log, fork resynchronization and generations: 13;
  • membership, visibility ranges, upgradeSeq and joinedSeq: 09 (channels) and 12 (DMs and group DMs); the share_history permission and the audit log: 10; the DeviceCertificate and its dbk claim: 07;
  • exact user-facing copy, including markers K4, K6, K7 and K8 and the share action: 20.

1.1 Terminology

This document uses the terms of 00 §2 exactly. It adds these:

Term Definition
Generation (gen) The generation number that is the last component of an MLS group_id (00 §7.6, 13). One context can have several generations over its life; epochs restart at 0 in each.
Epoch reference The triple (context, gen, epoch). Every history key is named by one.
Key store A client's local, protected table of the history keys it holds, keyed by epoch reference (§3.7).
SealedHeader The binary encoding of a SealedMessage's header fields. It is the AEAD associated data and the start of the signed content (§4.4).
Credential record The hosting server's stored copy of the device credential (IdentityCertificate and DeviceCertificate) of a device that sent sealed content or created a HistoryShare in a context (§5.6).
visibleFromSeq Per account and secure context: the seq at which the account's current membership began (§10.2). The hosting server serves that account no content item below it, apart from what a VisibilityGrant covers (§10.3). It only narrows what 09's visibility ranges and 12's joinedSeq allow.
Reference ekid The ekid that the hosting server records for an epoch from the bootstrap or commit that created it, once it is settled (13 §15.2; ekidSettled in 13 §7.2 and §7.6). Until then the reference is provisional, and every rule of this document treats it as unknown: the server holds no reference for that epoch.
Confirmed key A history key that has decrypted at least one SealedMessage of its epoch whose signature verified, or that came from MLS processing (§3.7).
Current membership An account's present membership of a context, from the event that started it (09 §7.2, 12 §12.5) until it ends. A rejoin, a new participation, or a re-add after an identity change starts a new one (§10.2).
HistoryShare A member's deliberate, signed share of the message keys of chosen earlier sealed items with one other current member of the same secure context (§7).
Sharer, recipient The account that creates a HistoryShare, and the account it is addressed to.
K_share The fresh random AES-256-GCM key that encrypts one HistoryShare's bundle (§7.5).
Bundle The list of (mid, K_msg) pairs inside a HistoryShare, encrypted under K_share (§7.5).
Shared message key A K_msg that a device received in a HistoryShare and verified (§7.8). It opens exactly one SealedMessage.
VisibilityGrant The hosting server's record that lets one recipient account be served the sealed items of one HistoryShare's range (§10.3).
Box key (dbk) A device's X25519 key pair (08 §10.1). Its public part is the dbk claim of the device's DeviceCertificate (07). HistoryShares wrap K_share to it (§7.5).

1.2 Notation

  • || is byte concatenation. X[a..b] is bytes a to b − 1 of X.
  • u8, u16, u32 and u64 are unsigned big-endian integers of 1, 2, 4 and 8 bytes.
  • V8(x) is u8(len(x)) || x, and V16(x) is u16(len(x)) || x. A field encoded this way MUST NOT exceed its prefix's range.
  • String labels such as "sv1 msg" are their ASCII bytes, with no terminator.
  • mid16(m) is the 16-byte binary form of a message ID m (RFC 9562 octets, the hexadecimal digits of the canonical string decoded in order).
  • did16(d) is the 16 bytes obtained by base64url-decoding the device ID d (00 §7.6).
  • B64U(x) is base64url without padding (RFC 4648 §5). Every base64url value in this document MUST be canonical: no padding, only alphabet characters, and zero unused trailing bits. Receivers MUST reject anything else.
  • HKDF-Expand, HMAC-SHA256 and AES-256-GCM are as profiled in 04 (RFC 5869, RFC 2104, NIST SP 800-38D with a 96-bit nonce and a 128-bit tag).

2. Design summary (informative)

             MLS group of the context (13), epoch e
                         |
                         | MLS-Exporter("sv1 history", "", 32)
                         v
                     K_hist(e) -------------------------> key archive (08, §12):
           ______________|______________                  the user's own devices
          |                             |
 HKDF "sv1 ekid"              HKDF "sv1 msg"||mid16
          |                             |
      ekid(e)                     K_msg(e, mid) ---------> HistoryShare (§7): one member,
   (public key ID)                      |                  on purpose, to one other member
                     +------------------+------------------+
                     |                                     |
            HMAC "sv1 kc" [0..16]                AES-256-GCM(content,
                     |                             AAD = SealedHeader)
                    kc                                     |
                     +-----------------> SealedMessage <---- DSK labelled signature "sealed"
  • A sender seals each piece of content under its own key K_msg, derived from the current epoch's history key and the client-generated message ID. It signs the result with its device signing key (DSK).
  • The hosting server checks the signature against the session's device and checks the epoch, then stores the SealedMessage. It can't decrypt it.
  • No history from before joining (D-007 as revised). In a secure context the hosting server serves each account content only from the start of its current membership (§10.2). Nothing hands history keys to newcomers. A newcomer sees marker K6 at its join point.
  • A user's own devices. Every enrolled device appends every history key it learns to the key archive in the user's AccountVault (08). A new device of the user downloads the archive, and the server serves it the account's items from the account's membership start (§10.4).
  • Manual sharing. A member may deliberately share the message keys of chosen earlier items with one other current member (§7). The keys go end to end to the recipient's devices, the hosting server records a VisibilityGrant so that it serves those items to the recipient, and every other member sees that it happened (K8).
  • A report reveals K_msg for exactly the reported messages. The signature and kc let moderators check that the content is exactly what the sender's device sent.

3. Key derivation

3.1 History key K_hist(e)

For every epoch e of every MLS group of a secure context, every member device computes, while in epoch e:

K_hist(e) = MLS-Exporter("sv1 history", "", 32)

MLS-Exporter is the exporter of RFC 9420 §8.5, using the group's ciphersuite 0x0001 (13). The label is the 11 ASCII bytes sv1 history, and the context is the empty byte string.

  • A device MUST compute K_hist(e) as soon as it enters epoch e, whether by processing a commit, having its own commit accepted, processing a Welcome, having its bootstrap accepted, or having its external commit accepted. It MUST store it in its key store (§3.7) before it deletes epoch e's MLS secrets.
  • Pending commits. A committer derives K_hist(e) of the epoch its pending commit would create only to compute the ekid that 13's CommitSubmission carries. It MUST NOT store that key in the key store, the notification key subset or the key archive until the server has accepted the commit (13's CommitResult, or the mls.handshake that carries it). If the commit is rejected (for example mls.epoch_conflict), the device MUST discard the key. The same applies to a bootstrap and to an external commit.
  • K_hist is never sent anywhere except inside the user's own key archive (§12), or inside the notification key subset of the same device (08 §13.5, 19). A HistoryShare carries per-message keys, never K_hist (§7).

Why: an exporter output is the RFC 9420 way to give an application a secret that every member of exactly that epoch holds. Using an exported key, instead of MLS PrivateMessage, lets the key be stored for the user's own devices and partly revealed, one message at a time, in a report or a HistoryShare (D-038, D-040), while MLS keeps its forward secrecy for its own secrets.

Why pending keys stay out of the store: a commit that loses the compare-and-set creates no epoch. A key derived from it would later meet the real key of that epoch and look like a fork (§6.6).

3.2 Epoch key identifier ekid(e)

ekid(e) = HKDF-Expand(PRK = K_hist(e), info = "sv1 ekid", L = 8)

ekid(e) is public. It appears in every SealedMessage. It lets a receiver:

  1. find the right key in its key store quickly;
  2. check a key read from the key archive (08 §9.4);
  3. notice a fork: two devices that believe they are in the same epoch but hold different keys compute different ekid values (§6.6).

Revealing ekid(e) reveals nothing useful about K_hist(e): it is a 64-bit output of a PRF keyed by K_hist(e).

3.3 Message key K_msg

K_msg(e, mid) = HKDF-Expand(PRK = K_hist(e), info = "sv1 msg" || mid16(mid), L = 32)
  • mid is the SealedMessage's message ID (00 §7.6), generated by the sending client.
  • K_msg encrypts exactly one SealedMessage: the one with that mid in that epoch. A client never encrypts twice under one K_msg. A retry in the same epoch resends the stored SealedMessage bytes (04 §9.6); only a move to a newer epoch (§4.7) re-seals, under that epoch's K_msg. If the stored bytes are lost in the same epoch, the message is created again with a new mid.
  • Clients MUST NOT store K_msg values, except the ones they reveal in a report (§13), the shared message keys they accepted from a HistoryShare (§7.8; kept in the key store, §3.7, and in the key archive, §12.7), and the transient values they need while sealing, opening or sharing. Where they hold K_hist, they can always derive K_msg again.

Why: a key per message makes it possible to reveal one message in a report, or to share chosen messages with one person (§7), without revealing their neighbours (D-040). Binding mid into the key means the server can't move a ciphertext to another message ID without decryption failing.

3.4 Key commitment kc

kc = HMAC-SHA256(key = K_msg, message = "sv1 kc")[0..16]

kc is carried in the SealedMessage and covered by the sender's signature. AES-GCM isn't key-committing: someone who chooses the key can make one ciphertext decrypt to two different plaintexts under two different keys. With kc signed by the sender, the only key a verifier will accept is the sender's own K_msg, so a reporter can't reveal a fake key that "decrypts" a real ciphertext to forged content (D-038, D-040).

Receivers and report verifiers MUST compare kc in constant time and MUST check it before they attempt decryption.

3.5 Retired derivations

Earlier drafts derived link and anchor keys from K_hist(e), with the HKDF labels sv1 link and sv1 anchor, to hand history to newcomers. The revised D-007 removes that handover (D-039 is superseded). Those labels and the labelled-signature label history-link are reserved and retired in 04's registries (04 §7.3, §8.4): no v1 implementation derives or accepts them, and they MUST NOT be reused.

3.6 Label summary

Every label below is in the registries that 04 owns (00 §7.15). Registry additions: this document adds the HPKE info label sv1 history-share and the labelled-signature label history-share (§7.5); 04 §8.5 and §7.3 register them. The labels sv1 link, sv1 anchor and history-link of earlier drafts are reserved and retired (§3.5).

Label Kind Input key Output Section
sv1 history MLS exporter label, empty context MLS epoch 32 bytes K_hist(e) §3.1
sv1 ekid HKDF-Expand info K_hist(e) 8 bytes §3.2
sv1 msg ‖ mid16 HKDF-Expand info (23 bytes) K_hist(e) 32 bytes K_msg §3.3
sv1 kc HMAC-SHA256 message K_msg first 16 bytes §3.4
sealed labelled-signature label (00 §7.14) DSK Ed25519 signature §4.6
sv1 history-share ‖ 0x00 ‖ mid16(shareId) ‖ did16 HPKE info (04 §9.8), 50 bytes The recipient device's box key dbk Wraps the 32-byte K_share §7.5
history-share labelled-signature label (00 §7.14) DSK Ed25519 signature §7.5

The HKDF info strings that share the PRK K_hist(e) are prefix-free: they differ within their first 8 bytes, and the only variable one (sv1 msg ‖ mid16) has a fixed length of 23 bytes.

3.7 The client key store

Every enrolled device keeps a key store: a local table in the platform key storage of 08. Each entry is:

Field Meaning
host Canonical domain of the hosting server
ctx Context reference
gen Generation
epoch Epoch number
key K_hist (32 bytes)
ekid ekid of key (8 bytes)
source mls (computed in the group) or archive (from the user's key archive, §12.4)
confirmed Boolean. True when the key came from MLS, or has decrypted at least one SealedMessage of its epoch whose signature verified (§6.3 step 11). A key from the archive starts with its entry's confirmed (§12.4).

Rules:

  1. A device MUST keep every K_hist it holds for as long as it keeps any content of that epoch, or might need to display it. By default that is indefinitely. Deleting entries locally is allowed: the key archive (§12) keeps the durable copy.
  2. A device MUST NOT keep MLS epoch secrets longer than RFC 9420 and 13 allow just because it keeps K_hist. The two are independent.
  3. For one epoch reference, an entry with source mls always wins over any other. A key from the archive never replaces an mls key. If the two differ, §6.6 decides which device is forked.
  4. On mobile, the device copies the key and ekid of the most recent epochs of each context into the notification-extension key store (08, 19), together with the sender public-key cache of §6.7.

Shared message keys. Beside the history keys, the key store holds the shared message keys the device accepted (§7.8): one entry per (host, ctx, mid) with the K_msg, the shareId and the sharer's canonical address. Each opens exactly one SealedMessage (§6.3). They are kept like history keys (rule 1), and they never enter the notification key subset.

Why: forward secrecy for content is traded so that a user's own devices can read everything the user could read (D-007, D-054, 00 §10). Keeping K_hist separately from MLS secrets keeps MLS's own post-compromise properties for handshakes and media keys (18), and confines the trade to stored content.

4. SealedMessage

Every piece of secure application content travels as a SealedMessage (D-038): messages, edits, author deletes, reactions, and attachment keys (inside the content of the message that carries the attachment). v1 has no profile-in-context data (11 §3.1). MLS PrivateMessage MUST NOT be used for application data (13).

4.1 JSON object

A SealedMessage is a JSON object (00 §7.2). It is carried in the sealed member of the posting body and of the message object of 11, and in the first events of a secure dm.request (12).

Member Type Required Meaning Constraints
v integer Yes Format version. 1. A receiver MUST reject any other value with sealed.invalid.
ctx string Yes Context reference of the context the message belongs to. 00 §7.6 form, colon unencoded. MUST equal the context the carrier names.
gen integer Yes MLS group generation (13). 1 to 2,147,483,647 (13 §4.1).
mid string Yes Message ID, generated by the sending client. Lowercase hyphenated UUIDv7 (ABNF mid in §4.2). MUST equal the carrier's mid.
epoch integer Yes Epoch whose K_hist seals this message. 0 to 2^53 − 1.
ekid string Yes B64U(ekid(epoch)). Exactly 11 characters (8 bytes).
kind string Yes What the content is (§4.3). 1–32 characters from [a-z_].
ref string Conditional The mid of the entry this one acts on. Required for edit, delete and reaction; MUST be absent for message. In a posting body it MUST equal the cleartext target (11 §4.2).
did string Yes Device ID of the sending device. 22 characters (16 bytes).
nonce string Yes AES-GCM nonce. B64U of 12 random bytes: 16 characters.
kc string Yes Key commitment, §3.4. B64U of 16 bytes: 22 characters.
ct string Yes AES-256-GCM ciphertext followed by its 16-byte tag. Decoded length at least 16 bytes, and at most roundUp256(maxMessageBytes) + 16 (§4.5).
sig string Yes Labelled signature sealed by the sender's DSK, §4.6. B64U of 64 bytes: 86 characters.
  • Producers MUST NOT add other members to a SealedMessage. Receivers MUST ignore unknown members (00 §7.2), and unknown members are not covered by the signature.
  • The sender's canonical address is not a member. It is bound into the SealedHeader (§4.4), and every carrier supplies it: the server takes it from the posting session, and the message object of 11 carries it as sender.addr.

Proposed decision: A SealedMessage carries ctx and gen as required members, in addition to the fields shown in 00 §7.4, and the SealedHeader binds the MLS group_id and the sender's canonical address. Rationale: an explicit generation is needed to name keys once a context has more than one MLS group, and binding the group and the sender makes a SealedMessage self-describing for reports, dm.request and the notification extension.

4.2 Field grammar

; ABNF (RFC 5234). HEXDIG here is restricted to lowercase by "lhex".
lhex        = DIGIT / %x61-66                       ; 0-9 a-f
mid         = 8lhex "-" 4lhex "-" "7" 3lhex "-" variant 3lhex "-" 12lhex
variant     = "8" / "9" / %x61 / %x62               ; 8 9 a b
b64u-char   = ALPHA / DIGIT / "-" / "_"
ekid-s      = 10b64u-char b64u-last2                ; 8 bytes  -> 11 chars
kc-s        = 21b64u-char b64u-last4                ; 16 bytes -> 22 chars
did-s       = 21b64u-char b64u-last4                ; 16 bytes -> 22 chars
nonce-s     = 16b64u-char                           ; 12 bytes -> 16 chars
sig-s       = 85b64u-char b64u-last4                ; 64 bytes -> 86 chars
b64u-last2  = %x41 / %x45 / %x49 / %x4D / %x51 / %x55 / %x59 / %x63
            / %x67 / %x6B / %x6F / %x73 / %x77 / %x30 / %x34 / %x38
                                                    ; A E I M Q U Y c g k o s w 0 4 8
b64u-last4  = %x41 / %x51 / %x67 / %x77             ; A Q g w
kind        = 1*32( %x61-7A / "_" )                 ; a-z and "_"

b64u-last2 and b64u-last4 enforce zero unused trailing bits. ctx follows 03. A value that doesn't match its rule makes the whole SealedMessage invalid (sealed.invalid).

4.3 Kinds

The kinds are those of 11 §3.1, which owns their meaning and content schema. This table gives the rule the server applies to ref.

kind Content (11 §3.1) ref Server rule on ref (§5.2 step 12)
message A new root message, including replies and attachment references with their file keys. Absent —
edit A replacement for the content of the root message named by ref. Required ref names a root message in this context whose sender is the posting account and that hasn't been deleted. 11 §4.7 rule 3 also requires the target to be sealed (message.not_editable).
reaction Adds one reaction to the root message named by ref. It never removes one. Required ref names a root message in this context, sealed or pre-upgrade plaintext, that the sender may see and that hasn't been deleted.
delete Deletes the author's own root message, or removes the author's own reaction. Required ref names a root message or a reaction entry in this context whose sender is the posting account and that hasn't been deleted. The server then tombstones the target (§5.7, 11).
  • The decrypted content MUST be consistent with kind and ref: if the content names a target, that target MUST equal ref. A receiver MUST treat a mismatch as invalid (§6.4).
  • Moderator deletions aren't sealed. They are moderation actions (10).
  • Unknown kinds. A server MUST reject a kind it doesn't know with 422 sealed.kind_unsupported (11 §3.1 uses the same code for secure carriers), because it can't apply the kind's policy. A client that meets a stored SealedMessage of an unknown kind (from a newer server and client) MUST verify it as usual and then ignore it: it shows nothing for it.

Why ref is in the header: the server must enforce "only the author edits or deletes" and must apply tombstones without reading content. Putting the target in the signed header lets it do that, and lets clients check that the server's view and the encrypted content agree.

4.4 SealedHeader and associated data

The SealedHeader is this byte string:

SealedHeader =
    u8(1)                       ; header version, equals v
 || V16(group_id)               ; UTF-8 MLS group_id: "sv1:" host ":" ctx ":" gen (00 §7.6)
 || V16(sender)                 ; UTF-8 canonical address of the sending account (D-032)
 || did16(did)                  ; 16 bytes
 || mid16(mid)                  ; 16 bytes
 || u64(epoch)
 || ekid                        ; 8 bytes
 || V8(kind)                    ; ASCII
 || V8(ref16)                   ; empty, or mid16(ref) (16 bytes)
 || nonce                       ; 12 bytes
 || kc                          ; 16 bytes
  • group_id is computed from the hosting server's canonical domain, ctx and gen, exactly as 13 builds it. For example sv1:b.com:ch:01938a11-2b3c-7d4e-8f90-112233445566:1.
  • sender is the canonical address (01). A verifier that holds the address in another form MUST canonicalize it first. Signed objects never name an alias (D-032).
  • The AEAD associated data is the SealedHeader, exactly.

4.5 Plaintext and padding

The plaintext is the content JSON of 11 (UTF-8, I-JSON), followed by zero or more padding bytes 0x20 (space).

  • The content JSON before padding MUST NOT exceed maxMessageBytes (11, default 16 KiB, floor 8 KiB).
  • Senders MUST pad the plaintext of every kind with spaces, so that its length is the smallest multiple of 256 bytes that is at least the content JSON's length (11 §3.8). The padded plaintext therefore never exceeds roundUp256(maxMessageBytes), where roundUp256(n) is the smallest multiple of 256 that is at least n. That is the bound the server checks (§5.2 step 5).
  • Receivers parse the plaintext as JSON. Trailing white space is valid JSON (RFC 8259 §2), so padding needs no special handling. A receiver MUST reject a plaintext that isn't one valid JSON object followed only by white space.

Why: spaces are the simplest padding that every JSON parser already ignores. Buckets of 256 bytes hide the exact length of short messages, which are most messages (00 §5.4 lists sizes as visible metadata). Padding is mandatory for every kind because an unpadded reaction's length would reveal which emoji it carries (11 §3.8).

4.6 Signature

SealedSigContent = SealedHeader || u32(len(ct)) || ct
sig = SignLabelled(DSK, "sealed", SealedSigContent)
    = Ed25519-Sign(DSK, "sv1 sig" || 0x00 || "sealed" || 0x00 || SealedSigContent)

ct here is the decoded ciphertext including its tag. Verification uses the strict Ed25519 rules of 04 (00 §7.15).

Why sign when the AEAD already authenticates: every member holds K_hist, so the AEAD proves only that some member wrote the message. The DSK signature proves which device wrote it, and a third party can check that, which is what makes reports verifiable (D-040). The cost is deniability, discussed in §17.

4.7 Sealing (sender algorithm)

To send content C of kind k (and target r where k needs one) in secure context ctx:

  1. Message ID. If this is a retry of an earlier attempt, reuse its mid. Otherwise generate a new UUIDv7 mid and record it in the outbox (11) before the first attempt. A client MUST NOT use one mid for two different contents.
  2. Group state. Make sure the device's MLS state is current (13). If the group is frozen (13 §13.3; known from mls.commit_needed, mls.proposal or an earlier mls.commit_required), commit first as 13 requires.
  3. Keys. Let e be the device's current epoch and gen its generation. If this is a retry and a stored SealedMessage exists for the current (gen, epoch), resend it unchanged instead: skip to step 9 (04 §9.6, §3.3). Otherwise take K_hist(e) from the key store. Compute ekid(e), K_msg(e, mid) and kc.
  4. Plaintext. Serialize C (11) and pad it (§4.5).
  5. Nonce. Draw 12 bytes from a CSPRNG.
  6. Header. Build the SealedHeader with this device's did and the account's canonical address.
  7. Encrypt. ct = AES-256-GCM-Encrypt(K_msg, nonce, plaintext, aad = SealedHeader).
  8. Sign. Compute sig (§4.6), and store the SealedMessage with the outbox entry, so that a retry in the same (gen, epoch) resends these bytes.
  9. Post the SealedMessage through 11's endpoint, with the cleartext kind, target (equal to ref), attachmentIds and mention hints that 11 §4.2 requires (D-063).
  10. On sealed.wrong_epoch or mls.commit_required: process the pending handshakes (or commit), then repeat from step 2 with the same mid. The new attempt uses the new epoch's key and a fresh nonce.
  11. On sealed.not_in_group, or mls.not_member with reason no_leaf and removedFor null, evicted, stale_leaf or identity_changed (13 §18): join or resynchronize by external commit (13 §10; in a DM or group DM that doesn't yet list the user's new identity key after the user's own reset, wait in 13's awaiting_readd state until the re-add, 13 §16, 12 §11.5), then repeat from step 2. On mls.group_not_found: bootstrap the group if bootstrapAllowed is true, otherwise wait as 13 §18 says, then repeat from step 2. On mls.generation_retired: move to the generation named in nextGeneration (13 §4.4), then repeat from step 2; if it is null, the context is no longer secure and the message is handled as in step 12. On mls.fork_detected: this device's MLS state is forked; resynchronize as 13 §15.5 says, then repeat from step 2. On mls.not_member with reason removal_pending, or no_leaf with any other removedFor: the device is being or has been removed; the message stays not sent.
  12. On sealed.not_secure: the server says the context is insecure. The client MUST NOT re-send the content as plaintext automatically, in any context type. It marks the message as not sent, with the ordinary "Not sent" state of 11 §13.5 and 20, and before any later plaintext send it checks the change itself, as 11 §4.7 says:
    • a channel the client has seen as secure and now sees presented as insecure is a downgrade: the client shows W9 and refuses to send (SM-12, D-056);
    • a group DM never becomes insecure (SM-9, D-069): the client sends nothing, records a diagnostic and keeps the message not sent;
    • a 1:1 DM is insecure only when the client's own check of both participants' fresh IdentityStates, fetched from their home servers, says so (12 §11.1). Then K2 and W7 explain the open lock, and a "Retry" tap sends the message as plaintext. Otherwise the client sends nothing and keeps the message not sent.
  13. After any retryable: false error other than those above, the message stays not sent.

Why step 12 never trusts the server alone: content written under a closed lock must never leave in plaintext without the user doing something, and a hosting server's word alone must never be enough to make a client send plaintext in a context it knows as secure. The not-sent state is the ordinary failed-message state, not a new security prompt (D-055).

4.8 Example

A message posted to a secure channel at b.com by alice@a.com's device in generation 1, epoch 42. The values are the test vector of §16.4.

POST {base}/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/messages

{
  "mid": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
  "sealed": {
    "v": 1,
    "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
    "gen": 1,
    "mid": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
    "epoch": 42,
    "ekid": "YFXAbWJVkwY",
    "kind": "message",
    "did": "q2bS9xVg3m0yJpQe1vT0Aw",
    "nonce": "oKGio6Slpqeoqaqr",
    "kc": "WiDtMu27IyR8C4Xr-0X0kw",
    "ct": "F35DYdjMpCWO922i_YtHzdogYWbmVXqHyOa80SxiaaOQXCd_P0VB0lzzEOuOKy2HvvH-av2A5L_xFSQC3qYqDVoLtfXWDMPr9lVdGLwP4gh3AWnwcNBUh0SfNH3pzTradH42_5n0cXs-e49B1it6jSSd3RoT4WBn1NZD1TaQOY_QbDnT9pFZ_1bvmSSSLDVwS9QQXrDXyaLB0gxPewBLzt_Qgxw0cw3K8AtETZjLfek6MyUH3tDan7R673X9k4N8nFaION3QxAEtXBAkMJ1xt4BosCRGe2i36Odzuw-YgurbjH-46v3-g1_G0wAcU6c_wCmI-YoFVOZ1DweuPky5H7IU3apfewbdFz1wTbaQ3rE",
    "sig": "pX-6E0toKJy6URMTnoXMl4q4by7T6xprN_JBoArZziNWAJLzlkQ-lXAjTT-OA8mcgPhQusR4FFW2YC5UVwS7DA"
  },
  "mentions": [],
  "mentionAll": false
}

An edit of that message, as the server would deliver it in 11's message.edited event (EditEvent, 11 §8.2) (ciphertext shortened):

{
  "v": 1,
  "t": "message.edited",
  "id": "01938f31-0000-7000-8000-00000000a001",
  "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
  "seq": 4190,
  "ts": "2026-12-04T18:23:02.004Z",
  "d": {
    "target": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
    "mid": "01938f31-4c5d-7e6f-8a7b-0c1d2e3f4a5b",
    "sender": { "kind": "user", "addr": "alice@a.com", "name": "Alice", "did": "q2bS9xVg3m0yJpQe1vT0Aw" },
    "carrier": "sealed",
    "createdAt": "2026-12-04T18:23:02.004Z",
    "mentions": [],
    "mentionAll": false,
    "sealed": {
      "v": 1, "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "gen": 1,
      "mid": "01938f31-4c5d-7e6f-8a7b-0c1d2e3f4a5b", "epoch": 42, "ekid": "YFXAbWJVkwY",
      "kind": "edit", "ref": "01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6",
      "did": "q2bS9xVg3m0yJpQe1vT0Aw", "nonce": "1o2bU0x3yAAAAAAA", "kc": "Hq8b0dM2Lw1pYk7rXc3VgA",
      "ct": "c1Xr…", "sig": "Qm9x…"
    }
  }
}

5. Server acceptance rules

5.1 Where the rules apply

A hosting server applies this section to every SealedMessage it is asked to sequence, through the posting endpoint of 11 (POST /v1/contexts/{ctx}/messages) or any other endpoint of 11 that creates sealed timeline items. It also applies §5.2 steps 3 and 4 to plaintext posts, to keep plaintext out of secure contexts.

On 11's posting endpoint, 11 §4.5 is the one normative order of checks. It performs §5.2 steps 1 to 4 and 7 itself, with the codes 11 §4.5 gives, and runs §5.2 steps 5, 6 and 8 to 13 as its step 10, in this document's order and with this document's codes. The table below is the order for any other endpoint that creates sealed items.

A secure dm.request (12) carries SealedMessages that the hosting server has already accepted. The recipient's home server stores and forwards them without checking them, and the recipient's client verifies them (§6).

5.2 Ordered checks

The server MUST perform these checks in this order and answer with the first failure. "Current group" means the context's MLS group in its current generation, as the server sequences it (13).

Step Check Failure
1 The request is authenticated (03, 05, 06). core.unauthenticated
2 The caller may post this kind in this context under 09, 10 and 11 (membership state, send_messages, add_reactions, timeouts, bans). The owning document's code
3 Secure door (SM-4). If the context is secure: the account is secure, and the session's device is enrolled. security.account_required, security.device_not_enrolled
4 Mode. If the context is insecure and the body carries sealed: reject. If the context is secure and the body carries plaintext content: reject. sealed.not_secure. Plaintext in a secure context: channel.plaintext_rejected (09) in a channel, sealed.required in a DM or group DM (11 §4.7).
5 Shape. The SealedMessage matches §4.1 and §4.2, including lengths. The decoded ct minus its 16-byte tag is at most roundUp256(maxMessageBytes) (§4.5). sealed.invalid; 413 message.too_large (11)
6 Binding to the carrier. sealed.ctx equals the path's context; sealed.mid equals the body's mid; sealed.kind equals the body's kind; and sealed.ref equals the body's cleartext target, or both are absent (11 §4.2). sealed.header_mismatch, with data.field naming the first member that differs
7 Idempotency (11 §4.6). If an entry with this mid already exists in the context with the same sender account, kind and target, return the stored acknowledgement and stop. If it exists with a different sender account, kind or target, reject. core.idempotency_conflict (03), reason mismatch
8 Device. sealed.did equals the session's device ID. sealed.device_mismatch
9 Membership in the group. In this order: (a) sealed.gen isn't a retired generation of this context; (b) the current generation has a group (13 state isn't none); (c) the session's device isn't the subject of a pending server Remove proposal (13 §13.1); (d) the session's device has a leaf in the current group's current epoch, and that leaf's signature key has the thumbprint dkf the session was created with (06). (a) 410 mls.generation_retired (13); (b) 404 mls.group_not_found (13), with bootstrapAllowed; (c) 403 mls.not_member (13) with data.removedFor set to the pending proposal's 13 §13.1 reason, and reason no_leaf when that reason is evicted, stale_leaf or identity_changed, otherwise removal_pending (13 §13.2); (d) when the server knows a removal reason for this device in the current generation (13 §7.2 removedFor), 403 mls.not_member with reason no_leaf and that removedFor; otherwise sealed.not_in_group
10 Freeze (D-037). The current group isn't frozen, that is, no server Remove proposal is pending (13 §13.3). A pending GroupContextExtensions proposal alone, such as a key rotation, doesn't fail this step. mls.commit_required (13)
11 Epoch. gen equals the current generation, and epoch is inside the grace window of §5.3. Then, if the reference ekid of (gen, epoch) is settled (13 §15.2), ekid equals it. A provisional reference isn't checked. sealed.wrong_epoch; 409 mls.fork_detected (13 §15.3)
12 Kind and target. kind is one of §4.3, and ref follows that row's rule. sealed.kind_unsupported; sealed.ref_invalid
13 Signature. sig verifies (§4.6) under the DSK of the session's device (the leaf's signature key), with the SealedHeader built from the session's canonical address and the server's own canonical domain. sealed.bad_signature
14 Store and sequence (§5.5). —
  • The server MUST NOT attempt to check kc or ct beyond their lengths. It doesn't hold the keys. The ekid check of step 11 needs no key: it compares two public values.
  • The checks of step 2 for reaction follow the permission 10 assigns to reactions (add_reactions); a delete needs nothing beyond active membership (11 §4.5 step 8).

Why idempotency comes before the epoch check: a client whose response was lost resends the same mid. If the epoch has moved on in the meantime, the resend must still return the message that was stored, not a sealed.wrong_epoch that would make the client seal a second copy.

Why the server checks ekid, and only against a settled reference: once the epoch's reference has settled, a forked sender is told at once (mls.fork_detected) and resyncs and resends before anyone receives a message they can't decrypt (13 §15.3), and one forked device can't make every honest receiver handle a mismatch. While the reference is provisional (at most 30 s, 13 §15.2) it is only the committer's value, and checking against it would let one bad committer push honest senders into resync. Receivers handle the rare mismatch from that window as §6.6 says.

5.3 Epoch grace window

Let E be the current epoch of the current group and T(E) the time the server sequenced the commit that created E. The server accepts epoch when:

  • epoch == E; or
  • epoch == E − 1, and the commit that created E neither added nor removed any leaf (it was a pure UpdatePath or a commit of non-membership proposals), and the request arrived no more than sealedGraceMs = 30,000 ms after T(E).

Every other value fails with sealed.wrong_epoch, whose data carries {"gen": …, "epoch": E}.

Proposed decision: The SealedMessage grace window is one epoch for 30 s, and only after commits that don't change the set of leaves. Rationale: messages in flight across a key update shouldn't bounce, but after a join a newcomer couldn't read a message sealed in the previous epoch, and after a removal the removed device could. Re-sealing costs the sender one round trip.

A membership-changing commit therefore always makes in-flight senders re-seal. A client sees this as a short retry, not a failure.

5.4 Interaction with the content freeze

When 13 has sent Remove proposals and the group is frozen, step 10 rejects every SealedMessage with mls.commit_required until a commit covering all pending proposals is sequenced. That includes messages from the designated committer itself. A device whose own leaf is the subject of a pending Remove proposal is refused earlier, at step 9, with mls.not_member as step 9 (c) says (removal_pending, or no_leaf for an entitled device-level removal, after which the device resyncs, 13 §13.2): it can't commit its own removal (RFC 9420 §12.2), so asking it to commit would only make it retry. When the commit arrives, the new epoch removes leaves, so §5.3 gives no grace: everything is re-sealed in the new epoch, which the removed devices can't read.

5.5 Storing and sequencing

On success the server:

  1. stores the SealedMessage verbatim: every member exactly as received, so that clients and moderators can rebuild the SealedHeader and verify the signature later;
  2. records, with the item, the sender's canonical address, the did, the gen and epoch, and the digest sigHash = SHA-256(decoded sig);
  3. creates or updates the credential record for (sender, did, dkf) (§5.6);
  4. assigns the next seq, and emits the timeline event of 11 carrying the SealedMessage and sender;
  5. sends notify (19) to recipients as 19 requires, with no content (D-022, D-051).

The server MUST NOT alter, re-encode, merge or split any member of a stored SealedMessage. The only exceptions are deleting ct on an author delete or an edit (§5.7, 11 §6.2). It MAY store ct in binary form if it serves exactly the same base64url string.

The server MUST keep the reference ekid of every epoch for as long as it keeps any sealed item of that epoch (13 §6.5), so that clients can resolve ekid mismatches (§6.6).

5.6 Credential records

A user's new device reading its account's earlier items, the recipient of a HistoryShare, or a moderator verifying a report must check signatures by devices that may have left the group long ago, and whose leaves it never saw. So the hosting server keeps a credential record for every (sender canonical address, did, dkf) that sent a SealedMessage or created a HistoryShare in a context. One (addr, did) can have several records, because a device keeps its did across an identity reset but gets a new DSK (08 §11.2, 07 §3.4):

Field Meaning
addr The sender's canonical address
did The device ID
dkf RFC 7638 thumbprint of the DSK
idc The IdentityCertificate JWS from the device's sv_device credential (07)
devcert The DeviceCertificate JWS from the same credential
firstSeenAt, lastSeenAt Times of the first and latest accepted SealedMessage or HistoryShare from this device
status active while the device has a leaf in the current group; otherwise removed. Receivers MUST treat an unknown value as removed.
  • The server fills the record from the leaf credential it validated as Authentication Service or Delivery Service (13). It MUST NOT accept a credential record from a client.
  • If a device's leaf is replaced with a different credential (a new DeviceCertificate after an identity reset), the server keeps one record per distinct (addr, did, dkf) and never overwrites an older one.
  • The server MUST keep a credential record for as long as it keeps any SealedMessage, tombstone or HistoryShare that the device produced.
  • Clients fetch records with POST /v1/contexts/{ctx}/history/credentials/lookup (§8.5).

Proposed decision: Hosting servers keep and serve credential records for every device that sent sealed content or a HistoryShare in a context. Rationale: verifying a historical signature needs the sender's DeviceCertificate after its leaf has gone; the handshake log of 13 is kept for only 30 days.

5.7 Author deletes, edits and tombstones

When the server accepts a delete SealedMessage, it tombstones the target as 11 specifies. In addition, for a sealed target, the server MUST:

  • delete the target's ct and every edit's ct;
  • keep, in the tombstone, the target's mid, sender, did, gen, epoch and sigHash.

The sigHash lets a report about a deleted message still be verified from a copy the reporter's client kept (§13.3).

Edits. When the server accepts an edit of a sealed root message, it deletes the ct of the previous edit, if any, and on the first edit the ct of the root SealedMessage (11 §6.2). For each it keeps the mid, sender, did, gen, epoch and sigHash, exactly as for a tombstone; these kept fields serve §13.2 as a tombstone's do.

Proposed decision: Tombstones of sealed messages keep the SHA-256 digest of the deleted message's signature, so that a recipient can still report it after the author deletes it. Rationale: harassment followed by a quick delete is a common abuse pattern; the digest reveals no content.

5.8 What the server must not do

  • It MUST NOT accept a SealedMessage under a group, generation or epoch other than the ones §5.2 and §5.3 allow.
  • It MUST NOT deliver SealedMessages to sessions of removed leaves (13), even ones it accepted before the removal.
  • It MUST NOT deliver or serve a SealedMessage, or anything derived from one, to an account outside the visibility rules of §10.2 and §10.3. A withheld item is delivered live and on replay with the reduced payload of 11 §8.3 ({"withheld": true}), so every subscriber still receives every seq (03 §7.2 D4), and timeline pages omit it (11 §7.5).
  • It MUST NOT keep any key material for content: K_hist, K_msg, file keys. The only exception is the K_msg values and file keys revealed in a report (§13), which become part of that report's evidence under 10. A HistoryShare's bundle and key wraps are stored only as ciphertext the server can't open (§7.5).

6. Client verification and decryption

6.1 Inputs

A client opening a SealedMessage S has:

  • the carrier's context ctx, hosting server canonical domain host, seq, server timestamp ts, and sender canonical address sender (from 11's sender.addr);
  • its key store and its MLS state for the context, including the reference ekid values it knows (13 §4.4);
  • the context type (channel, 1:1 DM, group DM).

Rule: content is shown only after the sender's signature verifies under a DSK whose credential this section accepts. No outcome displays content whose signature wasn't checked, and no outcome displays content under an address whose credential was rejected.

6.2 Finding the sender's key

The client needs the DSK of (sender, S.did). One (addr, did) can have had several DSKs over time, because a device keeps its did across an identity reset (08 §11.2) and gets a new DSK (07 §3.4). So the client names a key by (addr, did, dkf) and may hold several candidates for one (addr, did). It gathers candidates from these sources, in this order:

  1. Live leaf. A leaf in the client's MLS state for (ctx, S.gen) whose credential names sender and S.did. This is the normal case for messages arriving in real time, and the leaf has already passed the Authentication Service checks of 07 and 13.
  2. Local credential cache. Every leaf the client has validated in this context, cached as (addr, did, dkf) → (IdentityCertificate, DeviceCertificate), together with the generation and the epochs in which the client saw that leaf.
  3. Credential records. The hosting server's credential records for (sender, S.did) (§8.5), validated as below.

Epochs this device was in. When the key store holds an entry with source mls for (S.gen, S.epoch), the device was itself a member in that epoch and validated every leaf it had. The sender's key MUST then come from source 1 or 2: a leaf this device validated in that generation. The client MUST NOT use a credential record (source 3) for such a message. Where the cache records the epochs in which the client saw a leaf, that leaf MUST have been in the group at S.epoch. Credential records serve only epochs this device wasn't in, such as its account's items from before the device joined, or items opened with a shared message key (§7.8).

Validating a fetched credential record. The client MUST check, locally:

  • the IdentityCertificate and DeviceCertificate pass 07's local verification (07 §10.4 steps 3 and 4: VerifyIdentityCertificate, then VerifyDeviceCertificate under it), which covers the JWS profile, typ, signatures and matching igen;
  • both sub claims equal sender, and the DeviceCertificate's did equals S.did;
  • the thumbprint of the DeviceCertificate's dsk equals the record's dkf.

A record that fails these checks is not a candidate.

Then, depending on the context:

  • Channels. The hosting server is the Authentication Service (D-035). The client accepts a record that passes the local checks. It SHOULD verify the identity key against the sender's home server in the background (00 HP-2). As with every silent check in channels, a failure is a diagnostic only.

  • 1:1 DMs and group DMs. The client is the Authentication Service. It accepts a candidate from source 2 or 3 only if:

    • its identity key equals the key pinned for sender (07 pin ik), the key the pin replaced (prevIk), another identity key the AccountVault records as previously accepted for sender (§18, question 2), or the identity key whose fingerprint the sv_participants extension of a generation the client accepted lists for sender (13 §5); and
    • no DeviceRevocation that the client has verified covers (sender, S.did) (07 §8), and, if the sender's IdentityState that the client holds or fetches from the sender's home server (07) lists S.did as revoked at time at, the item's ts is earlier than at. This last check is best effort: it relies on the hosting server's timestamps (§17 item 5).

    Any other candidate is rejected.

  • A message request not yet accepted (D-049). For the items of a dm.request, the client takes DSKs only from the Welcome's ratchet tree and the IdentityStates the request carries (07 §14.7). It MUST NOT call §8.5, or contact the hosting server or any home server, before the user accepts. Items it can't resolve stay pending_sender until Accept.

If no candidate remains after these rules, the message is invalid. If the client hasn't been able to fetch the records yet, it is pending_sender.

6.3 Algorithm

OpenSealed(S, ctx, host, sender, ts):
 1. Check S against §4.1/§4.2 and S.v == 1.                 else -> invalid
 2. Check S.ctx == ctx.                                     else -> invalid
 3. Look up (host, ctx, S.gen, S.epoch) in the key store, then the archive (§12.4).
    If neither has a history key, look up a shared message key for (host, ctx, S.mid)
    in the key store, then in the archive's shared_keys records (§12.7).
      none found -> pending_key  (stop; §6.5)
 4. Gather the sender's candidate DSKs (§6.2).
      records not yet obtainable  -> pending_sender (stop; retry, §6.4)
      no acceptable candidate     -> invalid
 5. Build SealedHeader (§4.4) with group_id(host, ctx, S.gen) and sender.
 6. Verify sig (§4.6) under each candidate in the order of §6.2. If none verifies
    and records (source 3) are allowed but weren't fetched yet, fetch every record
    for (sender, S.did) and try those too.                  none verifies -> invalid
 7. With a history key: if entry.ekid != decode(S.ekid), handle the mismatch (§6.6)
    and stop. With a shared message key: skip this step.
 8. With a history key: K_msg = HKDF-Expand(K_hist, "sv1 msg" || mid16(S.mid), 32).
    With a shared message key: K_msg = that key.
    Check HMAC-SHA256(K_msg, "sv1 kc")[0..16] == S.kc in constant time.
                                                            else -> invalid
 9. plaintext = AES-256-GCM-Decrypt(K_msg, S.nonce, S.ct, aad = SealedHeader)
                                                            fail -> invalid
10. Parse plaintext as one JSON object plus trailing white space (§4.5).
    Check the content against 11 for S.kind, and that any target equals S.ref.
                                                            else -> invalid
11. With a history key: mark the key-store entry confirmed (§3.7).
12. -> ok(content)
  • Nothing before step 7 discards a key or starts a resync. The client acts on S.ekid only after the signature has verified, so a tampered or corrupted ekid can't make it do any of these.
  • Clients MUST deduplicate by (ctx, mid). If a SealedMessage with a mid already displayed arrives again, at another seq, the client keeps the first and ignores the rest.
  • Clients MUST check, for edit and delete, that the target's sender account equals sender. An honest server already enforces this (§5.2 step 12). A mismatch is invalid.
  • A shared message key that fails step 8 or 9 is discarded from the key store and isn't written to the archive. It was verified when it was accepted (§7.8), so this happens only after a fault; the client sends the diagnostic history_share with step item (§9.4).

6.4 Outcomes and what the user sees

Outcome Meaning Client behaviour
ok Verified and decrypted. Show the content normally.
pending_key No key yet for that epoch or message. Keep the item. Start or continue the archive download (§12.4), or wait while a share that lists it is processed (§7.8). Show marker K4 above the earliest decrypted item (§7.9) only on a user's own new device while its archive download is in progress, or while a share that lists the item is being processed. In any other case, for example an existing device that rejoined by external commit (§10.4), the item stays a placeholder that fills in place (§6.5).
pending_sender Key present, sender's credential not yet obtainable (the server didn't answer, or a message request isn't accepted yet). Keep it pending, shown as a placeholder that fills in place. Retry the credential lookup with backoff from 5 s doubling to 10 min. After 24 h, show it as invalid. The client MAY retry once each time the user reopens the context, and replaces the placeholder in place if the message then verifies.
unavailable No key can be obtained: no device of the account had a leaf in the item's epoch, the archive holds no copy, and no shared message key covers it (§10.4). Collapse consecutive unavailable items into one neutral line, for example "Earlier messages aren't available on this device" (20, ST.history_unavailable). It is not a security warning. Unavailable items directly below K6 get no line of their own: K6 covers them (§7.9).
invalid A format, credential, signature, kc, decryption or content check failed, or the sender's own state is forked (§6.6). Don't show the content. Show a neutral placeholder, for example "This message can't be shown" (20, ST.message_invalid). Send the diagnostic sealed_verify (§9.4) with the step that failed. Never a warning (00 §4.12.5).
fork_evidence This device's own MLS-derived key for that epoch differs from the reference ekid (§6.6). Resync as 13 specifies. Keep the item as pending_key, because after the resync the matching key may arrive through the archive.

Why there are no warnings here: an honest hosting server verifies every signature at ingress (§5.2), so a client-side failure means a bug or a malicious server. A warning can't help a non-technical user act. A diagnostic reaches someone who can (00 §4.12.5).

Why an unverifiable message is never shown with its sender's address: every member holds K_hist, so a message whose signature wasn't checked could have been written by any member, or by the hosting server together with any member, under anyone's name. Showing it would break the promise that nobody can forge another member's text (00 §5.2).

6.5 Pending items and ordering

  • Items stay in timeline order by seq whatever their outcome. A pending_key or pending_sender item is rendered as a placeholder that later fills in place. The timeline never jumps.
  • A client MUST NOT block live messages on history: it shows and decrypts new messages at once (M11).

6.6 ekid mismatches and forks

A fork means two devices hold different keys for the same epoch reference. The hosting server is the only sequencer (D-037), and MLS confirmation tags stop a committer from splitting members silently, so forks come only from bugs, lost state or a misbehaving server. 13 §15 owns fork detection and resync. The hosting server already refuses a SealedMessage whose ekid differs from the settled reference ekid (§5.2 step 11), so a client meets a mismatch only for messages accepted while the epoch's reference was still provisional (13 §15.2), or from a misbehaving server.

A client reaches this section only for a SealedMessage whose signature verified (§6.3 step 7). Let R be the settled reference ekid of (S.gen, S.epoch), when the client knows it or can fetch it (13 §4.4; 13 §7.2 and §7.6 with ekidSettled: true). A provisional value counts as unknown. The client's own key-store entry for that epoch is entry.

entry.source Condition Action
mls entry.ekid equals R, or the client's epoch-ack for that epoch was answered 200 with status: "match" (13 §7.8) The sender is forked. The item is invalid for this client. It sends an MlsReport fork_suspected naming the sender (13 §7.10, §15.3). It doesn't resync.
mls entry.ekid differs from R This device is forked: outcome fork_evidence. It resyncs (13 §10.5, §15.3).
mls R unknown and can't be fetched The client posts its epoch-ack for that epoch if it hasn't (13 §7.8) and follows the answer. Until then the item stays pending and is shown like pending_key. A 202 pending answer means the reference settles within 30 s (13 §15.2, §15.3). The client then fetches R again.
archive entry.ekid equals R, or R is unknown Keep the key: it passed the check of 08 §9.4. The item is invalid. The client sends fork_suspected naming the sender when R is known.
archive entry.ekid differs from R The archived key is the odd one out: it belongs to an abandoned fork. Discard it from the key store (the archive record keeps it, §12.5), take the record's entry whose ekid equals S.ekid if there is one (08 §9.4), and open the item again; otherwise the item is unavailable.

In every case the client also sends the diagnostic sealed_verify with step ekid (§9.4). Shared message keys never reach this section: they skip step 7 of §6.3, because kc binds each of them to its one message.

Why one mismatching message never makes the receiver resync: any member can sign a message with a wrong ekid. If every receiver resynced on that, one forked or malicious device could make every member of a large channel rejoin. Only the server-held reference decides which side is forked (13 §15.2).

6.7 The mobile notification extension

The notification extension (19) opens SealedMessages without MLS state. It MUST:

  • use only the notification key subset of §3.7 rule 4 (08 §13.5);
  • verify the signature using a sender public-key cache that the main app keeps in shared storage (08 §13.5 senders): (host, ctx, addr, did) → the DSK public keys the main app accepted for that device, written only from validated leaves or accepted credential records (§6.2). If one of several cached keys verifies, the signature is good;
  • if the key or the sender's public key is missing, or any step of §6.3 fails, show the fallback text of 19 ("New message from Alice in #Lobby") and never partial content. The extension never handles an ekid mismatch itself (§6.6); it shows the fallback text.

Why the extension checks signatures: without them, any member of a group could make a lock-screen preview appear to come from someone else, because every member can encrypt under K_hist. The public-key cache costs a few bytes per member and holds no secrets.

7. Manual history sharing: HistoryShare

7.1 What it is

In a secure context an account is served nothing from before its current membership (§10.2, D-007 as revised), and nothing hands history keys to newcomers. A member may still choose to share earlier messages with one specific current member of the same context. That is a HistoryShare: the sharer's client sends the per-message keys K_msg of the earlier sealed items it selects, end to end, to the recipient's devices, and the hosting server records a VisibilityGrant so that it serves those items to the recipient (§10.3). The server never sees a key.

  1. Deliberate only. A client MUST create a HistoryShare only when its user has chosen the action "Share earlier messages with <name>…" (20) for one named recipient and confirmed the range. It MUST NOT create one automatically, on a schedule, by default, or in response to a join, and it MUST NOT prompt or suggest sharing when someone joins (00 §4.12.5). Offering the action is OPTIONAL for clients.
  2. Servers MUST support it. Every server implements §7.7, §8.3, §8.4 and §9.1 for its secure channels, secure 1:1 DMs and secure group DMs, so that any client can offer the action.
  3. Where. Secure channels, secure 1:1 DMs and secure group DMs. Insecure contexts don't use it: new members there see earlier history under the ordinary permissions of 09 and 12 (D-007).
  4. One recipient, one range. A share names exactly one recipient account and one seq range of the context.
  5. Message keys only. A share never carries K_hist, MLS secrets, vault keys or plaintext. It opens exactly the messages it lists (§3.3, D-040), and the recipient checks that each of them is what its sender's device sent (§7.8).

In a secure 1:1 DM either participant may share with the other (D-007 as revised, 12 §12.5). The case that matters is a contact re-added after an identity change (12 §11.5), whom the other person may deliberately want to give the conversation back to; W2 has already told them that the key changed.

7.2 Who may share, with whom

The server enforces these rules (§7.7). Clients offer the action only where they hold.

Context Sharer Recipient
Secure channel A current member who holds the share_history permission in the channel (10). By default the admin role and the Moderator role hold it; admins may grant it to any role. Any other current member of the channel whose account has at least one device with a leaf in the channel's current group.
Secure group DM Any active participant (12 §12.5). Any other active participant whose account has at least one device with a leaf in the current group.
Secure 1:1 DM Either participant (12 §12.5). The other participant, if its account has at least one device with a leaf in the current group.
Any insecure context Nobody. —
  1. The sharer's session is on an enrolled device with a leaf in the current group, because the share is signed with that device's DSK (§7.5).
  2. A bot account never creates a share (§11). A bot may be a recipient.
  3. The range MUST lie within what the hosting server serves to the sharer's own account (§10.2, §10.3): a member can share only what it can itself be served.
  4. The sharer and the recipient are different accounts.

7.3 What a share contains

  • Range. fromSeq and toSeq, inclusive, with fromSeq ≤ toSeq and toSeq below the seq the share's event will get. The VisibilityGrant covers exactly this range (§10.3).
  • Items. One entry (mid, K_msg) for each sealed item in the range that the sharer's client selected and opened itself with outcome ok (§6.3): root messages, and the edits, reactions and author deletes in the range. A client SHOULD include every item of the range that it can open, so that edits and reactions display with their messages. Items it can't open are left out and stay unreadable for the recipient. Items whose ciphertext the server has deleted (author deletes and superseded edits, §5.7) have nothing to share; their tombstones are served as usual.
  • Attachments. File keys travel inside the sealed content (11 §3), so sharing a message shares its attachments. The grant also makes the server serve the encrypted blobs that the items of the range reference (§10.3).
  • Cap. At most 5,000 items per share (maxShareItems, §16.2), in a range that holds at most 5,000 sealed items. A client splits a larger selection into several shares with adjacent, non-overlapping ranges, newest first. It also splits a share whose request body would exceed the hosting server's maxRequestBytes (03). Each share is its own object, with its own event and its own K8 line.

A client MAY offer simple choices, for example "the last 7 days" or "everything I can see", and map the choice to a range of its own timeline (informative).

7.4 The HistoryShare object

A HistoryShare is a JSON object (00 §7.2). The sharer posts it (§8.3); the recipient's devices fetch it (§8.4).

Member Type Required Meaning Constraints
v integer Yes Format version. 1. A receiver MUST reject any other value.
ctx string Yes Context reference. 00 §7.6 form. MUST equal the path's context.
shareId string Yes Share ID, generated by the sharing client. Lowercase hyphenated UUIDv7 (ABNF mid in §4.2). Unique within the context.
recipient string Yes Canonical address of the recipient account. Canonical (01, D-032).
did string Yes Device ID of the sharing device. 22 characters (16 bytes). MUST equal the session's device.
fromSeq integer Yes First seq of the range. 1 to 2^53 − 1.
toSeq integer Yes Last seq of the range, inclusive. fromSeq to 2^53 − 1.
count integer Yes Number of items in the bundle. 1 to 5,000.
nonce string Yes AES-GCM nonce of the bundle. B64U of 12 random bytes: 16 characters.
ct string Yes The encrypted bundle followed by its 16-byte tag (§7.5). Decoded length exactly 5 + 48 × count + 16 bytes.
keys array Yes Key wraps: one entry {"did", "enc", "ct"} per device of the recipient account that the sharer wrapped K_share to (§7.5). 1 to 100 entries with distinct dids. did 22 characters; enc 43 characters (32 bytes); ct 64 characters (48 bytes).
sig string Yes Labelled signature history-share by the sharing device's DSK (§7.5). B64U of 64 bytes: 86 characters.

When the server returns a HistoryShare (§8.4), it adds:

Member Type Meaning
sharer string Canonical address of the sharing account, from the session that posted it.
createdAt string When the server accepted it.
seq integer The seq of its history.shared event (§9.1).
  • The sharer's canonical address isn't a request member, as a SealedMessage's sender isn't (§4.1). It is bound into the ShareHeader, and the server fills sharer from the session.
  • Producers MUST NOT add other members to the request. Receivers MUST ignore unknown members, which the signature doesn't cover.
  • Every base64url value is canonical (§1.2).

7.5 Bundle, ShareHeader, key wraps and signature

Bundle =
    u8(1)                          ; bundle version
 || u32(count)
 || count × ( mid16(mid) || K_msg )   ; 48 bytes per item, mid16 strictly ascending

ShareHeader =
    u8(1)                          ; header version, equals v
 || V16(host)                      ; UTF-8 canonical domain of the hosting server
 || V16(ctx)                       ; UTF-8 context reference
 || mid16(shareId)                 ; 16 bytes
 || V16(sharer)                    ; UTF-8 canonical address of the sharing account (D-032)
 || did16(did)                     ; 16 bytes: the sharing device
 || V16(recipient)                 ; UTF-8 canonical address of the recipient account
 || u64(fromSeq)
 || u64(toSeq)
 || u32(count)
 || nonce                          ; 12 bytes

K_share = 32 bytes from the CSPRNG, fresh for every share
ct      = AES-256-GCM-Encrypt(K_share, nonce, Bundle, aad = ShareHeader)

For each wrapped device d of the recipient, with box public key dbk(d):
    info        = "sv1 history-share" || 0x00 || mid16(shareId) || did16(d)
    (enc, wrap) = HPKE-SealBase(pkR = dbk(d), info, aad = empty, pt = K_share)   ; 04 §9.8
    keys entry  = {"did": d, "enc": B64U(enc), "ct": B64U(wrap)}

ShareSigContent = ShareHeader || u32(len(ct)) || ct
sig = SignLabelled(DSK, "history-share", ShareSigContent)
    = Ed25519-Sign(DSK, "sv1 sig" || 0x00 || "history-share" || 0x00 || ShareSigContent)
  • mid16(shareId) is the 16-byte binary form of the share ID, built like mid16 (§1.2). ct in the signature input is the decoded ciphertext including its tag.
  • Bundle items are sorted by mid16 in ascending byte order, with no duplicates.
  • Box keys. dbk(d) is the dbk claim of the DeviceCertificate in device d's sv_device credential (07, 13 §3.3), taken from a leaf of the recipient account in the sharer's own MLS state for the current generation, which the sharer validated as 07 and 13 require. The sharer MUST NOT take a box key from anywhere else, such as a credential record or 08's BoxKey objects.
  • K_share encrypts exactly one bundle and nothing else (04 §9.3). The sharer erases it once it has built the request body. The recipient's device erases it once it has stored the keys (§7.8).
  • The HPKE info binds each wrap to its share and device. The AEAD's associated data binds the bundle to the hosting server, the context, the share, both accounts, the sharing device and the range. The signature makes the sharer accountable, and lets the server check at acceptance that the share comes from the session's device.

The labels sv1 history-share (HPKE info) and history-share (labelled signature) are this document's registry additions (§3.6, 04 §8.5, §7.3).

Why per-message keys: a share then opens exactly the chosen messages and nothing else sealed in the same epochs, and the recipient can check each key against the sender's signed kc (§3.4), as a report verifier does (§13). Why HPKE to each device: the keys stay end to end, and the hosting server holds only ciphertext and the grant.

7.6 Creating a share (sharer's client)

  1. Action. The user chooses "Share earlier messages with <name>…" from the recipient's entry (for example the member list or the person's profile), or "Share earlier messages from here…" from a message's menu and then the recipient (20 §5.1), and picks a range. The client says in one plain sentence what will happen, for example that <name> will be able to read these messages and that everyone here will see that they were shared, and asks for confirmation. 20 owns the copy. This is an ordinary confirmation, not a security warning (D-055).
  2. Check. The client brings its MLS state up to date (13) and confirms, from its own validated roster, that the recipient has at least one leaf in the current group.
  3. Select. It lists the sealed items of the range that it opens with outcome ok (§6.3), and splits the selection as §7.3 says.
  4. Keys. For each item it derives K_msg from its key store (§3.3), or takes the shared message key it holds for the item (§3.7). It MUST NOT include a key for an item it hasn't opened with outcome ok.
  5. Encrypt and wrap. It generates shareId (UUIDv7), K_share and nonce, builds the Bundle and the ShareHeader, encrypts, and wraps K_share to every device of the recipient account that has a leaf in its current MLS state of the context (§7.5). It skips a leaf whose DeviceCertificate carries no valid dbk; if no device remains, it doesn't send.
  6. Sign and send. It signs (§7.5), keeps the request body until the server answers, and posts it (§8.3). A retry resends the kept body unchanged (§7.7 step 6).
  7. Errors. On sealed.not_in_group or mls.not_member the client resyncs as §4.7 step 11 says and builds a new share with a new shareId. On history.share_forbidden with reason recipient_not_in_group, it refreshes its MLS state and tries once more with a new shareId if the recipient now has a leaf; otherwise it tells the user that <name> can't receive shared messages yet (HSHARE.failed.not_ready, 20 §5.1). On history.share_too_large it splits (§7.3). On history.share_range_invalid it refreshes its timeline and rebuilds the selection. Every other error ends the attempt.
  8. Afterwards. The sharer's client shows K8 for its own share, as every other member's client does (§7.9).

7.7 Server acceptance

For POST /v1/contexts/{ctx}/history/shares (§8.3) the hosting server MUST perform these checks in this order and answer with the first failure.

Step Check Failure
1 The request is authenticated (03, 05, 06). core.unauthenticated
2 The context is secure. Insecure: history.disabled (reason insecure).
3 The caller's account is a current member that may read the context (09, 12); it is secure; it isn't a bot account (05); and the session's device is enrolled (SM-4). history.not_member; security.account_required; history.share_forbidden (reason bot); security.device_not_enrolled
4 Permission. In a channel, the caller holds share_history there (10), evaluated like any other permission, including timeouts. In a 1:1 DM or group DM, nothing further. history.share_forbidden (reason permission), or the owning document's code (for example moderation.timed_out, 10)
5 Shape. The object matches §7.4, including lengths and the grammar of §4.2 for shareId; ctx equals the path; did equals the session's device. history.share_invalid, with data.field naming the first member that fails
6 Idempotency. If a share with this shareId already exists in the context from the same account with a byte-identical body, return the stored response and stop. If it exists otherwise, reject. core.idempotency_conflict (03), reason mismatch
7 Sharing device. As §5.2 step 9 (b) to (d): the current generation has a group; the session's device isn't the subject of a pending server Remove proposal; and it has a leaf in the current group's current epoch whose signature key has the session's dkf. As §5.2 step 9 (b) to (d)
8 Recipient. recipient isn't the caller's account; it is a current member that may read the context (09 membership active, or participation state active, 12 §12.5); and every keys entry names a device that has a leaf of the recipient account in the current group's current epoch (the roster, 13 §6.5). history.share_forbidden with reason self, recipient_not_member or recipient_not_in_group
9 Size. count ≤ 5,000, and the range holds at most 5,000 sealed items (SealedMessages of every kind: root messages, edits, reactions and author deletes). history.share_too_large
10 Range. toSeq is below the seq the share's event will get; count is at most the number of sealed items (of every kind, as in step 9) stored in the range; and the server would serve every sealed item of the range to the caller's account (§10.2, §10.3, and the ranges of 09 and 12). history.share_range_invalid with data.reason beyond_head, count or not_visible
11 Signature. sig verifies (§7.5) under the DSK of the session's device (its leaf's signature key), with the ShareHeader built from the server's own canonical domain, the session's canonical address as sharer, and the request's members. history.share_invalid (field sig)
12 Rate. At most 30 shares per account per context per hour. core.rate_limited
13 Store (below). —

On success, in one transaction, the server:

  1. stores the HistoryShare verbatim, with sharer, createdAt and seq;
  2. creates the VisibilityGrant (§10.3) for the recipient account;
  3. creates or updates the credential record of the sharing device (§5.6);
  4. assigns the next seq of the context's stream to a history.shared event (§9.1) and emits it;
  5. in a channel, writes the audit-log entry history_shared exactly as 10 §11.3 specifies: actor the sharer, targetType history_share, targetId the shareId, targetAddress the recipient, ctx the channel, count the number of items, and changes recording fromSeq and toSeq;
  6. answers 201 with {"shareId", "seq", "createdAt"}.

The server can't decrypt anything in a share and MUST NOT try. It checks only the signature, the membership facts and the range.

Proposed decision: A VisibilityGrant covers the share's whole range, and the server checks that the sharer itself is served every sealed item of that range. Rationale: the server can't see which items the bundle lists, so a range is what it can check, and the sharer's own visibility bounds what a share can expose. Items of the range that the bundle doesn't list are served as ciphertext that the recipient can't open.

7.8 Receiving a share (recipient's client)

A full or web client of the recipient account MUST process every share addressed to its account. It looks for new shares when it receives a history.shared event naming its account (§9.1), when it opens the context, and after reconnecting, by listing them with GET …/history/shares (§8.4). For each share it hasn't processed yet:

  1. Unwrap. Find the keys entry for its own did. If there is none (the device wasn't in the group when the share was made), stop: the device gets the keys from the archive once another device of the account has written them (§12.7). Otherwise open the wrap with HPKE, its box key and the info of §7.5. On failure, drop the share on this device and send the diagnostic history_share (§9.4) with step unwrap.
  2. Sharer's signature. Gather the candidate DSKs of (sharer, did) exactly as §6.2 gathers a sender's, under the same rules for channels and for 1:1 DMs and group DMs. Verify sig over the ShareHeader rebuilt from the hosting server's canonical domain, ctx, shareId, sharer, did, the account's own canonical address as recipient, fromSeq, toSeq, count and nonce. If no candidate verifies, drop the share (diagnostic, step signature).
  3. Open. Decrypt ct with K_share and the ShareHeader as associated data. Check the bundle: version 1, the same count as the header, items strictly ascending by mid16, and every mid a valid UUIDv7. On failure, drop the share (diagnostic, step decrypt or bundle).
  4. Fetch. Fetch the sealed items of the range through 11's timeline (11 §7), which the grant now serves to the account (§10.3), and match bundle entries to items by mid. An entry whose mid isn't a sealed item of the range is ignored.
  5. Verify each key as a report verifier does (§13.2 steps 3 to 7): the stored SealedMessage's signature under its sender's credential (§6.2; credential records are allowed, because no device of the account was in that epoch); HMAC-SHA256(K_msg, "sv1 kc")[0..16] equal to S.kc, compared in constant time; AES-256-GCM decryption with the SealedHeader; and the content checks of 11. An entry that fails is dropped, its item stays unavailable, and the client sends the diagnostic history_share with step item. Unverified content is never shown (§6.1).
  6. Store. Keep every verified key as a shared message key in the key store (§3.7), and append it to the key archive's shared_keys records (§12.7) within 60 s, so that every device of the account can read the shared messages. Erase K_share.
  7. Show. Show K7 above the first item of the range, and K4 while steps 4 to 6 run for items on screen (§7.9).

The client verifies the items on screen first and then the rest in the background, without waiting for the user to scroll. Shares are processed in seq order. A later share never removes keys an earlier one gave. A share whose entries all failed shows no K7.

A secure bot's SDK processes shares as this section says (§11).

7.9 What users see

The markers are in the closed catalogue of 00 §4.12.3. 20 owns the copy. None of them is a warning, and nothing in this section prompts (00 §4.12.5).

Marker Intent Who sees it Where
K6 "Earlier messages are end-to-end encrypted and aren't available to people who join later." An account whose current membership began after earlier content existed in a secure context (a non-null withheldBeforeSeq, 11 §7.1; equivalently earlierWithheld, §8.2). At its join point: above the first item at or after its visibleFromSeq (§10.2). Served items directly below K6 that the account can't open (sealed before any of its devices joined the group) are covered by K6 and get no separate line.
K4 "Loading earlier messages…" A user's own new device restoring keys from the key archive; a recipient loading shared messages. Above the earliest decrypted item while the archive download (§12.4) or a share's processing (§7.8) is in progress for items the server serves. It disappears when done. Items that turn out unavailable collapse into the neutral line of §6.4.
K7 "<Name> shared earlier messages with you" The recipient. Above the first item of the shared range.
K8 "<Name> shared earlier messages with <Name2>" Every member other than the recipient, the sharer included. A system line at the seq of the history.shared event (§9.1).
  • Nothing prompts the newcomer or anyone else when someone joins. The share action is reached only from a person's entry or from a message's menu (§7.6, 20 §5.1), never from a join notice.
  • Clients SHOULD collapse consecutive K8 lines with the same sharer and recipient (a split share, §7.3) into one.
  • Members who joined before the context became secure see K1 or K3 at that boundary (09, 12), not K6. The one exception is an account reactivated from needs_encryption: its visibleFromSeq starts at the reactivation, and it also sees K6 there (09 §7.1).

7.10 Recipient state machine (per share, per device)

State Event Action Next state
(none) A history.shared event names this account, or a listing returns an unprocessed share Fetch the share (§8.4) opening
opening No keys entry for this device Wait for the shared_keys records (§12.7) done
opening Unwrap, signature or bundle check fails Diagnostic; drop the share done
opening Bundle opened Show K4 over affected items on screen; fetch and verify the items (§7.8 steps 4 and 5) verifying
verifying Every entry verified or dropped Store and append the keys; remove K4; show K7 done
any The account's membership ends Stop; keep the keys already stored done

8. API: /v1/contexts/{ctx}/history/

8.1 Common rules

These rules apply to every endpoint in this section.

  • The endpoints are on the context's hosting server, relative to its base URL (00 §7.3). The caller uses its home session or a remote session (06). Bots use their session the same way.
  • {ctx} is a context reference. The colon MAY be percent-encoded (00 §7.3).
  • The caller's account MUST be a current member of the context in a state that may read it (09, 12), else history.not_member. An insecure account gets security.account_required, and an unenrolled device gets security.device_not_enrolled (SM-4). A device that is the subject of a pending server Remove proposal gets 403 mls.not_member with the reason and removedFor that 13 §13.2 assigns (as §5.2 step 9 (c)).
  • For an insecure context, every endpoint answers history.disabled with data.reason insecure.
  • Request and response bodies are plain JSON (03). Collections page as 00 §7.10 says.
  • Rate limits follow 03. A server MUST allow at least 10 requests per second per session in bursts, and 1 per second sustained, for each endpoint of this section. §7.7 step 12 adds a limit on creating shares.
Method and path Purpose Section
GET /v1/contexts/{ctx}/history The caller's visibility in the context §8.2
POST /v1/contexts/{ctx}/history/shares Create a HistoryShare §8.3
GET /v1/contexts/{ctx}/history/shares List the HistoryShares addressed to the caller's account §8.4
POST /v1/contexts/{ctx}/history/credentials/lookup Fetch credential records §8.5

8.2 GET /v1/contexts/{ctx}/history

Returns a HistoryState object for the caller's account.

Member Type Required Meaning
ctx string Yes The context reference.
visibleFromSeq integer Yes The account's visibleFromSeq (§10.2): the seq at which its current membership began.
earlierWithheld boolean Yes Whether the context holds content items below visibleFromSeq that §10.2 withholds from this account, grants aside. Membership and other system events alone don't count, and after a 1:1 DM reopening (12 §6.4) it is false, because W2's new-account line marks the restart. It is true exactly when the MessagePage's withheldBeforeSeq (11 §7.1) is non-null. Clients use it to place K6 (§7.9); 20 places K6 from withheldBeforeSeq.
grants array Yes The account's VisibilityGrants in this context, oldest first (§10.3): {"shareId", "sharer", "fromSeq", "toSeq", "createdAt"}. Empty when there are none.
GET {base}/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/history

200 OK
{
  "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
  "visibleFromSeq": 5210,
  "earlierWithheld": true,
  "grants": [
    { "shareId": "01938f50-1a2b-7c3d-8e4f-5a6b7c8d9e0f", "sharer": "bob@b.com",
      "fromSeq": 4100, "toSeq": 4189, "createdAt": "2026-12-04T19:02:11.311Z" }
  ]
}

8.3 POST /v1/contexts/{ctx}/history/shares

Creates a HistoryShare. The body is a HistoryShare (§7.4) without the members the server sets. The server applies §7.7. Idempotency is by shareId (§7.7 step 6); an Idempotency-Key header isn't needed. The body is bounded by maxRequestBytes (03).

Response 201 Created: {"shareId": string, "seq": integer, "createdAt": string}. A retry with the same body gets the stored response.

Errors: history.disabled (409), history.not_member (403), history.share_forbidden (403), history.share_invalid (400), history.share_too_large (413), history.share_range_invalid (422), sealed.not_in_group (409), mls.not_member (403) and the other answers of §5.2 step 9, security.*, core.idempotency_conflict, core.too_large, core.rate_limited, and permission codes of 10 such as moderation.timed_out.

POST {base}/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/history/shares

{
  "v": 1,
  "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
  "shareId": "01938f50-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
  "recipient": "carol@c.com",
  "did": "Yx3kP0aL9qR2sT5uV8wZ1A",
  "fromSeq": 4100,
  "toSeq": 4189,
  "count": 1,
  "nonce": "0NHS09TV1tfY2drb",
  "ct": "17HQzORLyaU5KtrN1n9Yyhc-V6ZUYvfeXrnnHjV9I0EUPNpnjRvqNrfm045Sue-fmbdlPkZZDHjKh8_D7VG1xxyeb5Rd",
  "keys": [
    { "did": "wMHCw8TFxsfIycrLzM3Ozw",
      "enc": "2J47rXlDfb7Z-ENBgwT0YP8Fx_6B_kqVd6gEy5Nn_2Y",
      "ct": "k-pFj6zIb4ijB0e05p96-HR61w9PvL1NrT9HN42Om4vzDzGe-bBd7HHmFpVx3z-E" }
  ],
  "sig": "v_loNGrv9P-EkIoqm71dvMiGqZ9dSqgcPWzBo3Lx7JNGX5HyfGhTXL1lTCcc3UhjyJ1UXL_5Ml9kpfv1-mffBg"
}

201 Created
{ "shareId": "01938f50-1a2b-7c3d-8e4f-5a6b7c8d9e0f", "seq": 5302, "createdAt": "2026-12-04T19:02:11.311Z" }

The values are the test vector of §16.5: bob@b.com shares the message of §16.4 with carol@c.com, who joined at seq 5210.

8.4 GET /v1/contexts/{ctx}/history/shares

Lists the HistoryShares whose recipient is the caller's account and that were created during its current membership, oldest first, as a cursor-paged collection (00 §7.10).

Query parameter Required Meaning
shareId No Return only this share.
cursor, limit No 00 §7.10. limit is 1 to 10, default 5.

Each item is the HistoryShare (§7.4) with sharer, createdAt and seq.

  • Only the recipient account's sessions are served a share. Other members, the sharer included, get the history.shared event and nothing more.
  • Shares of an earlier membership of the account aren't listed (§10.3 rule 4).
  • Errors: history.disabled (409), history.not_member (403), core.not_found (a shareId that doesn't exist or isn't addressed to the caller), core.invalid_request.

8.5 POST /v1/contexts/{ctx}/history/credentials/lookup

Fetches credential records (§5.6).

Request: {"devices": [{"addr": canonical address, "did": device ID}, …]}, 1 to 100 entries.

Response 200 OK: {"items": [CredentialRecord…], "missing": [{"addr", "did"}…]}. A CredentialRecord has the members addr, did, dkf, idc, devcert, firstSeenAt, lastSeenAt and status of §5.6. Several records may come back for one (addr, did) if its credential changed. The client tries each one that §6.2 accepts, and uses the one whose DSK verifies the signature in hand.

Any member allowed by §8.1 may call it, bots included: the records hold only public certificates.

POST {base}/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/history/credentials/lookup

{ "devices": [ { "addr": "alice@a.com", "did": "q2bS9xVg3m0yJpQe1vT0Aw" } ] }

200 OK
{
  "items": [
    {
      "addr": "alice@a.com",
      "did": "q2bS9xVg3m0yJpQe1vT0Aw",
      "dkf": "FtIu-VbGrfe_KB6CH7GNwODB72MNxj_ml11dEvO-7kk",
      "idc": "eyJhbGciOiJFZERTQSIsInR5cCI6InN2LWlkY2VydCtqd3QiLCJraWQiOiJOemJMc1…",
      "devcert": "eyJhbGciOiJFZERTQSIsInR5cCI6InN2LWRldmNlcnQrand0Iiwia2lkIjoiTnpi…",
      "firstSeenAt": "2026-11-02T09:14:03.551Z",
      "lastSeenAt": "2026-12-04T18:22:31.512Z",
      "status": "active"
    }
  ],
  "missing": []
}

9. Events

This document owns the history and sealed areas (00 §7.5). It defines one event, history.shared.

Registration (03 §11.2):

Type Transport Direction Class Stream Timeline item Section
history.shared Client WebSocket Server to client Durable The secure context Yes: the K8 system line (the recipient's client shows K7 instead, §7.9) §9.1

9.1 history.shared

Sent by the hosting server when it accepts a HistoryShare (§7.7), to every subscriber of the context's stream. It carries no keys and no content.

Member of d Type Meaning
shareId string The share.
sharer string Canonical address of the sharing account.
recipient string Canonical address of the recipient account.
fromSeq, toSeq integer The shared range.
count integer The number of shared items.
{
  "v": 1,
  "t": "history.shared",
  "id": "01938f52-0d1e-7f20-8a31-4b5c6d7e8f90",
  "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
  "seq": 5302,
  "ts": "2026-12-04T19:02:11.311Z",
  "d": { "shareId": "01938f50-1a2b-7c3d-8e4f-5a6b7c8d9e0f", "sharer": "bob@b.com",
         "recipient": "carol@c.com", "fromSeq": 4100, "toSeq": 4189, "count": 1 }
}

9.2 Delivery and display

  • The event follows the visibility of other system lines (09 §7.2, 11 §7.5). It never carries content, so it isn't subject to the content rule of §10.2.
  • The server sends no notify (19) for it.
  • The recipient's clients process the share (§7.8) and show K7. Every other member's client shows K8 at the event (§7.9).

9.3 Other events this document relies on

  • No sealed.* events exist in v1. Sealed content appears in 11's timeline events. The sealed area holds error codes.
  • The membership events of 09 and 12 start and end memberships, which sets visibleFromSeq (§10.2) and ends VisibilityGrants (§10.3).
  • mls.handshake and mls.commit_needed (13) drive key creation (§3.1).

9.4 Diagnostic report kinds

Clients send these through POST /v1/diagnostics (15 §14.3) to the context's hosting server, using their session there. They use 15's report body (reportId, kind, client, platform, createdAt, ctx, data), and 15 §14.4 lists the kinds with this document as owner. They are sent only while the user's diagnostics setting (15 §14.2) isn't off. They never contain keys, plaintext or content, and are never shown to the user.

kind When data
sealed_verify A SealedMessage's outcome is invalid or fork_evidence (§6.4), or an ekid mismatch was handled (§6.6). {"gen", "epoch", "mid", "sender", "did", "step", "outcome"}. step is one of format, context, credential, signature, ekid, kc, decrypt, content, timeout (a pending_sender that reached 24 h). outcome is invalid or fork_evidence. For ekid, also ekid (the message's) and ownEkid. Unknown values: store as other.
history_share A received HistoryShare, or one of its entries, failed a check (§7.8). {"shareId", "sharer", "did", "step", "mid"}, where step is unwrap, signature, decrypt, bundle or item, and mid is present only for item. Unknown values: store as other.

Fork suspicions about another device go to 13's MlsReport (fork_suspected, 13 §7.10) as well, because 13 acts on them.

10. Visibility: what each account is served

10.1 The rule (D-007 as revised)

Context Does a new member see earlier content? How
Secure channel No. An account is served content only from the start of its current membership. visibleFromSeq (§10.2). A member may share earlier messages deliberately (§7, §10.3).
Secure group DM No, as for channels. D-070 is superseded. As for channels.
Secure 1:1 DM Both participants are members from the start. A DM reopened after peer_deleted, and a participant re-added after an identity change, start a new membership (§10.2 rule 3). visibleFromSeq. The other participant may share earlier messages deliberately (§7).
Any insecure context Yes, under the ordinary permissions and visibility ranges of 09 and 12, unchanged. This section doesn't apply.

There is no history setting. No channel or group DM chooses between full and since-join history, and nothing hands history keys to newcomers. Bots follow the same rule as people (§11, D-061 as amended). A user's own new devices still get everything that user could already read, through the key archive (§10.4, D-054).

10.2 What the server serves: visibleFromSeq

Which seq values an account is served at all is decided by the owners of membership: the visibility ranges of 09 §7.2 for channels, and joinedSeq and removal for DMs and group DMs (12 §12.5). 11 §7.5 applies them on every path. This section adds the rule for secure contexts. It only narrows what 09 and 12 allow, except where a VisibilityGrant widens it (§10.3). An item is served only if it passes both.

The hosting server keeps, for every (account, secure context), an integer visibleFromSeq: the seq at which the account's current membership began. It MUST NOT serve to that account any content item with seq < visibleFromSeq, through any path: timeline fetches, sync and gap fill, event replay on resume, search, reply and mention previews, attachment downloads, or dm.request. Content items are sealed items and everything derived from them: edits, reactions, author-delete tombstones, and the encrypted attachment blobs they reference (11). Pre-upgrade plaintext is content too, except as rule 4 says. Live delivery and replay carry the reduced payload of 11 §8.3 instead (03 §7.2 D4), and timeline pages omit the item (11 §7.5). The one exception is a VisibilityGrant (§10.3).

Computing it:

  1. Channels. The seq of the event that started the account's current channel membership (09 §7.2), or, for an account reactivated from needs_encryption, the seq of the reactivating member.updated (09 §7.1). A rejoin starts a new membership: nothing from an earlier membership is served again, whatever 09's ranges kept (D-007: devices keep whatever they stored locally).
  2. Group DMs. The account's joinedSeq in its current participation (12 §12.5). A participant who left or was removed and is added again starts a new participation. An identity change follows rule 8.
  3. 1:1 DMs. 1 for both participants, except that a DM reopened after peer_deleted sets both accounts' values to the seq of the reopening event (12 §6.4). An identity change follows rule 8.
  4. Upgraded contexts. An account whose current membership began before the context became secure (a channel's upgradeSeq, 09; the event at which a DM or group DM became secure, 12) keeps being served the pre-upgrade plaintext that 09 and 12 allow it, as before the upgrade: under marker K3 in a channel, and above K1 in a DM or group DM (20 §5 rule 1). An account whose current membership began after that point is served nothing from before its join, the pre-upgrade plaintext included (§10.5).
  5. Identity changes in channels. A reset doesn't end a channel membership (00 F6), so visibleFromSeq doesn't change. The new identity's devices hold no keys for earlier epochs unless an old device of the user's imports them (08 §11.4), so earlier sealed items stay unreadable to them (§10.9).
  6. Bots follow rules 1 to 3 like everyone else (§11).
  7. Leaving ends the membership. The server MAY keep the old value, but a later membership gets a new value under rules 1 to 3.
  8. Identity change in a DM (12 §11.5 item 4, D-007). When the hosting server starts 13's identity_changed procedure for a participant of a 1:1 DM or group DM, it sets that account's visibleFromSeq to the DM's lastSeq + 1; when it accepts the commit that lists the person's new identity-key thumbprint in sv_participants, it sets it to that commit's seq (§10.9). This overrides every other rule of this section, and a later identity change repeats it. In channels an identity change leaves visibleFromSeq unchanged (rule 5).

Why per account, not per device: D-007 says a user's own new devices always get everything that user could already read. The server serves all of an account's devices from the account's membership start, not from a device's enrolment or its first leaf, and the archive supplies the keys (§10.4).

Why the membership start, not the first MLS handshake that added one of the account's devices: D-007 names the join, and a join is defined the same way in every context type. Items sealed between the two are in epochs no device of the account holds. The client shows them under K6, not as a separate line (§7.9), and a member may share them (§7).

10.3 VisibilityGrants

A VisibilityGrant is the hosting server's record that one recipient account may be served the sealed items of one HistoryShare's range, below its visibleFromSeq.

Field Meaning
account Canonical address of the recipient account
ctx The context
shareId The HistoryShare that created it
fromSeq, toSeq The range, inclusive
sharer Canonical address of the sharing account
createdAt When the share was accepted
  1. The server creates exactly one grant for each HistoryShare it accepts, in the same transaction (§7.7).
  2. While a grant lasts, the server serves the recipient account, on every path of §10.2, the sealed items with fromSeq ≤ seq ≤ toSeq, their edits, reactions and tombstones in that range, the encrypted attachment blobs those items reference (11 §14), and the credential records of their senders (§8.5). An edit or reaction outside the range whose target is inside it is served as 11 §7.5 rule 3 allows for any visible target. A grant never covers pre-upgrade plaintext, system lines, or anything that isn't a sealed item or derived from one.
  3. A grant widens only what visibleFromSeq withholds. It doesn't override anything else of 09, 10, 11 or 12: an item purged by retention or deleted by a moderator isn't served again.
  4. A grant belongs to the recipient's current membership. It ends when that membership ends (leaving, removal, kick, ban, or a re-add after an identity change, §10.9). The server then stops serving its items and MAY delete it. A later membership starts with no grants: earlier memberships aren't served again (D-007).
  5. The sharer can't withdraw a grant. The keys have already reached the recipient (§17 item 18).
  6. A grant serves every device of the recipient account, as §10.2 does.
  7. The server keeps a grant and its HistoryShare for as long as the grant lasts and it keeps any sealed item of the range (§10.8).

10.4 A user's own devices (D-007, D-054)

  • The server serves the same items to every device of an account, from the account's visibleFromSeq and its grants.
  • A device that lacks a key for an epoch its account could read takes it from the key archive (§12.4). Every epoch in which some device of the account had a leaf is in the archive, because that device appended it (§12.2).
  • A device that rejoins by external commit, after eviction, a fork or lost state (13 §10.5, §14.4, §15.5), recovers the keys of the epochs it missed from the archive.
  • Epochs in which no device of the account had a leaf have no key anywhere in the account: for example the epochs between the account's join and its first device joining the group, or the epochs that the account's only device missed while it was evicted or away for longer than the handshake log is kept (13 §14.3, §14.4). Their items stay unavailable (§6.4) unless a member shares them (§7).
  • Shared message keys reach the account's other and future devices through the shared_keys records (§12.7).

10.5 Joining after an upgrade

When a channel is upgraded from insecure to secure (D-057), or a DM or group DM becomes secure (12):

  • accounts whose current membership began before that point keep reading the pre-upgrade plaintext (under marker K3 in a channel, above K1 in a DM or group DM), as far as 09 and 12 allow (§10.2 rule 4);
  • accounts that join afterwards see nothing from before their join, the pre-upgrade plaintext included;
  • a HistoryShare never covers pre-upgrade plaintext (§10.3 rule 2), and no client may re-share it by sealing it (§10.7 rule 2).

10.6 Generations

A context can get a new MLS generation (13 §4.2). A new generation changes neither visibleFromSeq, nor grants, nor what any account may read. Members' devices keep the history keys of earlier generations, and the key store and the key archive name keys by group_id, which includes the generation (08 §8.5), so a user's own new devices read every generation the account was in. A newcomer sees nothing from before its join in any generation. No key crosses from one generation to another: there is no bridge.

10.7 Pre-upgrade plaintext is never fed into sealed content

When a channel is upgraded (D-057) or a DM becomes secure (12), the plaintext before the switch stays plaintext. Normatively:

  1. No key archive record ever contains anything but a K_hist exported from a secure group or a shared message key (§12).
  2. Clients MUST NOT seal, re-seal, import or forward pre-upgrade plaintext items (in a channel, seq at or below upgradeSeq, 09; in a DM or group DM, plaintext items with seq below its securitySinceSeq, the dm.security_changed that made it secure, 12 §11.4) into SealedMessages. They MUST NOT copy text from a pre-upgrade message into sealed content automatically, for example as a quote preview. A reply refers to a pre-upgrade message by mid only.
  3. Pre-upgrade items keep marker K3 in a channel and stay above K1 in a DM or group DM (20 §5); they never show the closed lock (00 §4.12.3, §4.12.6).
  4. The key archive never contains plaintext.
  5. A report about a pre-upgrade item is verified as plaintext (§13.2 step 1).
  6. The admin's option to delete pre-upgrade history (D-057) touches no key, SealedMessage or HistoryShare.

Why: the server could read everything before the upgrade. Mixing it into encrypted history would put a closed lock on content the server has seen, and blur the K3 boundary users rely on.

10.8 Retention

When 11's retention deletes sealed items:

  • the server MAY delete a HistoryShare and its VisibilityGrant once retention has removed every sealed item of the share's range;
  • the server keeps the reference ekid of an epoch while any sealed item of that epoch remains (§5.5);
  • clients MAY delete local keys and plaintext for those epochs, and MAY leave the archive records in place.

10.9 Participants re-added after an identity change

A person re-added to a secure 1:1 DM or group DM after an identity change (a reset or a takeover, D-071) gets no content from before the re-add (D-007 as revised). This follows from §10.2: the re-add starts a new membership. As soon as the hosting server starts 13's identity_changed procedure for the participant (13 §13.2), it MUST set the account's visibleFromSeq to the DM's lastSeq + 1 and end the account's VisibilityGrants in the context (§10.2 rule 8, §10.3 rule 4), so that nothing earlier is served while the person waits to be re-added. When the hosting server accepts the commit that re-adds the account (the commit that lists its new identity-key thumbprint in sv_participants, 12 §11.5 item 3), it MUST, in the same transaction:

  1. set the account's visibleFromSeq to that commit's seq (§10.2 rule 8);
  2. end the account's VisibilityGrants in the context (§10.3 rule 4).
  • This holds in 1:1 DMs and group DMs alike. The account's devices keep whatever they decrypted and stored before (D-007), but the server serves them nothing earlier, and history keys imported after a reset (08 §11.4) open only items the server still serves.
  • In channels a reset doesn't end the membership (00 F6), so visibleFromSeq doesn't move. The new identity has no keys for earlier epochs: nothing hands keys to newcomers, and the previous identity's archive opens only for an old device of the same account (08 §11.4). Someone who forced a reset through a hijacked login (D-071) therefore reads no earlier channel content (§17 item 16).
  • Members' devices hand no keys to the new identity, so the rule holds even against a hosting server that ignored it: earlier ciphertext served against the rule can't be opened. Another participant may still share earlier messages deliberately, in a 1:1 DM or a group DM (§7); every other participant sees that (K8).

11. Bots

Bots follow the same rules as people (D-061 as amended by the revised D-007). There is no botsGetHistory setting.

  1. A secure bot's visibleFromSeq is the start of its current membership (§10.2), as for any member.
  2. A bot may be the recipient of a HistoryShare. A secure bot's SDK processes shares as §7.8 says, and appends the keys to the key archive when the bot account has an AccountVault (§12.6); otherwise it keeps them only locally.
  3. A bot account never creates a HistoryShare. The server refuses with history.share_forbidden (reason bot, §7.7 step 3). Why: a share must be a person's deliberate act (§7.1), and a bot acts automatically.
  4. W6 tells members that a bot reads what it can access from when it joined (20).

12. Key-archive append rules

The key archive is the set of AccountVault records of 08 that hold history keys (archive) and shared message keys (shared_keys). 08 owns the record formats, record IDs (keyed hashes, label sv1 vault id) and the API. This section owns what goes in and when (D-007, D-054).

12.1 Content of a history-key record

The record is 08's archive record (08 §9.1), encrypted under the current vault key generation. This document fills it like this:

08 member Filled with
host, ctx The hosting server's canonical domain and the context reference
groupId The MLS group_id, which names the generation (00 §7.6)
gen Its generation, the last field of groupId
epoch The epoch
keys One key entry per distinct key known for that epoch: ekid = ekid(e), key = K_hist(e), source = mls (the writer's own MLS processing, §3.1), confirmed = true, and learnedAt = when the key was first learned. v1 writers write no other source value; 08 §9.1 keeps recovered for readers only.

Keys imported after a reset keep the source and confirmed recorded for them (08 §11.4).

12.2 What every enrolled device appends

Every enrolled device of a secure account MUST append:

  1. every K_hist(e) it computes from MLS (§3.1), in every secure context: channels, 1:1 DMs and group DMs;
  2. every shared message key it accepts from a HistoryShare (§7.8), as shared_keys records (§12.7);
  3. the keys 08 §11.4 imports from a retired store or retired vault after a reset (each key keeping the source and confirmed recorded for it, 08 §11.4).

Exception: while the vault is full, 08 §8.11 applies.

It MUST NOT append keys it read from the current archive itself (08 §9.4), shared message keys that failed §7.8, keys of a pending commit (§3.1), or keys of a fork it has abandoned (§6.6).

12.3 When

  • Within 60 s of learning the key, batching several keys in one write (08), or at the next successful connection to the home server if it is offline.
  • In every case before it deletes the key from its local key store.
  • Retrying until the home server acknowledges the write.
  • An append is a background operation and never prompts (00 §4.12.5).

12.4 Reading

A device that lacks a key for an epoch its account could read consults the archive. It downloads the context's records lazily, per context, and selects the keys entry whose ekid matches, as 08 §8.10 and §9.4 specify. Keys from the archive enter the key store with source archive (§3.7), never mls. An entry whose confirmed is true is confirmed at once; any other is confirmed the first time it decrypts a verified SealedMessage (§3.7). For a sealed item that no history key opens, the device looks for a shared message key in the same download (§12.7).

Why the archive: it is the only source of earlier keys for a user's own devices (§10.4), it depends on nobody else being online, it covers every context type, and it doesn't reveal to the hosting server which keys a new device lacks.

12.5 Merging

08 §8.9.1 and §9.3 own the merge: the keys arrays are united by ekid, no merge removes an entry because another ekid exists (only 08's 4-entry overflow rule drops one), and a device that would add only an ekid already present skips the write unless it strengthens that entry (recovered to mls, or unconfirmed to confirmed). This document adds:

  • a device adds its key as a new keys entry when its ekid isn't present; otherwise it only strengthens the existing entry as 08 §9.3 allows, and it never removes another entry;
  • when a record already holds a different ekid for the same epoch, the two keys are evidence of a fork. If the device's own key came from MLS, it resolves which side is forked with the reference ekid as §6.6 says, and sends the diagnostic sealed_verify with step ekid (§9.4);
  • when reading a record with several entries, the device uses the entry whose ekid matches the SealedMessage in hand (08 §9.4), and, when it knows the reference ekid (13), prefers the entry that matches it.

12.6 Who and what else

  • Bots: a secure bot's devices MUST append when the bot account has an AccountVault. Bots aren't required to have one (D-061).
  • Unenrolled devices hold no keys and append nothing.
  • Leaving a context doesn't remove its records: the user could read that history. A client MAY delete them when the user deletes the conversation locally.
  • Identity reset: the reset creates a new vault and vault key (08). The new identity's devices can't read the old archive, except through 08 §11.4: an old device of the same account that is enrolled again within 30 days imports the old keys. Otherwise the new identity can't read earlier content in any context, because nothing hands keys to newcomers (§10.9). In DMs and group DMs the re-add also starts a new membership, so the server serves nothing from before it (§10.9).
  • Vault key rotation after a device revocation (D-054): new records are written under the new generation, so the revoked device can't read keys learned afterwards.
  • The archive never holds plaintext or MLS secrets, and holds K_msg values only in shared_keys records (§12.7).

12.7 Shared message keys

A device that accepts the keys of a HistoryShare (§7.8) appends them to the key archive as 08's shared_keys records (08 §9.5), so that the account's other and future devices can read the shared messages. Only the devices that had a leaf when the share was made can open its key wraps (§7.5); the archive carries the keys to the rest.

  1. One record per (host, ctx, shareId, part). Part p holds the verified keys among the bundle's items at positions 32p to 32p + 31, in the bundle's mid16 order (§7.5), and names the sharer for K7 (§7.9). A part whose keys all failed isn't written.
  2. Two devices of the account that accept the same share write the same record IDs, and 08 §8.9.5 merges them.
  3. The timing rules of §12.3 apply.
  4. A device that reads a shared_keys entry treats it as a shared message key (§3.7): it uses it only for the mid it names, and runs every check of §6.3 before showing anything.
  5. Leaving the context doesn't remove the records (§12.6). Once the membership ends the server serves none of those items again (§10.3 rule 4), so the keys open only content the device already stored.

13. Report verification procedure

10 owns the Report object, its endpoint and its workflow. This section is the procedure that the hosting server, and optionally a moderator's client, runs on each reported item (D-040, D-077).

13.1 Inputs

From the report (10), for context ctx:

  • items: for each reported or surrounding message, its mid, the revealed K_msg (32 bytes, base64url), and optionally the reporter's copy of its SealedMessage;
  • attachments: for each reported attachment, the mid of the message that references it, the attachment's ID (11), and the revealed file key.

The reporter's client derives each K_msg locally from K_hist (§3.3), or takes the shared message key it holds for the item (§3.7): a recipient of a HistoryShare can report a shared message like any other. It MUST NOT send K_hist or anything that would open messages other than the ones in the report.

13.2 Verifying one message

VerifyReportedItem(ctx, mid, kMsg, copy?):
 1. Find the entry (ctx, mid): a root message, an edit entry or a reaction entry (11 §2.1).
      context insecure, or entry is pre-upgrade plaintext -> plaintext (use the stored content)
 2. If the stored SealedMessage exists: S = stored.
    Else if the server kept a sigHash for it (a tombstone, or a root or edit
         whose ct a later edit deleted, §5.7), and copy is given,
         copy.mid == mid, copy.ctx == ctx, and SHA-256(decode(copy.sig)) == sigHash: S = copy.
    Else -> not_found
 3. sender = the entry's stored sender address. Find every credential record for
    (sender, S.did) (§5.6) and run the local checks of §6.2 on each.
                                                    none passes -> credential_invalid
 4. Build SealedHeader with the hosting server's own canonical domain and sender;
    verify S.sig (label "sealed") under the DSK of each record that passed step 3.
    Use the record whose DSK verifies.                none verifies -> bad_signature
 5. Check HMAC-SHA256(kMsg, "sv1 kc")[0..16] == S.kc, constant time.  -> bad_key
 6. Decrypt S.ct with kMsg, S.nonce, aad = SealedHeader.              -> decrypt_failed
 7. Parse and check the content against 11 for S.kind and S.ref.      -> bad_content
 8. -> verified, with: content, sender, did, kind, ref, gen, epoch, and the credential
       record's status.
  • An edit or reaction verifies like any other item. 10 presents it as acting on ref. Reporters SHOULD include the original message and its edits together.
  • Results for surrounding messages are computed the same way, and 10 labels them as context.
  • Verifiers that don't host the context (the reporter's home server, or the sender's home server receiving report.forwarded) have no timeline item and no credential record of their own. They run 10 §10.12, a variant of this procedure with the same results: S comes from the dm.request copy the home server holds, the reporter's copy, or the forwarded item; the credential {idc, devcert} comes with the report and is checked against the sender's IdentityState fetched from the sender's home server; and steps 4 to 7 run with the hosting server's canonical domain named in the report.

13.3 Deleted messages

When the author deleted a message before it was reported, the server no longer holds its ciphertext (§5.7). Step 2 then accepts the reporter's cached copy, if its signature digest matches the one the server kept at ingress. Clients that keep decrypted messages SHOULD keep the SealedMessage of each received message for as long as they keep its plaintext, so that they can supply this copy. The same applies to the original content of an edited message and to superseded edits, whose ciphertext the server deleted when it accepted the later edit (§5.7, 11 §6.2).

13.4 Verifying an attachment

VerifyReportedAttachment(ctx, mid, attachmentId, fileKey):
 1. The item (ctx, mid) MUST be verified in this same report.         -> not_referenced
 2. Its content MUST carry an AttachmentRef (or ThumbnailRef) for
    attachmentId whose `key` equals fileKey (constant-time comparison),
    and whose `sha256` is present (11 §3).                           -> not_referenced
 3. Fetch the stored encrypted blob (11).                             -> not_found
 4. Decrypt it with SVF1 (04 §10.6) under fileKey. This checks the
    header key commitment ("sv1 file kc") first, then every segment
    and the final-segment flag, and removes framing and padding.      -> decrypt_failed
 5. Check that the output is exactly the reference's `size` bytes and
    that its SHA-256 equals the reference's `sha256` (11 §14).        -> bad_content
 6. -> verified

A file key is authenticated only through the verified message that carries it, and the file's content only through the signed sha256 in that message. A reporter, or anyone else who learns the file key, can't attach an arbitrary file to someone else's message: a different file under the same key fails step 5.

13.5 Results

Result Meaning
verified The sender's device produced exactly this content in this context, epoch and group.
plaintext The item was never sealed (an insecure context or pre-upgrade history). The server's stored copy is shown, labelled as such.
not_found No stored item, or no acceptable copy.
credential_invalid The sender's credential record failed the local checks.
bad_signature The signature doesn't verify.
bad_key The revealed key doesn't match kc: the reporter sent a wrong or forged key.
decrypt_failed The AEAD failed.
bad_content The content isn't valid, isn't consistent with kind and ref, or an attachment's size or signed sha256 didn't match.
not_referenced The attachment isn't referenced with that key by a verified message of the report.

The report stores one result per item (10). Moderators see the content only of verified and plaintext items. For the other results they see the result, never unverified content. Consumers MUST treat an unknown result as not verified.

13.6 Who runs it

  • The hosting server MUST run the procedure when the report is submitted, and store the results and the revealed keys with the report as 10 specifies. D-077 applies: verified content is visible to the hosting server's moderators, and the reporter was told so.
  • A moderator's client MAY run it again from the stored SealedMessage, the credential record and the revealed key, which 10 makes available to moderators.
  • Forwarded reports (report.forwarded, 10): the evidence for each verified item MUST include the SealedMessage, the credential (both idc and devcert of the record whose DSK verified, 10's credential member) and K_msg, plus the hosting server's canonical domain, so that the sender's home server can repeat the verification with 10 §10.12.

13.7 What a verified result proves

It proves that the holder of the DSK of device (sender, did), whose DeviceCertificate chains to sender's identity key, produced exactly this ciphertext and key commitment for this context, generation, epoch and message ID, and that the revealed key opens it to exactly this content. Key commitment (§3.4) rules out a reporter presenting a different plaintext.

It doesn't prove when the message was sent (the server assigns ts), to whom it was delivered, or that the device wasn't compromised. The server can't check that K_msg derives from K_hist, and doesn't need to: kc binds the key the sender used.

14. Storage: who stores what, encrypted to what, written by whom

This table refines the one in 00 HP-4.

Data Stored by Encrypted to Written by Readable by Kept for
SealedMessage Hosting server K_msg, derived from K_hist(e) and mid The sending device Members holding K_hist(e), and recipients of a HistoryShare that lists it (served within visibleFromSeq and VisibilityGrants, §10.2, §10.3) 11's retention; ct deleted on author delete or a later edit (§5.7)
Tombstone digest sigHash Hosting server Not encrypted (a hash) Hosting server, at ingress Hosting server, for reports As long as the tombstone
Credential record, one per (addr, did, dkf) Hosting server Not encrypted (public certificates) Hosting server, from validated leaves Members (§8.5) As long as any item, tombstone or HistoryShare by the device
Reference ekid per epoch Hosting server Not encrypted (public) Hosting server, from bootstraps and commits (13 §15.2) Members (13) As long as any sealed item of the epoch (§5.5)
HistoryShare (bundle and key wraps) Hosting server Bundle: K_share; K_share: HPKE to each wrapped recipient device's box key The sharing device The recipient account's wrapped devices (§7.8) As long as its VisibilityGrant (§10.3)
VisibilityGrant Hosting server Not encrypted Hosting server, when it accepts a share (§7.7) Hosting server; the recipient (§8.2) Until the recipient's membership ends or retention removes the range (§10.3, §10.8)
GroupInfo and handshake log Hosting server Public (PublicMessage, 13) Committers Members and the server 13 (log at least 30 days)
Key archive records User's home server Vault key, current generation (08) Each of the user's enrolled devices The user's enrolled devices holding the vault key Until the user deletes them, or a reset retires the vault (08 §8.12, 30 days)
Shared message keys (shared_keys records) User's home server Vault key, current generation (08 §9.5) The recipient's enrolled devices The recipient's enrolled devices holding the vault key As key archive records
KeyBackup User's home server Key derived from the recovery phrase (08) Any enrolled device The user, with the phrase 08
Device key store (history keys and shared message keys) The device Platform key storage (08) The device The device Indefinitely by default (§3.7)
Notification-extension subset The device, shared storage Platform key storage (08, 19) The main app The notification extension Recent epochs only
Sender public-key cache The device, shared storage Not secret The main app, from validated leaves and records The notification extension While the context is in use
Report evidence (K_msg, file keys, verified content) Hosting server Not encrypted to members: revealed by the reporter (D-077) Reporter's client and the server's verification The hosting server's moderators (10) 10

No server ever stores K_hist, K_share, K_msg (outside report evidence), file keys (outside report evidence), or content plaintext of a secure context (SM-10). A HistoryShare holds K_msg values only encrypted end to end.

15. Error codes

This document owns the sealed and history areas (00 §7.5). The problem object follows 00 §7.9. "Auto" in the last column means the client handles the error itself and shows nothing, apart from the ordinary message states of 11.

Code HTTP userAction retryable Meaning data Client handling
sealed.invalid 400 none false The SealedMessage is malformed: missing or extra-length members, bad base64url, a bad v, or a grammar violation. {"field": string} Bug: diagnostic; the message stays not sent.
sealed.header_mismatch 400 none false sealed.ctx, sealed.mid, sealed.kind or sealed.ref doesn't match the path or the body's mid, kind or target (§5.2 step 6). {"field": string} Bug: as above.
sealed.not_secure 409 none false Sealed content was posted to an insecure context. {"security": "insecure"} §4.7 step 12: never re-sent as plaintext on the server's word alone; W9 for a channel the client saw as secure.
sealed.required 409 none false Plaintext was posted to a secure DM or group DM (a secure channel answers 09's channel.plaintext_rejected, 11 §4.7). {"security": "secure"} Refresh the context, then seal and retry (auto, 11 §4.7).
sealed.device_mismatch 403 none false did isn't the session's device. — Bug: diagnostic.
sealed.not_in_group 409 retry true The session's device has no leaf in the current group (§5.2 step 9 (d); also when creating a HistoryShare, §7.7 step 7). {"gen": int, "epoch": int} Join or resync by external commit (13 §10), then retry (auto). A retired generation or a generation with no group yet answers 13's mls.generation_retired or mls.group_not_found instead (§4.7 step 11). A device whose removal reason the server knows gets 13's mls.not_member instead (§5.2 step 9).
sealed.wrong_epoch 409 retry true gen isn't the current generation, or epoch is outside the grace window (§5.3). {"gen": int, "epoch": int}: the current generation and epoch Process handshakes, re-seal with the same mid, retry (auto).
sealed.kind_unsupported 422 none false The server doesn't know this kind (the server is older than the client). {"kind": string} Treat the feature as absent, silently.
sealed.ref_invalid 422 none false ref is missing, present where forbidden, unknown, deleted, or names another account's entry for edit or delete (§4.3). {"ref": string, "reason": "missing" | "forbidden" | "not_found" | "deleted" | "not_author"} Drop the operation; refresh the target.
sealed.bad_signature 400 none false The signature doesn't verify under the session device's DSK. — Bug or key mismatch: diagnostic; resync (13).
history.disabled 409 none false The context is insecure, so history visibility and sharing don't apply (§8.1). {"reason": "insecure"}; unknown values are treated as insecure. Stop; nothing to do.
history.not_member 403 none false The caller isn't a current member that may read the context. — Rejoin first, or stop.
history.share_invalid 400 none false A HistoryShare is malformed, names another device as did, or its signature doesn't verify under the session device's DSK (§7.7 steps 5 and 11). {"field": string} Bug: diagnostic; the share isn't sent.
history.share_forbidden 403 none false This share isn't allowed (§7.2, §7.7): the caller is a bot or lacks share_history, or the recipient is the caller, isn't a current member, or isn't in the group with every wrapped device. {"reason": "permission" | "bot" | "self" | "recipient_not_member" | "recipient_not_in_group"}; unknown values are treated as permission. permission, bot: hide the action. recipient_not_member: refresh the member list. recipient_not_in_group: refresh MLS state and retry once with a new shareId (§7.6 step 7). self: bug.
history.share_range_invalid 422 none false The range reaches the stream head, holds fewer sealed items than count, or includes sealed items the caller's own account isn't served (§7.7 step 10). {"reason": "beyond_head" | "count" | "not_visible"}; unknown values are treated as not_visible. Refresh the timeline and rebuild the selection.
history.share_too_large 413 none false count is above 5,000, or the range holds more than 5,000 sealed items (§7.3). {"max": 5000} Split the share (§7.3) and send each part.

Codes from other areas that this document uses: core.unauthenticated, core.idempotency_conflict, core.invalid_request, core.not_found, core.too_large, core.rate_limited (03); security.account_required, security.device_not_enrolled (00); channel.plaintext_rejected (09); message.too_large, message.not_editable (11); mls.commit_required, mls.fork_detected, mls.not_member, mls.generation_retired, mls.group_not_found (13); moderation.timed_out (10).

The codes history.handover_denied, history.link_invalid and history.epoch_out_of_range and the events history.link_needed and history.link_added of earlier drafts belonged to the automatic handover that the revised D-007 removed. They are withdrawn and MUST NOT be reused (03 §10.4 rule 3, §11.2 rule 4).

Unknown codes in these areas are handled by userAction and retryable, as 03 requires.

16. Timers, limits and test vectors

16.1 Timers

Timer Value Section
Epoch grace window sealedGraceMs 30,000 ms, one epoch, non-membership commits only §5.3
Archive append (history keys and shared message keys) Within 60 s of learning a key §12.3, §12.7
Credential retry for pending_sender 5 s doubling to 10 min; shown as invalid after 24 h, retried on reopening the context §6.4

16.2 Limits

Limit Value Section
Items per HistoryShare (maxShareItems) 5,000, in a range of at most 5,000 sealed items; the request body also within maxRequestBytes (03) §7.3, §7.7
Key wraps per HistoryShare 1 to 100 §7.4
HistoryShares created per account per context 30 per hour §7.7
HistoryShares per listing page 1 to 10, default 5 §8.4
Keys per shared_keys record 32 §12.7, 08 §9.5
Credential lookups per request 100 §8.5
Padding bucket 256 bytes §4.5
Minimum rate limit per endpoint 10 per second burst, 1 per second sustained, per session §8.1
SealedMessage plaintext maxMessageBytes before padding (11); roundUp256(maxMessageBytes) after §4.5

16.3 Derivation vectors

All values are hexadecimal unless marked b64u. The K_hist inputs in §16.3.2 are arbitrary test keys, not exporter outputs.

The vectors of §16.3 to §16.6 are normative. They are also published in machine-readable form as spec/vectors/14-sealed.json, in the format of 04 §16.2. If the file and this document disagree, this document wins until the error is corrected (04 §16.1).

16.3.1 K_hist from an MLS exporter secret (ciphersuite 0x0001, SHA-256)

exporter_secret     808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
KDFLabel (DeriveSecret, label "sv1 history", context "", length 32)
                    0020134d4c5320312e302073763120686973746f727900
DeriveSecret(exporter_secret, "sv1 history")
                    6a493a7e385de3ce387bbf65b0a1d1bd0136db1c53ded114998ee7c1db520ec2
KDFLabel ("exported", context = SHA-256(""), length 32)
                    0020104d4c5320312e30206578706f7274656420e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
K_hist = MLS-Exporter("sv1 history", "", 32)
                    f8065d70d6dbc53495f9b7b1fb7350859d4e417a8cf5c53314896dd1cd225dbd
ekid(K_hist)        a49e3e3ebcf4e1f4

These were computed from the RFC 9420 §8 definitions (ExpandWithLabel with the "MLS 1.0 " prefix and one-byte variable-length prefixes). Implementers SHOULD also check them against an RFC 9420 library before relying on them.

16.3.2 ekid, K_msg, kc

K_hist(42)          000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
ekid(42)            6055c06d62559306                       b64u YFXAbWJVkwY
mid                 01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6
mid16               01938f301b2c7d4e8f90a1b2c3d4e5f6
K_msg(42, mid)      45c1904c516af3bce29f9941e0ef08a864efaeb26a3840e1563e75e87e3f1ca4
kc                  5a20ed32edbb23247c0b85ebfb45f493       b64u WiDtMu27IyR8C4Xr-0X0kw

K_hist(41)          202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f
ekid(41)            b448d939bc9fd114                       b64u tEjZObyf0RQ

K_hist(256)         404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f
ekid(256)           af4937a8abdee16e                       b64u r0k3qKve4W4

K_hist(0)           606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f
ekid(0)             a09cb8e93b4d3fcd                       b64u oJy46TtNP80

16.4 Full SealedMessage

Inputs:

host                b.com
ctx                 ch:01938a11-2b3c-7d4e-8f90-112233445566
gen                 1
group_id            sv1:b.com:ch:01938a11-2b3c-7d4e-8f90-112233445566:1
sender              alice@a.com
did                 q2bS9xVg3m0yJpQe1vT0Aw  = ab66d2f71560de6d3226941ed6f4f403
mid, epoch, K_hist  as §16.3.2 (epoch 42)
kind                message (no ref)
nonce               a0a1a2a3a4a5a6a7a8a9aaab
DSK private seed    4ccd089b28ff96da9db6c346ec114e0f5b8a319f35aba624da8cf6ed4fb8a6fb
DSK public          3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c
dkf                 FtIu-VbGrfe_KB6CH7GNwODB72MNxj_ml11dEvO-7kk
content (48 bytes)  {"text":"Hello","replyTo":null,"attachments":[]}
plaintext           content followed by 208 bytes 0x20 (256 bytes in total)

(The DSK is RFC 8032 §7.1 test 2, Alice's desktop DSK in 07 §21.1. The content is illustrative; its schema belongs to 11.)

Outputs:

SealedHeader (152 bytes)
  01 0033 7376313a622e636f6d3a63683a30313933386131312d326233632d376434652d386639302d3131323233333434353536363a31
  000b 616c69636540612e636f6d
  ab66d2f71560de6d3226941ed6f4f403
  01938f301b2c7d4e8f90a1b2c3d4e5f6
  000000000000002a
  6055c06d62559306
  07 6d657373616765
  00
  a0a1a2a3a4a5a6a7a8a9aaab
  5a20ed32edbb23247c0b85ebfb45f493

ct (272 bytes = 256 + 16-byte tag)
  177e4361d8cca4258ef76da2fd8b47cdda206166e6557a87c8e6bcd12c6269a3905c277f3f4541d25cf310eb8e2b2d87
  bef1fe6afd80e4bff1152402dea62a0d5a0bb5f5d60cc3ebf6555d18bc0fe208770169f070d05487449f347de9cd3ada
  747e36ff99f4717b3e7b8f41d62b7a8d249ddd1a13e16067d4d643d53690398fd06c39d3f69159ff56ef9924922c3570
  4bd4105eb0d7c9a2c1d20c4f7b004bcedfd0831c34730dcaf00b444d98cb7de93a332507ded0da9fb47aef75fd93837c
  9c568838ddd0c4012d5c1024309d71b78068b024467b68b7e8e773bb0f9882eadb8c7fb8eafdfe835fc6d3001c53a73f
  c02988f98a0554e6750f07ae3e4cb91fb214ddaa5f7b06dd173d704db690deb1

Signing input = "sv1 sig" 00 "sealed" 00 || SealedHeader || u32(272) || ct
  length 443 bytes, SHA-256 1da979b8902536f7f91fbb691eae03968229518b899543a07ac87e6bf292d394

sig
  a57fba134b68289cba5113139e85cc978ab86f2ed3eb1a6b37f241a00ad9ce23
  560092f396443e9570234d3f8e03c99c80f850bac4781455b6602e545704bb0c

The resulting JSON object is the sealed member in the first example of §4.8.

16.5 HistoryShare

bob@b.com shares the message of §16.4 (sequenced at seq 4188 and, for this vector, not edited) with carol@c.com, who joined the channel at seq 5210.

Inputs:

host                b.com
ctx                 ch:01938a11-2b3c-7d4e-8f90-112233445566
shareId             01938f50-1a2b-7c3d-8e4f-5a6b7c8d9e0f   mid16 01938f501a2b7c3d8e4f5a6b7c8d9e0f
sharer              bob@b.com
sharer did          Yx3kP0aL9qR2sT5uV8wZ1A   = 631de43f468bf6a476b13e6e57cc19d4
sharer DSK seed     833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42   (RFC 8032 §7.1 TEST SHA(abc))
sharer DSK public   ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf
recipient           carol@c.com
recipient did       wMHCw8TFxsfIycrLzM3Ozw   = c0c1c2c3c4c5c6c7c8c9cacbcccdcecf
recipient box key   909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf   (X25519 private)
dbk                 9fd7ad6dcff4298dd3f96d5b1b2af910a0535b1488d7f8fabb349a982880b615   (b64u n9etbc_0KY3T-W1bGyr5EKBTWxSI1_j6uzSamCiAthU)
fromSeq, toSeq      4100, 4189
count               1
item                mid 01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6 and K_msg(42, mid) of §16.3.2
K_share             c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf   (fixed only for the vector)
nonce               d0d1d2d3d4d5d6d7d8d9dadb   (b64u 0NHS09TV1tfY2drb)
HPKE ephemeral      101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f   (X25519 private; fixed only for the vector)

Outputs:

Bundle (53 bytes)
  01 00000001
  01938f301b2c7d4e8f90a1b2c3d4e5f6 45c1904c516af3bce29f9941e0ef08a864efaeb26a3840e1563e75e87e3f1ca4

ShareHeader (137 bytes)
  01 0005 622e636f6d
  0027 63683a30313933386131312d326233632d376434652d386639302d313132323333343435353636
  01938f501a2b7c3d8e4f5a6b7c8d9e0f
  0009 626f6240622e636f6d
  631de43f468bf6a476b13e6e57cc19d4
  000b 6361726f6c40632e636f6d
  0000000000001004 000000000000105d 00000001
  d0d1d2d3d4d5d6d7d8d9dadb

ct = AES-256-GCM(K_share, nonce, Bundle, aad = ShareHeader)   (69 bytes = 53 + 16-byte tag)
  d7b1d0cce44bc9a5392adacdd67f58ca173e57a65462f7de5eb9e71e357d2341143cda678d1bea36b7e6d38e52b9ef9f
  99b7653e46590c78ca87cfc3ed51b5c71c9e6f945d

HPKE info (50 bytes) = "sv1 history-share" 00 || mid16(shareId) || did16(recipient did)
  73763120686973746f72792d7368617265 00 01938f501a2b7c3d8e4f5a6b7c8d9e0f c0c1c2c3c4c5c6c7c8c9cacbcccdcecf
enc                 d89e3bad79437dbed9f843418304f460ff05c7fe81fe4a9577a804cb9367ff66
shared_secret       7820f18e4c38f207153bace63eee39c9c06777acfe4b8d6c6d8d74a90b960626
key                 a229e38f12a6a4bd30221a4617b959a86c2aea2acd58f7b5f30d884b56c74cec
base_nonce          338393f5867c7bc28be5f374
wrap (48 bytes)     93ea458facc86f88a30747b4e69f7af8747ad70f4fbcbd4dad3f47378d8e9b8bf30f319ef9b05dec71e6169571df3f84

Signing input = "sv1 sig" 00 "history-share" 00 || ShareHeader || u32(69) || ct
  length 232 bytes, SHA-256 e7d3ee8cf647128adf46bcd650d093ade260bd120ae562ad6e15b2f7d7ed613d

sig
  bff968346aeff4ff84908a2a9bbd5dbcc886a99f5d4aa81c3d6cc1a372f1ec93
  465f91f27c68535cbd654c271cdd4863c89d545cbff9325f64a5fbf5fa67df06

The resulting JSON object is the request body in the example of §8.3. The key wrap was computed with a from-scratch HPKE and opens with the HPKE of Python cryptography 50; the signature verifies with that library's Ed25519.

16.6 Negative vectors

Implementations MUST reject each of these, derived from §16.4. Each has one expected result per verifier, under this state:

  • Server: hosting server b.com; the context's current generation is 1, in state active with no pending proposals; its current epoch is 42, created by a commit sequenced more than 30 s earlier; the settled reference ekid of epoch 42 is YFXAbWJVkwY; the posting session is alice@a.com's device q2bS9xVg3m0yJpQe1vT0Aw, which has a leaf in epoch 42 with the DSK of §16.4.
  • Client: a member device whose key store holds K_hist(1, 42) of §16.3.2 with source mls, and no key for epoch 43; Alice's leaf with the DSK of §16.4 is in its MLS state.
Change to the §16.4 SealedMessage Expected result
kc with its last byte changed Client: invalid at §6.3 step 6 (kc is in the signed header, so the signature fails before step 8). Server: sealed.bad_signature (§5.2 step 13).
epoch 43 with everything else unchanged Client: pending_key at §6.3 step 3. Server: sealed.wrong_epoch at §5.2 step 11, with data {"gen": 1, "epoch": 42}.
Unchanged, but the verifier builds the SealedHeader with sender bob@a.com and Alice's DSK Client: invalid at §6.3 step 6.
Unchanged, but the verifier builds the SealedHeader with host c.com Client: invalid at §6.3 step 6.
ekid encoded as YFXAbWJVkwZ (non-zero trailing bits) Client: invalid at §6.3 step 1. Server: sealed.invalid (§5.2 step 5).
Report with K_msg = K_hist(42) (the epoch key instead of the message key) bad_key (§13.2 step 5): HMAC-SHA256(K_hist(42), "sv1 kc")[0..16] is c71dff3ea1f4075806ffd9be79a4e1e9, not kc.

HistoryShare negative vectors, derived from §16.5. The server state is as above, with a leaf for bob@b.com's device Yx3kP0aL9qR2sT5uV8wZ1A and one for carol@c.com's device wMHCw8TFxsfIycrLzM3Ozw; the range check of §7.7 step 10 passes; the recipient is that device of Carol.

Change to the §16.5 HistoryShare Expected result
fromSeq 4099, everything else unchanged Server: history.share_invalid (field sig) at §7.7 step 11. Recipient: dropped at §7.8 step 2.
Unchanged, but the recipient rebuilds the ShareHeader with recipient dave@d.com Recipient: the signature fails; dropped at §7.8 step 2.
Unchanged, but the recipient opens the wrap with an info naming did q2bS9xVg3m0yJpQe1vT0Aw Recipient: HPKE open fails; dropped at §7.8 step 1.
A correctly signed share whose bundle item carries K_hist(42) instead of K_msg(42, mid) Recipient: the item fails the kc check at §7.8 step 5 and stays unavailable.
count 2 with the same ct Server: history.share_invalid (field ct) at §7.7 step 5: the decoded length must be 5 + 48 × 2 + 16.

17. Security considerations

  1. History keys outlive their epochs (D-007, D-054, 00 §10). Content keys don't expire with MLS epochs. Each device keeps K_hist for every epoch it can read, and the key archive keeps them under the vault key (§12), so that the user's own new devices can read everything the user could read. Anyone who compromises one current member device, or a user's vault together with the vault key, can therefore read all history that member's account can read. MLS still protects handshakes and media keys (18), and regular UpdatePath commits (13) limit how long a compromise lets an attacker read new content. Nothing hands earlier keys to newcomers, so a device of another account learns nothing from before that account's join, apart from what a member deliberately shared with it (§7). 22 states this plainly, and 20 must not describe a secure context as protected against a later compromise of a member's device.

  2. What the hosting server can and can't do. It can't read or forge content: content needs K_msg, which needs K_hist or a shared message key, and only members and the recipients of HistoryShares hold those. It can't create a HistoryShare, which needs a member's DSK signature and the keys. It can withhold, delay, reorder or delete SealedMessages and HistoryShares, serve wrong credential records, or serve ciphertext against §10.2. These are denial of service or metadata exposure, apart from the narrow attribution risk of item 5: ciphertext served against §10.2 can't be opened, because no key for it reaches the account. Clients dedupe by mid, so replaying a stored SealedMessage at a new seq has no visible effect. The binding of group_id and sender in the SealedHeader stops it from moving a SealedMessage to another context, group, generation or sender, and the ShareHeader binds a HistoryShare to its context, accounts and range in the same way.

  3. Malicious members. A member can always reveal content it legitimately holds to anyone, inside or outside the protocol; that is inherent to group messaging. Inside the protocol a member can share earlier messages only as §7 allows, and everyone sees that it did (items 18 to 21). No member can make content appear under someone else's name: a shared key is accepted only when the original sender's signature, kc and AEAD all verify (§7.8, §6.3).

  4. Forks. The hosting server is the only sequencer (D-037), and MLS confirmation tags stop a committer from giving members different epoch secrets for the same commit. Forks therefore come from bugs or a misbehaving server. Once an epoch's reference has settled (13 §15.2), the server refuses SealedMessages whose ekid differs from it (§5.2 step 11), so a forked sender resyncs before anyone receives its messages. During the at most 30 s before settlement nothing is refused, so that one bad committer can't make honest members resync. A receiver that still meets a mismatch decides with the reference which side is forked, and only after the signature verified (§6.6). One forked or malicious device therefore can't make the other members resync. A shared message key opens only the one message whose signed kc it matches, so it can't cross a fork.

  5. Historical attribution. A client never shows content whose signature it hasn't verified, and never shows content under an address whose credential it rejected (§6.1, §6.4). For epochs a device was itself in, the sender's key must be a leaf that device validated (§6.2), so the hosting server's credential records can't change who sent a live message. For items from epochs a device wasn't in, such as its account's earlier items or shared items, the sender's credential comes from the hosting server's credential record (§5.6). In channels that matches the trust model (the server is the Authentication Service, D-035): a malicious hosting server, together with any member who holds the epoch's key, could attribute a historical message to a member under a fabricated credential, which the background check against the member's home server (§6.2) can expose only for the current identity key. In DMs a record is accepted only for an identity key the client pinned, the key the pin replaced, or one listed in sv_participants (§6.2), so the same attack needs the victim's real DSK. Two residual risks remain for 22: in DMs, a stolen DSK of a device revoked without a DeviceRevocation can attribute backdated messages, because the revocation check relies on the hosting server's timestamps (§6.2); and without full pin history (§18, question 2), genuine messages signed under an identity key older than the one the pin last replaced (prevIk) show as "This message can't be shown".

  6. Non-repudiation, not deniability. Every SealedMessage carries an Ed25519 signature by a device key that chains to the sender's identity key. Anyone holding the ciphertext and K_msg can prove to a third party which device sent what. That property makes reports work (D-040), and it removes the deniability that some messaging systems give. Users aren't told their messages are deniable, and 20 MUST NOT say so.

  7. Key commitment. AES-GCM isn't committing. Without kc, a reporter could craft a key under which a real ciphertext decrypts to forged plaintext, the "invisible salamander" and partitioning-oracle attacks. kc = HMAC-SHA256(K_msg, "sv1 kc") truncated to 128 bits is collision resistant, and signed by the sender, so the reporter can't substitute a key. K_msg is used both as the AES key and as the HMAC key of kc. These are independent primitives, there is no known interaction, and 00 fixes this construction. The same reasoning covers the attachment rule of §13.4: a file key is accepted only as the key named inside a verified message, SVF1's own commitment binds the blob to that key (04 §10.2), and the signed sha256 binds the file's content, so nobody who learns the key can substitute another file.

  8. The epoch grace window lets a message sealed under epoch E − 1 be accepted for 30 s after an UpdatePath commit. That briefly delays the post-compromise benefit of the update for those messages. It never applies across a join or a removal, so a removed device can't read anything accepted after its removal, and a device that has just joined never meets a message sealed after its join that it can't read.

  9. Metadata. The header shows the server, and anyone who later gets the ciphertext, the context, generation, epoch, ekid, kind, target, sending device, and padded size. These are consistent with 00 §5.4. ekid reveals only which messages share an epoch, which the epoch number already reveals. Padding to 256 bytes hides the exact length of short messages. A HistoryShare shows the hosting server who shared which range with whom, how many items, and which of the recipient's devices it was wrapped to; every member sees the first three through K8. The archive (§12.4) hides from the hosting server which keys a user's own new device lacks.

  10. Visibility is enforced by the server for ciphertext and by key distribution for content (D-007, D-061). A malicious hosting server can serve earlier ciphertext to a newcomer, a bot or a participant re-added after an identity change, but no key for it reaches them: no member's device hands keys to newcomers, and a HistoryShare needs a member's deliberate, visible act. What such a server can expose is metadata: the senders, times and sizes of earlier items. Bots are treated like people (§11).

  11. Report evidence becomes visible to the hosting server's moderators (D-077). A report reveals only the reported messages and, if the reporter keeps the default, up to 10 messages on each side (10). The reporter's client never sends K_hist (§13.1). Revealed keys open exactly those messages, because K_msg is per message. Moderators never see unverified content as content (§13.5).

  12. Reports after deletion. Keeping sigHash in tombstones, and for content superseded by an edit (§5.7), lets a recipient prove what an author sent and then deleted or edited away. That is deliberate. It reveals no content to the server unless someone reports.

  13. Randomness and nonces. Every nonce is 96 random bits. K_msg is used for exactly one encryption, K_share encrypts exactly one bundle, and every HPKE wrap is single-shot with a fresh ephemeral key. The number of encryptions per key is tiny, far below the AES-GCM random-nonce bounds of 04.

  14. The notification extension verifies signatures with a public-key cache (§6.7), so a member can't spoof the sender of a lock-screen preview. It holds only recent K_hist values, which limits what a compromised extension process exposes.

  15. Archive-based recovery depends entirely on the vault key's secrecy (08). A home server that holds the archive can't read it. A device that the user revoked as lost or stolen loses access to records written after the rotation, because the same flow replaces the recovery key (D-054 as revised by D-082, 08 §10.8); a device removed routinely still knows the recovery-phrase entropy and, with the KeyBackup, can read the new vault generation (22 RR-33). Either way it keeps the keys it already had.

  16. A login takeover or reset reads no earlier content (D-071, D-007 as revised). Someone who takes over a user's OIDC login can reset the identity at once. The new identity's devices hold no earlier history keys: nothing hands keys to newcomers, and the previous identity's archive opens only for an old device of the same account (08 §11.4). In 1:1 DMs and group DMs the re-add also starts a new membership, so the server serves nothing earlier (§10.9). In channels the membership continues and the server keeps serving earlier ciphertext, which the new identity can't open. What remains is what D-071 accepts: the attacker reads everything sent after the takeover, the victim's own devices see W4a, and DM contacts see W2. A member could still share earlier messages with the account deliberately, which every member sees (K8). 22 states this.

  17. Pending commits. A committer derives the next epoch's key before its commit is accepted, but never stores it until acceptance (§3.1). A lost compare-and-set therefore can't leave a phantom key that later looks like a fork.

  18. What a HistoryShare reveals. The recipient learns exactly the listed messages and their attachments, and, as metadata, which sealed items exist in the range, with their senders, times and sizes. The hosting server learns who shared which range with whom, how many items, and which of the recipient's devices the wraps went to; every member learns the first three from K8, and in channels the audit log keeps them (10). Nothing else sealed in those epochs opens, because a share carries per-message keys, never K_hist (§3.3). A share can't be withdrawn: the keys have reached the recipient's devices.

  19. Senders' signatures stay verifiable. The recipient accepts a shared key only after the original sender's signature and key commitment verify (§7.8), exactly as for a report (§13). So a sharer can't put words in anyone's mouth: an altered key fails kc, and an altered message fails the signature. The sharer signs the share itself, so the sharer is accountable for having shared.

  20. Sharing with someone who shouldn't see it. A member can share earlier messages with a newcomer whom other members wouldn't have chosen. Mitigations: in channels only holders of share_history can share (by default the admin and Moderator roles, 10); every member sees K8, and channels record the share in the audit log (10); a member can share only what its own account is served (§7.7 step 10); and the recipient must be a current member. A member can leak content outside the protocol anyway; the protocol makes the in-band path visible.

  21. No share without a deliberate act. Clients create shares only on their user's explicit action, never automatically, by default or on a prompt (§7.1), and bot accounts can't create them (§11). The hosting server can't create one, because it needs a member's DSK signature and the message keys.

  22. Box keys. Key wraps use the recipient device's box key from its DeviceCertificate (dbk, 07), which the identity key certifies and the sharer reads from a leaf it validated, so the hosting server can't substitute its own key (§7.5). A stolen device's box key opens every share wrapped to it, as its key store would anyway. A revoked device loses its leaf, so later shares aren't wrapped to it.

18. Open questions

  1. (Resolved and removed: 00 §7.4's example now carries ctx and gen. The number is kept so that references to the later questions stay valid.)

  2. Pin history for historical DM messages (07, 08). Verifying a DM message sent before a contact's reset needs the identity key the contact had then. 07's pin record keeps the current key and the one it last replaced (prevIk), so messages from before an earlier reset can't be verified and show as "This message can't be shown" (§6.2, §6.4). Recommendation: 07 keeps, in each pin record in the AccountVault, the list of identity keys previously accepted for that address (with the time each was replaced), so that §6.2 can accept them.

  3. Neutral placeholders (20). §6.4 needs two neutral, non-security lines: one for content that can't be obtained ("Earlier messages aren't available on this device") and one for content that failed verification ("This message can't be shown"). They aren't warnings and add nothing to the D-055 catalogue. 20 already defines them as ST.history_unavailable and ST.message_invalid. Recommendation: the owner confirms that these content-state lines are outside the closed warning catalogue, and 20 owns their copy.

  4. (Resolved and removed: the revised D-007 removes the history setting, so nothing can switch. The number is kept so that references to the later questions stay valid.)

  5. Reports of deleted messages (owner). §5.7 and §13.3 let a recipient report a message the author has deleted, using the recipient's cached copy and a digest the server keeps. Recommendation: adopt it. It counters "harass and delete" without revealing content to anyone unless reported.

  6. (Resolved and removed: the revised D-007 removes history handover in every context, so 1:1 DMs and all other secure contexts rely on the key archive alone (§10.4). The number is kept.)

19. References

19.1 Normative

  • RFC 2119, RFC 8174: requirement key words
  • RFC 5234: ABNF
  • RFC 8259: JSON; RFC 7493: I-JSON
  • RFC 4648: base64url
  • RFC 9562: UUIDv7
  • RFC 9457: problem details for HTTP APIs
  • RFC 9420: The Messaging Layer Security (MLS) Protocol (exporter §8.5, key schedule §8, credentials §5.3)
  • RFC 5869: HKDF
  • RFC 2104: HMAC; FIPS 180-4: SHA-256
  • NIST SP 800-38D: GCM; FIPS 197: AES
  • RFC 8032: Ed25519
  • RFC 9180: HPKE (key wraps of HistoryShares)
  • RFC 7515: JWS; RFC 7638: JWK thumbprint
  • spec/00-overview.md: §4 security model, HP-3, HP-4, HP-11, §7 conventions
  • spec/03-transport.md: envelope, "online for a stream", reduced payloads (D4), error object, pagination, idempotency, rate limits
  • spec/04-crypto-conventions.md: suite sv1-c1, labelled signatures, label registries, AEAD rules, HPKE (§9.8), attachment encryption (SVF1), test-vector format
  • spec/07-identity.md: IdentityCertificate, DeviceCertificate, local credential check (§10.4), device validity and DeviceRevocation, pins (ik, prevIk), message requests (§14.7), the DeviceCertificate's dbk claim
  • spec/08-device-setup-recovery.md: AccountVault, archive and shared_keys record formats and merge, quota, retired vaults and import, box keys (§10.1), notification key subset, platform key storage
  • spec/09-communities-channels.md: membership and visibility ranges (§7.2), upgradeSeq, channel.plaintext_rejected
  • spec/10-roles-moderation.md: Report object and workflow, report.forwarded, verification away from the hosting server (§10.12), the share_history permission, the audit log (§11)
  • spec/11-messaging-attachments.md: kinds and content schema, posting procedure and idempotency, history visibility and reduced payloads, AttachmentRef key and sha256, maxMessageBytes
  • spec/12-direct-messages.md: DM security, joinedSeq, the reopening after peer_deleted (§6.4), re-add after an identity change (§11.5), dm.request
  • spec/13-mls-profile.md: group IDs and generations, GroupBootstrap and CommitSubmission, leaves and the sv_device credential (§3.3), freeze, removals, handshake log, reference ekid, fork handling, MlsReport
  • spec/15-calls-control.md: /v1/diagnostics and report kinds
  • spec/19-notifications-push.md: notification extension flow
  • spec/20-client-requirements.md: markers K3, K4, K6, K7 and K8, the share action, copy

19.2 Informative

  • RFC 9750: MLS architecture
  • spec/DECISIONS.md: decision log (D-007 as revised, D-038, D-040, D-054, D-061 as amended, D-071, D-077; D-039 and D-070, superseded)
  • spec/22-security-considerations.md: whole-system threat model
  • P. Grubbs, J. Lu, T. Ristenpart, "Message Franking via Committing Authenticated Encryption", CRYPTO 2017
  • Y. Dodis, P. Grubbs, T. Ristenpart, J. Woodage, "Fast Message Franking: From Invisible Salamanders to Encryptment", CRYPTO 2018
  • J. Len, P. Grubbs, T. Ristenpart, "Partitioning Oracle Attacks", USENIX Security 2021
  • A. Albertini, T. Duong, S. Gueron, S. Kölbl, A. Luykx, S. Schmieg, "How to Abuse and Fix Authenticated Encryption Without Key Commitment", USENIX Security 2022