fabro/lib
Bryan Helmkamp c69a47c4e6
Add auth_sessions and refresh_tokens schema
A CLI auth session is a rotation chain, but the SlateDB records that back
it today store identity and profile per token, so a chain has no owner and
nothing stops its rows from disagreeing. These two tables give the chain a
home: `auth_sessions` holds the identity and profile once, `refresh_tokens`
holds only per-token facts.

Two invariants the current code relies on but never states become
constraints. The partial unique index on `(session_id) WHERE used_at_ms IS
NULL` enforces that rotation leaves exactly one live token per chain --
which is what makes the session listing an indexed lookup instead of a
scan-and-group. The foreign key with `ON DELETE CASCADE` makes revoking a
session remove its tokens without a second statement.

Tokens are retained after rotation until they expire so a replayed token
stays distinguishable from a forgery.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-25 15:15:58 -04:00
..
apps Merge pull request #640 from fabro-sh/codex/workspace-glob-semantics 2026-07-25 12:05:17 -04:00
components Remove dead automation TOML serializers 2026-07-25 14:37:58 -04:00
foundation Add auth_sessions and refresh_tokens schema 2026-07-25 15:15:58 -04:00
packages/fabro-api-client Merge origin/main into feat/inference-observability 2026-07-24 22:55:15 -04:00