Skip to content

Accounts, passkeys & sessions

A person is an account. They prove it with a WebAuthn passkey, and each passkey on the account is one of their devices. Signing in gives them a short session token that every node of the cluster verifies on its own. A machine acting for an account uses an API key. calimero-identity holds the logic (WebAuthn, tokens, challenges) with no storage of its own; the records live in the system group.

An account id is 32 random bytes in base64url, made when someone signs up. The account record holds a display name, its passkeys (at most 10) and their labels and the account’s aliases for apps. An account approves nothing for itself: every app is in an organization, and its approvals (mero-tee releases and outbound prefixes) are that organization’s. A sign-up makes no organization: the account’s own apps are in one it creates, one made with an instance, or one it is invited to (see Where an instance goes and Deployment governance; below cluster version 1.0.0-rc.32 a sign-up made a personal organization in the same entry, CreateAccount { personalOrg }). Who may sign up is the cluster’s sign-up policy: open (the default; the operator’s maxAccounts quota bounds how many accounts a cluster takes), invite or closed. Under any policy a node creates at most 30 accounts a minute by default (--sign-ups-per-minute), invited or not, and refuses more 429 RATE_LIMITED (Node limits). CreateAccount carries the invite a person signs up with, as the token key’s signature over the new account and the time, and apply judges it against the policy.

The release of the node an organization was made through is approved for it from the start, so its apps can run where it began.

calimero-identity::webauthn verifies registrations and assertions itself (ES256 and EdDSA, via ring). Attestation statements are not checked (passkeys register with attestation: none); the relying party id is --rp-id and the accepted origins are --origins, plus a package’s frontend origin for a ceremony that comes from it. A ceremony from an origin a package’s manager registered (below) is checked against that origin alone and its own relying party id.

Ceremony Routes Result
Sign up /auth/passkey/register/{begin,finish} A new account with this passkey, and a session
Sign in /auth/passkey/login/{begin,finish} A session for the passkey’s account
Add a device /auth/passkeys/add/{begin,finish} (signed in; finish answers 412 and is approved by a passkey the account already has) Another passkey on the account
Recover (lost every passkey) /auth/recovery/{begin,start} (signed out; the account’s recovery code and a new passkey), then after 72 hours /auth/recovery/finish (the new passkey; /auth/recovery/cancel with an existing passkey stops it before) The code spent and the passkey pending; at finish the passkey on the account, every earlier session and API key revoked, and a session (Account recovery)
Label or remove a device POST / DELETE /auth/passkeys/{cred} (removal approved with a passkey, 412 first) A label; or the passkey gone and its sessions revoked (the last passkey cannot be removed)

A ceremony’s challenge lives in the memory of the node that issued it, for 5 minutes; its id names that node. It may finish on any node: that node takes the challenge from the issuer over the attested peer channel, so it is still used once (a load balancer may send the two requests anywhere). A node holds at most 10 000 open sign-in and sign-up ceremonies, and apart from those 64 step-ups per account (10 000 across accounts), so a full anonymous pool never blocks a signed-in account’s step-up; past either it answers 429.

Accounts and passkeys live in one cluster’s system group, while clusters may share a relying party id (every Calimero Cloud cluster uses calimero.network). A browser therefore offers a passkey made on one cluster on every other one. Two things keep that from confusing anyone:

  • The name it is made under. A registration’s user.name and user.displayName (sign-up, adding a device, recovery) are the person’s name and the cluster’s (--cluster) with its tag, cluster first, eu-shared-1 · alice · 3f2a; a sign-up begun on a package’s frontend (a served or registered origin, origin on register/begin) names the app too, eu-shared-1 · alice (kv-store) · 3f2a: the newest release’s display name, else the package id. Each part is cut at 32 characters (MAX_PASSKEY_NAME_PART_CHARS). The account’s own name is the person’s alone. The tag is the first 2 bytes of the cluster’s identity key (from its cluster key), 4 hex characters, public in GET /sign-up (passkeyTag, beside cluster): a cluster begun again under the same name has another cluster key, so its passkeys are listed apart from the old cluster’s. Each registration gets a random user handle (sign-up, adding a device and recovery alike): a password manager keeps one passkey per site and handle, so a shared handle would make a second passkey added in the same manager replace the first.
  • The answer to a passkey from elsewhere. An assertion (sign-in or step-up) whose credential no account here has answers 401 PASSKEY_UNKNOWN_HERE, “this passkey belongs to another Calimero cluster or was removed from this one; sign up here, or open the app from the link for the cluster your account is on”. It names no cluster and no account: a node knows only its own cluster’s passkeys, and the answer is the same for a passkey that was removed.

Sign-in and sign-up need the user present. A step-up — approving a confirm method, an upgrade, an approval or an organization’s deletion — needs the user verified too (PIN or biometric): a touch alone is not consent.

A session token is v2.<claims>.<Ed25519 signature>, signed by the node that issued it with its signing key (the key it signs receipts with, attested with GET /attestation?purpose=receipts) over "calimero.session.v2\0" ‖ claims. A node makes that key on its first start and keeps it in its data directory wrapped under its storage key K_r, so a restart on the same data directory (a crash, a rolling upgrade of the binary) keeps it. The claims are the account, a session id, the expiry (15 minutes), the passkey the session was opened with, for a session opened on a package’s frontend that package (and, on a registered origin, that origin), and the issuing node with its key. Signing in also returns a refresh token (rt_…, 30 days): POST /auth/refresh on any node answers a new token, signed by that node. A refresh token younger than an hour (api::REFRESH_ROTATE_AFTER) is kept: the node judges it on the cluster’s latest system state (a read index) and writes nothing to the system log, so a sign-out, a recovery or a passkey removal committed through any node already ends it. An older one is exchanged in the system log for a new refresh token; a refresh token presented again after it was exchanged revokes its session. So every active session writes to the system log once an hour, not once per session token.

A browser binds its session to a holder key: a P-256 key it makes with WebCrypto as non-extractable, so no script can read its private half. The sign-in names the key’s public point (holderKey on /auth/passkey/login/begin, or on a sign-up’s first finish); the challenge states it, so the passkey signs the binding with the session, and every exchange carries it to the next token unchanged (UseRefresh with another holder, or none, is refused at apply). Each use of such a refresh token must carry the key’s ECDSA signature over "calimero.refresh-holder.v1\0" ‖ b64url(SHA-256(token)) ‖ "\0" ‖ at ‖ "\0", at within 120 seconds of the node’s clock (holderProof); without one it is refused 401 HOLDER_PROOF_REQUIRED, before anything is spent or logged. So a refresh token copied off the device refreshes nothing, and such a token lives 7 days rather than 30. A proof replayed within its 120 seconds by someone who copied it with the token mints at most a session token, which the next exchange does not extend. The same holds for a bound token presented again after it was exchanged: it ends its session only with the key’s proof for it (RefreshReused carries the proof, judged again at apply), so a copy of an old token taken off the device cannot sign its owner out either. Binding a session to a holder key is the sessionHolders feature (1.0.0-rc.39): below that cluster version a sign-in naming one is refused 409 FEATURE_NOT_ACTIVE, and the clients sign in unbound.

A node verifies a token issued elsewhere without asking the issuer: it checks the signature against the issuer’s signing key as it attested it at the address the cluster registered for that node, checks the expiry, and that the issuer’s attested release may vouch for the account: a release one of the account’s organizations approved (where the operator holds release approvals, one it approved; SystemState::release_may_serve_account). Each app access then also requires the issuer’s release to be approved for that app’s data. So a node on a release nobody approved can mint tokens, but no other node takes them. Then — on fresh system state — the node checks that the session is not revoked and that its passkey still belongs to the account. See Keys & their lifetimes for revocation.

Every node attests each registered peer’s signing key ahead of time: at start, once it learns the directory, and whenever a node is registered. It keeps node → (key, release, attested at) in memory (Node::warm_issuers, at most MAX_CONCURRENT_ISSUER_ATTESTS at once, each bounded by ISSUER_ATTEST_WAIT). A token is verified from that entry without reaching the issuer, so a session outlives the node that issued it: with the issuer stopped or frozen, any other node still takes it.

  • The issuer restarted on its data directory: same key; its sessions go on verifying everywhere.
  • A token under another key than the one attested (the issuer’s data directory was replaced): the node attests the issuer again, at most every ISSUER_RETRY_SECS. If the issuer cannot be reached, or attests another key, the token is refused with 401.
  • The issuer was removed: its entry is dropped and its tokens stop verifying once the removal applies.

On a 401 a client refreshes once, on any node, and sends the request again (the Rust client and meroctl do it on their own).

The key is wrapped under K_r, not K_c. K_r comes only to the release whose mero-kms holds its root, so only that release opens the key: a key attested once under release R signs only for R, and a node on another release booted on the same disk cannot sign as this one.

A node on a release none of the account’s organizations approved neither issues nor takes the account’s sessions: it answers 421 WRONG_NODE, and the client uses another node.

There are no device keys. A device is a passkey; /auth/me reports which one the current session was opened with (passkeyId), when each was added and last signed in with (addedAt, lastSignInAt), and removing a passkey ends that device’s sessions. GET /auth/sessions lists the account’s sessions, the passkey each was opened with and the package and origin it is bound to, and DELETE /auth/sessions/{session} ends one (Sessions). GET /auth/activity lists what each passkey did, the last 100 entries: the package and origin each sign-in was bound to, and the method and subject of each change it approved (Activity). These are the account holder’s alone: the times come from the log entries a sign-up, a sign-in, an added passkey and a recovery already write (each carries its time; a refresh writes none), and no route shows them to operators, organization admins or deployment managers. Inside an app, env::caller() is the account, whichever of its devices made the call (Who a run acts as). Presence keeps one entry per device: the session’s passkey, or the API key.

POST /auth/apikeys { label, apps?, methods?, pipelines?, readOnly?, allowConfirm?, ttlSecs? } creates a key cal_… for the signed-in account, approved with a passkey (412 first; the consent binds the key’s hash and record); only its hash is stored and the key is shown once. A key may be scoped:

  • apps: only these app instances (default: every app the account reaches);
  • methods: only these methods (* for any);
  • pipelines: only these pipelines of the key’s apps: a pipeline key;
  • readOnly: views, events and reads only;
  • allowConfirm: may carry the account holder’s passkey assertion for a confirm method (it can never produce one);
  • ttlSecs: lifetime, at most and by default one year.
  • upgrades: { app, package? }: an upgrade key, which takes none of the fields above but ttlSecs.

A key is often useless until an app grants it access, and that grant is usually a confirm method: a second passkey prompt. then: [{ app, method, args }] folds it into the key’s one prompt. Each entry names a confirm call method of one of the key’s own apps (not an action, which answers before it runs; at most four, 64 KiB as JSON with the key’s id written in; none on an upgrade key), judged as POST /apps/{app}/intents judges the caller, a read-only member of the app’s team refused. Each must name the new key: a follow-up whose arguments hold no key:$key is refused. That only requires the placeholder to appear somewhere in the arguments: it does not limit which other principals or values the call names, which the person sees in the 412 and approves. The first request makes the key’s id and writes it into the arguments: every string value that is exactly key:$key becomes key:<keyId> (no substring is replaced). The 412 details list the calls so written (then), and the person’s passkey signs the key and them in one consent. __create_api_key’s arguments gain then, only when it is set, so a plain key’s consent reads as before; it states each call as { app, method, argsHash }, because the system log reaches every node, those the app’s organization never approved included. argsHash is the hex SHA-256 of a random salt the node makes for that call on the first request (16 bytes, kept with the challenge) followed by the call’s arguments as the node parsed them, with key:$key written in, every object’s keys sorted by their UTF-8 bytes, in the node’s compact JSON (not JCS, and not the bytes the client sent: 1e2 is written 100.0). Equal arguments of another key, or a guess at them, give another hash. Those arguments are exactly then[i].args as the 412 echoes them; the call’s entry in its app’s log carries the salt ({ followUpOf, index, salt }), so the app’s auditors check the hash against that echo. Both requests check the account’s key quota first, so the retry runs no call for a key the log would refuse; on the retry the node takes the account’s turn first, so two keys made at once through one node do not both run their calls for one last place. The retry checks its own then against the signed one (hashing its own arguments with the signed key id), runs each call in order as the person, and only then makes the key, in a task a dropped connection does not stop; the answer adds then: [{ index, result, receipt }]. Each call’s entry in its app’s log names only the approval it ran under, never the assertion, the key’s hash or the other calls, and runs under an idempotency key of the node’s own (node:apikey:<keyId>:<index>:<argsHash>, a prefix /intents refuses from a client). If a call fails, no key is made and the answer is 422 FOLLOW_UP_FAILED naming it (details: { index, app, method, error, applied, unknown }); the calls in applied stay applied, naming a key id that never exists. A call whose answer was a 5xx is sent again under its own key (at most three times, so a call that did apply replays); if it still cannot say, its index is in unknown. A failure of the key itself after the calls carries applied too, and keyWrite: refused when the log refused the key, unknown when the write may still land (a 5xx, such as a system group that did not commit in time); a request that ended without any answer says every call and the key are unknown. On an unknown key, list the account’s keys (GET /auth/apikeys) and revoke the key if it is there and not wanted. Two retries of different approvals through two different nodes at the account’s last free place can still both run their calls; the one the log refuses answers its applied calls. The account’s activity (GET /auth/activity) lists the key’s approval and one entry per call (method, subject: the app). The hosted consent page does not show __create_api_key: a client shows the 412’s then itself. A node logs a key with follow-ups only from cluster version 1.0.0-rc.38 (Feature::KeyFollowUps; rc.37 was cut without it). A node before that release ignores then and makes a plain key, so a client checks that the 412 lists then and that the answer’s then is as long as the one it sent.

A backend that only starts pipeline runs gets a pipeline key: POST /auth/apikeys { label, apps: [app], pipelines: [name] }. pipelines needs apps and names 1 to 64 of them, each at most 64 bytes (400 BAD_PIPELINE_SCOPE); names are flat, so each applies to every app in apps, and apps that need different pipelines take a key each.

  • What it does: on those apps’ pipeline routes, it estimates, starts, retries, reads, lists, watches, reads the receipt of and cancels runs of the pipelines it names, as its account may. Any run of a named pipeline, whoever started it. A start or retry needs a maxCost, a ceiling the caller chooses: the node does not bound it, so it limits one run and no more.
  • What it does not: another pipeline is refused 403 FORBIDDEN where the request names it, and a run of one is 404, as an unknown run; the list leaves it out. An app method is refused 403 FORBIDDEN, and every route that is neither a pipeline route nor gated on a method (the account, app records, packages, aliases and so on) 403 PIPELINE_KEY_ONLY.
  • Files: a run’s inputs are files the app holds. Name methods: ["__blob"] too for a key that uploads them, the only method a pipeline key may name (400 BAD_PIPELINE_SCOPE); a key that names an app method could start other pipelines as that app. The key then reads and lists only the files its pipelines’ runs took in or made, and starts a run only over those or over a file it uploaded itself (another file is 410 INPUT_EXPIRED, as for one the app does not hold); it reads an upload of its own once a run takes it in, and deletes and revokes none (403 FORBIDDEN); another file is 404. A key’s uploads are recorded under its account and its id, so a person’s files and another key’s are not its own, and are bounded: 1000 files and 1 GiB per key, then 429 KEY_UPLOAD_LIMIT.
  • readOnly leaves it the reads.

A node logs a pipeline key only from the cluster version that brings pipelineKeyScope: an earlier release ignores pipelines and would take the key for one that calls every method.

A deploy from CI cannot answer a passkey step-up. An upgrade key is an API key whose scope is one app’s upgrades: POST /auth/apikeys { label, ttlSecs?, upgrades: { app, package? } }, approved with the passkey of someone who may upgrade the app: an owner or admin of its organization (CreateApiKey { owner_approves }, judged where it applies). Its record keeps the app, the package (by default the one the app runs) and that package’s pinned signer, and the public half of an Ed25519 key derived from the key itself (proof::api_key_public: seed SHA-256("calimero.api-key.v1\0" || key)); the passkey consent covers all four. A package with no release its maker may use is answered 404 no such package, as one the cluster lacks, before the passkey.

  • What it does: POST /apps/{app}/upgrade { version } for its app, with no step-up, to a release of its package installed under the signer it names (a registry release is installed first, as for a session). The node signs the upgrade’s statement (<app> / __upgrade / { bundle, migrate, manifest }) with the derived key, and the directory’s UpgradeApp carries that signature in place of a passkey consent. Every replica checks it where it applies, against the key as the log holds it then, and spends it once; a node that saw only the log cannot sign one.
  • What it does not: every other route, reads included, answers 403 UPGRADE_KEY_ONLY. A raw bundle, another package, another signer and another app are refused 403.
  • The rules that still apply: governance holding app upgrades for owners, the key’s account still may upgrade the app (an admin made a member, or who left, takes the key’s power with them; a key a member made before 1.0.0-rc.33 upgrades nothing once that release holds), an owner release is never moved to a publisher one, release deadlines, and deployer grants for a registry install.
  • Revoking it (DELETE /auth/apikeys/{key}, approved with a passkey) stops it on every node at once, for an upgrade logged later too. It also ends with its ttlSecs.
  • What is logged: the app’s lastUpgrade names the account and the key (apiKey), in GET /auth/apps and GET /orgs/{org}/apps; the node logs each such upgrade with the app, the key’s id and the bundle.

How the session check and the account’s authority combine for each request, with worked examples, is in Sessions & authority.

Action Passkey session Package-bound session Unscoped API key Scoped API key
Call and read apps it reaches ✓ that package’s apps only ✓ within scope
Install packages, create apps ✓ instances of its own package only ✓ —
Manage passkeys, API keys, approvals, upgrades, uninstalls ✓ — — —
Manage organizations, teams, members and invites; delete an app or change its access ✓ its own package’s channels directly (below); everything else through the consent page only: create, rename or delete an organization; mint, accept or revoke an invite; leave; remove a member or change their role, teams, capabilities or all-apps grant; a team’s or the organization’s default capabilities — —
Upgrade one app to signed releases of its package, without a step-up — — — an upgrade key, and nothing else
Approve a confirm method ✓ (with step-up) from its own origin only with allowConfirm, relaying an assertion same
Ask for an approval on the node’s consent page ✓ ✓ (returns to its own origin) — —

Deleting an app, changing its access, creating organizations and issuing invites also need a passkey session on the cluster’s own origin, or, for the organization changes the consent page takes (creating, renaming and deleting an organization; issuing, accepting and revoking invites; leaving; a member’s removal, role, teams, capabilities and all-apps grant), the person’s passkey on the node’s consent page: an API key cannot do them, nor can a package-bound session by itself.

A session opened on a package’s frontend is bound to that package (SessionClaims::app, carried through refresh): it reaches only apps running a release of that package, and the node refuses it credential management, API keys, approvals, upgrades, uninstalls and uploads, and every change to organizations, teams, members and invites (redeeming one included), and to an app’s lifetime or access, with one exception below.

Its own package’s channels. In an organization where the package has an app team, the session may manage the teams below that app team (Principal::within_team; Org::package_of_team): create a team under it, rename or move a team below it (never the app team itself, and a move only within), add, change and remove members there, delete a team below it whose apps are all of the package, and move the package’s apps between those teams (POST /apps/{app}/access). This is how a chat app runs its channels. The authority is still the person’s, judged where each command applies as for any session; the step-ups these need (__set_team_member, __remove_team_member, __delete_team, over org:<org>) are accepted from the package’s own origin, and only over its own package’s teams. Everything else in the organization stays refused to it.

A step-up it makes is otherwise for one of its package’s apps only. An app that creates organizations, invites people, lets them join or leave, moderates members or changes an organization’s settings asks the node’s consent page instead, where the person approves each with their passkey. An app’s page is third-party code; this keeps it from acting as the whole account.

A developer’s own site (their domain, a hosting preview) is not an origin the node serves, so on its own it could not run a passkey ceremony against the cluster. A package’s manager registers it (/package-origins/{package}): where the package’s signing key is bound to a publisher organization, that organization’s org-wide MANAGE_APPLICATION holders; otherwise the account that installed the package’s first release. Never the operator, an API key or a package-bound session.

Change Route Consent (412 first)
List GET /package-origins/{package} none
Register POST /package-origins/{package} { origin, rpId?, served? } package:{package} / __add_origin / { origin, rpId } ({ origin, rpId, served: true } for a served one)
Remove DELETE /package-origins/{package} { origin } package:{package} / __remove_origin / { origin }

The consent is logged with the command (AddPackageOrigin, RemovePackageOrigin) and checked where it applies, on every node: a command without the manager’s own consent over exactly that change is refused there, whichever node proposed it. The registrations live in the system state (SystemState::package_origins, crate::origins).

Relying party. WebAuthn binds a passkey to a relying-party id, which must be the page’s host or a parent domain of it. The cluster’s --rp-id cannot be a developer’s domain, so each registered origin carries its own rpId: the origin’s host by default, or a parent domain of it that the manager names (https://app.example.com with example.com). The cluster’s rp-id, or a parent of it, is refused, so the cluster’s own passkeys never answer on a developer’s site. So is a public suffix (co.uk, github.io), as a browser refuses it. A person signing in there makes a passkey for that site; the account it opens is an ordinary cluster account whose sessions from that origin are always bound to the package. WebAuthn’s Related Origin Requests (one rp-id, a /.well-known/webauthn list of origins) was not chosen: browsers allow the list five registrable domains, for the whole cluster; the rp-id’s host would have to serve the list, which the node does not control; and not every browser supports it.

Ceremonies. POST /auth/passkey/{register,login}/begin take the page’s origin and answer its rpId (403 ORIGIN_NOT_REGISTERED for an origin that is neither the cluster’s, a node’s own, a served frontend’s nor registered). The finish routes verify a ceremony from a registered origin against { rpId, [origin] } alone, and open a session bound to the package exactly as a served frontend’s (SessionClaims::app), which also names the origin (SessionClaims::origin, carried through refresh; an exchange that changes it is refused). A step-up of that session answers 412 with the origin’s rpId.

A sign-up there is a sign-up like any other: the cluster’s sign-up policy judges it (invite on register/begin and register/finish, 403 SIGN_UP_REFUSED, checked again at apply), and the new passkey signs the account it creates (register/finish answers 412). That 412 names the origin’s rpId, as the new passkey belongs to it, and the confirmation is taken from that origin only.

A passkey made on a package’s frontend is held to that site: the account records it (passkeySites, cluster version passkeyScopes; below it a sign-up there is refused 409), and every sign-in, step-up and consent page checks it, so the passkey answers on that site alone and never on the cluster’s own pages, whatever rpId it was made under. A site is named so that no later unit reusing its name matches: a registered origin by its registration (registered anew, it is a new site), the package’s own hosts by the package and its publisher’s key, and a deployment’s host by the deployment, its creation time, the package it serves and that package’s publisher. The frontend’s code may hold such a key outright (a software authenticator signs whatever origin and rpId it is told), so the site, not the rpId, is what binds it. A passkey without a record, the cluster’s own, answers on the cluster’s origins and the hosts it serves, never on a registered origin. A holder slice carries the records; one written before them restores its passkeys without records, as nothing in it tells a site’s passkey apart. A restore carries no origin registration or deployment, so a passkey whose site this cluster does not hold signs in nowhere until that very site exists, and a site made anew under the same name is another: the import does not refuse it, but its answer (lockedPasskeys) and the node’s log name each such account, with how many of its passkeys and which kinds of site.

Removal ends it: from the next request every session opened on the origin, and its refresh token, is refused 401, judged on fresh system state. An uninstalled package takes its origins with it.

Limits and rules. https://host[:port] exactly as a browser writes it (lowercase, no path, no default port); http:// only for a localhost name and only on a --dev node. One package per origin (first come; the cluster’s own origins and served frontends are refused). 8 origins per package, 4096 per cluster. CORS on the node’s API admits registered origins. Each node answers a preflight from its own applied state, so one sent to a lagging node can fail for a moment right after the origin is registered. The node logs, at info, each registration and removal (package, origin, rp-id) and each session opened on a registered origin (package and origin); who made the change is in the system log’s command and at debug only, never in the journal an operator reads.

Served origins (custom domains). Registered with served: true, the origin is one the cluster also serves the package’s frontend on, from its signed bundle, as at {label}.D: the developer points their domain at the cluster, and a request whose Host is that name (on 443) gets the package’s site before any node route. Everything else is a registered origin’s: its own rp-id, package-bound sessions naming it, removal ending them and the site with them. Its consent names served: true, so a consent to the plain origin never makes it served, and one origin is held either way (change it by removing it first). Only https://host with no port (http://name.localhost:port on a --dev node); not on a node without --apps-domain (400 NOT_SERVING), not under the apps domain or the cluster’s rp-id, not a node’s API host; 4 per package and 64 per cluster; adding one needs every node on this release (409 CLUSTER_NOT_UPGRADED). The operator lists them, by the package’s label, at GET /ops/served-origins. A custom domain’s sessions are only as safe as its DNS: whoever controls the name can serve their own page there and use its passkeys for that package (custom domains).

Registering an origin proves nothing about controlling it: a manager who registers another developer’s origin denies them its use on this cluster, but never sees a token, since the sessions go to the pages on that origin. Origins belong to a package, never to a deployment.

An instance’s origins. A package’s origins are its manager’s, so the customer who runs an instance of someone else’s package (a Confidential KV store, say) registers a site of their own for that instance instead: whoever manages the instance (its owner or an admin of its organization) registers it with their passkey.

Action Route Consent
List GET /apps/{app}/origins none
Register POST /apps/{app}/origins { origin, rpId? } {app} / __add_origin / { origin, rpId }
Remove DELETE /apps/{app}/origins { origin } {app} / __remove_origin / { origin }

The commands are AddAppOrigin and RemoveAppOrigin (cluster version 1.0.0-rc.39, 409 FEATURE_NOT_ACTIVE below it), judged where they apply. The registration is a package origin in every other way (its own rp-id, the ceremonies, CORS, a session bound to the instance’s package and naming the origin, removal ending it), and one more rule: such a session reaches that instance alone. Any other instance answers 404 though the account reaches it, as does a new instance, and a team change is refused, as is a read of the organization’s or the account’s past the instance (403: the organization, its teams, invites, usage, update policy and upgrade runs, the account’s usage and aliases, and taking back a delegation), and /auth/me names only the account’s id and name and the instance’s organization, with no passkeys and no recovery state. What the account may do in the instance is the instance’s own access: a person who signs up there has a new account, which reaches the instance only once its managers let it in (a guest of the organization with a grant on the instance) and the app’s own grants then decide. An instance’s origin is never served, 4 per instance, 64 per organization’s instances and 4096 per cluster (apart from packages’ own 4096, so instances never fill the packages’ room), and deleting the instance, moving it to another organization or handing it to a new owner takes them with it. The same first-come rule holds, one package or instance per origin, with one exception: the package’s manager takes back an origin an instance of its own package holds (POST /packages/{package}/origins), which ends the instance’s registration and the sessions opened under it. An instance of another package keeps it.

An account acts only with its own passkeys. A person who loses every one can no longer sign in, and nobody can act for them: not an organization admin, not the operator, not a node. Organization recovery hands an organization to another account and never touches the old one. Account recovery gives the account itself a new passkey, after a delay during which any passkey the account still has can cancel it.

recovery: start, 72 hours to cancel, finishbeforestart (at)readyAt = at + 72 hpending: cancel allowed, finish refused (409 RECOVERY_NOT_READY)finish allowedaccount/auth/recoverymake a codea passkey approvesbegin + startcode + new passkey; code spentcancelany passkey it still hasfinish: new passkeysessions + API keys endorganization/orgs/{org}/recoveryset a keyowner; seed offlinestartseed signs org+accountcancel / rotate keythe owner's passkeyfinish: new ownerold owners leave the orgtimes are the commands' own `at` (the proposing node's clock, replicated), never apply timeone pending recovery at a time (409 RECOVERY_PENDING) · every proof spent once (used_proofs)members see recovery.pending; the account's devices see recoveryPending in /auth/me

The recovery code. An account may hold one: 160 random bits, shown once as 32 Crockford base32 characters in groups of four (calimero_identity::new_recovery_code). It is read back however it is typed: case, dashes and spaces are ignored, and O, I, L read as 0, 1, 1 (normalize_recovery_code; at most MAX_RECOVERY_CODE_CHARS, 80, are read). The code stands for an Ed25519 key, as an invite token does: its seed is SHA-256("calimero.account-recovery-code.v1\0" ‖ code) (proof::recovery_signing_key). The log keeps only the public half (SystemState::recovery_keys, key → account), so neither the code nor anything that redeems it is logged.

Step Route Who Proof logged Effect where it applies
Make a code POST /auth/recovery (412 first) The account, on an unbound passkey session Passkey consent over account:<a> / __set_recovery / { recoveryKey } SetAccountRecoveryKey: replaces any code the account had; the answer carries the code, once
Remove it DELETE /auth/recovery (412 first) The account Consent over account:<a> / __remove_recovery / {} RemoveAccountRecoveryKey
Begin POST /auth/recovery/begin { code } Anyone, signed out None (nothing is logged) A passkey registration challenge for the account the code names
Start POST /auth/recovery/start { challengeId, code, registration } Anyone, signed out The code key’s signature over recover_message StartAccountRecovery: the code is spent; accountRecoveries[a] = { credential, startedAt, readyAt }; no passkey is added and no session opens
Cancel POST /auth/recovery/cancel (412 first) The account, with a passkey it already has Consent over account:<a> / __cancel_recovery / { credentialId } CancelAccountRecovery: the pending recovery goes; the code stays spent
Finish POST /auth/recovery/finish { accountId? } (412 first) The new passkey, signed out, at or after readyAt The new passkey’s sign-in assertion over session / __sign_in / sign_in_args(refresh) FinishAccountRecovery: the passkey is added; every session, refresh token and API key of the account is revoked; the new session’s refresh token is recorded

recover_message is "calimero.account-recovery-start.v1\0" ‖ key ‖ 0 ‖ account ‖ 0 ‖ credential id ‖ 0 ‖ SHA-256(credential public key JSON) ‖ 0 ‖ at (proof::recover_message). It names the passkey, so a node that saw the log cannot put its own in its place, and it is spent once (used_proofs). The finish opens a session as every sign-in does: the challenge is the new session’s statement (the refresh token’s hash and key, the session and its expiry), and the assertion is checked where it applies, under the pending credential, with the user verified. So no node can finish a recovery, or open its session, without the new passkey.

Limits. RECOVERY_DELAY_SECS is 72 hours, the same as for organizations, judged at the commands’ own at (the clock of the node that took the request, replicated with the command), never at apply. One recovery per account at a time: a begin or a start while one is pending is 409 RECOVERY_PENDING. One code per account; a code starts one recovery and is spent whether that finishes or is cancelled. A wrong or spent code is 401 at begin, and a wrong code at start spends the ceremony (begin again). There is no attempt counter: a counter changes nothing against guessing 160 bits. A finish before readyAt is 409 RECOVERY_NOT_READY with details.readyAt; with no recovery under way, 404. The recovered passkey is not held to the per-account passkey cap, since each recovery spends a code a passkey approved.

What clients show. /auth/me answers recoveryCode (whether one is set) and recoveryPending ({ accountId, credentialId, startedAt, readyAt } or null), so every device the account is signed in on can warn that a recovery is under way. An organization’s owner and admins see only whether each member has a code (Members’ security), never a recovery under way.

API keys end with it. Whoever took the lost passkey may also have made API keys with it, and a key works without a passkey, so a finish revokes every API key of the account as it ends every session. The machines the person runs need new keys once the recovery finishes. A finish an earlier release logged (without revoke_api_keys) replays as that release applied it, keeping the account’s API keys, so a replica that replays it after a restart reaches the state the others reached; from the cluster’s RequireCurrentRules mark on, every finish revokes them. An account recovered that way revokes its keys itself once signed in (DELETE /auth/apikeys/{key}).

Who Can they recover the account? What limits it
The operator, a node, anyone reading the log No The log holds the code’s public key and spent signatures, each over one account and one passkey; the finish needs that passkey’s assertion
Someone who stole the code Yes, unless the account acts within 72 hours Every signed-in device sees recoveryPending; any passkey cancels
The person, every passkey lost Yes Begin and start with the code and a new passkey, wait 72 hours, finish
The person, code and passkeys lost No Nobody can

The recovery disk seals each app’s backups to the X25519 public key of whoever upgrades the app: the operator where it holds app upgrades, else the app’s organization (SystemState::backup_holder). An account’s own apps are in its personal organization, so their backups open with that organization’s key (POST /orgs/{org}/backup-key, see Organizations).

meroctl login --dev-passkey FILE keeps a software passkey in a file (SoftAuthenticator, feature testing). It is a real WebAuthn credential, so only a development cluster whose relying party accepts it can use it. Against a real cluster, people use their own authenticators in a browser and give programs API keys.

Where the node implements this chapter, by the names in its code: paths are under crates/node/src unless another crate is named. The design and its reasons are above; a module’s own detail is in its //! doc, and the node’s mental model is crates/node/AGENTS.md.

Code: api/passkeys.rs.

  • A registration’s user.name and displayName are passkey_user_name: config.cluster · person · cluster_tag, plus the app’s name after the person for a sign-up begun on a package origin.
  • cluster_tag is the first 2 bytes of the cluster identity key, public in GET /sign-up as passkeyTag.
  • Every user handle is random, since a shared one makes a password manager replace the earlier passkey.
  • An unknown credential is 401 PASSKEY_UNKNOWN_HERE (unknown_here, from check_assertion_for).
  • A session names the passkey it was opened with (SessionClaims::passkey, passkeyId in /auth/me).
  • Account::passkey_times (types::PasskeyTimes { addedAt, lastSignInAt }) and RefreshRecord::opened_at are set at apply from the times entries carry.
  • Sources: CreateAccount::at, AddPasskey::at, a sign-in’s CreateRefresh record and a recovery finish’s record; UseRefresh keeps the old opened_at.
  • These fields are outside what a passkey signs (account_args and sign_in_args are unchanged), so an older replica checks the same consent.
  • GET /auth/sessions (api::account_sessions, at most MAX_SESSIONS_LISTED) gives lastActiveAt as expires_at - REFRESH_TTL, up to about 1 h 15 min behind.
  • DELETE /auth/sessions/{session} is RevokeSession; both routes are holder, as /auth/logout-all is.

Code: api::auth::follow_ups, types::KeyFollowUp.

  1. POST /auth/apikeys { then } takes up to MAX_KEY_FOLLOW_UPS calls; gate and the ABI judge each before the passkey (takes_follow_up: a Call, never an action).
  2. key:$key becomes key:<keyId> in exact string values only (for_key).
  3. The consent (CreateApiKey { then }, Feature::KeyFollowUps) carries types::SignedFollowUp: arguments only as a hash salted per follow-up (KeyFollowUp::signed), because the system log reaches unapproved nodes.
  4. Both requests check SystemState::api_key_room; the retry takes Node::api_key_turn, catches up on the system log and runs make_key in a spawned task.
  5. The follow-ups run first through calls::call_consented under follow_up_consent, with a FOLLOW_UP_KEY_PREFIX idempotency key /intents refuses from clients. A 5xx is retried up to MAX_FOLLOW_UP_TRIES; a failure answers 422 FOLLOW_UP_FAILED with applied and unknown indexes and makes no key.
  6. approval_of adds an activity entry per follow-up.
  • SystemState::activity keeps the last types::ACTIVITY_KEPT ActivityEntry { at, passkey, kind } per account, beside accounts so account_args is unchanged.
  • signIn entries come from a session’s opening record through system::sign_in_of.
  • approval entries come from one hook in SystemMachine::run: system::approval_of finds the consent authorize verified before the command applies.
  • The time is proof::Consent::at; a time of 0 records nothing, so a replayed old log adds nothing.
  • GET /auth/activity is api::activity_list, holder only.

Code: system/recovery.rs, api/recovery.rs; the same RECOVERY_DELAY_SECS as organization recovery.

  • The code is made by calimero_identity::new_recovery_code and read with normalize_recovery_code (at most MAX_RECOVERY_CODE_CHARS).
  • The log keeps only its Ed25519 key (proof::recovery_key) in SystemState::recovery_keys.
  • SetAccountRecoveryKey uses consent_minted; RemoveAccountRecoveryKey is DELETE /auth/recovery.
  • StartAccountRecovery carries proof::sign_recover, checked in authorize and spent, and records SystemState::account_recoveries[a] (types::PendingAccountRecovery).
  • FinishAccountRecovery (Pending::RecoverFinish) is verified at apply under the pending credential, then calls SystemState::revoke_account_sessions. With revoke_api_keys (which the API sets) it also revokes the account’s API keys; an entry without the flag replays keeping them. The new session is an api::NewSession, as CreateRefresh; 409 RECOVERY_NOT_READY before readyAt on app_clock.
  • api::org_members is holder and needs SystemState::is_org_admin; rows are filtered by Org::sees_member.
  • Passkeys are counted up to PASSKEYS_COUNTED; lastActiveDay is api::last_active, over PasskeyTimes::last_sign_in_at and api::session_use.
  • deployment_orgs adds memberCount and activeMembers30d (ACTIVE_WINDOW_SECS).

Code: api/account_proof.rs, Node::account_proof.

  • POST /auth/account-proof { nonce, audience } (a holder session) answers a calimero_client::attest::AccountProof.
  • It is the receipt key’s signature over "calimero.account-proof.v1\0" || JCS({ cluster, node, account, nonce, audience, issuedAt, expiresAt }).
  • Limits: ACCOUNT_PROOF_TTL (5 min), ACCOUNT_PROOF_NONCE, MAX_ACCOUNT_PROOF_AUDIENCE, plain text only.
  • GET /ops/nodes/{id}/receipt-key answers the key Node::session_issuer holds for a node, so the operator checks a proof from any node.

Account::aliases (PUT/GET/DELETE /auth/aliases/{alias}, GET /auth/aliases); an alias names only an app its account reaches.

Code: origins.rs, api/origins.rs.

  • A manager is SystemState::manages_package; commands are AddPackageOrigin and RemovePackageOrigin, checked in authorize.
  • origins::covers_cluster refuses an rp-id that is, or is a parent of, the cluster’s.
  • api::app_origin is the one lookup (served, then registered) for ceremonies (claimed_app, rp_with), CORS (lib.rs) and the consent page’s returnTo.
  • Begin routes take origin (403 ORIGIN_NOT_REGISTERED).
  • The origin rides in SessionClaims::origin and RefreshRecord::origin, kept by Pending::SignUp and stated nowhere in the sign-in challenge.
  • principal and refresh refuse such sessions once the origin is removed, and UseRefresh refuses an exchange that changes it.
  • UninstallPackage of the last release forgets them.
  • An instance’s origin is a PackageOrigin with app; AddAppOrigin and RemoveAppOrigin are judged by SystemState::manages_app, remove_app, TransferApp and MoveApp forget them (forget_app_origins), and Principal::origin_admits keeps its sessions to that instance (within, within_team, beyond_instance, instance creation, app lists, streams).
  • Limits MAX_ORIGINS_PER_PACKAGE, MAX_PACKAGE_ORIGINS and, for instances, MAX_ORIGINS_PER_APP, MAX_APP_ORIGINS_PER_ORG and MAX_APP_ORIGINS (SystemState::origins_full, SystemState::org_origins_full); http only for localhost names on a --dev node (allow_package_uploads).

The design is custom domains.

  • PackageOrigin::served and AddPackageOrigin::served are left out when false; origins::add_args builds the consent for both the API and authorize.
  • app_host::layer serves the site when served_origin_of names a served origin (Node::served_site, after app_host_site); app_origin_package stays apps-domain only.
  • served_fits refuses a port, a node without --apps-domain (NOT_SERVING), a name under the apps domain or the cluster’s rp-id, a node’s API host, and a held origin with the other served.
  • Limits MAX_SERVED_ORIGINS_PER_PACKAGE and MAX_SERVED_ORIGINS (the certificate metadata budget).
  • require_upgraded_nodes runs before the consent, so no older node drops the flag.
  • GET /ops/served-origins lists { origin, host, label, addedAt } without package names, for mdma’s certificates and routes.
  • merod terminates no TLS: Traefik in the TD does, with certificates mdma delivers.