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 keys and the partners’ rule, 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. An update that would wait is refused too while an update counts down, since the phone keeps one staged APK. | 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 16 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 one to ten partners: partner keys, or one partner with a partner phone secret, or one partner with 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. “D partners” means valid signatures from D different partner keys; the partner phone secret typed on the phone counts as one, and only on a phone with at most one partner key. D, N and T are the numbers in the phone’s rule (The partners’ rule).
| Action | Solo | Partner mode | Timing while ARMED |
|---|---|---|---|
config, tightening | Owner | Owner, or T partners when T > 0 | Immediate |
config, loosening | Owner | Owner and D partners | Delayed; immediate with the owner and N partners |
update | Owner | Owner and D partners | As config, loosening |
key_add, role owner | Owner | Owner and D partners | As config, loosening |
key_add, role partner | Owner (a tap, while ready for a partner) | With no partner key yet, the partner (by phone secret). With partner keys, owner and D partners; not_permitted with ten, or beside a partner phone secret | Immediate when it is the first partner key; otherwise as config, loosening |
key_remove (owner keys) | Owner | Owner and D partners | As config, loosening |
partner_remove | not_permitted | Owner and D partners | As config, loosening |
phone_secret_allow, role owner | Owner | Owner | Immediate |
phone_secret_allow, role partner | not_permitted | The partner’s key; not_permitted unless the phone has exactly one partner key (with none, clearing the secret would remove the partner) | Immediate |
rule, asking no less of the partners | not_permitted | Owner | Immediate |
rule, asking less | not_permitted | Owner and D partners | Delayed, always |
exit | Owner | Owner and D partners | As config, loosening |
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.- A
key_addwith rolepartnerMUST carry the signature of the key it adds (step 7c) in every case. - “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; 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 (or Add another partner), then With your partner’s computer, in person, makes the phone ready for a partner key for 10 minutes, or until the user stops it. It is offered while the phone can take another partner key: fewer than ten, and no partner phone secret. A
key_addwith rolepartnerthat arrives then, signed only by the key it adds, waits for the owner to confirm on the phone (Waiting changes), and for the partners the rule asks for when there are partners already. - 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.
The partners’ rule
Every phone in partner mode has a rule: {delayed: D, at_once: N, tighten: T} (rule). It is set at enrolment, or by a rule bundle, and defaults to {1, 0, 0}: the owner and one partner, then the delay, which is partner mode as it was with a single partner.
- Loosening needs the owner and D partners, then waits out the delay. With the owner and N partners (N > 0), it applies at once. The owner is always needed: partners alone can never loosen.
- Tightening a config needs the owner, or T partners (T > 0) without the owner.
- Changing the rule to one that asks no less of the partners (D and N not lower, T not higher, where 0 counts as never for N and T) needs the owner and applies at once. Any other new rule is loosening, and always waits out the delay, however many approve: a moment’s agreement must not switch the delay off for good.
- Fitting: 1 ≤ D ≤ n, N is 0 or D ≤ N ≤ n, and T ≤ n, where n is the number of partners. When a partner is removed, each number is brought down to the partners left, so the rule can always be met.
- A damaged store (Damaged state on the phone) reads as the strictest rule: D = n, never at once, no tightening by partners.
- Sending with fewer approvals. A bundle that arrives with the owner and D partners is accepted and starts its countdown; the phone does not hold it waiting for N. Signatures for N are collected in the file before it is sent. A waiting change completed on the phone (by an owner phone secret or a tap) is judged with every signature it carries, so it can apply at once too.
The bundle result says immediate for a loosening action applied at once, and the event log marks it at_once.