Protocol guide
Secure accounts and devices
How an account turns on end-to-end encryption, which keys and signed objects describe it, how a new device gets the keys, and how clients pin, verify, recover, reset and store them.
Specification: 07 Identity keys, certificates and verification, 08 Turning on encryption, pairing, backup and the vault
A secure account has an identity key that all its enrolled devices share, a signing key on each device, and an encrypted backup and vault on its home server. An insecure account has none of these (07 §3.1, 08 §2). Device records, sessions and fresh authentication are on Accounts and sign-in; how the keys are used in MLS groups is on MLS and sealed messages.
Secure contexts only
Only enrolled devices of secure accounts keep pins, raise W2, read the vault or show the recovery key. Insecure accounts still have a published IdentityState, and every client, enrolled or not, still raises W2's new-account wording in a 1:1 DM (07 §16, 07 §16.8).
Keys
One key is shared by the account and two belong to each device (07 §3):
| Key | Algorithm | Scope | Used for |
|---|---|---|---|
| Identity key (IK) | Ed25519 | One per account and identity generation (igen). Every enrolled device holds the same private key. |
Signing exactly three object types: IdentityCertificate, DeviceCertificate, DeviceRevocation |
| Device signing key (DSK) | Ed25519 | One per device. Never leaves the device. | MLS leaves and handshakes, SealedMessages, HistoryShares, MediaAttestations, DeviceProofs, the vault-box-key and vault-generation labelled signatures |
Box key (dbk) |
X25519 | One per device. Never leaves the device. | Receiving keys sealed to this device with HPKE (VaultKeyGrants, HistoryShare K_share). Never signs. |
Contacts reason only about the identity key. A new phone receives the IK, certifies its own new DSK, and nobody is warned (07 §2).
- Your IK signing function must accept only the
typvaluessv-idcert+jwt,sv-devcert+jwtandsv-devrevoke+jwtand build the header itself, because the IK is the root of every pin and must never sign attacker-influenced data (07 §3.3). - A device generates a new DSK and box key every time it enrols, including after a reset. The home server keeps every key thumbprint ever registered for the address and refuses a repeat with identity.key_reused, so every new key is detectable by pins (07 §3.4).
Enrolled devices also hold the account secrets that the backup and vault carry: the vault keys K_vault(g), the vault ID key K_vid, and the 10-byte phrase entropy E behind the recovery key. Every secret can be recovered from an enrolled device, or from the recovery phrase plus a home session (08 §2).
Signed identity objects
Four compact JWS objects describe the identity. All use alg EdDSA, and each header has exactly alg, typ and kid; any other header member fails malformed (07 §4.1).
| Object | typ |
Signed by | kid |
Max size | Lifetime |
|---|---|---|---|---|---|
| IdentityCertificate | sv-idcert+jwt |
IK (self-signed) | thumb(ik) |
2,048 bytes | Until the next reset |
| DeviceCertificate | sv-devcert+jwt |
IK | thumb(ik) |
2,048 bytes | Until revoked or reset |
| DeviceRevocation | sv-devrevoke+jwt |
IK | thumb(ik) |
1,024 bytes | Permanent |
| IdentityState | sv-idstate+jwt |
Home server sign key |
<domain>#<keyId> |
32,768 bytes | exp − iat ≤ 86,400 s |
Reject an object over its size limit before parsing it, reject duplicate JSON member names, and reject exp or nbf in certificates and revocations (nbf in IdentityState). Never re-serialize: signatures cover the exact bytes, and later checks compare certificates byte for byte (07 §4).
The IdentityCertificate binds the IK to the canonical address, a generation and the account kind. It proves nothing until a home-signed IdentityState names it in idc, or a contact has pinned its key (07 §5). The DeviceCertificate binds a device ID, its DSK and its box key to the IK; a device issues one only for itself (07 §6.2). Decoded headers and payloads from 07 §5.4 and 07 §6.4:
{"alg":"EdDSA","typ":"sv-idcert+jwt","kid":"kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k"}
{"sub":"alice@a.com","ik":{"kty":"OKP","crv":"Ed25519","x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo"},"igen":1,"kind":"user","iat":1764800000}
{"alg":"EdDSA","typ":"sv-devcert+jwt","kid":"kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k"}
{"sub":"alice@a.com","igen":1,"did":"q2bS9xVg3m0yJpQe1vT0Aw","dsk":{"kty":"OKP","crv":"Ed25519","x":"PUAXw-hDiVqStwqnTRt-vJyYLM8uxJaMwM1V8Sr0Zgw"},"dbk":{"kty":"OKP","crv":"X25519","x":"ST6C_HRGSlkmiBdiPSBTxeuOLMSpiLT-4XnsawENUx0"},"plat":"desktop","iat":1764800000}plat is desktop, web, ios, android or bot, and is bot exactly when kind is bot. Accept an unknown plat from a user account and show it as a generic device, so new platforms don't break old clients (07 §6.1).
The DeviceRevocation {sub, igen, did, iat} says one device is revoked for good: it covers that did in every generation, and the home server refuses any later DeviceCertificate for it with identity.device_revoked. Count it only when it appears in revoked[].rev of a verified IdentityState, because a thief with a copy of the IK could otherwise revoke the owner's devices directly (07 §8.2).
Warning
A kid that doesn't match the key fails malformed on an IdentityCertificate but key_mismatch on a DeviceCertificate or DeviceRevocation (07 §5.3, 07 §6.3, 07 §8.3). Test N1 of 07 §21.10 checks the IdentityCertificate case. The full compact forms in 07 §21 are signed with the RFC 8032 Ed25519 test keys (the box key is the X25519 key of 04 §16 V-12), so you can reproduce every signature.
IdentityState
The home server publishes an IdentityState for every account it hosts, insecure accounts and bots included: its signed statement of the security state, generation, IdentityCertificate and active devices (07 §7.1). A secure account's payload (07 §7.7):
{
"iss": "a.com",
"sub": "alice@a.com",
"inc": "sLGys7S1tre4ubq7vL2-vw",
"ver": 17,
"sec": "secure",
"igen": 1,
"idc": "eyJhbGciOiJFZERTQSIsInR5cCI6InN2LWlkY2VydCtqd3QiLCJraWQiOiJrUHJLX3FteFZXYVlWQTl3d0JGNkl1bzN2Vnp6N1R4SENUd1hCeWdyUzRrIn0.eyJzdWIi…",
"devices": [
{ "did": "q2bS9xVg3m0yJpQe1vT0Aw", "dkf": "FtIu-VbGrfe_KB6CH7GNwODB72MNxj_ml11dEvO-7kk", "plat": "desktop", "since": 1764800000 }
],
"revoked": [
{ "did": "Yx3kP0aL9qR2sT5uV8wZ1A", "at": 1764850000, "rev": "eyJhbGciOiJFZERTQSIsInR5cCI6InN2LWRldnJldm9rZStqd3Qi…" }
],
"iat": 1764872400,
"exp": 1764958800
}An insecure account's state has sec: "insecure", no idc and empty devices. Three counters carry most of the meaning (07 §7.3):
vergoes up by exactly 1 on every content change. A refresh that changes onlyiatandexpkeeps it, so two states with the sameverand different content prove the home server equivocated.igenis 0 for an address that was never secure and goes up by 1 at every upgrade, re-upgrade, reset and downgrade. Never infer the security state from it; onlysecsays that.incnever changes while the account exists. A deleted address registered again gets a newinc, which you treat as a different account, not a key change (07 §11.9).
The server should re-sign every 12 h, and the served state always has at least 1 h of validity left. devices holds at most 64 entries; revoked holds at most 50, of which only the 8 most recent keep their rev, and an entry stays at least 90 days unless those limits force it out (07 §7.1, 07 §7.2).
Fetching and verifying
GET /v1/users/{local}/identity is public, cacheable for at most 60 s (If-None-Match gets a 304 when nothing changed), and returns the state with the DeviceCertificates in the same order as devices. It answers identity.not_found for an unknown local part and identity.account_deleted while a deleted account's local part is in quarantine (07 §11.1, 07 §11.2):
GET /server/v1/users/alice/identity HTTP/1.1
Host: chat.a.comHTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: public, max-age=60
ETag: "17-1764872400"
Access-Control-Allow-Origin: *
{
"address": "alice@a.com",
"state": "eyJhbGciOiJFZERTQSIsInR5cCI6InN2LWlkc3RhdGUrand0Iiwia2lkIjoiYS5jb20jMjAyNi0xMmEifQ.eyJpc3MiOiJhLmNvbSIs…",
"deviceCertificates": [
"eyJhbGciOiJFZERTQSIsInR5cCI6InN2LWRldmNlcnQrand0Iiwia2lkIjoia1ByS19xbXhWV2FZVkE5d3dCRjZJdW8zdlZ6ejdUeEhDVHdYQnlnclM0ayJ9.eyJzdWIi…"
]
}/server is the path of the example server's base URL, which you find by discovery. For your own account, GET /v1/me/identity adds thisDevice: {did, enrolled}; call it at every start and every home WebSocket reconnect (07 §11.3).
VerifyIdentityState checks size, header, payload types, subject, that iss matches the domain of sub and kid, the signature under the server key found by discovery, the time window (skew 60 s, and exp − iat from 1 to 86,400) and the embedded idc (07 §7.4). It then compares the state with your verifier store, the highest state you accepted for that subject:
| Compared with the stored state | Result |
|---|---|
Lower ver |
state_rollback |
Same ver, different content |
state_equivocation |
Higher ver, lower igen |
state_rollback |
Higher ver, same igen, both secure with different idc, or different sec |
state_equivocation |
New inc without a higher igen, or an inc already replaced |
state_rollback |
On a client the verifier store is local only; pins sync between devices, the store doesn't. If a home server later lists one of its sign keys as revoked, discard every state signed by it that you didn't accept before rvt − 60 s by your own clock, and refetch; otherwise whoever held the key could sign one state with a huge ver and lock the account out (07 §7.5).
Freshness and dual control
| Name | Test | Used for |
|---|---|---|
| Unexpired | exp > now − skew |
Everything |
| Fresh for admission (DM) | Unexpired and iat ≥ now − 86400 − skew |
A client admitting a new device into a DM |
| Fresh for the channel AS | Unexpired and validated ≤ 300 s ago | A hosting server admitting a channel leaf |
A device is valid only under dual control: its DeviceCertificate verifies under the current IdentityCertificate's key, it is listed in devices of a sufficiently fresh accepted state with dkf equal to thumb(dsk), and no DeviceRevocation covers it. The home server can't meet the first condition without the IK; a thief with a copy of the IK can't meet the second without a home session (07 §7.6, 07 §9).
Note
An expired state or an unreachable home server never invalidates a device that was already admitted. Only positive evidence does: a newer verified state that delists it or changes igen, sec or inc, a verified DeviceRevocation, or proof the account was deleted (07 §14.4).
Turning on encryption
"Turn on encryption" makes an insecure account secure in one tap. Offer it in account settings, on every G1 gate card (the interrupted action then resumes), and right after sign-up on a secure server or at sign-in of an account in upgrade_required, where it blocks every other screen (08 §3.1). Ask no question before generating keys. The only decision is how to save the recovery key, and "Later" is a valid answer.
The 24 h provider sign-in
The home server accepts PUT /v1/me/identity only from a session whose last provider sign-in (authAt) is at most 24 h old (maxAgeMs 86,400,000), because every DM contact pins the first key silently and attaching it must take more than a stolen token (07 §11.4). The client checks earlier: if authAt is 23 h old or more, it runs fresh authentication (05 §9) before generating keys, then continues without another tap. The hour of margin keeps registration from failing mid-ceremony (08 §3.2). Bots use their token instead.
Before starting, also check that the account is a kind: "user" account in state insecure or upgrade_required, and on the web that IndexedDB and WebCrypto are available; if any check fails, don't start (08 §3.2).
Client procedure
"Persist" means writing to the local key store and waiting for the write (08 §3.3):
| Step | Action |
|---|---|
| U1 | Fetch your own IdentityState and read igen as g0. |
| U2 | Generate the IK, DSK, box key, K_vault(1), K_vid, E, phraseId and backup salt. Persist them as pending_upgrade. |
| U3 | Build the IdentityCertificate (igen = g0 + 1) and this device's DeviceCertificate. Persist both. |
| U4 | Derive the backup key with Argon2id and encrypt the backup payload. |
| U5 | Stage the KeyBackup: PUT /v1/me/backup with "stage": true. |
| U6 | Register the identity: PUT /v1/me/identity. |
| U7 | Set the state to enrolled, initialize the vault, upload the box key, write the recovery record with savedAt: null. |
| U8 | Show the save step. Never before U6 succeeds, so the user never saves a key that doesn't work. |
| U9 | In the background: publish KeyPackages, resume the interrupted action, let eligible DMs upgrade. |
PUT {home}/v1/me/identity
Authorization: Bearer …
Content-Type: application/json
{
"identityCertificate": "eyJhbGciOiJFZERTQSIsInR5cCI6InN2LWlkY2VydCtqd3QiLCJraWQiOiJrUHJLX3FteFZXYVlWQTl3d0JGNkl1bzN2Vnp6N1R4SENUd1hCeWdyUzRrIn0.eyJzdWIi…",
"deviceCertificate": "eyJhbGciOiJFZERTQSIsInR5cCI6InN2LWRldmNlcnQrand0Iiwia2lkIjoia1ByS19xbXhWV2FZVkE5d3dCRjZJdW8zdlZ6ejdUeEhDVHdYQnlnclM0ayJ9.eyJzdWIi…",
"expectedIgen": 0
}The server activates the staged backup in the same transaction, so a secure user account never exists without a recovery path; without one it answers backup.required (08 §5.6.3). It then lists only this device, marks every other device not enrolled, and sends identity.changed with change: "upgraded" (07 §11.4).
Retry U5 and U6 with the same persisted material (backoff 1, 2, 4, 8 s, then every 30 s); U6 is idempotent for byte-identical certificates (08 §3.4). Other outcomes:
- identity.already_secure or identity.generation_mismatch: another device won. Zeroize the pending keys and become an unenrolled device showing "Approve this device", with no warning.
- backup.required: the staged backup expired after 24 h. Repeat from U4.
- auth.reauth_required: keep the material, sign in again, retry U6 once.
- The app stopped between U2 and U6: on the next start, fetch IdentityState. If its
idcequals the persisted IdentityCertificate byte for byte, continue at U7; ifigenis stillg0, continue at U4 with the persisted material after the recent-sign-in check; otherwise discard the material as above.
The account's other devices become unenrolled: they keep working in insecure contexts and show one non-blocking "Approve this device" banner. Contacts see nothing, because they have no earlier pin (08 §3.5, 08 §3.6).
Recovery phrase
Users see the recovery phrase as the "recovery key": 8 words encoding E and an 8-bit checksum C = SHA-256(E)[0]. The 11 bytes E || C are split into eight 11-bit indices into the BIP-39 English word list (08 §4.1). Only the word list is shared with BIP-39, so never present it as a wallet phrase. Test vector: E = 7f3a9c0e55d2b18e4a61 gives left stay adjust produce climb shrimp civil curtain (08 §17.1).
The canonical form is 8 lowercase words separated by single spaces (08 §4.2). Input must be forgiving (08 §4.3): apply NFKC and lowercase, turn every character outside a–z into a separator, and resolve each token to an exact word or, if it has at least 4 letters, to the one word sharing its first 4 letters. Exactly 8 resolved tokens are needed before the checksum is checked. So 1. Left 2. STAY 3. adjust 4. produ 5. climb 6. shrimps 7. civil 8. curtain is valid. Offer 8 numbered slots with autocomplete, plus a password-manager field (read-only username set to the canonical address, password field with autocomplete="current-password").
The save step (M4)
After an upgrade, a reset or a new recovery key, offer these options in this order (08 §4.4):
| Option | Counts as saved |
|---|---|
| Save to password manager (primary): username = canonical address, password = phrase, label "Sloppy Voice recovery key – " plus the address | Only on platform confirmation (Android createCredential, iOS SecAddSharedWebCredential). Where the platform can't confirm, as with web PasswordCredential or the sensitive-clipboard fallback used where no password-saving facility exists, an inline "Saved it?" decides. |
| Print or save as PDF, rendered locally, with no QR code of the phrase | When the platform reports the job completed, else "Saved it?" |
| Show words, with "I've written them down" | On that tap |
| Later | No; W8 applies |
There is no quiz. Block screenshots where possible (Android FLAG_SECURE, the iOS snapshot), keep the words out of your own screen share, and never put the phrase in logs or notifications. W8, a settings badge plus a banner at most once per 7 days per account, applies while the recovery record has savedAt: null (08 §4.7).
Any enrolled device can show the key again, after the operating system's user verification where the platform has one, or after one confirming tap on the web; unenrolled devices can't (08 §4.5). To make a new one, generate and persist a new E, phraseId and salt, then write a new backup with prevVer. On backup.version_conflict with an unchanged active phraseId, rebuild and retry; with a changed one, another device made a new phrase first: adopt it and never overwrite it. Then write the recovery record with savedAt: null and show the save step. You must do this after a lost or stolen device is revoked (08 §4.6).
KeyBackup
The KeyBackup is the account keys encrypted under the recovery phrase and stored on the home server, which can never open it (08 §5). The payload holds ik, idc, vaultIdKey, vaultKeys, phrase and phraseId, and no DSK, box key or MLS state, because those belong to one device (08 §5.2). The key comes from the entropy, not the words' text, so normalization can't make devices disagree (08 §5.3):
A = Argon2id(password = E, salt = S, m = kdf.m, t = kdf.t, p = kdf.p, tag length = 32, version = 0x13)
BK = HKDF-Expand(A, "sv1 backup" || 0x00 || lv(addr), 32)Writers use m: 65536, t: 3, p: 1 and a fresh salt for every new phrase. Readers check kdf against 04 §12.1 before running Argon2id, so a malicious server can't exhaust the device's memory. The AEAD associated data binds every client-set member except nonce, ct and kdf.alg (08 §5.4). The test vector of 08 §17.2:
{
"v": 1,
"addr": "alice@a.com",
"igen": 1,
"ikf": "qI__BOccgAhhH9wob_G7gFVHLKIkS4CutvoSx0bMCY8",
"vgen": 1,
"phraseId": "0NHS09TV1tfY2drb3N3e3w",
"kdf": { "alg": "argon2id", "v": 19, "m": 65536, "t": 3, "p": 1, "salt": "AAECAwQFBgcICQoLDA0ODw" },
"nonce": "oKGio6Slpqeoqaqr",
"ct": "cRj9TcONRKfw4u7zXvONSYwYf8ToW7ZlrSTnU6HTAkpjvJ5jEcE-gJx-1Zq1t1n-dYI6bsw88zy6qcH5cJq10EffT5…",
"ver": 3,
"state": "active",
"updatedAt": "2026-12-04T18:20:01.044Z",
"updatedBy": "q2bS9xVg3m0yJpQe1vT0Aw"
}Note
The 08 vectors use a different identity key from the 07 vectors, so this ikf isn't Alice's ikf from the sections above.
GET /v1/me/backup?part=metareturns the backup withoutnonceandct, plusdownloadAllowedandphraseChangePending. It isn't rate-limited as a download.- GET /v1/me/backup returns the full backup to an enrolled device, to an unenrolled device whose last sign-in is at most 1 h old, or to a bot token, so a stolen refresh token alone can't take it. Any other session gets auth.reauth_required with
data.maxAgeMs: 3600000. Limits: 10 per 24 h for all unenrolled sessions together, 5 per hour per session, 50 per 24 h for enrolled sessions, 50 per 24 h for a bot token; over a limit you get core.rate_limited withdata.policy: "backup.download". - PUT /v1/me/backup stages (
"stage": true,igen= current + 1,vgen1, expires after 24 h) or updates (prevVercompare-and-set, enrolled devices only). There is no DELETE.
Whenever the backup's vgen falls behind the vault's, an enrolled device that holds the current vault key and the active phrase rewrites it, unless phraseChangePending is set; prevVer lets exactly one win. Check this at start, after vault.key_rotated, after backup.updated and after syncing the recovery record (08 §5.6.4).
To restore (08 §5.8): fetch the metadata, and if downloadAllowed is false, sign in again before asking for the words. Take the phrase and check the checksum locally, download the backup, check kdf, derive BK and decrypt ("That recovery key didn't work" on AEAD failure). Then check the payload against a fresh IdentityState: addr is this account, igen matches, idc matches byte for byte, ik derives the certificate's key, phrase is the entered E and vaultKeys holds the object's vgen. If not, the key belongs to an earlier setup. Finally persist the keys and complete enrolment.
Adding a device by pairing
Pairing moves the IK, vault keys and E from an enrolled approver to an unenrolled new device through the home server, which relays but can't read them. CPace (04 §11, see Cryptography) lets a 6-digit code resist the relaying server (08 §6).
Separately, the displayer shows a QR code and a 6-digit code together and the entering device scans or types. In direction A, the default, the new device displays; in direction B the approver does. The displayer generates a fresh 16-byte secret and code per session and never sends either to the server. The QR string is SVPAIR1: plus base32 of 0x01 || displayer || pairingId[16] || secret[16] || lv(addr); scanners check that addr is the signed-in account (08 §6.3).
Every pairing endpoint needs a home session of a secure user account: a bot token gets pairing.unsupported_client and an insecure account pairing.account_not_secure (08 §6.4). A new device creates the session with POST /v1/me/pairing, and the server sends pairing.requested to every enrolled device (08 §6.4.1). Call GET /v1/me/pairing at start and on every WebSocket reconnect, so a prompt missed while offline still appears (08 §6.4.2). Creating a direction-A session:
POST {home}/v1/me/pairing
{ "displayer": "new_device" }
HTTP/1.1 201 Created
{
"id": "01938f40-0000-7a00-8000-00000000a1b2",
"state": "waiting",
"displayer": "new_device",
"createdBy": "new_device",
"newDevice": {
"did": "Lp0wS3aQx9bT6mVc1rK2eA",
"plat": "web",
"client": "sloppyvoice-web/1.2.0",
"name": "Chrome · Windows",
"provider": "google", "authAt": "2026-12-04T18:30:02.118Z"
},
"approver": null,
"createdAt": "2026-12-04T18:30:05.410Z",
"expiresAt": "2026-12-04T18:40:05.410Z",
"endedAt": null,
"endReason": null
}The approver joins with POST /v1/me/pairing/{id}/join; messages go through POST /v1/me/pairing/{id}/messages and arrive as pairing.message, or by polling GET /v1/me/pairing/{id}/messages when the WebSocket is down. The entering device is the CPace initiator (08 §6.6):
| # | type |
From | body |
|---|---|---|---|
| 1 | cpace_a |
Initiator | cred (qr/code), ya, ad |
| 2 | cpace_b |
Responder | yb, ad, tb |
| 3 | confirm_a |
Initiator | ta |
| 4 | payload |
Approver | nonce, ct |
| 5 | ack |
New device | status, optional reason, proof |
| — | abort |
Either | reason |
The payload, encrypted under a key derived from the CPace ISK, is the backup payload plus approverDid and newDid. The new device must check it against a freshly fetched IdentityState (igen, approverDid listed active, idc byte-identical) before registering. The approver shows "Your new device is ready" only after the ack proof decrypts and says ok (08 §6.7).
Rules that trip people up (08 §6.4.4, 08 §6.8, 08 §6.9):
- A session allows exactly one
cpace_a,cpace_bandconfirm_a, which gives a malicious server one guess at the code (a 10⁻⁶ chance). Enforce this in the client too, and discard the secret and code aftercpace_b. - An out-of-order message gets pairing.out_of_order and fails the session. A byte-identical repeat of your latest message returns the original
n, which is how you retry safely. Wait for each202before sending the next message. - Deadlines: 10 min to reach
confirmed, 60 s between messages whileexchanging, 5 min afterconfirmed. Limits: 5 sessions per account per hour, 3 open per account (08 §6.10).
The approver's prompt asks "Is this you signing in on {name}?" with the provider and time; "No" sends POST /v1/me/pairing/{id}/cancel with reason: "denied" (08 §6.9.2). In direction B, whoever joins first receives the keys, so the approver shows the joined device and should ask "Send to …?" before sending (08 §6.9.3). Every failure shows "That didn't work" and "Try again", never a warning (08 §6.11).
Completing enrolment
A device that received the IK by pairing or restore finishes with E1–E8 (08 §7):
- E1: generate the DSK (non-extractable where possible) and box key, issue its own DeviceCertificate, register it with POST /v1/me/identity/devices, then zeroize the IK. The interrupted action resumes here.
- E2: upload the box key with PUT /v1/me/vault/box-keys/{did}.
- E3: fetch GET /v1/me/vault/keys, check
kcv, and catch up to the current generation. - E4: sync the eager vault types (
recovery,settings,pin,sec_pin) from change sequence 0. - E5–E8: publish KeyPackages, join groups by external commit, fetch the archive lazily, and append every history key learned from now on.
Before E1, compare the IdentityCertificate you received with idc from GET /v1/me/identity byte for byte. If they differ, the key is outdated: discard it and don't register (07 §11.5). The server allows 10 registrations per account per hour, refuses a different certificate for an already-listed device with identity.device_conflict, refuses a device beyond maxEnrolledDevices (default 50, at most 64) with identity.too_many_devices, and sends identity.changed with change: "device_added" (07 §11.5, 07 §20). The user's other signed-in devices then show W4c, except the approving device. A device that lost its DSK must come back with a new did, because a did is bound to one DSK per igen (08 §7).
AccountVault and key archive
The AccountVault is per-account encrypted record storage that syncs pins, settings, the recovery record and the key archive between enrolled devices. There is one vault per igen, and only enrolled devices (or a bot token) may use it; others get security.device_not_enrolled (08 §8.1).
Records have a 16-byte rid, a compare-and-set version ver, and a gap-free change sequence vseq per write (08 §8.1, 08 §8.2, 08 §8.4, 08 §8.5):
K_rec(g, rid) = HKDF-Expand(K_vault(g), "sv1 vault" || 0x00 || 0x01 || rid, 32)
AAD = "sv1 vault" || 0x00 || 0x01 || rid || lv(type) || u32(igen) || u32(vgen) || u32(ver) || lv(addr)
VID(input) = HMAC-SHA256(K_vid, "sv1 vault id" || 0x00 || input)[0..16]The ver in the AAD is the version the write creates, ifVer + 1, so a conflict means re-encrypting, not resending. Readers check that the plaintext's t is the record type and that rid and bucket recompute from the plaintext, and never accept a lower ver than one seen, so the server can't move or replay records (08 §8.4). archive and shared_keys records are downloaded lazily, one bucket per context; pin, sec_pin, settings and recovery eagerly (08 §8.6).
Write with PUT /v1/me/vault/records (1 to 100 items, each with ifVer). Per-record errors come back inside a 200 (08 §8.7.3):
{
"results": [
{ "rid": "4vooBBFj0AiQfNuN3WVipw", "ok": true, "ver": 1, "vseq": 18423 },
{ "rid": "FB42kmZHqbgiFQclRh84sg", "ok": false,
"error": { "type": "urn:sloppyv:error:vault.version_conflict", "code": "vault.version_conflict",
"title": "Record changed", "status": 409, "retryable": true, "userAction": "none",
"data": { "currentVer": 4 } } }
],
"vseq": 18423
}To sync, keep the last vseq you processed and read GET /v1/me/vault/changes with type set to the eager types while hasMore (08 §8.8). On vault.changes_expired, read the summary's vseq first, relist, and resume from it. On vault.version_conflict, fetch, merge by the type's rule and rewrite, up to 5 times (08 §8.9). When the vault is full, delete archives of contexts the user left, then stop appending; never delete pin, sec_pin, settings or recovery (08 §8.11).
The key archive is the set of archive records: every history key any of the user's devices has learned, so a new device can read everything the user could (08 §9). History keys are defined in document 14. An archive plaintext (08 §9.2):
{
"t": "archive",
"host": "b.com",
"ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
"groupId": "sv1:b.com:ch:01938a11-2b3c-7d4e-8f90-112233445566:1",
"gen": 1,
"epoch": 42,
"keys": [ { "ekid": "D5RG_xNqInY", "key": "4OHi4-Tl5ufo6err7O3u7_Dx8vP09fb3-Pn6-_z9_v8",
"source": "mls", "confirmed": true, "learnedAt": "2026-12-04T18:22:31.512Z" } ]
}Devices batch appends within 60 s or at 100 pending keys and never prompt. The rid depends only on (groupId, epoch), so two devices that learn the same key write the same record and merge it per ekid. When reading, recompute HKDF-Expand(key, "sv1 ekid", 8) and use the entry only if it matches (08 §9.3, 08 §9.4). Message keys that other members shared with the user in a HistoryShare go into shared_keys records in the same bucket, at most 32 keys per record, so the account's other and future devices can read the shared messages too (08 §9.5).
Revocation and vault rotation
Revoking a device is owned by 05 §13. An enrolled device should attach a DeviceRevocation, in 05's revoke call or with POST /v1/me/identity/revocations. Revoking another still-active device needs fresh authentication, so a thief holding one enrolled device can't revoke the others (07 §11.7). The server sends device.revoked.
Every delisting other than by a reset (a revocation, a sign-out of an enrolled device, a shared-computer device's automatic revocation) rotates the vault key, so the delisted device can't read anything written afterwards (08 §10, 08 §10.4). Each new generation stores a VaultKeyLink (the previous key encrypted under the new one), and remaining devices receive it as a VaultKeyGrant sealed to their box key. Anyone can encrypt to a public box key, the home server included, so verify a granted key before use: the generation signature verifies under its creator's DeviceCertificate, the creator is listed active in a fresh own IdentityState, kcv matches, and the link opens to the previous key you hold (08 §10.2.1).
The server sets rotationPending and writes fail with vault.rotation_required, but don't rely on that flag: also rotate after revoking a device yourself or seeing one delisted in your own state (08 §10.4). The procedure is V1–V7 in 08 §10.5.2.
Warning
A revoked device still knows E. When a device is revoked as lost or stolen, the rotation is followed by a new recovery key, and the new vault key is never written into a backup under the old phrase. The server enforces this with backup.phrase_change_required (08 §10.8).
Pins and key changes
In DMs and group DMs every member client is the Authentication Service: it pins each contact's identity key and warns with W2 when it changes. Channels never touch pins and never warn about other people (07 §2, 07 §13.6). See Direct messages.
Pin records live in the vault, so all the user's enrolled devices share them and a new device never pins again (07 §16.1). A record holds the contact's inc, ik, igen, highest ver, a state, and W2 bookkeeping (changeId, w2Dismissed). First contact pins silently, in state pinned, from the idc of a verified IdentityState: when the user starts a DM, after accepting a message request, when processing a Welcome or commit in an accepted DM, or when claiming KeyPackages. Never pin from channels or profiles, or your own address (07 §16.2).
Whenever you accept a verified IdentityState with a higher ver for a pinned address, run change detection (07 §16.4):
- A different
incis a new account at the address. sec: "insecure"is downgrade evidence, unless the pin is alreadydowngradedordowngraded_blocked.sec: "secure"while the pin isdowngradedordowngraded_blockedis re-upgrade evidence, whatever the key.- Otherwise the same key as the pin (or the pending key in
verified_blocked) updatesverandigenonly. Added or removed devices show nothing. - Otherwise a different key is key-change evidence.
Only a home-signed state is evidence. A credential or KeyPackage showing a different key without one is rejected with pin_mismatch and never raises W2, or a hosting server could cause W2 at will. The main transitions (07 §16.3):
| From | Event | To | User sees |
|---|---|---|---|
pinned |
Key change | changed |
W2 "key changed", not blocking |
verified |
Key change | verified_blocked |
Blocking W2; new key in pendingIk |
verified_blocked |
"Accept new key" | accepted |
Non-blocking banner |
verified_blocked |
Verifies the new key | verified |
Block ends |
pinned, changed, accepted |
Downgrade | downgraded |
W2 "turned off encryption" |
verified, verified_blocked |
Downgrade | downgraded_blocked |
Blocking W2 |
downgraded_blocked |
The user taps the accept action | downgraded |
Non-blocking banner |
downgraded |
Re-upgrade | changed, or verified_blocked if the key was verified (wasVerified) |
W2 "key changed", blocking if verified |
downgraded_blocked |
Re-upgrade | verified_blocked |
Blocking W2 "key changed" |
| Any | New inc |
pinned, or new_account if insecure |
New-account wording, 1:1 DM only |
The same changeId never raises W2 twice on any of the user's devices. Wording is in 20 §3.2; see Client requirements.
While a pin is verified_blocked, in any secure DM or group DM with that contact, send no SealedMessage, start or join no call, and create no commit or Welcome that admits the pending key or changes the contact's sv_participants entry; queue the user's messages until they accept or verify (07 §16.5). You still process another member's commit in a group DM that admits the key if the other identity checks pass, because refusing would only split the group (07 §14.2). If the user is in a call of that group DM when the pending key is admitted, stop transmitting media from that epoch until the block ends. In downgraded_blocked, send nothing in the now-insecure 1:1 DM until the user accepts, and never send earlier secure drafts as plaintext automatically. Treat an unknown pin state as verified_blocked, so it fails safe. When devices merge a pin, a downgrade always survives, verification on any device wins over an unverified version, and blocking spreads to every device (07 §16.6).
Safety numbers and QR verification
Verification is optional; never prompt for it except through W2's "Verify" action (07 §17). The safety number is two 30-digit halves, one per person, sorted so both see the same number (07 §17.1):
Fingerprint(ik, addr):
h ← "sv1 safety" || 0x00 || 0x00 0x01 || ik || addr
repeat 5200 times:
h ← SHA-512(h || ik)
digits ← ""
for j in 0 .. 5:
v ← uint40_be(h[5j .. 5j+4]) mod 100000
digits ← digits || five decimal digits of v, zero-padded
return digits
SafetyNumber(A, B):
return min(Fingerprint(ik_A, addr_A), Fingerprint(ik_B, addr_B))
|| max(Fingerprint(ik_A, addr_A), Fingerprint(ik_B, addr_B))ik is the 32-byte raw key and addr the UTF-8 canonical address. Show all 60 digits as 12 groups of 5. For alice@a.com and bob@b.com with the 07 test keys: 01726 05374 77840 65085 81186 70573 78737 24390 15349 01458 87682 60356 (07 §21.8). Use the contact's pendingIk while the pin is verified_blocked, so verifying from a blocking W2 verifies the new key and ends the block.
For QR verification each device shows SVV1: plus base64url of VerifyQR: version 1, a 16-byte nonce, the displayer's address and key, and the contact's address and the key the displayer trusts for them, with 2-byte fixed length prefixes (not MLS varints), in byte mode at error correction level M, valid for 10 minutes. The scanner checks that the displayer's key matches its pin and that the code carries the scanner's own address and current key (07 §17.2).
Self-alerts
The only identity alerts a user sees in channels are about their own account (07 §18):
- W4a: your own state has a higher
igenthan the secure state you had, and you didn't initiate it (compareactor.didinidentity.changed). Stop using the old IK and DSK at once, drop secure MLS state, keep decrypted history, and become unenrolled. It needs a tap, and its actions are "Set up encryption on this device" and "This wasn't me". An upgrade from insecure never raises it. - W4b: a roster has a leaf under your address with a different key at your
igenor higher, or your key with adidyour server doesn't list and no revocation covers. Refetch your own state first: a higherigenthere means W4a instead. It needs a tap. Leaves with anigenbelow yours are your own stale leaves and never raise it. - W4c: your own state at the same
igenlists a newdid. No tap; not shown on the new device or on the device that approved its pairing.
Check your own state at every start, reconnect and identity.changed on me, and accept it from any verified source, including states relayed by hosting servers, so a home server that shows you a private view is caught (07 §18.4).
Resets and downgrades
A reset replaces the identity key in a new generation. It is the last resort, for a user with no enrolled device and no recovery key ("Start fresh") or who believes the IK was stolen. A lost device is never a reason to reset; revoke it (07 §15.1). It takes effect at once, from any home session, with no waiting period.
The client asks for one confirmation (M10) and signs in again if the session isn't fresh within 600 s. It then generates and persists new keys as pending_reset, builds certificates and KeyPackages, stages the backup, leaves any call, and sends POST /v1/me/identity/reset with mode: "new_key". Afterwards it deletes the old keys and MLS state, initializes the new vault and shows the save step (08 §11.2).
The request carries mode, expectedIgen, and for new_key the new identityCertificate and deviceCertificate plus, optionally, keyPackages (a KeyPackageUpload with at most 10 KeyPackages and lastResort); send at least lastResort, so DM participants' clients can re-add the device by Welcome as soon as they learn of the reset. The home server requires a session whose authAt is at most 600 s old (or a bot token) and, for a user account, a staged KeyBackup for the new identity (07 §11.6).
The server applies it in one transaction: igen + 1, devices = [the caller], every other device unenrolled but still signed in so it can show W4a, old KeyPackages and the old backup deleted, and the old vault retired read-only for 30 days (07 §15.2).
| Party | Sees (07 §15.3) |
|---|---|
| Channel members | Nothing. Old leaves are removed silently. |
| DM contacts | W2. Verified contacts are blocked until they accept or verify. |
| The user's other devices | W4a, then "Set up encryption on this device" |
| The initiating device | The save step for the new recovery key |
mode: "downgrade" turns encryption off and counts as a reset. A secure server refuses it with identity.downgrade_not_allowed. Every device deletes every key, and the server deletes the backup and every vault (08 §11.3). Servers must allow at least 5 generation changes per account per 24 h and should refuse more (07 §20).
An old device that comes back may keep the old vault keys in a retired store for 30 days; if it is enrolled again in time, it silently imports its history keys and the pins missing from the new vault (08 §11.4). The old recovery key alone opens nothing, because the old backup is deleted at the reset.
Note
07 §11.4 states that the upgrade's fresh-authentication check comes before its replay check. 07 §11.6 doesn't say the same for a reset. A client handles either order, because S5 of 08 §11.2 already retries after auth.reauth_required.
Unenrolled devices
An unenrolled device is a signed-in device of a secure account without the IK. It works fully in insecure contexts; in secure ones servers answer security.device_not_enrolled and the client shows a G2 card (08 §12.1). G2 opens the device-setup chooser (08 §12.3):
- "Use another device" (pairing, direction A), the default when another active device exists;
- "Scan or type a code from my other device" (direction B);
- "Use recovery key", the default when no other active device is listed;
- "I can't do either", leading to "Start fresh", always last.
The two pairing options are shown only when the IdentityState lists another active device, and "Use recovery key" only when GET /v1/me/backup?part=meta found a backup. A device that became unenrolled because another device turned encryption on also shows the "Approve this device" banner once per identity generation; it is dismissable and never modal. Unenrolled devices can't use the vault, show the recovery key or W8, verify contacts or approve another device, and they download the KeyBackup only within 1 h of a provider sign-in (08 §12.1).
Key storage per platform
On every platform (08 §13.1):
- Wrap every secret with AES-256-GCM under a platform wrapping key, with associated data
lv(label) || lv(addr) || did. - Exclude keys from OS and cloud backups, device migration and keychain sync, so restored app data never carries keys.
- Unwrap the IK only to issue this device's certificate, build a pairing payload or backup, or sign a revocation, then zeroize it.
- Make the DSK non-extractable where possible, and use the "after first unlock" class for background keys.
- Keep secrets, the phrase and pairing credentials out of logs, diagnostics, notifications and URLs.
- Treat a temporarily unavailable store, such as a locked GNOME Keyring, as a reason to retry, not as key loss.
| Platform | Wrapping key | Location |
|---|---|---|
| iOS, iPadOS | Keychain, kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, not synchronizable; should be wrapped by the Secure Enclave |
App container, excluded from backup |
| Android | Keystore AES-256-GCM key, StrongBox-backed when available, else TEE | getNoBackupFilesDir() |
| macOS | Data-protection Keychain, ThisDeviceOnly; Secure Enclave wrap where available |
~/Library/Application Support/<app>/, excluded from Time Machine |
| Windows | TPM through the Platform Crypto Provider, else DPAPI user scope | %LOCALAPPDATA%\<app>\, never roaming %APPDATA% |
| Linux | Secret Service or XDG Secret portal, then a TPM-sealed key, then a 0600 key file reported as keyProtection: "file" |
$XDG_DATA_HOME/<app>/, mode 0700 |
The web
Web clients follow extra rules (08 §13.3):
- Generate a non-extractable AES-GCM wrapping key in a dedicated Worker and store the
CryptoKeyin IndexedDB; store every secret only wrapped under it. - Run all secure-mode cryptography in that Worker. The main thread never gets an unwrapped secret, except the phrase while it is on screen.
- Use a non-extractable WebCrypto Ed25519 key for the DSK where the browser supports it.
- Call
navigator.storage.persist()after enrolment. - Keep session tokens in the same IndexedDB database as the keys, so eviction signs the browser out cleanly. Eviction is device loss: sign in as a new device and pair or restore.
- Serve the client with a strict CSP and Subresource Integrity on every script, because a web client is only as trustworthy as its origin (08 §13.3, 08 §18.4).
In opt-in shared-computer mode, secrets and session tokens live only in the Worker's memory, closing or reloading the tab signs the device out, the home server revokes the device 12 h after its last activity, and the client never offers saving to a password manager or printing (08 §13.4). A notification extension or service worker may read only the notification key subset: recent history keys and public sender DSKs, at most 2,000 entries and 1 MiB, under its own wrapping key (08 §13.5); see Notifications.
A device that has really lost its keys must not register a new DSK under its old did. It shows "Set up encryption on this device", signs out when the user picks an option, and returns as a new device (08 §13.6).
Events
identity.changed and device.revoked are durable on your own me stream; identity.refresh_hint is an ephemeral hint from DM hosting servers. In all three, only the verified state counts; every other member is a hint (07 §12.3). identity.changed has change set to upgraded, reset, downgraded or device_added; treat an unknown value as an unspecified change and act on state. Only your own devices receive actor (did, plat, changedAt), which W4a uses to recognise the initiating device. A revocation produces device.revoked, never identity.changed (07 §12.1, 07 §12.2). The pairing, backup and vault events (pairing.requested, pairing.updated, pairing.message, backup.updated, vault.changed, vault.rotation_needed, vault.key_rotated, vault.grant_needed) are ephemeral and never replayed, so re-read state over HTTP at start and on reconnect (08 §14). For the threat model, see Security model.