Accounts 1.1.0: moving Events' users in, people.* requests, new recovery codes

POST /api/accounts/v1/requests (crosscode.identity-request/1): import.* keeps
each person's Events id as sub, password hash and authenticator secret
(sealed in transit), consent, notices and lockout; linked when the email
already has an account. people.* for product admins, limited to people the
product knows. New recovery codes after the first 2FA sign-in for people
moved in with 2FA. screen=signup. auth-client: request(), seal(), signUp.
8 new tests (47 in all).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 13:40:15 +02:00
co-authored by Claude Opus 5.5
parent 08fef930c1
commit 733992e917
19 changed files with 834 additions and 39 deletions
+4 -2
View File
@@ -6,6 +6,7 @@ import PgBoss from 'pg-boss';
import type { Ctx } from './context.js';
import { heartbeat } from './hub/client.js';
import { runDue } from './links/deliveries.js';
import { forgetOldRequests } from './links/requests.js';
import { deleteExpired } from './oidc/adapter.js';
import { runDeletionJob } from './privacy/deletion.js';
import { runExportsJob } from './privacy/export.js';
@@ -21,13 +22,14 @@ export const JOBS: Job[] = [
name: 'cleanup', cron: '17 * * * *', everyMs: 3600e3,
run: async (ctx) => {
const now = ctx.now();
const [oidc, pending, tokens, nonces] = await Promise.all([
const [oidc, pending, tokens, nonces, requests] = await Promise.all([
deleteExpired(ctx),
ctx.db.pendingSignIn.deleteMany({ where: { expiresAt: { lt: now } } }),
ctx.db.emailToken.deleteMany({ where: { expiresAt: { lt: new Date(now.getTime() - 7 * 24 * 3600e3) } } }),
ctx.db.linkNonce.deleteMany({ where: { seenAt: { lt: new Date(now.getTime() - 3600e3) } } }),
forgetOldRequests(ctx),
]);
return { oidc: oidc.count, pending: pending.count, tokens: tokens.count, nonces: nonces.count };
return { oidc: oidc.count, pending: pending.count, tokens: tokens.count, nonces: nonces.count, requests: requests.count };
},
},
];