Files
CatoandClaude Opus 5.5 ebe51fa38e feat(auth): every way in on AccountKit's own screens (#289)
* feat(auth): every way in on AccountKit's own screens

Botsmann signed people in against OrangeCat's GoTrue (auth.users). It now
runs on AccountKit (@bitbaum/accountkit 0.23) with AccountKit's own forms:
/auth/signin offers email and password, an emailed sign-in link, a
passkey, recovery through the mailed link and the second factor;
/auth/signup is sign-up; /account carries the account panel ("Sign-in and
security" in the account menu). "Continue with OrangeCat" and the shared
sign-in show when their clients are set, the link and recovery when mail
is. The GoTrue routes (/api/auth/signin, signup, forgot-password,
resend-verification, profile) and pages (callback, forgot-password,
reset-password, verify-email) and the cookie-session client are gone.

AccountKit's tables live in a host accounts database (drizzle/, loki
accounts-db.conf); the data stays in the botsmann supabase schema, which
every route already read with the service-role client. verifyUser now reads
AccountKit's session; /api/user/profile moves onto it too. New accounts get
uuid ids, and migration 013 drops the person columns' keys to auth.users,
which a new person's id is not in. Nothing is deleted. The profile editor
writes AccountKit's name and image.

Existing people keep their rows: scripts/db/accountkit-people.sql lists
everyone who owns rows with their OrangeCat actor id, and
scripts/db/accountkit-import.sql gives each an account under the same id,
linked to OrangeCat by that actor id, never by address (loki
accountkit-supabase.yml rehearses it rolled back, then imports).

Pages were served with public, max-age=3600 to every browser, account pages
included: after sign-out the browser showed its cached /account. /account
and /auth/* are now private, no-store. The account menu's trigger has a name.

tests/__tests__/accounts runs the ways in and the import on the committed
migration; browser-smoke.yml's account job rehearses the import and runs
the browser journey against the production build with AccountKit's real
mail caught by a sink.

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

* fix(auth): send a signed-out visitor to sign in with the router

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

* ci(auth): the shared sign-in's button is matched by how it starts

AccountKit 0.24 names only the providers Morulia publishes, so the label
changes with Morulia.

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

* ci(auth): expect the shared sign-in only once Morulia publishes a provider

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

* ci: run the checks on the journey change

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-02 23:27:16 +01:00

77 lines
2.9 KiB
Bash

# ===========================================
# Supabase Configuration (required)
# Self-hosted on bitbaum, NOT supabase.com — URL is https://supabase.orangecat.ch.
# Keys live in /opt/botsmann/shared/.env on the box; ask before minting new ones.
# Our tables are in the `botsmann` schema (see lib/constants.ts), not `public` —
# `public` belongs to orangecat and shares this database with us.
# ===========================================
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=
# ===========================================
# Accounts (@bitbaum/accountkit). The accounts database is a host Postgres
# beside the supabase schema (loki accounts-db.conf); provision-db.yml writes
# both values on the box.
# ===========================================
DATABASE_URL=
# 32+ characters: `openssl rand -base64 32`
BETTER_AUTH_SECRET=
# BETTER_AUTH_URL=https://botsmann.orangecat.ch
# "Continue with OrangeCat": shown only when both are set
# ORANGECAT_OAUTH_CLIENT_ID=
# ORANGECAT_OAUTH_CLIENT_SECRET=
# The shared bitbaum sign-in: shown only when all three are set
# SIGNIN_ISSUER=
# SIGNIN_CLIENT_ID=
# SIGNIN_CLIENT_SECRET=
# Account mail: the emailed sign-in link and recovery are offered only with it
# RESEND_API_KEY=
# ===========================================
# Groq LLM (optional - free tier)
# Get your free API key at: https://console.groq.com
# 14,400 requests/day on free tier
# ===========================================
GROQ_API_KEY=
# ===========================================
# OpenRouter LLM (optional - alternative to Groq)
# Get your API key at: https://openrouter.ai/keys
# ===========================================
OPENROUTER_API_KEY=
# ===========================================
# Readers' own provider keys (Settings → Infrastructure)
# Seals each reader's Groq/OpenRouter key at rest (@bitbaum/ai-kit/seal,
# AES-256-GCM). Without it no new key is saved (the screen says so) and chat
# keeps using the free models. Generate once: `openssl rand -base64 32`.
# ROTATING it makes every sealed key unreadable — readers are asked again.
# ===========================================
BYOK_SEAL_SECRET=
# ===========================================
# API Authentication
# ===========================================
API_KEY=
NEXT_PUBLIC_API_KEY=
# ===========================================
# Email (@bitbaum/mail-kit — Resend, optional)
# ===========================================
RESEND_API_KEY=
RESEND_FROM=
# ===========================================
# Email Addresses
# ===========================================
ADMIN_EMAIL=
# ===========================================
# Loki feedback widget
# Mint on Loki → project → Feedback widget.
# Must be present at `next build` (self-host CD pulls box .env). Runtime-only
# changes after deploy are not enough — Next tree-shakes an empty token.
# ===========================================
LOKI_FEEDBACK_TOKEN=