Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Verification

Acceptance

The phone runs these steps in order and stops at the first failure. Each failure has a result code. The order is normative, because the shared vectors expect one specific code per input.

The inputs are the received bytes and the device state: lifecycle state, device ID (if any), enrolled owner keys, enrolled partner key (if any), whether an owner phone secret and a partner phone secret are set, whether the phone is ready for a partner key (Who may do what), the last accepted sequence number, the active config, whether a loosening action is pending, the waiting change (Waiting changes) if any, and the current time.

StepCheckCode on failure
1The envelope decodes (Envelope).malformed
2aThe payload is canonical JSON and its root is an object with an integer v.malformed
2bv is 1.unsupported_version
2cThe root has exactly the six keys of Payload, with the right types; device_id is 32 hex characters; expires > seq.malformed
2dtype is a known type.unsupported_type
2eThe body has the shape given in Payload for its type (config contents are checked later, in step 8).malformed
2fNo bytes follow the envelope, unless type is update.malformed
3aAn enrol has at least one signature.missing_signature
3bNo key ID appears twice.malformed
3cTaking the signatures in order: the key ID belongs to a known key, then the signature verifies. Every signature must pass, not just enough of them.unknown_key, bad_signature
4device_id equals the device’s ID. Skipped only for an enrol on a device that has no ID yet.wrong_device
5now < expires.expired
6aseq > last accepted sequence number. Skipped when completing a waiting change (Waiting changes).stale_sequence
6bseq ≤ now + 24 hours. Skipped when completing a waiting change.sequence_in_future
7aThe type is allowed in the current lifecycle state (Who may do what).wrong_state
7bThe action exists in the current mode (Who may do what). For enrol on an ARMED device (a re-pair): its config equals the config in force or is tightening.not_permitted
7cA key_add with role partner is signed by the key it adds; an enrol is signed by an owner key it lists.insufficient_signatures
7dFor config with replaces: replaces equals the config in force.config_changed
8For enrol and config: the config is valid.invalid_config
9aIf the approvals are complete and the action is delayed: no other loosening action is pending.pending_action_exists
9bIf the approvals present do not include every role the action requires (Who may do what), the bundle will wait (Waiting changes): the waiting slot is free, or holds this same payload.approval_pending
10aFor update: the APK is present, is apk_size bytes long and has SHA-256 apk_sha256. A connection must not also carry bytes after the envelope. When completing a waiting update, an APK may be left out; the one stored with the waiting change is used.apk_mismatch (malformed for the second sentence)
10bFor update: the APK may replace the installed app (update).apk_rejected

Known keys in step 3c are the enrolled owner and partner keys, and for a key_add with role partner, the key it adds. For an enrol bundle they are instead the keys listed in its own body, since nothing is enrolled yet; an enrolment is trusted on first use, which is safe because it is only accepted when nothing is enforced, or after the user started a re-pair on the phone itself; and a re-pair while armed cannot loosen the config (step 7b), so the new keys gain nothing that skips the delay.

Approvals in step 9 are the roles of the signatures that verified, plus, for a waiting change, the roles approved on the phone. A signature by the key a key_add adds is not an approval by anyone: it only proves the key is held.

Step 6b exists because the sequence number is a timestamp. Without it, one bundle with a far-future seq would make the phone refuse every later bundle.

On acceptance with complete approvals, the phone stores the greater of seq and the last accepted sequence number, then applies the action at once or starts its countdown. The sequence number is consumed either way, including when the countdown is later cancelled. A rejected bundle changes nothing except the event log. A bundle that waits consumes nothing yet.

The time used in steps 5 and 6 is the phone’s wall clock. While armed, the user cannot change it (the date and time restriction, with automatic time forced on).

Waiting changes

The phone keeps at most one waiting change: the envelope exactly as received (payload and the signatures that verified), the roles approved on the phone, and for an update, the APK. The result is ok with effect waiting (Result).

  • More signatures. A bundle whose payload bytes equal the waiting change’s payload is checked by the steps above, with steps 6a and 6b skipped, and its verified signatures are added to the stored ones (at most 8 in all). If the approvals are then complete, the change is accepted; otherwise it stays waiting. Any other bundle that would wait while one is waiting is refused with approval_pending; a bundle that does not need to wait is handled as usual and leaves the waiting change alone.
  • Phone approvals. A person who still has to approve types their phone secret on the phone. A right answer adds their role. If the approvals are then complete, the phone runs the steps again on the stored envelope, with 6a and 6b skipped, and accepts or drops it.
  • A tap. One case accepts a tap in place of an owner approval: a key_add with role partner that arrived while the phone was ready for a partner, when no owner phone secret is set. It adds a partner and so tightens protection.
  • Dropped. If a later check fails (for example expired or config_changed), the waiting change is dropped. pending_action_exists does not drop it; it stays waiting until the countdown is over or cancelled. It is also dropped when it expires, when it is cancelled on the phone, after an enrol, and at teardown.
  • Drafts. A draft has no signatures; every approval is given on the phone. The phone also makes drafts itself, for actions started on the phone (Request exit): a payload with its own device ID, seq set to now, and expires set to 7 days later.

Who may do what

Lifecycle states. enrol is accepted only when the device is UNARMED with no keys enrolled, or while it waits for a re-pair (the user tapped “Pair a new key”; in partner mode, after that action’s delay). An accepted enrolment replaces every key, clears both phone secrets and any waiting change, and ends the wait. Every other type requires keys to be enrolled.

Modes. Solo mode has no partner. Partner mode has a partner: a partner key, a partner phone secret, or both.

“Owner” below means a valid signature from any one enrolled owner key, or the owner phone secret typed on the phone for a waiting change. “Partner” means a valid signature from the partner key, or the partner phone secret typed on the phone.

ActionSoloPartner modeTiming while ARMED
config, tighteningOwnerOwnerImmediate
config, looseningOwnerOwner and partnerDelayed
updateOwnerOwner and partnerDelayed
key_add, role ownerOwnerOwner and partnerDelayed
key_add, role partnerOwner (a tap, while ready for a partner; 5.1)Partner, if the partner has no key yet; otherwise not_permittedImmediate
key_remove (owner keys)OwnerOwner and partnerDelayed
partner_removenot_permittedOwner and partnerDelayed
phone_secret_allow, role ownerOwnerOwnerImmediate
phone_secret_allow, role partnernot_permittedPartnerImmediate
exitOwnerOwner and partnerDelayed

Further rules:

  • key_add is not_permitted if the key is already enrolled in either role. key_remove is not_permitted if the role is partner, if the key is not an enrolled owner key, or if it is the last owner key.
  • “Delayed” means the action waits out the config delay tier in force when its approvals become complete. Whether a config bundle is tightening or loosening is decided by the classifier in the main specification; when in doubt it is loosening.
  • While UNARMED nothing is enforced, so every accepted bundle applies immediately once its approvals are complete.
  • Ready for a partner. On the phone, Add a partner, then Use a computer, makes the phone ready for a partner key for 10 minutes, or until the user stops it. It is offered only while there is no partner. A key_add with role partner that arrives then, signed only by the key it adds, waits for the owner to confirm on the phone (Waiting changes).
  • The actions started on the phone (pair a new key, cancel a pending action, cancel a waiting change, allow USB debugging, add a partner with a phone secret, set or change a phone secret) involve no bundle. Pairing a new key is immediate in solo mode; in partner mode it is a pending action (key_replacement) that waits the longer of the tier and 72 hours.
  • A re-pair enrol on an ARMED device must carry the config in force or a tightening of it; otherwise not_permitted (step 7b). Before arming nothing is enforced, so any valid config is accepted.