Skip to content

Conseal is pre-release. The interface can change between releases.

Threat model: the circle

The circle is the set of a user’s devices that hold the AEK. The AEK reaches a new device only when the user approves it on a device that already holds it. On the way, the server relays ciphertext, wrapped keys, salts, public keys and the AEK commitment, and nothing it could open or guess a passphrase against.

The ceremony: the new device reads the AEK commitment, then posts a join request with an ephemeral ECDH public key, and both devices show a verification code derived from the commitment and that key. Once the user confirms the codes match, the approving device seals the AEK to that key, and the new device unseals it, checks it, and wraps it under its own passphrase and Secret Key.

  • The verification code. Each device shows 80 bits of the SHA-256 of a label, the AEK commitment and the ephemeral public key. The new device takes the commitment before its key pair exists, so whoever supplies it can’t choose it after seeing the key, and the approving device uses its own, never one the server supplies with the request. The server relays the request, so it can put a key of its own in its place and receive the AEK sealed to it, or give the new device the commitment of a key of its own and seal that key to the request. Either changes one device’s code. The user approves only when the codes match, and a server needs a match by chance: about 2⁸⁰ tries, out of reach both within the request’s five minutes and as a table built in advance for the account’s commitment.
  • The commitment. finalizeJoin checks the AEK it unseals against the commitment the request was created with, which the code covers. A mismatch throws, and nothing is wrapped.
  • The server’s receipt time. authorizeJoin refuses a request the server received more than five minutes earlier. It takes serverReceivedAt, the time the server says it received the request, never the request’s own createdAt, which the joining device sets.

CircleClient, in @consealdev/conseal/sync, runs the ceremony against a backend that serves the circle routes of the spec.

  • The code comparison is said out loud. approveJoin takes codeConfirmed: true, so an app can’t approve without saying the user compared the codes. The comparison itself is the user’s, and the library can’t make them look. A UI that approves without showing the code, or confirms on the user’s behalf, removes the defence in §4.1: a server that swaps in its own key then receives the AEK.
  • The approving device’s own commitment. A device keeps the commitment it took the AEK with, at setup, joining or recovery, and pendingJoins derives the codes from it. A device set up before it kept one reads as locked until its next unlock, which works the commitment out from the AEK.
  • A key from a device that knows the passphrase. The request’s ephemeral public key is public: the server relays it, so it can seal a key of its own to it and answer the join itself, with no approving device. The new device’s code then covers that key’s commitment, but no trusted device shows a code to compare, and a user who sees the new device move on may finish the join. The joining device therefore takes the AEK only with the approving device’s passphrase check, and the check vouches for that one sealed AEK: it carries a SHA-256 of the sealed AEK’s IV and ciphertext. A server without the passphrase can’t make a check that passes, and can’t move a real check onto a key of its own, since the check travels sealed. An approval with no check, a check that doesn’t open, or one that vouches for another key fails the join with UnverifiedKeyError, and nothing is registered or kept.
  • The passphrase check itself. The approving device sends a salted PBKDF2-SHA-256 hash of its passphrase (200,000 iterations), with the digest of the sealed AEK, sealed to the joining device’s ephemeral key. The joining device asks for the same passphrase and refuses another with WrongPassphraseError, so the user can try again. The server relays ciphertext. The joining device can guess against the hash, but it is the user’s own device, about to hold the same passphrase.
  • The commitment, when joining. startJoin reads the account’s commitment before it makes the key pair, and doesn’t take the one createJoin answers with. The joining device checks the AEK it receives against it. A mismatch fails the join with CommitmentMismatchError, and nothing is registered or kept.
  • The commitment, when recovering. recover checks the key derived from the mnemonic against the commitment before it registers anything. A mistyped phrase that still passes the BIP-39 checksum, as about one single-word typo in 256 does, is refused, so it can’t replace the circle’s key or, with revokeOtherDevices, lock the other devices out.
  • Short-lived keys. The joining device’s ephemeral private key lives only in its JoinSession, in memory, and is dropped when the session ends. setup returns the mnemonic once and never stores or sends it.

4.3 The core functions without CircleClient

Section titled “4.3 The core functions without CircleClient”

An app on the core functions alone gets the code comparison of §4.1, as long as the new device takes the commitment before createJoinRequest and the approving device derives its code from its own commitment, the one initCircle returned or its own join or recovery checked. A server that gives the new device another key’s commitment then changes the new device’s code.

What the core doesn’t add is the passphrase check (§4.2). A server can still answer a join itself, with a key of its own and that key’s commitment, and no trusted device then shows a code. A new device that finishes without the user having confirmed matching codes on a trusted device takes the server’s key, and the server reads everything it seals. So the new device finishes only once the user has confirmed the codes match, as a channel invite does (§5.2), or checks where the AEK came from as CircleClient does.

The circle routes are spec/circle.yaml.

  • What it holds. Each device’s wrapped AEK, the AEK commitment, device names and platforms, and while a join waits, the new device’s public key, then the AEK and a passphrase check sealed to that key. None of it opens without what stays on the devices: a passphrase and a Secret Key, or the new device’s private key.
  • What it sees. When devices join and are revoked, how many there are, and what their users call them.
  • A substituted commitment. The commitment is written once. A server that changes it, or lies about it from the start, can make every join fail. It can’t make a device take a key of its own that way: the codes cover the commitment, so a lie shows as codes that differ, and the passphrase check decides which key a new device takes.
  • A replayed join. A join request is used once and expires by the server’s clock, so an old approval can’t complete a later join. A dishonest server can keep a request open longer; approving it still needs the code comparison.
  • A device added without the ceremony. A save with no join request is how setup and recovery work, and the server can’t tell it from someone with the user’s sign-in adding a device. That device holds a wrapped AEK only its own passphrase and Secret Key open, so it gains no access, and the server tells the user, so a device they don’t know is noticed and revoked.
  • Revoking. The server deletes the revoked device’s wrapped AEK, refuses it from then on, and tells the user when it tries again. The device keeps the AEK it held (§4.6).
  • The code comparison. A server that swaps the request’s public key for its own receives the AEK, and a passphrase check it can open and guess against offline. Only the user comparing the whole code stops that. An app that approves a join without the user comparing it loses the join’s defence.
  • A passphrase the server wouldn’t guess. A dishonest server can make up a check for a passphrase it guesses and seal a key of its own with it. The join then passes only if the user types that same passphrase. Each guess costs the server a join the user starts, and a wrong one shows as a wrong passphrase. As long as the codes are compared, the server holds nothing to test guesses against offline.
  • Keys at rest. The device keeps its Secret Key, its wrapped AEK and, while unlocked, the AEK as a non-extractable CryptoKey, in its CircleStore, IndexedDB by default. A script running in the page can use the AEK and read the Secret Key (§11.1).
  • The sign-in. Setup and recovery register a device on the strength of the user’s sign-in alone. Such a device gains no access, but the device list is only as trustworthy as the sign-in.
  • Rotate keys. A revoked device stops syncing but keeps the AEK it held, and can open everything sealed under it. Making a revoked device unable to read new data needs AEK rotation, which this version doesn’t define.
  • Guarantee availability. The server can refuse, deny or expire any join, and withhold the device list.