Bundles
These pages are normative for the bundle format (this page, Verification and Test vectors), the connection protocol with the event log it carries, and the files the CLI writes. The Rust CLI creates bundles and the Kotlin app verifies them; both are tested against the shared vectors in protocol/vectors/.
The words MUST, MUST NOT, SHOULD and MAY are used as in RFC 2119.
Status: bundle format version 1, session protocol version 1. Nothing has been released yet, so both may still change without a version bump until the first signed release.
Overview
A bundle is one signed command for one phone. It has two layers:
- The payload: canonical JSON saying what to do, for which device, with a sequence number and an expiry time.
- The envelope: a small binary frame holding the payload bytes and up to eight Ed25519 signatures over them. A bundle with no signature is a draft, which can only wait on the phone to be approved there (Waiting changes).
The phone treats a bundle the same way whether it arrives over a session or from an imported file. All security comes from the checks in Acceptance, never from how the bundle arrived.
Byte order is big-endian throughout. Hex strings are lowercase.
Envelope
| Offset | Size | Field |
|---|---|---|
| 0 | 4 | Magic: ASCII QLB1 (51 4c 42 31) |
| 4 | 4 | payload_len, unsigned 32-bit. At most 1 048 576 (1 MiB). |
| 8 | payload_len | Payload bytes |
8 + payload_len | 1 | sig_count. At most 8; may be 0 (a draft). |
then, sig_count times | 32 | Key ID |
| 64 | Ed25519 signature |
- A key ID is the SHA-256 of the 32-byte Ed25519 public key.
- A signature covers the 19-byte prefix
QuitLock bundle v1followed by one zero byte (51 75 69 74 4c 6f 63 6b 20 62 75 6e 64 6c 65 20 76 31 00), followed by the payload bytes exactly as they appear in the envelope. - A receiver MUST verify signatures over the payload bytes it received. It MUST NOT parse and re-encode the payload to obtain the bytes to verify.
- A signature whose S value is not reduced (S ≥ L, the group order) MUST be rejected, as RFC 8032 requires. The vector
config_signature_s_not_reducedchecks this. The phone’s verdict is the one that counts; signature results shown by the CLI are a preview. - The suggested file extension is
.qlb.
Nothing may follow the last signature, with one exception: an update bundle stored in a file is followed immediately by the APK (update).
Canonical JSON
The payload is JSON restricted so that every value has exactly one encoding. A receiver MUST reject a payload that is not in this form. This removes any chance that the CLI (which shows a human what a bundle does) and the phone (which acts on it) read the same signed bytes differently.
- Encoding is UTF-8 with no byte order mark.
- No whitespace anywhere outside strings.
- Value types are object, array, string, integer and boolean. There is no
nulland there are no fractional or exponent numbers. - Integers are non-negative, at most 2^53 − 1 (9007199254740991), written in decimal with no sign and no leading zeros (
0itself is allowed). - Strings contain no character below U+0020. The only escapes are
\"and\\, and both of those characters MUST be escaped. Every other character, including non-ASCII, appears literally.\uXXXX,\n,\/and the like are not allowed. - Object keys match
[a-z0-9_]{1,64}, appear in ascending byte order, and are unique. - Objects and arrays nest at most 16 deep in total.
A receiver checks canonical form by parsing with a parser that accepts only this grammar. This check is separate from signature verification and does not change which bytes are verified.
Payload
The payload is an object with exactly these six keys:
| Key | Type | Meaning |
|---|---|---|
v | integer | Format version. 1. |
type | string | One of enrol, config, update, key_add, key_remove, partner_remove, phone_secret_allow, exit. |
device_id | string | 32 hex characters (16 bytes). The device this bundle is for. |
seq | integer | Sequence number: the creation time in Unix milliseconds. |
expires | integer | Expiry time in Unix milliseconds. MUST be greater than seq. |
body | object | Depends on type; see below. |
Example (an exit bundle):
{"body":{},"device_id":"514c000102030405060708090a0b0c0d","expires":1800086400000,"seq":1799999940000,"type":"exit","v":1}
The CLI needs no saved state to produce a sequence number, so a restored key works from a fresh desktop. The CLI sets expires to 24 hours after creation by default.
A body MUST contain exactly the keys listed for its type. The one exception is the config object (4.2), where unknown keys are allowed and handled by the classifier.
enrol
| Key | Type | Meaning |
|---|---|---|
device_id | string | MUST equal the payload device_id. |
owner_keys | array of strings | One to eight owner public keys, each 64 hex characters. No duplicates. |
partner_key | string | Optional. The partner public key. MUST NOT also be an owner key. Omitted in solo mode. |
config | object | The initial config (4.2). |
The device ID is 16 random bytes chosen by the CLI. The phone adopts it on first enrolment.
config
| Key | Type | Meaning |
|---|---|---|
config | object | The full replacement config. |
replaces | object | Optional. The config this one replaces, exactly as the phone reported it. The phone accepts the bundle only while that is the config in force (step 7d). |
replaces makes a config bundle say what it changes, inside the signed bytes. A partner asked to approve a change can then be shown the difference from the current config without trusting anything the owner sends alongside, and an approval cannot be reused once the config has moved on. The CLI always includes it. Comparison is by value: the same JSON object, as canonical JSON compares.
The config object mirrors the TOML config file:
{"apps":{"allowlist":[],"blocklist":[],"browser_allowlist":[],"install_policy":"trusted_installers","trusted_installers":["com.android.vending","org.fdroid.fdroid"]},"chrome":{"disable_incognito":true,"force_safesearch":true,"url_allowlist":[],"url_blocklist":[]},"delay":{"tier":"long"},"dns":{"provider_host":"family-filter-dns.cleanbrowsing.org"},"schema":1}
Lists are sets: order and repetition carry no meaning. The CLI SHOULD write them sorted and without duplicates.
A config that has an unknown key anywhere is still valid, but the classifier treats the whole change as loosening. A config that is missing a known key, or has a known key with a value of the wrong type or an unknown enum value, is invalid.
Value rules, schema 1:
| Key | Rule |
|---|---|
schema | The integer 1. |
dns.provider_host | A host name of at least two labels (letters, digits, inner hyphens; 253 characters at most). Not an IP address, no port. |
delay.tier | short, medium, long or very_long. |
apps.install_policy | open, trusted_installers or approval_required. |
apps.trusted_installers, apps.blocklist, apps.allowlist, apps.browser_allowlist | Lists of package names: two or more dot-separated parts, each starting with a letter and continuing with letters, digits or underscores. |
chrome.force_safesearch, chrome.disable_incognito | Booleans. |
chrome.url_blocklist, chrome.url_allowlist | Lists of non-empty strings without whitespace. |
A list holds at most 1000 entries, each at most 2048 bytes. The four sections dns, delay, apps and chrome and every key above are required.
update
| Key | Type | Meaning |
|---|---|---|
apk_sha256 | string | SHA-256 of the APK, 64 hex characters. |
apk_size | integer | Size of the APK in bytes. |
The APK is not inside the signed payload. In a file it follows the envelope directly: the remaining bytes of the file are the APK and their count MUST equal apk_size. Over a connection it is sent in APK_DATA frames (Connection protocol). In both cases the phone MUST check the size and hash before using the APK (step 10a), and MUST also require that the APK is the same app, signed with the same certificates as the installed app, with a version code not lower than the installed one (step 10b).
A phone accepts APKs of at most 64 MiB. A session that sends more in APK_DATA frames is ended.
The phone keeps an accepted APK until it is installed or the pending update is cancelled, and checks its hash again while copying it into the installer. When an update’s delay has passed, the pending action is cleared before the install starts, because a successful install restarts the app. If the install then fails, the update is dropped and the failure is shown on the phone; the owner sends it again.
key_add and key_remove
| Key | Type | Meaning |
|---|---|---|
public_key | string | 64 hex characters. |
role | string | owner or partner. |
A key_add with role partner MUST also carry a signature by the key it adds (step 7c). That proves the partner holds the key, and it is what lets the in-person join (Who may do what) work with the partner’s signature alone.
key_remove removes owner keys only; with role partner it is not_permitted. The partner is removed with partner_remove.
exit
The body is the empty object.
partner_remove
The body is the empty object. It removes the partner: the partner key and the partner phone secret.
phone_secret_allow
| Key | Type | Meaning |
|---|---|---|
role | string | owner or partner. |
It clears that role’s phone secret, if any, and for 10 minutes lets a new one be set on the phone without the old one. It needs that role’s approval (Who may do what), which in practice is a signature by that role’s key.