Client protocol and license token, version 1
Status: draft for Phase 1 (#18). This document is normative for the server, the Rust SDK core and every SDK built on it. It is written in English because it addresses SDK authors. Background and reasoning in German: plan.md, "Client-SDK und Sicherheitskonzept".
The key words MUST, MUST NOT, SHOULD and MAY are used as in RFC 2119.
| File | Content |
|---|---|
| This file | The protocol |
| schema/ | JSON Schemas (draft 2020-12) for the token footer, license claims, signed responses, revocation lists, offline license files, offline request codes, signed requests, release lists and module tokens |
| vectors/v1.json | Test vectors, generated and checked by scripts/protocol_vectors.py |
1. Principles
- The server decides. The client only verifies signed, short-lived statements and holds public keys, never a secret shared with other installations. The only private key on the device is the device key of its own activation, created there (section 6.7).
- One signature scheme: PASETO v4.public (Ed25519). There is no algorithm field and no negotiation. Any other token header is rejected.
- Every token names its key ID and protocol version.
- Tokens and responses are data. The SDK validates every field against the schema of its protocol version and rejects anything else.
- A response that is unsigned or fails verification never changes stored license state. The SDK treats it like an unreachable server.
2. Keys
- Each product has its own Ed25519 signing keys, separate for the
testandliveenvironments. Only the signing service holds private keys (AGENTS.md, "Sicherheit und Protokoll"). - The key ID (
kid) is the PASERKk4.pidof the public key:"k4.pid." + base64url(BLAKE2b-264("k4.pid." + "k4.public." + base64url(public_key))). It is derived, not assigned, so it cannot drift from the key. - The SDK is configured with the product ID, the environment and one or two public keys. Two keys exist only during a rotation.
- Rotation: (1) create the new key, (2) ship an app version that accepts both keys, (3) once enough installations have it, the server signs with the new key, (4) a later app version drops the old key. Tokens signed with the old key stay valid until they expire.
3. Token format
Every token is a PASETO v4.public token with footer:
v4.public.<base64url(payload || signature)>.<base64url(footer)>
| Part | Content |
|---|---|
| Payload | UTF-8 JSON object, the claims. Duplicate keys are invalid |
| Footer | UTF-8 JSON object {"kid": "<k4.pid...>", "v": 1}, at most 512 bytes. Authenticated by the signature, not encrypted |
| Implicit assertion | UTF-8 bytes of the product ID, e.g. prod_01J.... Not transmitted; binds every signature to one product |
The implicit assertion means a token issued for one product fails signature verification in any other product, even if a key were shared by mistake.
Three token types exist, told apart by the claim typ:
license: the license token. Stored by the SDK, checked at every start. An offline license (section 6.2) is a license token too.response: a signed Client API response. Checked once on receipt, never stored.revocations: the revocation list of a product (section 3.5). Stored by the SDK, replaced only by a newer list.
A token MUST NOT be accepted where another type is expected. Size limits: license token 8 KiB, response token 16 KiB, revocation list 64 KiB.
3.1 License token claims
Schema: schema/license-claims.schema.json. All fields are required except gexp and chn; no other fields are allowed in version 1.
| Claim | Type | Meaning |
|---|---|---|
typ |
"license" |
Token type |
pid |
string prod_… |
Product ID, equals the implicit assertion |
env |
"test" or "live" |
Environment |
lid |
string lic_… |
License ID. Never the license key |
aid |
string act_… |
Activation ID: this license on this device |
ent |
object | Entitlements by code. Value true (flag), integer (limit) or string up to 256 characters (variant). At most 256 entries |
dev |
object | Device binding, see section 5 |
iat |
time | Server time of issue |
exp |
time | End of validity. Default iat + 24 hours |
oexp |
time | End of offline tolerance, see 3.3 |
lexp |
time or null |
End of the license term, null for perpetual licenses. For display only |
gexp |
time, optional | End of the grace period after the license term (the plan's grace_days). Present only when the license has a term and the plan a grace period; then it MUST be after lexp, and null is not allowed. A token with gexp and lexp null, or with gexp not after lexp, fails with schema_invalid. From lexp until gexp the license is in its grace period: usable, and the SDK reports the end so the app can show it. For display only, like lexp |
chn |
string, optional | Release channel the license gets updates from, for example stable or beta: 1 to 32 characters a-z, 0-9 and -, starting with a letter or digit. The server names the channel in every token it issues; null is not allowed. Informative: the SDK reports it so the app can show it, it never gates a check |
nonce |
string | Nonce of the request that produced this token |
ren |
integer | Renewal counter of the activation: 0 after activate, +1 with every validate |
Times are UTC in the form YYYY-MM-DDTHH:MM:SSZ, nothing else.
3.2 Response claims
Schema: schema/response-claims.schema.json. The HTTP body of a signed response is {"v": 1, "response": "<v4.public token>"} (schema/response-body.schema.json). The body MAY also carry "revocations": "<v4.public token>", the product's revocation list (section 3.5). The list is signed on its own and is not part of the response token, so the response stays within its size limit.
| Claim | Type | Meaning |
|---|---|---|
typ |
"response" |
Token type |
op |
activate, validate, heartbeat, deactivate, device_code, device_poll, account_sign_in, update, config |
Operation this response answers |
pid, env |
As in the license token | |
iat |
time | Server time. The SDK stores it as last seen server time |
nonce |
string | Nonce of the request, echoed |
ok |
boolean | Outcome |
license |
string | New license token. With ok: true on activate, validate and device_poll |
next_heartbeat_s |
integer | With ok: true on heartbeat: seconds until the next heartbeat |
device_code |
object | With ok: true on device_code only: code, user_code, expires_in_s, interval_s (section 6.1) |
account |
object | With ok: true on account_sign_in only: token, expires_in_s (section 6.3) |
update |
object | With ok: true on update only, when a newer release is available: version, channel, published_at, optional notes, notes_language, notes_truncated (section 6.4) |
config |
object | With ok: true on config only: aid, values, optional omitted (section 6.6) |
signal |
object | Only on activate and heartbeat, only when the product's tamper_response is terminate and the request reported a finding: terminate (boolean), optional message (section 6.20) |
error |
object | With ok: false only: code (section 7), optional message (English, for logs, not for display), optional retry_after_s |
3.3 Validity and offline tolerance
expis when the SDK must have renewed the token. The server sets it toiat+ token validity (default 24 hours).oexpis the last moment the token may be used while the server cannot be reached. The server sets it tomax(exp, iat + offline_tolerance). Offline tolerance is set per plan from 0 to 30 days, default 7 days (decisions.md). With tolerance 0,oexpequalsexp.- Both are capped at the end of the license term, or at the end of its grace period (
gexp) if the plan has one. A license that expires in 3 hours without a grace period getsexpandoexpat most 3 hours ahead. - State of a stored token at time
now: fresh ifnow < exp; grace ifexp <= now < oexp(usable, the SDK MUST try to renew); expired ifnow >= oexp. - "Cannot be reached" means a transport failure or an unsigned or unverifiable answer. A signed refusal (for example
license_revoked) ends the license on this device at once, whateveroexpsays. - An offline license (section 6.2) is issued with
expequal tooexp: the end of the offline term set by the plan, capped at the end of the license term. It stays fresh until then and needs no renewal. If the device gets online,validaterenews it like any other license token, with the plan's offline tolerance; this short renewal on every contact is the lease.
3.4 Clock rule
The SDK stores the latest server time it has seen (iat of every verified response or license token). It rejects any check where the system time is more than 300 seconds before that value (clock_rollback). The leeway absorbs normal clock drift; a clock set back by hours or days fails. The stored value only ever moves forward.
3.5 Revocation lists
Schema: schema/revocation-claims.schema.json. A revocation list names licenses and activations of one product and environment that must no longer be used, even where the SDK cannot ask the server: offline licenses, and stored license tokens within their offline tolerance.
| Claim | Type | Meaning |
|---|---|---|
typ |
"revocations" |
Token type |
pid, env |
As in the license token | |
iat |
time | Server time of issue |
seq |
integer, 1 or more | Sequence number. The server raises it with every change of the list |
lic |
array of lic_… |
Revoked licenses, at most 1024, no duplicates |
act |
array of act_… |
Ended activations, at most 1024, no duplicates, for example the old device after a device change |
Rules:
- The server adds the current list to the body of Client API answers (section 3.2) and to offline license files (section 6.2). It MAY leave it out when nothing is revoked.
- The SDK verifies a list with steps 1 to 6 of section 4 (
typ=revocations). Time, nonce and device do not apply. - The SDK stores a verified list only if it holds none or its
seqis higher than the stored one. An older or equal list never replaces a newer one, so a replayed old list cannot lift a revocation. - The SDK treats the
iatof a stored list as server time seen (section 3.4). - The SDK checks every license token against the list it holds (step 11). A license or activation on the list is rejected with
token_revokedand the SDK deletes the token, as after a signedlicense_revoked. - Entries are final. Reversible states such as
license_suspendedare not listed. The server MAY drop an entry once every token it issued for that license or activation has passed itsoexp. - Without contact there is no revocation: a device that never reaches the server and never imports a new file keeps an offline license until its
exp. The vendor limits this with the offline term.
4. Verifying a token
The SDK performs these steps in this order and stops at the first failure. The error codes are SDK-local (section 7.2). Test vectors depend on the order.
License token (at every start and on receipt):
- Structure: header
v4.public., exactly one footer, canonical base64url without padding, size limits. Otherwisetoken_malformed. - Footer: parse as JSON, validate against schema/footer.schema.json (otherwise
token_malformed).vmust be a supported protocol version (otherwiseprotocol_unsupported). - Key:
kidmust be one of the configured keys. Otherwisekey_unknown. - Signature: PASETO v4.public verification with that key, the footer bytes as received, and the product ID as implicit assertion. Otherwise
signature_invalid. - Claims: parse as JSON (duplicate keys rejected), validate against the schema of the token type. Otherwise
schema_invalid. - Binding:
typ,pidandenvmust match the expectation and the SDK configuration. Otherwisetoken_mismatch. - Clock: section 3.4. Otherwise
clock_rollback. - Time: section 3.3. Expired gives
token_expired; fresh and grace are both valid, and the SDK reports which. - Nonce, on receipt only:
noncemust equal the nonce the SDK sent. Otherwisenonce_mismatch. - Device: section 5.3. Otherwise
device_mismatch. - Revocation: if the SDK holds a revocation list (section 3.5), neither
lidnoraidmay be on it. Otherwisetoken_revoked.
Response (on receipt of every Client API answer):
- Parse the HTTP body as JSON and validate against the response body schema. Otherwise
token_malformed. HTTP status codes are informational only; the decision comes from the signed body. - Steps 1 to 6 above with
typ=response, andopmust equal the operation called (token_mismatch). noncemust equal the nonce of this request (nonce_mismatch). Then the clock rule.- If the body carries
revocations: verify the list (section 3.5). A list that fails rejects the whole answer with its error code. A list that passes replaces the stored one if itsseqis higher. - If
okand alicenseis present: verify it with all eleven license steps, using the responseiatas last seen server time, the request nonce and the list held after step 4.
Offline license file (on import, section 6.2):
- Parse the file as JSON and validate it against schema/offline-file.schema.json. Otherwise
token_malformed. - If the file carries
revocations: verify and apply the list as in response step 4. - Without a pending offline request on this device:
nonce_mismatch. - Verify
licensewith all eleven license steps, with the nonce of the pending request as expected nonce.
Comparisons of nonces, IDs and digests SHOULD be constant-time.
5. Device binding
5.1 Order of binding
Per legal review point 4 (legal.md, section 1) the SDK uses the first available method, in this fixed order:
kind |
Method | id or features |
|---|---|---|
chip |
P-256 key pair created in the security chip (TPM 2.0, Secure Enclave, Android Keystore, App Attest on iOS), non-exportable | id: SHA-256 of the public key in SubjectPublicKeyInfo DER, base64url; with App Attest its key ID (SHA-256 of the uncompressed point) |
hwid |
Digests of a few hardware and system features (keyed-hwid) | features: feature ID to digest |
install |
Random installation ID, 32 bytes, created at first activate, kept in the OS secure storage |
id: the 32 bytes, base64url |
none |
No binding. Only when the plan turns device binding off | none |
Rules:
- The SDK reads nothing before
activateand uses only the rights the app already has. It never asks for elevation. A feature it cannot read is left out. - The server decides what goes into
dev: it echoes the method, and forhwidaddsmin_match(minimum number of matching features) and optionalanchors(features that must match). Defaultmin_matchis the number of features minus one, at least 1. - Requests of an activation are signed with its device key (section 6.7). An activation that binds by
chipalso proves its chip key with every signed call (section 6.7, "Chip key"), so a copied activation without the chip is refused. Offline license files (section 6.2) cannot prove it and bind by key ID only.
5.2 Feature list
Each digest is 32 bytes, base64url, computed on the device with a key that never leaves the device (keyed-hwid). The server sees digests only, never values, and treats them as opaque. Derivation, normalization and the exact sources per operating system: SDK device identification. In short:
key = HKDF-SHA256(salt = "keyed-hwid/v1", ikm = device secret, info = product ID)
digest = HMAC-SHA256(key, "keyed-hwid/v1" 0x00 "hardware" 0x00 label 0x00 value), label = feature ID with "." replaced by "_"
The first 16 bytes of a digest equal the keyed-hwid part digest, so the server can use keyed-hwid's signals on truncated digests.
| Feature ID | Windows | macOS | Linux |
|---|---|---|---|
os.machine_id |
MachineGuid from HKLM\SOFTWARE\Microsoft\Cryptography |
IOPlatformUUID (IOKit) |
/etc/machine-id, else /var/lib/dbus/machine-id |
os.system_volume_id |
Serial number of the system volume | UUID of the system volume | Filesystem UUID of the root filesystem |
hw.board_uuid |
SMBIOS system UUID as recorded in HKLM\SYSTEM\HardwareConfig (LastConfig) |
not used (same source as os.machine_id) |
/sys/class/dmi/id/product_uuid only if readable without root, usually not |
hw.cpu_model |
CPU brand string (CPUID) | CPU brand string | CPU brand string |
Never collected: MAC addresses, IP addresses, Wi-Fi or network names, location, host name, user name, serial numbers of the device or its parts, and anything that needs elevated rights. Location and network signals only exist as an opt-in with consent (decision 11) and are not part of protocol version 1.
Changing this list (new feature, new source) is a protocol change and needs an update of this document and of the public SDK documentation.
5.3 Local check
none: always passes.chip,install: the localkindmust equaldev.kindand the localidmust equaldev.id.hwid: the SDK recomputes its digests. A feature matches if the token has it and the digest is equal. Passes if every anchor matches and at leastmin_matchfeatures match. One replaced part therefore does not lock the user out; the server decides on renewal whether the change is acceptable.
6. Client API
Base URL: the Client API host, configured in the SDK. The host name is open (decisions.md, question 9) and MUST NOT be hard-coded in a way that survives no rename. All calls are POST with Content-Type: application/json, path prefix /v1. The SDK sends a fresh random nonce of 32 bytes (base64url) with every call.
Common request fields: v (protocol version, 1), product_id, environment, nonce.
| Call | Additional request fields | Success response |
|---|---|---|
POST /v1/activate |
license_key, account_token or user_token (exactly one), device, app_version, platform, optional device_name, optional device_key (section 6.7), optional integrity (section 6.20) |
ok, license with ren 0, optional signal |
POST /v1/validate |
license (current token), device, app_version, optional build (section 6.8) |
ok, license with ren + 1 |
POST /v1/heartbeat |
license, app_version, optional build, optional integrity (section 6.20) |
ok, next_heartbeat_s, optional signal |
POST /v1/deactivate |
license |
ok |
POST /v1/device-code |
device, app_version, platform, optional device_name |
ok, device_code (section 6.1) |
POST /v1/device-code/poll |
user_code, code, app_version, optional device_key (section 6.7) |
ok, license with ren 0, or authorization_pending |
POST /v1/account/sign-in |
email, password, optional code (TOTP) |
ok, account (section 6.3) |
POST /v1/update |
license, app_version, platform, optional language (en, de), optional build |
ok, with update if a newer release is available (section 6.4) |
POST /v1/config |
license, app_version, optional build |
ok, config (section 6.6) |
POST /v1/download |
license, app_version, platform, version, optional build, optional recipient_key (section 6.12) |
ok, with download if the file is offered (section 6.9) |
POST /v1/update-result |
license, app_version, platform, version, outcome (ok, rolled_back), optional build |
ok (section 6.10) |
POST /v1/crash-report |
license, app_version, platform, report, optional build |
ok (section 6.13) |
POST /v1/assets |
license, app_version, optional language (en, de), optional build |
ok, assets (section 6.14) |
POST /v1/asset-download |
license, app_version, name, optional build |
ok, with asset if the license may fetch it (section 6.14) |
POST /v1/usage |
license, app_version, entitlement, optional amount (1 to 10^9, default 1), report_id, optional build |
ok, usage (section 6.15), or quota_exhausted |
POST /v1/proxy |
license, app_version, target, optional body (JSON object or array, at most 8 KiB), optional build |
ok, with proxy if the license may call the target (section 6.16) |
POST /v1/remote-actions |
license, app_version, optional build |
ok, remote_actions (section 6.17) |
devicein requests is the binding without server-side fields:{"kind": "hwid", "features": {...}},{"kind": "chip", "id": "..."}or{"kind": "install", "id": "..."}.app_versionis a SemVer string.platformis one ofwindows,macos,linux,ios,android.device_nameis set only by the app, for example from user input. The SDK does not read the host name.validateaccepts a license token whose signature is valid even if it has expired, as long as the activation still exists. A presentedrenlower than the latest issued one means the activation was copied: the server records the signalforked. Whether that blocks is a vendor rule (plan.md, keyed-hwid).- Calls of an activation are sent signed (section 6.7): the body is then
{"v": 1, "request": "<token>"}, for achipbinding with the proofchipbeside it, and the request object above is the payload of the token. integrityonactivateandheartbeatis only ever sent inside a signed request, so that a copied token alone cannot forge a clean report for a device; an unsigned call that carries it is refused (section 6.20).
Requests that cannot be attributed to a product (unknown product_id, malformed JSON before the product is known) get an unsigned JSON error with HTTP 400 or 404. Rate limits applied in front of the service (for example by the CDN) are unsigned HTTP 429. The SDK treats all unsigned answers as "server unreachable" (section 1).
6.1 Device code flow
For devices without a convenient keyboard (#33). The app shows a short code; the end customer confirms it in the browser, on a page of the vendor or in the customer portal, and picks a license or enters a key. The SDK polls and then gets a license token as from activate. The device code flow was added to version 1 before its first release.
device_codebinds nothing yet. The server keeps the request'sdevice,app_version,platformanddevice_namewith the code and answers withdevice_code:code: 32 random bytes, base64url. A secret between SDK and server: the SDK keeps it in memory only and never shows it.user_code: two groups of four letters fromBCDFGHJKLMNPQRSTVWXZ, joined by-, for exampleBCDF-GHJK. Consonants only, so no word appears by chance and no letter looks like a digit: 20^8, about 2.6 × 10^10 codes. The confirming page accepts it in any case and without the dash.expires_in_s: lifetime of the code, 60 to 1800 seconds; the server uses 600.interval_s: seconds between polls, 1 to 60; the server uses 5.
- The app shows
user_codeand the address of the confirming page, which the vendor configures in the app. The SDK does not know it. - The confirming page shows what the code stands for (product, platform, device name, time) and asks for a license. Confirming takes one step; with the code shown on screen, redeeming takes at most two (plan.md, E1).
- The SDK sends
device_pollwithuser_codeandcodeeveryinterval_sseconds until the code expires:- not confirmed yet:
authorization_pendingwithretry_after_sset to the interval; - confirmed: the server activates the license on the device sent in step 1, with every check of
activate(license state and term, device limit, reset cooldown, account). Success givesokwith a license token,ren0. A refusal such asdevice_limit_reachedkeeps the confirmed code until it expires, so the customer can free a device and the SDK can poll again; - unknown, expired or already used code, or a
codethat does not belong to theuser_code:device_code_expired. The SDK stops and the app may start again.
- not confirmed yet:
- A code gives one license token. The server deletes it with the first successful
device_poll.
Guessing is limited three ways: the confirming page needs a signed-in customer or the vendor's API key and has rate limits; a code lives for minutes; and device_poll also needs the 32-byte code, which only the SDK has.
6.2 Offline activation
For devices that never reach the Client API, for example in closed company networks (#58). The device shows a request code, the end customer carries it to a device with internet, and brings back a license file. Background in German: plan.md, "Apps ohne eigenen Server und ohne Internet".
Request code. The SDK measures the device as for
activate(section 5.1; reading features here counts as activation), creates a fresh nonce and keeps it as the pending request in its storage. A new request replaces a pending one. The request code is"offline1." + base64url(canonical JSON of the request)The request (schema/offline-request.schema.json) holds the fields of
activatewithout the license key:v,product_id,environment,nonce,device(chip,hwidorinstall, nevernone),app_version,platform, optionaldevice_nameand, for a device from the vendor's own production, optionalcertificate(see In the factory below). Canonical JSON is compact with object keys sorted. The code is at most 4096 characters, fits a QR code and is shown as text for copying. Readers ignore leading and trailing whitespace. The code is not signed and holds no secret; it says what the customer asks for, and the server checks it like anactivaterequest.Issue. The end customer enters the code and the license key in the customer portal, or the vendor issues the file through the Management API. The server applies every check of
activate(license state and term, device limit, reset rules, blocklists, account) and creates the activation. It issues a license token with the nonce of the request,ren0, the device from the request andexp=oexp(section 3.3).File. The license file (schema/offline-file.schema.json) is UTF-8 JSON:
{"v": 1, "license": "<token>"}, optionally with"revocations": "<token>". Files SHOULD use the extension.lic.Import. The SDK checks the file as in section 4 and on success stores the license token, deletes the pending request and from then on checks locally at every start. A file answers exactly one request: imported twice, or on another device, it fails with
nonce_mismatchordevice_mismatch. A changed file fails the signature.
In the factory. A device from the vendor's own production can get its license before it was ever online (#706). Its chip holds the P-256 key named in its factory certificate, which the vendor uploaded to the product (section 6.7, last rules).
- The request MAY carry
certificate, base64url of the DER of that certificate, only withdevice.kindchip. The server checks it like the certificate of section 6.7: it MUST be the stored certificate of a device of the product whose key, as SubjectPublicKeyInfo DER, has the SHA-256device.id, and valid now; otherwise the code is refused like a malformed one. While the device is suspended or revoked, or its batch or CA is blocked, the file is refused withblocked. The activation remembers the device as in section 6.7. - The factory station runs the app, or a factory tool built with the SDK, once on the device, takes the request code over its local link, issues the file with the Management API (
POST /v1/offline-licenses, a plan with offline files) and writes the file back for import (step 4). The device needs no internet, and no private key leaves the signing service or the chip. Because the file is bound to the chip key, a copy works on no other device. - The certificate is public. Anyone holding it can ask for a file for that device, but the file only works where the chip is, and it takes a place of the license like any activation.
- When the vendor revokes the device, the server ends its activations, so the next revocation list (section 3.5) names them. Suspending a device, or blocking its batch or CA, refuses its next call with
blockedand ends nothing; a device that never calls again keeps its file untilexp.
Limits for vendors: an offline license cannot be revoked before its exp unless the device gets a newer revocation list, through a Client API answer or a later file. A device change issues a new file; the old one stays usable until its exp or until a list names its activation. Offline plans therefore get a limited offline term with renewal and a small reset allowance.
6.3 Activation with an account
For products whose identity mode is account or both (#234): the end customer signs in to the app with the account they have with this vendor (plan.md, "Noctix-Konten"), and the app activates without a license key. The app asks for email and password itself; the SDK sends them once and keeps neither. Added to version 1 before its first release.
account_sign_inwithemail,passwordand, if the account has TOTP on,code(six digits from the authenticator app):- right:
okwithaccount:token, an opaque stringacct1.followed by base64url, at most 512 bytes, andexpires_in_s, 60 to 3600 seconds; the server uses 600. The SDK keeps the token in memory only and does not show it; - wrong email, wrong password, unconfirmed account or wrong TOTP code:
invalid_credentials. The answer does not tell whether the address has an account, and an unknown address takes as long as a known one; - right password, TOTP on, no
code:totp_required. The app asks for the code and sends the sign-in again with it; - five failed sign-ins in a row lock the account for 15 minutes:
rate_limitedwithretry_after_s. Products with identity modelicense_keyanswerinvalid_request.
- right:
activatewithaccount_tokeninstead oflicense_key. The server finds the account's licenses for the product: a license this device is already activated on, else the newest one that is unused or active and within its term, else the newest one, whose refusal it answers (for examplelicense_expired). It then applies every check ofactivate. An account without a license for the product getslicense_not_found.- An account token is bound to the vendor's team, the environment and the product, and sealed by the server: a token of another vendor, product or environment, an expired one, and one issued before the password changed get
invalid_credentials. The SDK signs in again. A token may be used more than once within its lifetime, for example afterdevice_limit_reachedonce the customer has freed a device.
Products with identity mode account take no license key: activate with license_key answers invalid_request.
6.4 Update check
The app asks whether a newer release is available for this device and shows its release notes as an update hint (#281). Added to version 1 before its first release. Since #3 the answer also names the release's file, which download (section 6.9) hands over.
updatewith the stored license token (an expired one is fine, as forvalidate), the runningapp_version, theplatformand optionally thelanguageof the notes. The server checks the token, the license state and the activation likeheartbeat, but not the minimum version: an app below it is exactly the one that needs the hint.- The server takes the published releases of the license's channel and of every channel with a lower rank (plan.md, release channels) that list the platform or no platform and whose rollout reaches this activation, and picks the highest SemVer version. A rollout reaches an activation when it is not paused and the activation's bucket for the release is below its share: the first four bytes of SHA-256 of
<release_id>:<activation_id>as a big-endian number, modulo 100. A growing share keeps every device it reached. If it is higher thanapp_version, the answer isokwithupdate:version,channel,published_at;notesinlanguage, else in English, else in German, withnotes_language. Notes are cut to at most 6000 characters, so that their JSON form stays within 6000 bytes, and then carrynotes_truncated: true. Without notes of the release the three fields are absent;file, if the release has a file for the platform:filename,size_bytes,sha256(32 bytes, base64url);required: trueif the device must update (section 6.10).
- Otherwise the answer is
okwithoutupdate.
The answer does not change the stored license token, and the call does not renew it. Refusals are those of heartbeat without version_outdated and session_limit_reached.
6.5 Activation with a user token
For vendors with their own account system (#52): the vendor's backend vouches for the signed-in user, and the app activates without a license key and without a Noctix account. Noctix never sees the vendor's private key. Added to version 1 before its first release.
- Keys. The vendor registers the Ed25519 public key of its backend per product and environment through the Management API (
/v1/products/{id}/user-token-keys), at most five at once, so a key can be rotated: add the new key, switch the backend over, remove the old one. A product without a key answersuser_tokenwithinvalid_request. - Token. The backend signs a user token: PASETO v4.public as in section 3, footer
{"kid": "<k4.pid of the key>", "v": 1}, implicit assertion the product ID, at most 2048 bytes. The claims (schema/user-claims.schema.json) aretyp(user),pid,env,sub(the user's ID in the vendor's system, 1 to 200 characters, no control characters),iatandexp, at most 3600 seconds afteriat. Short lifetimes are better; the Node backend SDK uses 300 seconds. - Activate. The app gets the token from the vendor's backend and sends
activatewithuser_tokeninstead oflicense_key. The server checks the signature against the product's keys,pid,envand the time with 60 seconds of leeway. A token that fails any of these getsinvalid_credentials. The server then finds the end customer whoseexternal_user_idissub(license_not_foundwithout one), picks the license as in section 6.3, step 2, and applies every check ofactivate. - The SDK keeps the token in memory only. A token may be used more than once within its lifetime, for example after
device_limit_reached. Removing a key refuses every token signed with it from then on.
6.6 Remote config
The vendor sets values per product, plan, entitlement or license through the Management API (/v1/products/{id}/config-keys, /v1/products/{id}/config-values); the app fetches the values of its license (#256). Remote config is data, never code: every value is a boolean, a number or a text of at most 4096 characters. Added to version 1 before its first release.
configwith the stored license token and the runningapp_version. The server checks the token and the activation likeheartbeat, and that the license is usable: in its term or its grace period, not suspended, paused or revoked. Otherwise it refuses with the code ofvalidate.- Per key of the product the most specific value counts: license, then plan, then an entitlement of the plan (the smallest code wins), then product. Keys without a value for the license are absent. The answer is
okwithconfig:aid: the activation the config was resolved for. The SDK MUST reject a config whoseaidis not that of its stored license token (token_mismatch);values: the values by key, at most 100. Keys match^[a-z][a-z0-9_]{0,63}$;omitted: present only when the values do not all fit into the size limit of a response (16 KiB). The server keeps keys in key order while they fit and names the others here, so the app knows they exist. A single text of 4096 characters of four bytes each never fits.
- The SDK checks the values against the JSON Schema the vendor embeds in the app, the one the Management API gives for the product (
GET /v1/products/{id}/config-schema). The SDK supports the subset that schema uses: per keytype(boolean,integer,number,string),minimum,maximum,maxLength,description, andadditionalProperties: false. A schema with other keywords is a configuration error (config_invalid). Values of unknown keys and values the schema does not allow are dropped and their keys reported; the app never sees them. - The SDK stores the signed answer with the nonce of its request. Without network it gives the stored config again after verifying its signature once more, but only while the stored license token passes the local check and belongs to the same activation.
The answer does not change the stored license token, and the call does not renew it.
6.7 Signed requests
A copied license token alone must not be enough to act for a device (#93). Each activation therefore gets its own Ed25519 key, the device key, and signs its calls with it. Added to version 1 before its first release.
- Key. Before
activateordevice-code/poll, the SDK creates a new device key from 32 random bytes and sends the public key asdevice_key(32 bytes, base64url). It keeps the private key in the secure storage of the device next to the license token, and replaces it only with the next activation. The key never leaves the device and is not shared with other installations. Where the device binds by security chip, the chip will hold the key (#57). - Format. A signed call has the HTTP body
{"v": 1, "request": "<token>"}and nothing else. The token is PASETO v4.public, at most 16 KiB:- payload: the request object of the call (common fields and the call's own fields, as in the table above) plus
op, the call as in response claims, andiat, the time of signing. Schema: schema/request-claims.schema.json; - footer:
{"kid": "<k4.pid of the device key>", "v": 1}; - implicit assertion: the product ID, like every token.
- payload: the request object of the call (common fields and the call's own fields, as in the table above) plus
- Which calls.
activateanddevice-code/pollwithdevice_keyare signed with that new key (proof of possession).validate,heartbeat,deactivate,update,configanddownloadare signed with the key of the activation their license token names.device-codeandaccount/sign-inbelong to no activation and are never signed. Only calls that create an activation carrydevice_key. An unsignedactivatethat matches an activation with a stored key is refused withinvalid_request: only a call signed with a new key replaces the key, so a copied token cannot be turned back into an unsigned activation. Offline files (section 6.2) are issued by the vendor and leave the activation as it is. - Time.
iatis device time corrected by the difference to the server time of the last verified response. The server acceptsiatwithin 10 minutes of its own time, and within 24 hours for calls that create an activation, because the device may not have seen server time yet. An SDK whose call is refused withinvalid_requestand whose clock differs from the server time of that refusal by more than a minute corrects its time and tries once more.
The server checks a signed call in this order. A failure in steps 1 to 3 leaves no product to sign for and gets the unsigned 400 of section 6; every later failure is the signed refusal invalid_request. The test vectors name the failing step with the codes of section 7.2 in brackets:
- The body is exactly
vandrequest, andchipif present is an object of the fields named under Chip key, each a non-empty string (token_malformed). - Structure and footer of the token as in section 4, steps 1 to 2 (
token_malformed,protocol_unsupported). - The payload matches the schema, and
device_keyis present exactly in calls that create an activation (schema_invalid). opandproduct_idare those of the path and the call (token_mismatch).- The key: for a new activation
device_key, else the key stored with the activation of the license token. The footer'skidMUST be that key's ID (key_unknown), and the signature MUST verify with the product ID as implicit assertion (signature_invalid). iatis within the window described under Time (token_expired).- The nonce was not used before with this device key while its
iatwindow is open. The server keeps used nonces in a store all its instances share, so a request accepted by one instance is a repetition for every other. - The chip key, as described under Chip key: for a new activation from
chip, else the one stored with the activation (schema_invalidif the proof is missing or has the wrong fields,key_unknownifkeyis not the device ID,signature_invalidif the signature fails). - From here on the request object is handled like an unsigned one.
Chip key. The device key is Ed25519, which security chips do not offer. A device that binds by chip therefore keeps its device key in the secure storage like any other, and proves the chip key beside it: the body is {"v": 1, "request": "<token>", "chip": {...}}, and the chip signs the token exactly as it is in request. The token holds the nonce and iat, and the server keeps used nonces (step 7), so the token is also the one-time challenge for App Attest and Play Integrity. Every field is base64url without padding.
| Where | Call that creates the activation | Later calls |
|---|---|---|
| TPM 2.0 (Windows, Linux), Secure Enclave (macOS), Android Keystore | key: SubjectPublicKeyInfo DER of the P-256 key, its SHA-256 MUST be device.id; sig: ECDSA P-256 with SHA-256 over the ASCII bytes of the token, r and s with 32 bytes each |
sig alone |
| Android, when the vendor set up Play Integrity for the product | as above, plus integrity: the token of a classic Play Integrity request whose nonce is the SHA-256 of the request token, base64url |
sig alone |
| iOS, App Attest | attestation: the attestation object of attestKey with clientDataHash = SHA-256 of the request token; device.id is the key ID |
assertion: the assertion of generateAssertion over the request token; its counter MUST be higher than the last one |
- A call that creates an activation with a
chipbinding MUST carry the proof; an activation that binds otherwise MUST NOT, and neither MUST the calls of an activation without a chip key. - When the vendor set up App Attest for the product (#512), activations on platform
iosMUST use App Attest. When the vendor set up Play Integrity, activations on platformandroidMUST bind bychipand carryintegrity, with the app and device verdicts the vendor asks for. Without these settingsattestationandintegrityare refused. - With App Attest the server accepts keys of apps signed for development only in the
testenvironment. - A device from the vendor's own production, whose factory certificate the vendor uploaded to the product (device CAs and batches of the Management API), MAY add
certificate: the DER of that X.509 certificate, on the call that creates the activation and besidekeyandsig. The certificate MUST be the one stored for a device of the product whose key is the chip key, and valid now; the activation then remembers the device. While the device is suspended or revoked, or its batch or CA is blocked, that call and every later call of the activation are refused withblockedinstead ofinvalid_request. - All other refusals of this step are
invalid_request, like every other step of this section.
An activation that has a device key accepts only signed calls; an unsigned call with its license token is refused with invalid_request. An activation without one, for example from an offline license file (section 6.2), accepts unsigned calls, and a signed call for it is refused. Calls are limited per activation in addition to the limit per license.
6.8 Approved builds
The vendor can tell the server which builds of a version it shipped (#61, protection level 4 in plan.md). A changed program then loses what the server delivers. Added to version 1 before its first release.
- Digest.
buildis the SHA-256 of the running program, 32 bytes, base64url. The SDK sends it withvalidate,heartbeat,update,configanddownloadonce the app sets it; the Rust SDK hashes the running executable (current_build_digest) or takes a digest the app computed itself, for example of its main assembly.activatedoes not carry it. - Approval. The vendor registers the same digest, as hex, per release and platform (
POST /v1/releases/{id}/builds, Management API), typically from its build pipeline. - Rule. Per product and environment,
build_checkdecides:off(default) checks nothing;flagrecordsactivation.unknown_buildfor a build that no release with the reportedapp_versionlists for the activation's platform;denydoes the same and withholds:updateanswersokwithoutupdate,configanswersokwith an emptyconfig,downloadanswersokwithoutdownload.validateandheartbeatare never refused for the build; the license stays usable. A call withoutbuildcounts as unknown once the check is on. The event comes once per activation and build, not with every call. - Limits. The digest is the device's word. It stops a changed program that still reports what it measures; whoever also patches the digest the SDK sends gets past it. The check is a server-side consequence for the common case of a patched binary, not a guarantee.
6.9 Downloads
A device fetches the file of a release only with a usable license (#3). Added to version 1 before its first release.
downloadwith the stored license token, the runningapp_version, theplatform, theversionit wants (usually the oneupdateoffered) and, if set,build. The server checks token, license and activation likeconfig: the license must be usable, in its term or grace period, not suspended, paused or revoked.- The release with that version must be offered to this activation as in section 6.4 (channel, platform, rollout), though it need not be newer than the running app, so that a broken install can be repaired. Under
build_checkdeny, an unknown build gets no file (section 6.8). - If so and the release has a file for the platform, the answer is
okwithdownload:version,file(as in 6.4),urlandexpires_at. The link works for 5 minutes with a plainGETand needs no credentials. Otherwise the answer isokwithoutdownload. - The SDK fetches the file, checks
size_bytesandsha256before the file gets its final name, and hands path and checksum to the app. It never opens, unpacks or runs the file; installing is the job of the app's updater. A link that is nothttpsis refused, except forlocalhostduring development.
Each link handed out is recorded as activation.file_downloaded.
6.10 Update results and blocked versions
A faulty release stops itself before it reaches every device, and a blocked version is replaced (#92). Added to version 1 before its first release.
- Result. After installing a release, the app's updater reports with
update_resultwhether the new version runs (outcomeok) or it went back to the earlier one (rolled_back): the stored license token, theapp_versionthat runs now, theplatform, theversionthat was installed and, if set,build. The license must be usable, as forconfig. The release is the one of that version in the license's channels (section 6.4) that is or was published; an unknown version has no effect. The answer isok. One result counts per release and activation; a later report replaces it. Each change is recorded asactivation.update_reported. - No second offer. A release an activation rolled back is not offered to it again, by
updateordownload. - Halt. When the rollbacks of a release reach the product's threshold (
rollback_halt_percent, default 20, of at leastrollback_halt_minresults, default 10; Management API, product settings), the server pauses its rollout:release.rollout_changedwithreasonrollbacks. It does so when the share crosses the threshold. A rollout the vendor resumes stays on until the share drops below the threshold and reaches it again. The vendor resumes, withdraws or blocks. - Block. The vendor can block a version (
POST /v1/releases/{id}/block, eventrelease.blocked). The release counts as withdrawn. A device that runs the version getsversion_outdatedfromvalidateandactivate, andupdatenames the newest release of its channels as for section 6.4, withrequired: true, whatever the rollout share (a paused rollout still counts). Never an older version. The samerequiredcomes when the running version is below the minimum version of the product or the channel.downloadhands over that release under the same rule. - Stepping stones. A release can name
min_from_version(Management API, SemVer below its own version).updateanddownloadoffer it only to devices whoseapp_versionis at least that version; a device below gets the newest release it may install, also when it must update, and so reaches the newer version over intermediate ones. Files of a release another published release names this way stay in storage.
The SDK runs nothing: installing, checking that the new version starts and rolling back are the job of the app's updater.
6.11 Release lists signed by the vendor
The server never signs code. The vendor signs a list of its releases in its own build pipeline, so that not even a compromised server can offer a foreign, older or revoked version (#90). Added to version 1 before its first release. Schema: schema/release-list-claims.schema.json.
| Claim | Type | Meaning |
|---|---|---|
typ |
"release_list" |
Token type |
pid, env |
As in the license token | |
iat |
time | When the vendor signed it |
seq |
integer, 1 or more | Sequence number. Every new list has a higher one |
releases |
array, at most 200 | Releases the server may offer: version (SemVer, unique) and files, at most one per platform, each with platform, filename, size_bytes, sha256 as in section 6.4 |
revoked |
array of versions, at most 1000 | Versions that must never be offered again |
- Keys. The vendor creates an Ed25519 key pair and keeps the private key, for example in the secret store of its pipeline. The format is that of every token here: PASETO
v4.public, footer with the key'skidandv, the product ID as implicit assertion. Thetypkeeps a list from passing as any other token. The vendor registers the public key with the server (POST /v1/products/{id}/release-keys, at most two per product and environment: active and reserve) and embeds the same keys in the app (Rust SDK:with_release_keys). - Publishing. For every change the vendor signs a new list with a higher
seq(reference toolrelease-tool sign) and uploads it (POST /v1/products/{id}/release-lists). The server checks it with the registered keys, the product, the environment and thatseqis higher than the current list's, and recordsproduct.release_list_published. - Server. With a list in place,
updateanddownloadoffer only releases it names and does not revoke. Both send the current list next to the response token, asrelease_listin the body (section 6), like the revocation list. - SDK. With release keys set, the SDK verifies a list in the body with steps 1 to 6 of section 4 (
typ=release_list) using the vendor's keys; a list that does not verify rejects the whole answer (server unreachable). It stores a list only if itsseqis higher than the stored one's and keeps it across activations, so a replayed older list changes nothing. An offer fromupdatemust be on the stored list, not revoked and newer than the runningapp_version, and itsfilemust be the listed file for the platform; adownloadmust be listed, not revoked, not older than the running version and name the listed file. Otherwise the SDK refuses withtoken_mismatch, and withkey_unknownwhile it holds no list at all. The file itself is then checked againstsize_bytesandsha256as in section 6.9. - Key change. Ship an app that embeds both the current and the new key, register the new one, sign the next list with it and remove the old key. Apps that know both keep working without a forced update.
6.12 Encrypted release files
A release file can lie in the file store only encrypted, so that a leaked link or a copy of the store opens nothing without a license (#91). Added to version 1 before its first release. Optional per file; files without encryption stay as in section 6.9.
- Wrapping key. Each product has per environment one X25519 key pair for this, the wrapping key. Only the signing service holds the private half, like the signing keys (section 2); the API service never sees it. The vendor fetches the public half (
GET /v1/products/{id}/wrapping-key, withkey_id=x25519.plus the base64url of the first 16 bytes of SHA-256("release-seal/v1 key-id"0x00 public key)). - Encrypting. The vendor's pipeline (reference tool
release-tool encrypt) draws a random 32-byte content key and encrypts the file: the 16 bytesrelease-seal/v1\n, then the content in chunks of 65 536 bytes, each sealed with ChaCha20-Poly1305 under the content key and the nonce of an 11-byte big-endian chunk counter followed by one byte, 1 for the final chunk and 0 for every other. Only the final chunk may be shorter; it is empty only for an empty file.size_bytesandsha256everywhere (sections 6.4, 6.9, 6.11) are those of the encrypted file. - Wrapping. The content key is sealed with HPKE (RFC 9180), base mode, DHKEM(X25519, HKDF-SHA256), HKDF-SHA256, ChaCha20-Poly1305, empty
aad, for the wrapping key. The wrapped key is the 32-byte encapsulated key followed by the 48-byte ciphertext, 80 bytes.infois the label, the product ID, the environment (test,live) and the 32-byte SHA-256 of the encrypted file, each followed by 0x00 except the last: labelrelease-seal/v1 platformfor the wrapping key,release-seal/v1 devicefor a device. The vendor announces the file withencryption:wrapping_key_idandwrapped_key(Management API). - Download. The SDK makes a fresh X25519 key pair for each
downloadand sends the public key asrecipient_key(32 bytes, base64url). The call is signed with the device key of the activation (section 6.7), so the key belongs to that device. For an encrypted file the signing service opens the content key with the wrapping key and seals it again forrecipient_keywith the device label;downloadcarries it askey(80 bytes, base64url). Withoutrecipient_keyan encrypted file is not handed out (okwithoutdownload). - SDK. The SDK opens
keywith the private half of its download key, which it keeps in memory for this one download only, fetches the file, checkssize_bytesandsha256as in section 6.9 and decrypts it. Only a file that decrypts completely gets its final name. Akeythat does not open is refused withtoken_mismatch.
The info binds a wrapped key to its file, product, environment and recipient, so it opens nothing else, and a key wrapped for one download opens nothing on another device. The labels carry a version; a change of format gets a new label. The customer portal does not offer encrypted files, since a browser cannot open them.
6.13 Crash and error reports
The app can send reports of crashes, unexpected exits and errors the user reports, so the vendor sees which faults hit which versions (#506, first part of #81). Added to version 1 before its first release. Off by default: the product must allow it (crash_reports, Management API, product settings) and the app must turn it on; the SDK sends nothing by itself.
- Call.
crash_reportis signed like every call of an activation (section 6.7) and carries the stored license token, the runningapp_versionandplatform, if setbuild, andreport. The license must be usable, as forconfig. While the product does not allow reports, the answer isinvalid_request. - Report.
reportis an object of at most 32 KiB as JSON:kind(crash,exitfor an unexpected exit,errorfor a report the user wrote),occurred_at(Unix seconds, at most five minutes in the future), optionalexception(type or signal, at most 200 characters),message(at most 2000),frames(at most 128, each with optionalfunction,module,file,line,address,module_build_id,module_offset),log(at most 100 lines) and, only forerror,contactandsteps. Unknown fields are refused. The app decides what goes in; the SDK collects no data of its own and adds no device features. - Grouping. The server groups reports per product and environment by a fingerprint: SHA-256 over
kind,exceptionand the first five frames (function, else module withmodule_offset, else module); without frames it takes the first line ofmessagewith numbers replaced. A new group recordscrash_group.created. Its title is the exception and the top frame, never the message text unless there is nothing else; a group oferrorreports, which the user wrote, then gets the neutral title "Error report" (#680). - Regression. The vendor resolves a group in the Management API; the highest version seen so far is stored. A report in a higher version (SemVer) reopens the group as a regression (
crash_group.regressed). A report in the same or a lower version leaves it resolved. With the product settingscrash_auto_resolve_devicesandcrash_auto_resolve_days(#510) the server resolves a crash or exit group itself once higher versions ran on that many devices on that many days after its last report. - Limits. At most 20 reports per activation and day count; further ones are answered
okand dropped, so a crash loop does not flood the store. Reports hold no IP address. Each report expires after the product's retention (crash_retention_days, 1 to 90, default 90) and goes with its license or activation. Groups without reports go a year after they were last seen.
The answer is ok without further fields. Reports and their counts on a group are telemetry and record no event; changes by the vendor (status, assignee, notes, deleting) do. A frame without function but with module_build_id (the Breakpad debug ID of the module) and module_offset (0x and hex, the instruction's offset in the module, the same in every start) is resolved when the vendor reads the report, with the symbol file the vendor uploaded for that debug ID (#508); the stored report stays as sent, and symbols never go to devices. Each stored crash or exit also counts for its version and day in the crash numbers (GET /v1/crash-stats), which hold sums only.
6.14 Assets
Files of a product outside its releases, such as AI models, content packs or voices (#97, #550). Added to version 1 before its first release. The vendor uploads them per product and environment through the Management API and gives each a name of 1 to 100 characters (a-z, 0-9, ., _, -, starting with a letter or digit) that never changes; new content gets a new name. An asset is public (every usable license), entitled (only licenses whose plan grants its entitlement: a flag that is true, a limit above 0 or a variant) or unlisted (not listed, fetched by name like a public one). Assets can form a group, such as voice, in which at most one is the default the app takes when the user chose none.
List.
assetswith the stored license token, the runningapp_version, if setbuild, and optionallylanguage. The license must be usable, as forconfig. The answer isokwithassets, a list of at most 100 entries, ordered by group (assets without a group first) and name:name, optionalgroup,default(only when true), optionaltitle(at most 100 characters) anddescription(at most 500) in the requested language, else English, else German, andfile(as in 6.4). A list that does not fit into the response (section 3) loses the descriptions first, then entries from the end. Underbuild_checkdeny, an unknown build gets an empty list (section 6.8).Download.
asset_downloadwith the license token,app_version, if setbuild, and thename. If the license may fetch an asset of that name, the answer isokwithasset:name,file,urlandexpires_at, a link for 5 minutes as in section 6.9, and for a modulemodule_token(step 5). Otherwise the answer isokwithoutasset, so an app cannot tell an unknown name from one it may not fetch.Encrypted assets. An asset can be encrypted exactly like a release file (section 6.12): the same format, the product's wrapping key,
infowith the same labels and the SHA-256 of the encrypted file, andencryptionwithwrapping_key_id,wrapped_keyand optionallysource_sha256when the vendor announces it.asset_downloadtakesrecipient_keyasdownloaddoes; for an encrypted assetassetcarrieskey, the content key wrapped for it, and withoutrecipient_keythe answer isokwithoutasset. The list (step 1) does not say whether an asset is encrypted.On the device. The SDK fetches the file, checks
size_bytesandsha256before the file gets its final name, decrypts an encrypted asset as in section 6.12 and hands the path to the app, as in section 6.9. It never opens, unpacks or runs the file. Since the checksum names the content, the SDK can skip a download whose file it already holds.Modules. An asset can be a WebAssembly module of section 6.18 (#653). The vendor turns modules on per product and environment (setting
modules, off by default) and announces the module with its module token. The server verifies the token with the product's release keys and checks that it names this product, environment, size and SHA-256; it never signs one.asset_downloadreturns the token asmodule_tokenbeside the link, never together withkey: a module is not encrypted. While the setting is off, modules are neither listed nor handed out. The SDK verifies the token again before the module runs (section 6.18, step 3).
Listing records no event. Each link handed out is recorded as activation.asset_downloaded, with encrypted and module.
6.15 Usage reports
Use of a quota reported by the app itself, without the vendor's backend (#587). Added to version 1 before its first release. A quota is an entitlement of the plan whose value is an integer of at least 0, such as "exports": 1000; it holds for the whole term of the license. The rules are those of POST /v1/licenses/{id}/usage of the Management API (plan.md), with source client.
- Report.
usagewith the stored license token,app_version, if setbuild, theentitlementcode,amount(1 to 10^9, default 1) andreport_id, the app's own ID of this use (1 to 100 characters, no control characters). The activation must be open and the license usable, as forconfig. An entitlement without an integer value isinvalid_request. - Answer.
okwithusage:entitlement,counted,used,limit(the plan's value plus the units granted on top) andremaining. A report counts once perreport_idand license: a repeated one changes nothing and answers with the current counter andcounted: false, also after the license ended, so an app that lost the answer can ask again with the same ID. - Refusal. A report that would go past
limitcounts nothing and is refused withquota_exhausted(409). It keeps the license token. Reports of one license are counted one after the other, so concurrent reports never go past the quota.
A counted report is recorded as usage.recorded, a refused one as usage.exhausted. The license token is unchanged.
6.16 Proxy calls
The app calls an endpoint of the vendor through the server, so the endpoint's URL and credentials never ship in the app (#76). Added to version 1 before its first release. The vendor sets up targets per product and environment through the Management API (/v1/products/{id}/proxy-targets): a name the app uses (same rules as asset names, section 6.14), an https URL with public addresses, up to ten headers whose values the server keeps sealed (such as Authorization), optionally an entitlement, a timeout (1 to 10 seconds, default 5) and a limit of calls per activation and minute (1 to 600, default 60).
- Call.
proxywith the stored license token,app_version, if setbuild, thetargetname and optionallybody, a JSON object or array of at most 8 KiB as compact JSON. The activation must be open and the license usable, as forconfig. Underbuild_checkdeny, an unknown build getsokwithoutproxy(section 6.8). - Who may call. A target with an entitlement takes calls only from licenses whose plan grants it (a flag that is
true, a limit above 0 or a variant). An unknown, disabled or not granted target answersokwithoutproxy, so an app cannot tell them apart. A call over the target's limit is refused withrate_limited; it keeps the license token. - Forwarding. The server sends
POSTto the target's URL with the vendor's headers and the JSON body{"type": "proxy.call", "id", "target", "product_id", "environment", "license_id", "activation_id", "plan_id", "app_version", "body"}, wherebodyis the app's ornull. It is signed like a webhook with the target's secret (webhook-id,webhook-timestamp,webhook-signature, docs/api/webhooks-v1.md, section 2), so the vendor can tell calls through the server from others and trust license and plan without asking the Management API. Redirects are not followed; addresses in private, local or reserved networks are refused when the URL is set and on every call. - Answer.
okwithproxy:target, andstatus, the target's HTTP status, if it answered.bodyis the target's body if it is a JSON object or array of at most 8 KiB; an empty body gives none. Otherwisefailuresays why:timeoutorunreachable(withoutstatus),response_too_largeorresponse_invalid(withstatus, withoutbody). A body that would make the signed response too large (section 3) is dropped withresponse_too_large. The SDK handsstatusandbodyto the app as data; the server never interprets them.
Calls are telemetry and record no event; changes to targets do (proxy_target.created, proxy_target.updated, proxy_target.secret_rotated, proxy_target.deleted). The license token is unchanged.
6.17 Remote actions
Named actions with a fixed schema that the vendor or the end customer sends to one running app (#78). Added to version 1 before its first release. They take the place of KeyAuth's web loader without carrying code: an action is a name and a few scalar parameters, and the app decides what it does with it. The server never sends code this way (section 1).
- Definitions. The vendor defines actions per product and environment in the Management API (
/v1/products/{id}/remote-action-types, at most 100): aname(a-z,0-9,_, starting with a letter, at most 64 characters, fixed), titles and descriptions inenandde, at most 10paramsandcustomer_allowed. A parameter has a name (like an action name, at most 32 characters),type(string,integer,boolean),required, for integersminimumandmaximum, for stringsmax_length(1 to 200, default 200) andenum(1 to 20 different texts). Texts never hold control characters. - Sending. The vendor sends an action to one open activation (
POST /v1/licenses/{id}/activations/{activation_id}/remote-actions), or the end customer in the portal for one of their own devices when the definition hascustomer_allowed. The server checks the parameters against the definition (unknown names, types, ranges, required ones, at most 4 KiB as JSON). An action waits aspendingforttl_s(60 seconds to 7 days, default one day); at most 50 wait per activation. The vendor can cancel a waiting action. Deleting a definition cancels its waiting actions; a reset or deactivated device takes none. - Fetching.
remote_actionswith the stored license token,app_versionand, if set,build. The activation must be open and the license usable, as forconfig. The answer isokwithremote_actions, the pending, unexpired actions of this activation, oldest first, at most 20 and as many as fit into the response (section 3):id(rac_…),name,params,sent_by(vendor,customer),issued_atandexpires_at. Each action handed out is markeddeliveredand never comes again, so an app that loses the answer loses those actions. An empty list is the normal answer. Underbuild_checkdeny, an unknown build gets an empty list (section 6.8). - On the device. The app embeds the definitions it accepts (the answer of
GET /v1/products/{id}/remote-action-types). The SDK checks every action against them again, with the same rules as the server, and drops each one whose name is unknown, whose parameters do not fit or that has expired by the server time of the answer. It hands the remaining actions to the app as data and never runs anything itself. Since the SDK checks the app's own copy, a definition changed on the server after the app shipped cannot widen what the app accepts.
Fetching records remote_action.delivered for each action handed out; sending and cancelling record remote_action.created and remote_action.cancelled, changes to definitions remote_action_type.created, remote_action_type.updated and remote_action_type.deleted. The license token is unchanged.
6.18 Modules signed by the vendor
The server never delivers native code. The only code an app may run on behalf of a vendor is a WebAssembly module that the vendor signed with its release key (section 6.11), in a sandbox of the SDK (#77). Added to version 1 before its first release. Schema: schema/module-claims.schema.json. The runtime is optional: an SDK built without it cannot run a module, and an app that includes it opts in with the vendor's keys.
| Claim | Type | Meaning |
|---|---|---|
typ |
"module" |
Token type |
pid, env |
As in the license token | |
iat |
time | When the vendor signed it |
name |
string | Name of the module, same rules as asset names (section 6.14) |
version |
SemVer | Version of the module |
size_bytes |
integer, 1 to 4194304 | Size of the module |
sha256 |
b64u32 | SHA-256 of the module |
- Signing. The vendor signs the token in its own pipeline (reference tool
release-tool sign-module), with the same keys as its release lists. The format is that of every token here: PASETOv4.public, footer withkidandv, the product ID as implicit assertion. The platform's product keys MUST NOT be accepted for modules. - Delivery. Module and token travel together by any channel, for example in the app bundle or as an asset (section 6.14, step 5), which hands out the token as
module_token. The channel is not trusted. - Loading. The SDK verifies the token with steps 1 to 6 of section 4 (
typ=module) using the vendor's keys embedded in the app, then checks thatnameis the one the app asked for, thatversionis not below a lowest version the app may set, and that the module's size and SHA-256 equalsize_bytesandsha256. Only then does it parse the module. Any failure refuses the module: the token errors of section 7.2, otherwise a local error. - Sandbox. The module MUST NOT reach files, network, processes, clocks or randomness. Its only imports are functions the app registered, in the namespace
app; a module with any other import is refused before it runs. Each call is bounded in instructions (fuel), memory, and input and output size. Proposals beyond WebAssembly 2.0 core that a module does not need (threads, SIMD, memory64, multi-memory, exceptions, tail calls, GC) and start functions are refused. A failed call does not affect the app; the instance is not used again. - ABI version 1. The module exports
memoryandalloc(len i32) -> i32. A callable export and every import have the type(ptr i32, len i32) -> i64: input atptrwithlenbytes, output returned as(out_ptr << 32) | out_len. The SDK checks every pointer and length against the module's memory and the limits.
Modules are not secret and not a replacement for a decision on the server: a module on the device can be copied and read like any file.
6.19 Devices behind a host
A device without its own internet access can reach the Client API through a host in its local network, for example a gateway, a PC or a phone (#706). The protocol does not depend on the path a call takes: calls of an activation are signed with its device key and, for a chip binding, with the chip (section 6.7), and every answer is signed and bound to the nonce and the device (section 4). A host can therefore delay or drop calls, but it cannot sign a call, change an answer or use an answer for another device or another call. It sees what the device sends (license token, device digests, app version), and the server sees the host's IP address, not the device's. The host is the vendor's or the customer's own machine; a vendor who does not trust it uses offline files (section 6.2).
SDKs and hosts that relay use this framing, so that a device built with one SDK works with a host built with another. The link between device and host (TCP in the local network, a serial line, Bluetooth) is the vendor's choice; on it, each message is one line of UTF-8 JSON ending in a line feed, at most 64 KiB.
| Device sends | Host answers |
|---|---|
{"v": 1, "post": "/v1/<call>", "body": "<request body>"} |
{"v": 1, "status": <HTTP status>, "body": "<response body>"}, or {"v": 1, "error": "unreachable"} |
{"v": 1, "get": "<url>"} |
{"v": 1, "status": <HTTP status>, "size": <bytes>}, then exactly that many bytes of the file; or {"v": 1, "error": "unreachable"} |
postis the path of a call of the table in section 6, nothing else. The host sends the body unchanged to its own configured Client API base URL and returns status and body unchanged. It MUST refuse other paths and never take a base URL from the device.getfetches the file of adownloadorasset-downloadanswer (sections 6.9 and 6.14). The host fetches onlyhttpsURLs that appeared in an answer it relayed in the last 5 minutes. The device checkssize_bytesandsha256as in section 6.9, so a changed file fails there.- The device treats
error, a closed link and every answer it cannot parse as "server unreachable" (section 1), exactly as for a direct call. The rules of section 4 apply to the relayed body unchanged. - The host keeps nothing it relayed, except the URLs for
getuntil they expire.
6.20 Client integrity signals
The SDK reports what it observed about its own run as a detection signal, so that tampering becomes visible on the server even when the local check is bypassed (#848, measure M5 in docs/hardening.md). Like every check on the device's word (sections 6.8, 6.17), this is a signal, never proof: a client under an attacker's control can withhold or forge it. It is strong only together with attestation (section 6.7), which the attacker cannot forge.
- Field.
activateandheartbeatMAY carryintegrity, an object whose fields are the findings the SDK made, each a boolean that is only evertrue. The SDK leaves out a field it did not find, so the object is never empty; leaving the whole field out reports nothing. The findings aredebugger(a debugger is attached),hooking(a known hooking or instrumentation framework is present),root_jailbreak(the device is rooted or jailbroken),emulator(the program runs in an emulator) andbuild_mismatch(the running program's hash deviates from the build the SDK was shipped for, section 6.8). Schema: schema/request-claims.schema.json. Onlyactivateandheartbeataccept it, and only inside a signed request (section 6.7); an unsigned call that carries it is refused withinvalid_request. - Signals. The server turns each reported finding into the detection signal of the same name. A signal flags the license for review by default (
license.flagged), and suspends it (license.suspended) when the product lists the signal inauto_suspend_signals(the mechanism of #63 and #248), exactly like the shared-license signals. Each finding records its own event, so that the audit log, webhooks and reports see it. Which findings a product acts on is the vendor's choice; the server stores and converts them the same way regardless. - Response. The product setting
tamper_responsechooses what the server tells the client when it reported a finding:offignoresintegrityentirely (no signal, no event);report(the default) raises the signals above and answers as usual;terminateraises the signals and additionally answers withsignal(response claim, section 4),{"terminate": true, "message": "<text>"}, the opt-in that asks the SDK to stop the app with that message.terminateis never silent and never forced: the default stays report-only, and the client ends only when the vendor turnedterminateon and the SDK itself chose to honor it. - Limits. The findings are the device's word and travel in the request token, so they are as trustworthy as the signed call that carries them: enough to flag or suspend on the server, not a guarantee about the device. A
terminateanswer is a request to the SDK, not an enforcement the server can make; an app that ignores it keeps running, which is why the signal on the server (flag or suspend) is the measure that does not depend on the client.
7. Error codes
7.1 Server codes (signed, in error.code)
The same codes in every SDK. The first seven are fixed by plan.md; the others complete the license lifecycle and the protocol. account_blocked was added to version 1 before its first release (decisions.md, "account_blocked im SDK"), as were authorization_pending and device_code_expired with the device code flow (section 6.1) and invalid_credentials and totp_required with the activation with an account (section 6.3), and quota_exhausted with usage reports (section 6.15).
| Code | HTTP | Meaning |
|---|---|---|
license_not_found |
404 | Unknown license key or account without license |
license_expired |
403 | License term ended |
license_suspended |
403 | License suspended by the vendor (reversible) |
device_limit_reached |
409 | No free activation on this license |
version_outdated |
426 | App version below the product's minimum version, or blocked (section 6.10) |
blocked |
403 | Blocked by a blocklist entry |
rate_limited |
429 | Too many requests, retry_after_s set |
license_paused |
403 | License paused, term on hold |
license_revoked |
403 | License revoked (final) |
activation_not_found |
404 | Activation was reset or deactivated; the SDK deletes the token and needs a new activate |
session_limit_reached |
409 | Concurrent session limit of the plan reached (heartbeat) |
invalid_request |
400 | Request fails validation |
protocol_unsupported |
400 | Requested protocol version not supported |
account_blocked |
403 | The vendor's account is blocked, for example unpaid. Temporary; the vendor can lift it at once |
authorization_pending |
400 | Device code not confirmed yet (device_poll), retry_after_s set |
device_code_expired |
400 | Device code unknown, expired or already used (device_poll) |
invalid_credentials |
401 | Email, password or TOTP code wrong (account_sign_in), or account token expired, of another vendor or older than the last password change, or user token not valid for the product (activate) |
totp_required |
401 | The account has TOTP on; send account_sign_in again with code |
quota_exhausted |
409 | The usage report would go past the quota; nothing was counted (usage, section 6.15) |
On license_* codes and activation_not_found the SDK deletes the stored license token. rate_limited, version_outdated, session_limit_reached, account_blocked and quota_exhausted leave it in place, as do authorization_pending, device_code_expired, invalid_credentials and totp_required, which concern only the device code or the sign-in: the stored token stays usable until its offline end (oexp), and the next successful call carries on without a new activate.
7.2 SDK codes (local verification)
token_malformed, protocol_unsupported, key_unknown, signature_invalid, schema_invalid, token_mismatch, clock_rollback, token_expired, nonce_mismatch, device_mismatch, token_revoked. Order and meaning: section 4. The release list of section 6.11 reuses key_unknown (no list held) and token_mismatch (offer not allowed by the list). A module token (section 6.18) uses the codes of steps 1 to 6.
8. Versioning and compatibility
- The protocol version is an integer. It appears in the URL path (
/v1), in every request (v) and in every token footer (v). - Within a version nothing changes: no new claims, no new required request fields, no new error codes. Anything else is a new version with its own schemas and vectors.
- Offline licenses and revocation lists (sections 3.5 and 6.2: token type
revocations, the optionalrevocationsfield of the response body, license step 11, SDK codetoken_revoked) were added to version 1 before its first release, like the device code flow the activation with an account (section 6.3), the update check (section 6.4) and the remote config (section 6.6, response claimconfig), and signed requests (section 6.7, request fielddevice_key, body fieldrequest), as was the proof of the chip key (section 6.7, body fieldchip, #513). An SDK without them still verifies every response: the extra body field is optional. The optional license claimgexp(section 3.1) was added to version 1 the same way, before its first release (decisions.md, "Kulanzfrist im Lizenz-Token"); an SDK without it rejects tokens that carry it withschema_invalid. The optional claimchn(section 3.1, release channel, #255) was added the same way and for the same reason. - The server answers every request in the version the request names. It supports a version for at least 24 months after the release of its successor (decisions.md, "Alte SDK-Versionen"); security fixes for SDKs for five years (CRA).
- An SDK supports exactly the versions it ships schemas for. A token with an unknown version fails with
protocol_unsupported.
9. Test vectors
vectors/v1.json holds three test keys (seeds included, for tests only), 37 license token cases, 19 response cases, 7 device code cases (device_code_responses, section 6.1; kept apart so that an SDK without the device code flow can run every case of responses through activate), 10 account cases (account_responses, section 6.3, kept apart for the same reason), 7 update cases (update_responses, section 6.4), 10 remote config cases (config_responses, section 6.6), 13 offline file cases (offline_files), 13 revocation list cases (revocation_lists), 5 responses carrying a revocation list (revocation_responses) 8 offline request codes (offline_requests) and 26 signed requests (signed_requests, section 6.7, checked on the server side) with the seeds of their two device keys (device_keys, for tests only) and the public chip key of their chip cases. Each case has the input, a context (configured keys, product, environment, now, last seen server time, expected nonce on receipt, local device) and the expected result: valid with state fresh or grace, or invalid with an SDK code from 7.2. A valid license case past its lexp also names license_grace_until, the gexp the SDK reports; a valid case with chn names it as channel.
Covered: valid, valid on receipt, grace, expired, tolerance 0, wrong signature, foreign key with a stolen key ID, other product, wrong nonce, wrong device, tolerant hardware match, anchor mismatch, chip, install and unbound devices, unknown key ID, rotation with two keys, clock set back, clock within leeway, wrong environment, token type confusion in both directions, missing, unknown and duplicate claims, the grace period claim gexp (running grace period, announced grace period, without a term, not after the term, null), the release channel claim chn (named, malformed, too long, null), unsupported version, missing footer, wrong header, replayed and misdirected responses, unsigned error, and a signed refusal with every server code of section 7.1. Device code cases: a new code, a confirmed and a pending poll, a malformed user code, a device code in an activate response, and the two codes of the flow. Results of device_code responses also name the user_code. Signed request cases: validate and heartbeat with the activation's key, activate with a new key, another key, a spoofed key ID, a changed signature, other operation and product, a product only in the implicit assertion, iat too old and too new, activate past 24 hours, device_key missing in activate and present in validate, missing op and iat, a nested request, a duplicate key, an extra body field and a footer of version 2, and for the chip key: activate and validate with a valid proof, a proof missing, with a key that is not the device ID, with a signature over another token, and a chip that is not an object. A valid case names the request object the server goes on with.
Offline and revocation cases: a file on its own device and on another one, a changed signature and changed claims, a file for an earlier request and without a pending request, an expired file, a file with a list that does or does not name it, a newer stored list against an older one in the file, a bare token, an unknown field, and a list in place of the license. Their context adds stored_revocations (the list the SDK holds, or null); the expected_nonce of a file case is the nonce of the pending request. Revocation list cases name the list's seq, whether it replaces the stored one (applied), and the result of checking the context's license afterwards: a list naming the license or the activation, older and equal lists that change nothing, a newer list without the entry, and lists with a bad signature, of another product or environment, with an unknown key, of the wrong type, with a duplicate entry and with seq 0. Request code cases give the decoded request or "valid": false: hwid and installation ID devices, whitespace, wrong prefix, padding, device none, a license key and an oversized code.
Check them:
pip install cryptography jsonschema
scripts/protocol_vectors.py # verify
scripts/protocol_vectors.py --write # regenerate after a deliberate change
The Python script is a second, independent implementation. Its PASETO and PASERK output has also been checked against the pyseto library. The Rust token crate (#24) and the server MUST pass the same file in their tests. CI runs are switched off for cost reasons at the moment; until they return, run the script locally before changing anything in this directory.