Zum Inhalt springen

Die Entwickler-Doku gibt es nur auf Englisch.

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 test and live environments. Only the signing service holds private keys (AGENTS.md, "Sicherheit und Protokoll").
  • The key ID (kid) is the PASERK k4.pid of 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

  • exp is when the SDK must have renewed the token. The server sets it to iat + token validity (default 24 hours).
  • oexp is the last moment the token may be used while the server cannot be reached. The server sets it to max(exp, iat + offline_tolerance). Offline tolerance is set per plan from 0 to 30 days, default 7 days (decisions.md). With tolerance 0, oexp equals exp.
  • 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 gets exp and oexp at most 3 hours ahead.
  • State of a stored token at time now: fresh if now < exp; grace if exp <= now < oexp (usable, the SDK MUST try to renew); expired if now >= 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, whatever oexp says.
  • An offline license (section 6.2) is issued with exp equal to oexp: 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, validate renews 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 seq is 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 iat of 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_revoked and the SDK deletes the token, as after a signed license_revoked.
  • Entries are final. Reversible states such as license_suspended are not listed. The server MAY drop an entry once every token it issued for that license or activation has passed its oexp.
  • 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):

  1. Structure: header v4.public., exactly one footer, canonical base64url without padding, size limits. Otherwise token_malformed.
  2. Footer: parse as JSON, validate against schema/footer.schema.json (otherwise token_malformed). v must be a supported protocol version (otherwise protocol_unsupported).
  3. Key: kid must be one of the configured keys. Otherwise key_unknown.
  4. Signature: PASETO v4.public verification with that key, the footer bytes as received, and the product ID as implicit assertion. Otherwise signature_invalid.
  5. Claims: parse as JSON (duplicate keys rejected), validate against the schema of the token type. Otherwise schema_invalid.
  6. Binding: typ, pid and env must match the expectation and the SDK configuration. Otherwise token_mismatch.
  7. Clock: section 3.4. Otherwise clock_rollback.
  8. Time: section 3.3. Expired gives token_expired; fresh and grace are both valid, and the SDK reports which.
  9. Nonce, on receipt only: nonce must equal the nonce the SDK sent. Otherwise nonce_mismatch.
  10. Device: section 5.3. Otherwise device_mismatch.
  11. Revocation: if the SDK holds a revocation list (section 3.5), neither lid nor aid may be on it. Otherwise token_revoked.

Response (on receipt of every Client API answer):

  1. 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.
  2. Steps 1 to 6 above with typ = response, and op must equal the operation called (token_mismatch).
  3. nonce must equal the nonce of this request (nonce_mismatch). Then the clock rule.
  4. 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 its seq is higher.
  5. If ok and a license is present: verify it with all eleven license steps, using the response iat as last seen server time, the request nonce and the list held after step 4.

Offline license file (on import, section 6.2):

  1. Parse the file as JSON and validate it against schema/offline-file.schema.json. Otherwise token_malformed.
  2. If the file carries revocations: verify and apply the list as in response step 4.
  3. Without a pending offline request on this device: nonce_mismatch.
  4. Verify license with 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 activate and 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 for hwid adds min_match (minimum number of matching features) and optional anchors (features that must match). Default min_match is 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 chip also 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 local kind must equal dev.kind and the local id must equal dev.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 least min_match features 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)
  • device in requests is the binding without server-side fields: {"kind": "hwid", "features": {...}}, {"kind": "chip", "id": "..."} or {"kind": "install", "id": "..."}.
  • app_version is a SemVer string. platform is one of windows, macos, linux, ios, android.
  • device_name is set only by the app, for example from user input. The SDK does not read the host name.
  • validate accepts a license token whose signature is valid even if it has expired, as long as the activation still exists. A presented ren lower than the latest issued one means the activation was copied: the server records the signal forked. 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 a chip binding with the proof chip beside it, and the request object above is the payload of the token.
  • integrity on activate and heartbeat is 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.

  1. device_code binds nothing yet. The server keeps the request's device, app_version, platform and device_name with the code and answers with device_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 from BCDFGHJKLMNPQRSTVWXZ, joined by -, for example BCDF-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.
  2. The app shows user_code and the address of the confirming page, which the vendor configures in the app. The SDK does not know it.
  3. 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).
  4. The SDK sends device_poll with user_code and code every interval_s seconds until the code expires:
    • not confirmed yet: authorization_pending with retry_after_s set 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 gives ok with a license token, ren 0. A refusal such as device_limit_reached keeps 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 code that does not belong to the user_code: device_code_expired. The SDK stops and the app may start again.
  5. 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".

  1. 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 activate without the license key: v, product_id, environment, nonce, device (chip, hwid or install, never none), app_version, platform, optional device_name and, for a device from the vendor's own production, optional certificate (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 an activate request.

  2. 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, ren 0, the device from the request and exp = oexp (section 3.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.

  4. 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_mismatch or device_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 with device.kind chip. 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-256 device.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 with blocked. 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 blocked and ends nothing; a device that never calls again keeps its file until exp.

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.

  1. account_sign_in with email, password and, if the account has TOTP on, code (six digits from the authenticator app):
    • right: ok with account: token, an opaque string acct1. followed by base64url, at most 512 bytes, and expires_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_limited with retry_after_s. Products with identity mode license_key answer invalid_request.
  2. activate with account_token instead of license_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 example license_expired). It then applies every check of activate. An account without a license for the product gets license_not_found.
  3. 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 after device_limit_reached once 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.

  1. update with the stored license token (an expired one is fine, as for validate), the running app_version, the platform and optionally the language of the notes. The server checks the token, the license state and the activation like heartbeat, but not the minimum version: an app below it is exactly the one that needs the hint.
  2. 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 than app_version, the answer is ok with update:
    • version, channel, published_at;
    • notes in language, else in English, else in German, with notes_language. Notes are cut to at most 6000 characters, so that their JSON form stays within 6000 bytes, and then carry notes_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: true if the device must update (section 6.10).
  3. Otherwise the answer is ok without update.

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.

  1. 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 answers user_token with invalid_request.
  2. 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) are typ (user), pid, env, sub (the user's ID in the vendor's system, 1 to 200 characters, no control characters), iat and exp, at most 3600 seconds after iat. Short lifetimes are better; the Node backend SDK uses 300 seconds.
  3. Activate. The app gets the token from the vendor's backend and sends activate with user_token instead of license_key. The server checks the signature against the product's keys, pid, env and the time with 60 seconds of leeway. A token that fails any of these gets invalid_credentials. The server then finds the end customer whose external_user_id is sub (license_not_found without one), picks the license as in section 6.3, step 2, and applies every check of activate.
  4. 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.

  1. config with the stored license token and the running app_version. The server checks the token and the activation like heartbeat, and that the license is usable: in its term or its grace period, not suspended, paused or revoked. Otherwise it refuses with the code of validate.
  2. 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 ok with config:
    • aid: the activation the config was resolved for. The SDK MUST reject a config whose aid is 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.
  3. 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 key type (boolean, integer, number, string), minimum, maximum, maxLength, description, and additionalProperties: 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.
  4. 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.

  1. Key. Before activate or device-code/poll, the SDK creates a new device key from 32 random bytes and sends the public key as device_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).
  2. 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, and iat, 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.
  3. Which calls. activate and device-code/poll with device_key are signed with that new key (proof of possession). validate, heartbeat, deactivate, update, config and download are signed with the key of the activation their license token names. device-code and account/sign-in belong to no activation and are never signed. Only calls that create an activation carry device_key. An unsigned activate that matches an activation with a stored key is refused with invalid_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.
  4. Time. iat is device time corrected by the difference to the server time of the last verified response. The server accepts iat within 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 with invalid_request and 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:

  1. The body is exactly v and request, and chip if present is an object of the fields named under Chip key, each a non-empty string (token_malformed).
  2. Structure and footer of the token as in section 4, steps 1 to 2 (token_malformed, protocol_unsupported).
  3. The payload matches the schema, and device_key is present exactly in calls that create an activation (schema_invalid).
  4. op and product_id are those of the path and the call (token_mismatch).
  5. The key: for a new activation device_key, else the key stored with the activation of the license token. The footer's kid MUST be that key's ID (key_unknown), and the signature MUST verify with the product ID as implicit assertion (signature_invalid).
  6. iat is within the window described under Time (token_expired).
  7. The nonce was not used before with this device key while its iat window 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.
  8. The chip key, as described under Chip key: for a new activation from chip, else the one stored with the activation (schema_invalid if the proof is missing or has the wrong fields, key_unknown if key is not the device ID, signature_invalid if the signature fails).
  9. 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 chip binding 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 ios MUST use App Attest. When the vendor set up Play Integrity, activations on platform android MUST bind by chip and carry integrity, with the app and device verdicts the vendor asks for. Without these settings attestation and integrity are refused.
  • With App Attest the server accepts keys of apps signed for development only in the test environment.
  • 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 beside key and sig. 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 with blocked instead of invalid_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.

  1. Digest. build is the SHA-256 of the running program, 32 bytes, base64url. The SDK sends it with validate, heartbeat, update, config and download once 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. activate does not carry it.
  2. 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.
  3. Rule. Per product and environment, build_check decides: off (default) checks nothing; flag records activation.unknown_build for a build that no release with the reported app_version lists for the activation's platform; deny does the same and withholds: update answers ok without update, config answers ok with an empty config, download answers ok without download. validate and heartbeat are never refused for the build; the license stays usable. A call without build counts as unknown once the check is on. The event comes once per activation and build, not with every call.
  4. 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.

  1. download with the stored license token, the running app_version, the platform, the version it wants (usually the one update offered) and, if set, build. The server checks token, license and activation like config: the license must be usable, in its term or grace period, not suspended, paused or revoked.
  2. 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_check deny, an unknown build gets no file (section 6.8).
  3. If so and the release has a file for the platform, the answer is ok with download: version, file (as in 6.4), url and expires_at. The link works for 5 minutes with a plain GET and needs no credentials. Otherwise the answer is ok without download.
  4. The SDK fetches the file, checks size_bytes and sha256 before 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 not https is refused, except for localhost during 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.

  1. Result. After installing a release, the app's updater reports with update_result whether the new version runs (outcome ok) or it went back to the earlier one (rolled_back): the stored license token, the app_version that runs now, the platform, the version that was installed and, if set, build. The license must be usable, as for config. 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 is ok. One result counts per release and activation; a later report replaces it. Each change is recorded as activation.update_reported.
  2. No second offer. A release an activation rolled back is not offered to it again, by update or download.
  3. Halt. When the rollbacks of a release reach the product's threshold (rollback_halt_percent, default 20, of at least rollback_halt_min results, default 10; Management API, product settings), the server pauses its rollout: release.rollout_changed with reason rollbacks. 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.
  4. Block. The vendor can block a version (POST /v1/releases/{id}/block, event release.blocked). The release counts as withdrawn. A device that runs the version gets version_outdated from validate and activate, and update names the newest release of its channels as for section 6.4, with required: true, whatever the rollout share (a paused rollout still counts). Never an older version. The same required comes when the running version is below the minimum version of the product or the channel. download hands over that release under the same rule.
  5. Stepping stones. A release can name min_from_version (Management API, SemVer below its own version). update and download offer it only to devices whose app_version is 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
  1. 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's kid and v, the product ID as implicit assertion. The typ keeps 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).
  2. Publishing. For every change the vendor signs a new list with a higher seq (reference tool release-tool sign) and uploads it (POST /v1/products/{id}/release-lists). The server checks it with the registered keys, the product, the environment and that seq is higher than the current list's, and records product.release_list_published.
  3. Server. With a list in place, update and download offer only releases it names and does not revoke. Both send the current list next to the response token, as release_list in the body (section 6), like the revocation list.
  4. 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 its seq is higher than the stored one's and keeps it across activations, so a replayed older list changes nothing. An offer from update must be on the stored list, not revoked and newer than the running app_version, and its file must be the listed file for the platform; a download must be listed, not revoked, not older than the running version and name the listed file. Otherwise the SDK refuses with token_mismatch, and with key_unknown while it holds no list at all. The file itself is then checked against size_bytes and sha256 as in section 6.9.
  5. 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.

  1. 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, with key_id = x25519. plus the base64url of the first 16 bytes of SHA-256("release-seal/v1 key-id" 0x00 public key)).
  2. Encrypting. The vendor's pipeline (reference tool release-tool encrypt) draws a random 32-byte content key and encrypts the file: the 16 bytes release-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_bytes and sha256 everywhere (sections 6.4, 6.9, 6.11) are those of the encrypted file.
  3. 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. info is 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: label release-seal/v1 platform for the wrapping key, release-seal/v1 device for a device. The vendor announces the file with encryption: wrapping_key_id and wrapped_key (Management API).
  4. Download. The SDK makes a fresh X25519 key pair for each download and sends the public key as recipient_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 for recipient_key with the device label; download carries it as key (80 bytes, base64url). Without recipient_key an encrypted file is not handed out (ok without download).
  5. SDK. The SDK opens key with the private half of its download key, which it keeps in memory for this one download only, fetches the file, checks size_bytes and sha256 as in section 6.9 and decrypts it. Only a file that decrypts completely gets its final name. A key that does not open is refused with token_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.

  1. Call. crash_report is signed like every call of an activation (section 6.7) and carries the stored license token, the running app_version and platform, if set build, and report. The license must be usable, as for config. While the product does not allow reports, the answer is invalid_request.
  2. Report. report is an object of at most 32 KiB as JSON: kind (crash, exit for an unexpected exit, error for a report the user wrote), occurred_at (Unix seconds, at most five minutes in the future), optional exception (type or signal, at most 200 characters), message (at most 2000), frames (at most 128, each with optional function, module, file, line, address, module_build_id, module_offset), log (at most 100 lines) and, only for error, contact and steps. Unknown fields are refused. The app decides what goes in; the SDK collects no data of its own and adds no device features.
  3. Grouping. The server groups reports per product and environment by a fingerprint: SHA-256 over kind, exception and the first five frames (function, else module with module_offset, else module); without frames it takes the first line of message with numbers replaced. A new group records crash_group.created. Its title is the exception and the top frame, never the message text unless there is nothing else; a group of error reports, which the user wrote, then gets the neutral title "Error report" (#680).
  4. 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 settings crash_auto_resolve_devices and crash_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.
  5. Limits. At most 20 reports per activation and day count; further ones are answered ok and 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.

  1. List. assets with the stored license token, the running app_version, if set build, and optionally language. The license must be usable, as for config. The answer is ok with assets, a list of at most 100 entries, ordered by group (assets without a group first) and name: name, optional group, default (only when true), optional title (at most 100 characters) and description (at most 500) in the requested language, else English, else German, and file (as in 6.4). A list that does not fit into the response (section 3) loses the descriptions first, then entries from the end. Under build_check deny, an unknown build gets an empty list (section 6.8).

  2. Download. asset_download with the license token, app_version, if set build, and the name. If the license may fetch an asset of that name, the answer is ok with asset: name, file, url and expires_at, a link for 5 minutes as in section 6.9, and for a module module_token (step 5). Otherwise the answer is ok without asset, so an app cannot tell an unknown name from one it may not fetch.

  3. Encrypted assets. An asset can be encrypted exactly like a release file (section 6.12): the same format, the product's wrapping key, info with the same labels and the SHA-256 of the encrypted file, and encryption with wrapping_key_id, wrapped_key and optionally source_sha256 when the vendor announces it. asset_download takes recipient_key as download does; for an encrypted asset asset carries key, the content key wrapped for it, and without recipient_key the answer is ok without asset. The list (step 1) does not say whether an asset is encrypted.

  4. On the device. The SDK fetches the file, checks size_bytes and sha256 before 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.

  5. 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_download returns the token as module_token beside the link, never together with key: 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.

  1. Report. usage with the stored license token, app_version, if set build, the entitlement code, amount (1 to 10^9, default 1) and report_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 for config. An entitlement without an integer value is invalid_request.
  2. Answer. ok with usage: entitlement, counted, used, limit (the plan's value plus the units granted on top) and remaining. A report counts once per report_id and license: a repeated one changes nothing and answers with the current counter and counted: false, also after the license ended, so an app that lost the answer can ask again with the same ID.
  3. Refusal. A report that would go past limit counts nothing and is refused with quota_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).

  1. Call. proxy with the stored license token, app_version, if set build, the target name and optionally body, a JSON object or array of at most 8 KiB as compact JSON. The activation must be open and the license usable, as for config. Under build_check deny, an unknown build gets ok without proxy (section 6.8).
  2. 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 answers ok without proxy, so an app cannot tell them apart. A call over the target's limit is refused with rate_limited; it keeps the license token.
  3. Forwarding. The server sends POST to 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"}, where body is the app's or null. 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.
  4. Answer. ok with proxy: target, and status, the target's HTTP status, if it answered. body is the target's body if it is a JSON object or array of at most 8 KiB; an empty body gives none. Otherwise failure says why: timeout or unreachable (without status), response_too_large or response_invalid (with status, without body). A body that would make the signed response too large (section 3) is dropped with response_too_large. The SDK hands status and body to 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).

  1. Definitions. The vendor defines actions per product and environment in the Management API (/v1/products/{id}/remote-action-types, at most 100): a name (a-z, 0-9, _, starting with a letter, at most 64 characters, fixed), titles and descriptions in en and de, at most 10 params and customer_allowed. A parameter has a name (like an action name, at most 32 characters), type (string, integer, boolean), required, for integers minimum and maximum, for strings max_length (1 to 200, default 200) and enum (1 to 20 different texts). Texts never hold control characters.
  2. 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 has customer_allowed. The server checks the parameters against the definition (unknown names, types, ranges, required ones, at most 4 KiB as JSON). An action waits as pending for ttl_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.
  3. Fetching. remote_actions with the stored license token, app_version and, if set, build. The activation must be open and the license usable, as for config. The answer is ok with remote_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_at and expires_at. Each action handed out is marked delivered and never comes again, so an app that loses the answer loses those actions. An empty list is the normal answer. Under build_check deny, an unknown build gets an empty list (section 6.8).
  4. 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
  1. 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: PASETO v4.public, footer with kid and v, the product ID as implicit assertion. The platform's product keys MUST NOT be accepted for modules.
  2. 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.
  3. 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 that name is the one the app asked for, that version is not below a lowest version the app may set, and that the module's size and SHA-256 equal size_bytes and sha256. Only then does it parse the module. Any failure refuses the module: the token errors of section 7.2, otherwise a local error.
  4. 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.
  5. ABI version 1. The module exports memory and alloc(len i32) -> i32. A callable export and every import have the type (ptr i32, len i32) -> i64: input at ptr with len bytes, 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"}
  • post is 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.
  • get fetches the file of a download or asset-download answer (sections 6.9 and 6.14). The host fetches only https URLs that appeared in an answer it relayed in the last 5 minutes. The device checks size_bytes and sha256 as 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 get until 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.

  1. Field. activate and heartbeat MAY carry integrity, an object whose fields are the findings the SDK made, each a boolean that is only ever true. 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 are debugger (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) and build_mismatch (the running program's hash deviates from the build the SDK was shipped for, section 6.8). Schema: schema/request-claims.schema.json. Only activate and heartbeat accept it, and only inside a signed request (section 6.7); an unsigned call that carries it is refused with invalid_request.
  2. 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 in auto_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.
  3. Response. The product setting tamper_response chooses what the server tells the client when it reported a finding: off ignores integrity entirely (no signal, no event); report (the default) raises the signals above and answers as usual; terminate raises the signals and additionally answers with signal (response claim, section 4), {"terminate": true, "message": "<text>"}, the opt-in that asks the SDK to stop the app with that message. terminate is never silent and never forced: the default stays report-only, and the client ends only when the vendor turned terminate on and the SDK itself chose to honor it.
  4. 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 terminate answer 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 optional revocations field of the response body, license step 11, SDK code token_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 claim config), and signed requests (section 6.7, request field device_key, body field request), as was the proof of the chip key (section 6.7, body field chip, #513). An SDK without them still verifies every response: the extra body field is optional. The optional license claim gexp (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 with schema_invalid. The optional claim chn (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.