/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>
The box holds only the standalone build, so scripts/seal-company-ai-keys.ts
could not run there and the keys nobody opened stayed plaintext. The sealing
now lives in lib/seal-company-ai-keys.ts. The script and a new start-up run
both use it.
instrumentation.ts starts it once when the Node server starts. It does not
await it, so start-up never waits, and a failure is caught and logged. It is
idempotent, logs one line of counts and never a key, and keeps the guarded
write: a key changed between the read and the write is counted, not
overwritten.
The unit test runs the sealing against an in-memory companies table that
applies the guarded UPDATE the way Postgres would.
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9
Co-authored-by: Claude <noreply@anthropic.com>
The schema said `aiApiKey // encrypted`; the settings action wrote it as typed,
and nothing checked it — a mistyped key saved fine and every chat then fell
back to the shared models with nobody told why.
- A new key is checked with its provider (ai-kit probeByokKey) before saving;
a refused key, or a model the key cannot use, is reported in the provider's
own words and nothing is stored.
- The key is encrypted with the existing integration-secrets helper (same app
secret, no new env); keys saved before this still read as-is.
- Chat decrypts it; an undecryptable key behaves as no key.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>