Expand description
Stateless, signed web-session tokens and their logout denylist.
A session token binds a SessionSubject — a persona-credential login
(a persona_id) or a wallet-passkey login (a wallet_address, and
optionally the persona it currently resolves to) — plus the SessionScopes
it carries, to an issue/expiry window, and is signed by a dedicated
SessionSigner. Verification needs only the role’s public
key, so a session survives a cold restart of whatever process minted it:
nothing here reads or writes a server-side session store. mint_session
and verify_session are the mint/verify pair; RevokedTokens is the
best-effort, in-memory logout denylist verify_session consults.
This module owns only the token’s cryptographic shape and the denylist —
it mints no challenges, runs no login ceremony, and knows nothing about
cookies or HTTP. A caller that needs those (e.g. a passkey-authenticated
login flow) builds them on top, choosing its own token TTL and calling
mint_session/verify_session directly.
C1.4 adds the replacement protocol through mint_authorized_session and
verify_authorized_session. Its signed claims bind a stable bearer id and
authorization epoch to the same subject/scopes/time window. Verification
remains deliberately pure: a caller must check the resulting id and epoch
against current State before authorizing a request. The v2 path remains
live only until the coordinated caller cutover removes it.
See ADR 0007 (docs/decisions/0007-web-sessions-rooted-in-either-passkey.md)
for why a session may be rooted in either credential, and why
explorer-read/wallet-manage/agent-turn are independent claims rather
than one all-or-nothing grant: revoking a persona-credential must never
revoke a wallet’s own sessions, and vice versa.
Structs§
- Authorized
Session Claims - Claims signed into a bearer whose current authorization lives in State.
- Revoked
Tokens - Best-effort, in-memory logout denylist for session tokens.
- Session
Claims - A verified session’s claims: who it’s bound to, what it authorizes, and its issue/expiry window.
Enums§
- Session
Scope - A capability a session token carries.
- Session
Subject - Which credential rooted a session.
Functions§
- mint_
authorized_ session - Mints a signed bearer bound to the durable record State already accepted.
- mint_
session - Mint a stateless, signed session token bound to
subject, carryingscopes. - verify_
authorized_ session - Verifies only the signed and time-bounded half of a State-backed bearer.
- verify_
authorized_ session_ with_ trust - Verifies a State-backed bearer against current and retired session keys.
- verify_
session - Verify a session token minted by
mint_session, returning itsSessionClaimson success. - verify_
session_ with_ trust - Verifies a session against the role’s current and retired trust set.