Expand description
The wire form of the cross-device add ceremony (SSoT: Device Enrollment § Cross-Device Add): what each device advertises, the payloads they relay, and the safety code over them.
The server leg (code issue/redeem, the relay channel, close) carries opaque strings; this module defines what goes inside them. The ceremony, in relay order:
- enrollee B → initiator A:
EnrollmentPayload::Commitmentto B’sEnrolleeKeys; - A → B:
EnrollmentPayload::InitiatorKeys, carrying a fresh nonce; - B → A:
EnrollmentPayload::EnrolleeKeys, which A checks against the commitment (EnrolleeKeys::matches_commitment); - both display
enrollment_safety_codeover what they hold and the user compares them; - A admits B with
Workspace::cross_sign_device(capsule-library) and sendsEnrollmentPayload::Directory, which B verifies under the user IK.
The commit-before-reveal order in steps 1–3, over inputs that each carry a fresh per-ceremony
nonce, is what makes a twelve-digit code sound against a man in the middle (see
the safety-code module, crypto::keys::safety_code). Each side therefore draws its
bundle once per ceremony and keeps the one it sent: a second call draws a new nonce, and
so a different code. The master-key transfer under a
channel key (design step 5) is not here: the channel’s ephemeral key agreement is not yet
defined.
§Wire form
A payload is canonical CBOR of { "v": 1, "payload": <tagged payload> }, written as
lowercase hex — the relay’s field is a JSON string, and hex needs no new dependency. Decoding
refuses anything that does not re-encode to the exact same string, so every payload has one
spelling and a key set hashes to one safety code.
Structs§
- Enrollee
Keys - What the enrollee (the new device B) advertises: the public halves of the device keys it generated, which A cross-signs into the directory.
- Initiator
Keys - What the initiator (the enrolled device A) advertises: the account it is adding to, the identity key the directory it will send verifies under, and its own device signing key.
Enums§
- Enrollment
Payload - One message relayed between the two devices.
- Enrollment
Payload Error - Why a relayed payload could not be encoded or decoded.
Constants§
- ENROLLMENT_
NONCE_ LEN - The length of each side’s per-ceremony nonce. Device keys are static — the initiator’s are already published — so without fresh randomness on both sides a man in the middle could predict one side’s input and grind the code offline.
- ENROLLMENT_
PAYLOAD_ VERSION - The payload format version this build writes and the only one it reads.
- MAX_
ENROLLMENT_ PAYLOAD_ CHARS - The longest encoded payload this build writes or reads, in characters — the relay’s own per-payload ceiling, so a payload this side accepts is one the relay would have carried.
Functions§
- enrollment_
safety_ code - The safety code both devices display, over the initiator’s and the enrollee’s advertised keys as each side received them.