This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index at /llms.txt, or add .md to any page's URL.

Recipe: guests, personas and password sessions

Use the complete mixed identity app for the schema, Contract, TypeScript and browser tests.
This recipe needs the Snapback client at <exact2>/snapback4/, which this repository does not include. Its accompanying snapback4/README.md, where a checkout has it, contains “A complete mixed identity app”: the schema, Contract, TypeScript and browser tests. The guide's retest command runs it twice against the selected Snapback version.
Bare use identity permits guests and password accounts. Call guest() before reading; keep its session with auth: {store, key, now} and grant secret.keep for that key. authConfig() is public GET /auth/config; it reports guests, password and development. use identity password removes guests.
On the web that store is origin-readable. Web sessions describes server-set HttpOnly cookies; this bearer-session example does not implement them.
During development the schema may also declare use personas alice, bob. Start with state persona = "", signed out, and offer an explicit persona choice. A persona uses development headers. Password and guest sessions use stored bearer credentials; await logout before switching accounts. Hide retained rows until the current principal's resource answers. serve refuses persona headers, so remove those controls for production. Use a distinct secret key for each backend origin.
reload resets a transient persona choice. An inherited test that expected Alice after reload must now expect signed out, then choose Alice explicitly. A password or guest session restores from the secret store instead. These steps are part of the complete example's tested transition:
Add guests, personas or password sign-in
Paste this into Claude, Cursor, Codex, or another agent.
contract-test
test "persona reload signs out; a password session restores"
expect text "session" == "Signed out"
tap "alice"
clock data
expect text "session" == "Signed in"
reload
clock data
expect text "session" == "Signed out"
expect tree missing "note-0"
type "email" "alice@example.com"
type "password" "correct horse battery staple"
tap "signup"
clock data
expect text "session" == "Signed in"
reload
clock data
expect text "session" == "Signed in"
tap "logout"
clock data
reload
clock data
expect text "session" == "Signed out"
expect tree missing "note-0"
Run that test against dev with fresh and epoch now at the file's top. “A complete online password app” in that client's guide adds login and periodic session refresh with Contract time.
Is this helpful
Last updated November 18, 2026
Exact Docs