mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 07:38:43 +01:00
Loki moves from Auth.js to @bitbaum/accountkit one reversible step at a time, as evig, kivvi, petvity and surf-your-life do. Nothing changes while AUTH_RUNTIME is unset. - Migration 0130: AccountKit's tables under `auth_`, and the mirror functions: users <-> auth_users, and AccountKit's OrangeCat token set into Loki's `accounts`, where publish, promote and the wallet read it. - scripts/db/accountkit-import.sql + a rollback-only rehearsal: ids, Loki's own scrypt hashes (read through AccountKit 0.17.0's legacyPassword), verification, OrangeCat links, a placeholder address for people with none; collisions, drift and a live shared runtime refused. - src/lib/auth/shared/: the runtime, the session re-read from `users` on every request, and a bridge for next-auth/react: email, the invite's user-password and the owner key (stored hash only), OrangeCat sign-in or link, and the studio's server signIn by redirect. GitHub, Google and X are not offered on this runtime (getEnabledAuthProviders knows it). - src/lib/auth/bootstrap.ts: onboarding heal and personal org, now one function both runtimes call. - The proxy reads the shared session and asks the same authorized(). - /api/me/password keeps the caller's shared session. - scripts/test/accountkit-journeys.ts joins `test:db` (16 journeys and the rehearsal on CI's Postgres). docs/architecture/accountkit-migration.md records what blocks the switch, chiefly GitHub/Google sign-in and the GitHub repository token. Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML Co-authored-by: Claude <noreply@anthropic.com>