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.
| Step | Check | Code on failure |
|---|---|---|
| 1 | The envelope decodes (Envelope). | malformed |
| 2a | The payload is canonical JSON and its root is an object with an integer v. | malformed |
| 2b | v is 1. | unsupported_version |
| 2c | The root has exactly the six keys of Payload, with the right types; device_id is 32 hex characters; expires > seq. | malformed |
| 2d | type is a known type. | unsupported_type |
| 2e | The body has the shape given in Payload for its type (config contents are checked later, in step 8). | malformed |
| 2f | No bytes follow the envelope, unless type is update. | malformed |
| 3a | An enrol has at least one signature. | missing_signature |
| 3b | No key ID appears twice. | malformed |
| 3c | Taking 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 |
| 4 | device_id equals the device’s ID. Skipped only for an enrol on a device that has no ID yet. | wrong_device |
| 5 | now < expires. | expired |
| 6a | seq > last accepted sequence number. Skipped when completing a waiting change (Waiting changes). | stale_sequence |
| 6b | seq ≤ now + 24 hours. Skipped when completing a waiting change. | sequence_in_future |
| 7a | The type is allowed in the current lifecycle state (Who may do what). | wrong_state |
| 7b | The 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 |
| 7c | A key_add with role partner is signed by the key it adds; an enrol is signed by an owner key it lists. | insufficient_signatures |
| 7d | For config with replaces: replaces equals the config in force. | config_changed |
| 8 | For enrol and config: the config is valid. | invalid_config |
| 9a | If the approvals are complete and the action is delayed: no other loosening action is pending. | pending_action_exists |
| 9b | If 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 |
| 10a | For 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) |
| 10b | For 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_addwith rolepartnerthat 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
expiredorconfig_changed), the waiting change is dropped.pending_action_existsdoes 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 anenrol, 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,
seqset to now, andexpiresset 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.
| Action | Solo | Partner mode | Timing while ARMED |
|---|---|---|---|
config, tightening | Owner | Owner | Immediate |
config, loosening | Owner | Owner and partner | Delayed |
update | Owner | Owner and partner | Delayed |
key_add, role owner | Owner | Owner and partner | Delayed |
key_add, role partner | Owner (a tap, while ready for a partner; 5.1) | Partner, if the partner has no key yet; otherwise not_permitted | Immediate |
key_remove (owner keys) | Owner | Owner and partner | Delayed |
partner_remove | not_permitted | Owner and partner | Delayed |
phone_secret_allow, role owner | Owner | Owner | Immediate |
phone_secret_allow, role partner | not_permitted | Partner | Immediate |
exit | Owner | Owner and partner | Delayed |
Further rules:
key_addisnot_permittedif the key is already enrolled in either role.key_removeisnot_permittedif the role ispartner, 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
configbundle 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_addwith rolepartnerthat 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
enrolon an ARMED device must carry the config in force or a tightening of it; otherwisenot_permitted(step 7b). Before arming nothing is enforced, so any valid config is accepted.