Replace the walking skeleton's hardcoded dev-token stub with a real, self-hosted token store — the customs gate's papers check — keeping the dev token as a documented local-only bootstrap. WHY: hexa needs a proper 31-day scoped token (#33), and every future engine endpoint needs per-engine authorization. Self-hosted SQLite (no vendor, same DB that'll hold jobs/cache/usage) matches the 'self-host all' decision. WHAT: - db.py — stdlib sqlite3, WAL mode so the API + worker daemon read/write concurrently. Tables: accounts, tokens (token_hash, prefix, scopes, quota_json, expires_at, revoked). The DB is the one thing worth backing up; the artifact cache is rebuildable (noted in SRE.md). - auth.py — mint() returns the plaintext ONCE and stores only sha256(token), so a DB leak isn't replayable. verify() is an indexed hash lookup → a Principal (account, scopes, expiry); checks revoked + expiry. has_scope() honors the '*' wildcard. Scope-gated dependency require_scope(scope) in app.py: 401 unknown/expired/revoked, 403 scoped-out; scope=None = any valid token. - douanier.py — admin CLI (token mint/list/revoke, db init); the only way tokens are created (no public signup). list masks to a 6-char prefix. - /v1/me echoes the caller's identity (onboarding smoke test); /v1/analyze/emotion now requires the 'emotion' scope. VALIDATION: - 15/15 tests green (8 auth: mint→verify, wildcard, unknown→None, revoke, expiry, never-expires, only-hash-stored, dev-bootstrap; 7 smoke incl. /me guarded). No CLAP/torch needed; DB points at a temp file via conftest. - CLI smoke end-to-end: mint prints secret once + masks in list, expiry lands exactly 31 days out (2026-07-26), revoke flips state to REVOKED.
| Name |
Last commit
|
Last update |
|---|---|---|
| armada | Loading commit data... | |
| blocks | Loading commit data... | |
| blog | Loading commit data... | |
| copycat | Loading commit data... | |
| gifts | Loading commit data... | |
| lib-parvagues | Loading commit data... | |
| live | Loading commit data... | |
| output | Loading commit data... | |
| releases | Loading commit data... | |
| sandbox | Loading commit data... | |
| study | Loading commit data... | |
| test | Loading commit data... | |
| tools | Loading commit data... | |
| utils | Loading commit data... | |
| viz | Loading commit data... | |
| .gitignore | Loading commit data... | |
| BootTidal.hs | Loading commit data... | |
| BootTidal.hs.broken | Loading commit data... | |
| BootTidal.visuals.broken.hs | Loading commit data... | |
| CLAUDE.md | Loading commit data... | |
| LICENSE | Loading commit data... | |
| PatchBay_MultiChannel.xml | Loading commit data... | |
| PatchBay_Perf.xml | Loading commit data... | |
| PatchBay_Perf5.1.xml | Loading commit data... | |
| README.md | Loading commit data... | |
| backlog.md | Loading commit data... | |
| bullet_train.tidal | Loading commit data... | |
| collide.sh | Loading commit data... | |
| debug.tidal | Loading commit data... | |
| didacticpatternvisualizer.pde | Loading commit data... | |
| hello.sc | Loading commit data... | |
| init_midi.sh | Loading commit data... | |
| intro.md | Loading commit data... | |
| library.txt | Loading commit data... | |
| link_jack.sh | Loading commit data... | |
| link_samples.sh | Loading commit data... | |
| link_samples_all.txt | Loading commit data... | |
| main_fairbanks.scd | Loading commit data... | |
| notes.md | Loading commit data... | |
| perf-tray.py | Loading commit data... | |
| perf.sh | Loading commit data... | |
| samples.txt | Loading commit data... | |
| start_and_midi.scd | Loading commit data... | |
| test.tidal | Loading commit data... |