跳到內容
GitHub

Authentication

Unaudited

本頁內容尚未翻譯。

The server can prove a request comes from a session it issued, not who the user is. The master key, held client-side, is the identity root. Every login credential authenticates a session only, and the master key never derives from, and is never visible to, the credential verifier. Endpoint shapes and status codes are in Authentication and devices.

  • Registered accounts have a unique identity and their own master key, and sign in with password (+ optional TOTP) or OIDC (Choosing an Auth Path).
  • Delegated/sponsored accounts have their own keys, wrapped under a random per-sponsoree KEK that the sponsor’s master key wraps, and no recovery path of their own. The sponsor authenticates and manages them and has full access (Key Management — Delegated/Sponsored accounts).
  • Non-registered accounts have no identity or master key: share links (Share Links) encapsulate keys to the link secret, and web-upload links (Web Upload) let a guest seal to a link-scoped key with no read access.

Registration takes an address, a password and the account’s identity anchor, and signs the caller in with a token pair.

  • No display name, username or invitation code: the server stores as little about a person as it can. The anchor is a public key the device directory publishes anyway, not a fact about the person.
  • Passwords have a 12-character floor and no composition rule, because they guard a session, not the master key.
  • A taken address is 409 error.auth.user_already_exists, an account oracle by decision, bounded by the per-source registration budget (Authorization — Rate Limits). Every attempt whose body parses, refused ones included, is charged, so probing costs the prober whatever the answer.
  • Open registration needs a default quota. The server refuses to start with password registration enabled and no default quota limit, unless the operator sets the default to unlimited explicitly (Quota — Thresholds and States), so accounts minted for free cannot fill the disk.
  • A new account has no device directory and therefore cannot write (invariant 7 of Validation Invariants — Server-Side Validation Invariants), so the client publishes its first directory immediately after registering (Device Enrollment — First-Device Enrollment).
  • There is no token introspection, since the session ledger is read on every request and validation is the request. There is no password reset, since the server cannot re-wrap a master key it never saw; recovery is the escrow blob (Backup and Recovery).

The anchor is the User IK public key (Key Management — User Identity Keys (User IKs)) that every directory publish and every global sign-out verifies under (Key Management — Device Directory). Whoever sets it owns the account’s write identity for the account’s life, so no credential the server verifies may set or change it after the fact.

  • A password account is anchored at registration. The request carries the IK public key and an IK signature over a domain-separated message naming the address and this server’s origin (proof of possession). A bad proof is 400, and nothing is created. There is no window between creating the account and pinning its anchor in which a phished password can pin a different one.
  • An OIDC account is anchored by its first directory publish. Its first sign-in creates it before any client key exists. The window is accepted because squatting it requires the identity-provider credential, and on that path the provider is the account’s root by decision (Choosing an Auth Path).
  • No sign-in credential and no operator command replaces an anchor. Neither a password, a second factor nor a provider assertion can, because the anchor exists so that a password holder cannot replace it. It changes only by a recovery-signed identity rotation (Key Management — Identity Rotation), which needs the one secret no device or server holds. The first directory publish, which must verify under the anchor, pins the recovery verification key beside it.
  • An account that never publishes a directory is swept 7 days after registration. It cannot have written anything, so deleting it loses nothing and frees the address. The client persists the master key and IK before it registers, so a crash between registering and publishing resumes (“finishing setup”) rather than orphaning the anchor.

No passkey surface ships. Building one is new work and reopens the rustls-only rule (Network Resilience — Transport Security), because webauthn-rs links openssl for attestation parsing.

TOTP is the local path’s second factor.

  • Login with a confirmed factor answers 202 Accepted with a challenge. No session, cohort or refresh token exists until it completes. Clients read the 202 from the status, and the SDK returns a LoginOutcome, never a challenge shaped like a failure.
  • Verifying the challenge opens the session, so the advisory cohort_hash/device_id ride that request.
  • A challenge is single-use. The session it opens burns it; a completed challenge is never re-armed for another code inside its 5-minute life.
  • Every route that checks a code is charged twice, before the code is checked: once per challenge and once per account (Authorization — Rate Limits). The routes are verify-login, verify-enrollment and disable. The challenge is the login challenge, the pending enrollment, or the session presenting the disable. The per-challenge counter bounds one ceremony. The per-account counter bounds the loop of minting fresh challenges, which would otherwise give the holder of a password five guesses per sign-in without end. The per-account counter cannot be spent by a stranger, because every route that reaches it requires the password or a live session first.
  • Enrollment requires a fresh credential (Authorization — Freshness-Gated Operations) and gates nothing until confirmed. It issues a secret and an otpauth:// URI, is refused over a confirmed factor and replaces a pending one. The confirming code is spent into the replay ledger. Without the freshness gate, a stolen access token could bind the thief’s authenticator and lock the owner out of every new sign-in.
  • Disabling requires a live code, not just a session, so a stolen access token cannot switch off the control.
  • A code is accepted at most once (RFC 6238 §5.2) by compare-and-set on the highest step used. Parameters are fixed: SHA-1, 6 digits, 30 s step, ±1 step drift.
  • The secret is sealed at rest under a dedicated server key, so a database or backup leak yields no second factor. The key is independent of the token key (Session and Access Tokens), so rotating the token key after a leak never strands a factor.
  • A store outage fails sign-in closed.
  • Reauthentication takes a password alone, because an existing session has already passed the factor.
  • The profile is the caller’s own id, address, optional display name and creation time: the whole of what the server stores about a person. The route has no {user_id} segment, so reading another’s profile is unrepresentable; other accounts’ public facts are the device directory (Key Management — Device Directory).
  • Only the display name is editable. An absent key leaves it unchanged and an explicit null clears it. It is trimmed and ≤128 chars, and control characters are refused, not rewritten.
  • A password change authenticates with the current password and is charged as a re-authentication (Sign-In Limits). It closes every session of the account, then re-opens the caller’s. A wrong current password is 403, never 401.
  • The login address is immutable. Changing it without proof of control of the new address is an account takeover, so the port has no method for it until such proof exists.

Password guessing is bounded by counting, never by locking. An account is never locked: a lock that a stranger can trigger is a denial of service against the owner, and the owner is the one person the limit exists to protect. The budgets are in Authorization — Rate Limits.

  • Per source. Login, re-authentication and registration are charged against the resolved client address (IPv4 address, IPv6 /64) on every attempt whose body parses, before Argon2 runs. This bounds both guessing and the CPU a source can spend.
  • Per address, a soft delay. Failed sign-ins against one presented address are free up to a small allowance. After that, each failure sets a not-before instant that doubles up to a cap, and the run decays after a quiet period; the numbers are in Authorization — Rate Limits. An attempt before the instant is answered 429 error.auth.rate_limited with Retry-After, without verifying the password and without being charged, so waiting is never punished. The run clears on a success or a password change.
  • Keyed on the address as presented, never on the account. The key is a keyed hash of the address string, so the counter store holds no addresses, and an unknown address is slowed exactly as a known one is. Keying on the account would make the delay itself the enumeration oracle that a single answer for “no such account” and “wrong password” exists to deny.
  • A known device is exempt from the address delay. Every successful sign-in also returns a sign-in device token: server-signed, bound to the keyed hash of the address, and valid for 365 days. A later sign-in presenting it for the same address is charged against that token’s own small failure budget instead of the address delay. A stranger flooding an address therefore slows only devices that have never signed in to it. A thief who holds a device token for an address and is guessing its password is bounded by the token’s budget.
  • Re-authentication and password change are charged per session, not against the address delay. They are performed by a session, so a stranger’s failures at the sign-in door cannot block an owner’s re-prove, and a stolen session’s guesses are bounded by that session’s budget.
  • The answer is one shape. A slowed address, an unknown address and a wrong password differ only in status (429 vs 401), and the 429 depends on the presented string alone.
  • Residual risk, accepted. An attacker who knows an address and keeps the delay at its cap from many sources can slow the first sign-in of a brand-new device to one attempt per delay cap. Refused sign-ins on an existing account reach its activity log, coalesced (Account Activity Log).

Both paths mint the same sessions (Session and Access Tokens) and differ only in who verifies the credential. A deployment may enable either or both.

  • Local auth (password + optional TOTP) is the default, with no external dependency, for personal and household servers.
  • OIDC (authorization code + PKCE, Capsule as relying party only) suits deployments with an IdP or wanting SSO. Account lifecycle policy lives at the IdP.

Authorization code + PKCE, plus the device grant (Signing In Without a Browser). No implicit or hybrid flow.

Ceremony. Authorize takes the client’s redirect_uri and binding_challenge and answers the provider URL, state and a 10-minute deadline; the client receives the redirect itself. The callback takes state, code and binding_verifier and answers exactly as password login does (token pair or 202 TOTP challenge), through the same session code.

  • Redirect allow-list. Exactly OIDC_REDIRECT_URL, or, only when OIDC_ALLOW_LOOPBACK_REDIRECT is on (default off), http on 127.0.0.1/[::1] at any port (RFC 8252 §7.3; localhost refused per §8.3). The redirect is stored with the ceremony and replayed byte-for-byte to the token endpoint. Refusal is 400 error.auth.oidc_redirect_invalid.
  • Begin is rate-bounded as an unauthenticated write (Authorization — Rate Limits). It is charged per source first, so one caller cannot spend the deployment-wide buckets behind it. Then it is charged per admitted redirect host (429 error.auth.rate_limited), and finally against the ceremony store’s capacity (503 error.auth.oidc_at_capacity). The host key is chosen after redirect validation and all refusals share one deployment-wide bucket, so a caller cannot mint counter keys. Limiter ceilings are partitioned per key kind so a flood on one surface cannot starve another.
  • The callback is charged per source before state is looked up, so the number of provider token exchanges a single source can drive is bounded even before state stops it.
  • state is single-use, burned on the first callback whatever the outcome. Unknown, spent and expired are one answer, 401 error.auth.oidc_state_invalid.
  • Client binding defends against login CSRF. binding_challenge is the S256 hash (43-char unpadded base64url) of a ≥256-bit client secret; a malformed one is 400 error.request.malformed before any budget is charged. The callback compares binding_verifier in constant time after burning state and before contacting the provider; a mismatch is the same 401 error.auth.oidc_state_invalid. The SDK also refuses a foreign state locally (RFC 6749 §10.12).
  • ID-token checks: alg ∈ {RS256, ES256, EdDSA}, never none or HMAC; signature against the provider JWKS; iss exactly OIDC_ISSUER; aud contains the client id; azp if present; exp/nbf/iat with 60 s skew; nonce matches; bounded sub. Every failure is one wire code, 401 error.auth.oidc_token_invalid, with detail in the log. A provider refusing the exchange is 401 error.auth.oidc_exchange_failed; an unreachable one is 500 error.auth.oidc_unavailable, distinct from error.auth.unavailable.
  • Discovery is lazy: first use, cached 1 day, so an IdP outage never blocks local auth. It is refused if its issuer differs from the configured one (mix-up defence). Endpoints must be https unless the issuer is a loopback IP literal, in which case plain-HTTP endpoints must also be loopback. JWKS is refetched on an unknown kid at most once a minute, and unconditionally after an hour to drop revoked keys. OIDC_CA_BUNDLE adds trust anchors.
  • Accounts are keyed on (issuer, subject), never linked by address. First sign-in creates a password-less account. A verified IdP email already held by any account is 409 error.auth.oidc_address_taken; unverified emails reserve and collide with nothing. Explicit linking is a separate, out-of-scope ceremony.
  • A federated account is a row in the one account table with a null credential. Registering over its verified address is 409 error.auth.user_already_exists. A null credential never authenticates and is never charged to a sign-in budget. A profile with no verified address omits email.
  • OIDC ignores the password sign-in delay (Sign-In Limits), or password guessing could slow a person’s SSO too.
  • A confirmed TOTP factor is honoured: the callback answers the same 202 challenge.
  • A session’s credential instant is the provider’s. A session opened through the provider records the ID token’s auth_time as authenticated_at when the token carries it, and the callback instant otherwise. An identity-provider session cookie therefore never counts as a fresh credential.
  • Re-authentication through the provider. Authorize takes an optional re-authentication flag on an authenticated request. The flag sends max_age=0 (OpenID Connect Core §3.1.2.1). Its callback MUST carry an auth_time inside the freshness window (Authorization — Freshness-Gated Operations) and name the session’s own (issuer, subject). It then refreshes that session’s authenticated_at instead of opening a new session. Any other outcome is 401 error.auth.oidc_token_invalid.
  • Scopes are fixed at openid email. profile is not requested.
  • server-info publishes auth.oidc: { authorize, callback } or null, endpoints only, never issuer or client id. Unconfigured, the OIDC routes answer 404 error.auth.oidc_not_configured.

Configuration (capsule-server/src/config.rs): OIDC_ISSUER (absent = off), OIDC_CLIENT_ID, OIDC_CLIENT_SECRET (optional; absent = public PKCE-only client, RFC 8252 §8.5), OIDC_REDIRECT_URL, OIDC_ALLOW_LOOPBACK_REDIRECT, OIDC_CA_BUNDLE. An issuer without a client id, or the reverse, is a startup fault. Ceremonies live in PostgreSQL (in-memory in development), and capsule-server/compose.yaml ships a dex service (--profile oidc).

PASSWORD_AUTH_DISABLED (default off) narrows the audited surface to the identity provider.

  • serve refuses it without OIDC_ISSUER, since a server with neither door admits nobody.
  • Register, login and reauthenticate answer 403 error.auth.password_disabled before anything else: no rate-limit charge, body validation, directory lookup or Argon2. A malformed body, an unknown address and a slowed address get the same answer.
  • Every local account is refused, including one created before the switch. There is no break-glass account: a named exception keeps a password door open on the account an attacker most wants, and the operator’s recovery is turning the switch off.
  • Existing sessions are not revoked. A password session lives out its sliding and hard expiry but cannot re-authenticate with a password, so freshness-gated operations are closed to it. A session opened through the provider re-proves through the provider (Signing In Through an Identity Provider).
  • server-info publishes auth.password_disabled: true beside auth.oidc, so a client hides its password form. Absent means false, as on a server predating the switch.

capsule auth login --oidc is the RFC 8252 native-app flow and needs no extra server surface.

  • It listens on 127.0.0.1 at an ephemeral port with redirect http://127.0.0.1:{port}/callback. The server must enable loopback redirects, and the CLI prints that remedy on refusal.
  • The URL is always printed. It is also opened unless --no-browser, only if it parses as absolute http(s), and on Linux/BSD only under a graphical session.
  • It waits ≤5 min, never past the ceremony deadline.
  • Only a loopback callback carrying this ceremony’s state ends the wait; anything else is ignored, so another local process cannot cut the sign-in short. A provider error for this state ends it, and error_description is printed with control characters stripped.
  • The session is settled by the same function as a password sign-in, TOTP prompt included.

Headless clients use the device authorization grant (RFC 8628): capsule auth login --oidc --device.

  • The server proxies the provider and the device_code never leaves it. Begin takes a binding_challenge and answers a server-minted 128-bit handle, user_code, verification_uri (+ _complete if given), interval and expires_by (the minimum of the provider’s expires_in and 15 min).

  • Polling takes handle, binding_verifier and the advisory cohort_hash/device_id. Success answers as the callback does (tokens or 202). Otherwise:

    Provider answer Capsule answer Ceremony
    authorization_pending 400 error.auth.oidc_device_pending kept
    slow_down, or poll sooner than one interval 429 error.auth.oidc_device_slow_down, interval += 5 s kept
    access_denied 401 error.auth.oidc_device_denied burned
    expired_token; unknown/spent handle; binding mismatch 401 error.auth.oidc_device_expired burned
    other refusal 401 error.auth.oidc_exchange_failed burned
    unreachable 500 error.auth.oidc_unavailable kept
  • The interval is server-enforced at the provider’s value, ≥5 s, and an early poll is refused without asking the provider. A client that waits one interval before every poll and adds 5 s per slow_down stays in step.

  • The ID token passes every callback check except the nonce, which MUST be absent: a token carrying a nonce was minted for another authorization request. The back-channel request with a server-held device code replaces the nonce’s binding.

  • binding_verifier is checked in constant time on every poll before the provider is asked; a mismatch burns the ceremony.

  • A session, TOTP challenge, refused ID token or taken address also burns the ceremony. It is burned before the session opens, so racing polls open one.

  • No grant support (no device_authorization_endpoint, or unauthorized_client/unsupported_grant_type) is 404 error.auth.oidc_device_unsupported; other device-endpoint refusals are 500 error.auth.oidc_unavailable. verification_uri is held to the endpoint scheme rule, and user_code to ≤64 chars with no control characters.

  • Begin checks binding shape first, then the per-source begin budget, then one deployment-wide budget, then store capacity (Authorization — Rate Limits). Polls are bounded by the begin budget × one provider call per interval.

  • The CLI prints the address and code, never opens a browser, and gives up at expires_by.

Handles are [email protected] (Matrix-style). .well-known/ never enumerates users.

  • .well-known/capsule/server-info is public and server-scoped only: API base, auth and federation endpoints, server signing key, protocol_version range and min_protocol_version cutoffs.
  • User lookup is authenticated: local clients by session token, federated peers by a federation capability token (Federation — Federation Capabilities) rate-limited per peer.
  • Anonymous WebFinger returns only what the user opted into (default nothing), limited to handle and display name, never keys, devices or album hints, per the deny-by-default rule (Schema Rules and Open Questions — Schema Evolution and Field Grammar).

All are public and take no credential. A new path MUST add a row.

Path Contents Owner
server-info Server-scoped facts above. Never a user list. Identity and Discovery
moved/{user} IK-signed moved certificate (post-v1). Account Portability
revoked-jti Federation capability revocations (≤24 h). Federation — Token Lifecycle and Chain of Trust
deprecation Min-supported-client announcements. Schema Rules and Open Questions — Min-Supported-Client Deprecation Policy
attestation-keys Storage-attestation public keys + append-only history. Durability

Post-v1. The User IK (Key Management — User Identity Keys (User IKs)) is already a server-independent root; only the handle is host-bound. No DID system.

  • The new server registers the account under the same IK, leaving the key hierarchy unchanged.
  • The old server publishes .well-known/capsule/moved/{user}, { old_handle, new_handle, moved_at, ik_sig }, cacheable 24 h. It is the only well-known record naming a user, admissible because the user signs and initiates it.
  • Resolvers verify ik_sig against the IK from the signed device directory (Key Management — Device Directory) and re-resolve. An unverifiable certificate is ignored (the old handle keeps resolving) and surfaced.

No server can forge a migration, because the IK signs the move.

Both tokens are EdDSA JWTs signed with the server’s Ed25519 token key (JWT_ED25519_DER). They are classical only, per the operational-signature carve-out (Cryptographic Primitives — Signature Scheme). Each names its kind (access, refresh, or the half-finished second_factor), and every verifier takes the kind it expects, so one kind is never accepted as another.

A server-generated UUIDv7 identifying the session record. It is not a secret: the record carries its creation time in the clear beside it.

The refresh token: a JWT naming the account, the session id and the session’s lineage (Token Lineage and Reuse). It is stored on the client and presented only to obtain a new pair. Its expiry is the session’s remaining life (Session Expiry and Revocation).

What the server stores is not a credential. The session ledger holds session ids, lineages and timestamps, never a bearer secret. A leaked database, replica or backup therefore yields no live session on its own. The token key is the one secret that turns such a leak into every live session, so it is held as the deployment’s most sensitive secret (Self Hosting). Rotating it signs every device out.

A 15-minute JWT issued against the session token, presented as the bearer credential on every authenticated request. The lifetime is fixed, not configurable: it bounds what a lost access token buys, not what a revoked one does (Explicit Revocation).

A lineage is the chain of sessions one sign-in produces through refreshes. A refresh closes the presented session and opens its successor in the same lineage, so a refresh token is good once. The lineage id is minted at sign-in, carried in every refresh token and never moved, as the hard cap’s sign-in instant is (Hard Expiry).

  • Reuse revokes the lineage (refresh-token rotation with reuse detection, RFC 9700 §4.14.2). A refresh token whose session is closed while its lineage still has a live session is a stolen or replayed token. The server closes every session of that lineage and records the event in the account’s activity log. The legitimate device and the thief both re-authenticate. Only the one who holds the password and factor gets back in.
  • A lost response is retried, not punished. A client that retries a refresh within 60 s of the rotation receives a fresh pair for the same successor session, provided that successor has not itself been refreshed. Outside that window the retry is reuse.
  • Refreshes are budgeted per lineage (Authorization — Rate Limits), so a stolen token cannot rotate a lineage faster than an honest client ever does.

A session token stops being honoured on sliding expiry, hard expiry or explicit revocation, and nothing else. Expiries are enforced at access-token issuance.

180 days (SESSION_TTL_DAYS) without an access-token issuance. Each issuance resets the clock; activity alone does not, since a request records last-used time and never extends the session.

365 days (SESSION_HARD_CAP_DAYS) from sign-in, never reset. It caps the window for a silently exfiltrated token on an active device (the malicious keyholder of Threat Model — Client Class Taxonomy).

Both are whole days, set per deployment and never per session. Zero, a negative count, or a cap shorter than the sliding window refuses the boot as a configuration fault. A stored session keeps the deadline it was opened under, so a changed value applies from its next refresh. A lowered value then refuses a session idle longer than the new window, or a lineage older than the new cap, as expired, and rotates one inside both with only what the new values leave it. A raised value lengthens nothing until that refresh.

Invariants:

  • The cap survives rotation. The session record carries its lineage’s sign-in instant; a refresh carries it forward unchanged and a re-authentication does not move it.
  • A session lives until the earlier of the two expiries, and its refresh token is issued for exactly that remaining life, never a whole window past the cap.
  • A deploy never shortens a live session. A record that predates the sign-in instant measures its cap from its own creation.

The session ledger supports:

  1. List active sessions with last-used time.
  2. Revoke one session, authenticated by any active session token.
  3. Revoke all, authenticated by proof of master-key possession, not a session token, so a stolen token cannot lock the user out of every device.

Revoke-all is two requests. An authenticated POST /v1/auth/logout/all/challenge issues a single-use challenge; it is authenticated so it is not an account-existence oracle. An unauthenticated POST /v1/auth/logout/all redeems an IK signature over a domain-separated message containing it, verified against the account’s identity anchor (Key Management — Device Directory), never a request-supplied key. The challenge is burned on every attempt.

Invariants:

  • Revocation is immediate. The bearer scheme reads the ledger on every authenticated request, so an in-flight access token is refused on next use. The access-token lifetime bounds a lost token, not a revoked one.
  • An unreadable ledger refuses (fail closed) with 503 error.auth.unavailable and Retry-After, never 401. A client that read an outage as an expiry would discard a live session and send its user to a sign-in that cannot succeed until the store is back (Authorization — When the Counter Store Fails).
  • Last-used is coarse: at most one write per minute per session.
  • Nothing revokes a session automatically except reuse. The server never revokes on a heuristic, because that bypasses the user-initiated audit trail. The one automatic revocation is a lineage whose refresh token was replayed (Token Lineage and Reuse), recorded in the account’s activity log.
  • An operator can revoke, and it is recorded. On a confirmed server-side compromise the operator has two levers. One is a maintenance command that revokes every session of one account or of all accounts, recording an operator-revocation event in each affected account’s activity log. The other is rotating the token key, which invalidates every token at once. Neither touches keys, directories or data, so the user’s own revoke-all remains the only path that proves master-key possession.

Reinstalling re-enrolls with a new device_id, because device keys are hardware-bound (Metadata — Add-id Binding), so one phone accumulates ledger entries. The cohort hash groups sessions from one physical device and is a grouping aid only.

Platform Primary identifier App reinstall OS reinstall Factory reset
iOS Keychain random 128-bit seed, ThisDeviceOnly, non-synchronized yes (not guaranteed) no no
Android SSAID (signing-key-scoped ANDROID_ID) yes no no
macOS IOPlatformUUID yes yes yes
Windows MachineGuid yes no no
Linux /etc/machine-id (only ever hashed) yes no no

The promise is reinstall-stable everywhere, reset-stable only on macOS. A factory-reset phone is a new cohort.

cohort_hash = SHA-256( canonical-CBOR([ "capsule-device-cohort/v1", user_id, platform_tag, primary_id ]) )

The input is canonical CBOR (Metadata — Canonical CBOR Encoding) with a closed platform_tag enum. user_id is folded in so one device under two accounts yields unlinkable hashes. It is implemented once in capsule-core (cohort).

  • Sent only in the session-opening request body, and registered in the header census (Validation Invariants — Universal Headers) as a body field. Never in signed artifacts, to federated peers or in .well-known.
  • Advisory only. It is client-asserted and unverifiable, so no authorization or capability decision may read it, and it never substitutes for device_id or the DSK. Absent or garbage values behave identically to valid ones.
  • The session record carries cohort_hash, and a durable device_cohorts(user_id, cohort_hash, first_seen, last_seen) map outlives session expiry.
  • Recording a cohort never fails a sign-in: it is written after the session, and a failure is logged and dropped.
  • It appears only in the session listing. There is no filter by cohort and no “revoke cohort” verb; revocation names a session_id.
  • The UX asserts (“a device you’ve used before, last seen date”) with no “not my device” toggle. Disputes go through a support report bundling {cohort_hash, [(device_id, session_id, first_seen, last_seen)]}.
  • The server still locks an account after repeated failed sign-ins: AccountLocked answers 423 (capsule-server/src/routes/auth.rs:436), charged against the per-account LOGIN_ATTEMPTS budget of 5 failures in 15 minutes (capsule-server/src/counter/budgets.rs:21). The per-address delay and the sign-in device token that replace it are not implemented.
  • Refresh rotation detects no reuse: no lineage claim or reuse check exists in capsule-server/src, so a replayed refresh token is not caught and no lineage is revoked (Token Lineage and Reuse).
  • An unreadable session ledger is not answered 503 with Retry-After; the server answers 500 or 401 today (Authorization — When the Counter Store Fails).
  • TOTP enrolment and the escrow PUT carry no freshness gate (Authorization — Freshness-Gated Operations), and TOTP secrets are stored as plaintext base32 (capsule-server/src/auth/totp/postgres.rs:136) rather than sealed at rest.
  • The operator session-revoke maintenance command does not exist.
  • Registration carries no identity key or proof of possession, and no sweep removes accounts that never publish (The Identity Anchor; invariant 37 in Validation Invariants).
  • Token round-trip (unit): session token → access JWT → verify; after key rotation, old JWTs verify within their grace window.
  • Expiry (unit, mock clock): sliding refreshes on each issuance, hard does not and survives rotation; rejection happens at access-token issuance.
  • Revoke-all (unit): rejected without master-key proof; with it, every other session is invalidated.
  • Revocation immediacy (unit): a revoked session’s live access token is refused on next use.
  • TOTP: 202 on a confirmed factor; code replay refused; per-challenge and per-account caps on verify-login, verify-enrollment and disable; a completed challenge cannot open a second session; enrollment refused on a stale session; the stored secret is not its base32 plaintext; store outage fails closed.
  • Identity anchor (integration): registration without a valid proof creates nothing; a publish under a different IK after registration is 403; an account with no directory is swept after its window and one with a directory never is.
  • Sign-in limits (unit, mock clock): the per-source budget trips before Argon2 runs; the address delay doubles to its cap, refuses without verifying or charging, decays and clears on success; a known and an unknown address are slowed identically and answer byte for byte alike; a valid device token for the address bypasses the delay and one for another address does not; re-authentication failures never slow the address; a parallel burst is admitted at most the allowance.
  • Lineage (unit): a replayed refresh token closes every session of its lineage; a retry inside the grace window returns the same successor; a retry after the successor rotated is reuse.
  • OIDC freshness (integration): a callback whose auth_time is outside the window does not make a session fresh; re-authentication for another (issuer, subject) is refused.
  • OIDC (integration): an in-process loopback mock provider (offline, container-free) covers key rotation, the refetch floor, a wrong PKCE verifier, every claim refusal, binding mismatch and each device-grant answer; gated round trips run against dex (CAPSULE_TEST_DEX=1).
  • Account portability (smoke, post-v1): moved certificate from A; B registers the same IK; peers follow the move.
  • Cohort: cross-language known-answer vectors; the same primary_id under two user_ids gives distinct hashes; absent, malformed and colliding values behave identically; a tripwire asserts no signed schema has a cohort field; the durable map outlives sessions.

The auth → library-query E2E case is in the E2E case index.