3 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 344ddd4c77 feat(auth): every way in on AccountKit's own screens (#167)
* feat(auth): every way in on AccountKit's own screens

Petvity has answered sign-in from AccountKit since this morning, through the
Auth.js compat layer, with AccountKit's sign-up, recovery, passkey and
two-factor endpoints closed. This finishes the move:

- /login, /register and /forgot-password render AccountKit's SignInForm,
  SignUpForm and recovery form: email and password, an email sign-in link,
  passkeys, two-factor, recovery, Continue with OrangeCat and the shared
  bitbaum sign-in, each shown when its env is set.
  /portal/settings/security renders AccountPanel (password, passkeys, second
  factor, linked sign-ins, deleting the account).
- The compat layer passes screens: "accountkit" (AccountKit 0.20.0): every
  AccountKit endpoint is open, and useSession and signOut keep Petvity's
  session shape.
- AccountKit is the only credential writer. Petvity's registration route,
  reset routes, settings password change and its own deletion are removed,
  and so are Auth.js, its edge config, the Drizzle adapter and the
  credential-less Google provider.
- Migration 0009 (additive) makes the panel's rename and deletion reach
  users. The import attaches the new trigger too.
- A Petvity plugin keeps the shared demo account explorable (no sign-in
  changes, no deletion, no mailed links) and keeps ADMIN_EMAILS promotion
  at a password or email-link sign-in.
- Every imported account keeps working: same ids, bcrypt hashes through
  legacyBcrypt, OrangeCat links, roles on users.

browser-smoke.yml now runs every way in against the production build and a
migrated, imported PostgreSQL: the method set at 320px and 390px, sign up,
sign out, a wrong password, sign in, an Auth.js-era bcrypt account, a reset
through the mailed link and an email sign-in link. AccountKit's real mail is
caught by scripts/ci/mail-sink.cjs. Long button labels now wrap (.btn-wrap):
the shared sign-in's label overflowed a 320px screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

* fix(ci): the mail sink path needs no runner context

Job-level env cannot read the runner context, so the workflow did not
parse. The sink sits at a fixed path outside the uploaded artifacts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 23:38:49 +01:00
CatoandClaude 096d2c7160 refactor(auth): use AccountKit's compat layer instead of a local copy (#160)
The next-auth/react bridge, its call helper, the session plumbing, the
AUTH_RUNTIME switch, the import rehearsal script and the journey-test cookie
client were copies of code five products each carried. They now come from
AccountKit 0.18.0:

- @bitbaum/accountkit/auth/nextauth-compat answers next-auth/react. The
  product's compat.ts holds only what is its own: the session shape, how each
  password form signs in, its login codes and hooks.
- @bitbaum/accountkit/auth/switch: sharedRuntimeEnabled().
- `pnpm run db:rehearse-import` runs AccountKit's accountkit-rehearse-import
  on this product's import SQL.
- The journeys use @bitbaum/accountkit/auth/compat-testing.

Behaviour is unchanged with the switch off. With it on, a signed-out session
reads as null, and a resolver or hook failure is a readable refusal rather
than a 500. The real-database journeys pass unchanged.


Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 11:48:50 +01:00
CatoandClaude 2d3609c13e feat(auth): stage AccountKit beside Auth.js, switch off (#156)
Petvity moves from Auth.js to @bitbaum/accountkit one reversible step at a
time, as evig and kivvi do. Nothing changes while AUTH_RUNTIME is unset.

- Migration 0008: AccountKit's tables under an `auth_` prefix, plus the
  users <-> auth_users mirror functions, inert until attached.
- scripts/db/accountkit-import.sql: accounts under their own ids, bcrypt
  hashes byte for byte, verification kept, orangecat_sub as an `orangecat`
  account row; refuses collisions, drift or a live shared runtime, then
  attaches the triggers. The rehearsal CLI always rolls back.
- lib/auth/shared/: the runtime (ids: 'uuid', legacy bcrypt, AccountKit
  0.16.0), a session reader re-read from `users` on every request, a bridge
  that answers next-auth/react including "Sign in with OrangeCat", and a
  Petvity row for a person AccountKit creates itself. AccountKit's own
  credential endpoints stay closed; Petvity's writers stay the only ones.
- lib/auth/claims.ts: the ADMIN_EMAILS promotion rule, written once.
- The proxy has one routing function and two session sources.
- browser-smoke.yml runs the account journey once per runtime; the
  AccountKit leg first runs the rehearsal and the real-database journeys.

docs/ACCOUNTKIT-MIGRATION.md records what is left before switching.


Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 08:31:55 +01:00