3 Commits
Author SHA1 Message Date
CatoandClaude c106673c24 feat(auth): every way in on AccountKit's own screens (#225)
/login, /register and /forgot-password are AccountKit's forms: password,
passkey, an email sign-in link, recovery, Continue with OrangeCat and the
shared bitbaum sign-in, each when its env is set. The profile settings
carry AccountKit's account panel (password, passkeys, two-factor, linked
sign-ins, deletion). compat passes screens: "accountkit" (AccountKit 0.20).

AccountKit is the only credential writer: Kivvi's registration, invite
sign-up, reset link and settings password change are removed, along with
the Auth.js runtime. A new person gets Kivvi's users row under the same id
and lands on /join; an invitation sends them through sign-up and back.
Deleting an account is refused before anything is deleted when the person
is named on kept business records or is the only owner of a company others
work in.

Migration 0039 (additive, idempotent) makes the panel's rename and deletion
reach users. The browser journey runs every method in CI against the
production build, with AccountKit's real mail caught by a sink.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 00:47:01 +01:00
CatoandClaude ab8fad1550 refactor(auth): use AccountKit's compat layer instead of a local copy (#212)
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:53:06 +01:00
CatoandClaude Opus 5.5 405ba372d4 feat(auth): stage AccountKit beside Auth.js, switch off (#209)
* feat(auth): stage AccountKit beside Auth.js, switch off

Kivvi moves from Auth.js to @bitbaum/accountkit one reversible step at a
time, the same way evig did. This step adds everything the switch needs and
changes nothing while AUTH_RUNTIME is unset.

- Migration 0038: AccountKit's tables under an `auth_` prefix, plus the
  users <-> auth_users mirror functions, inert until attached.
- scripts/db/accountkit-import.sql: copies accounts under their own ids and
  bcrypt hashes byte for byte, refuses address collisions, drift or a live
  shared runtime, then attaches the mirror triggers. The rehearsal CLI always
  rolls back and prints only counts.
- apps/web/lib/accountkit/: the runtime (ids: 'uuid', legacy bcrypt, AccountKit
  0.16.0), a session reader in Kivvi's shape re-read from `users` and the
  membership on every request, and a bridge that answers next-auth/react.
  AccountKit's own credential endpoints stay closed: Kivvi's sign-up, reset and
  password change remain the only writers, and the triggers carry them over.
  Changing your own password keeps that session and ends the others.
- apps/web/lib/session-claims.ts: the company/role/onboarding rule, written
  once and used by both runtimes.
- The middleware has one routing function and two session sources, and runs
  on Node so it can read a database session.
- 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.

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

* fix(web): load tailwindcss-animate by import; keep the switch-off password path unchanged

Node 24 loads tailwind.config.ts natively as ESM, where require() is not
defined, and next dev exited in the chatkit smoke. The settings password change
now uses a transaction only when it has a shared session to keep.

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

---------

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