feat(db,schemas): add migration 004, runtime throttle profile, and v1.1 Zod schemas

This commit is contained in:
tyuXX 2026-11-27 22:15:50 +00:00
parent d7c3e11d7e
commit afc2d6358a
30 changed files with 792 additions and 118 deletions

View file

@ -3,7 +3,7 @@ import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import * as OTPAuth from 'otpauth';
import { afterEach, describe, expect, it } from 'vitest';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { createGCoordinatorServer } from '../src/server/app.js';
const cleanups: Array<() => Promise<void> | void> = [];
@ -202,6 +202,8 @@ describe('WebAuthn Passkey Registration, Login & Step-Up', () => {
return { status: res.status, data };
};
vi.useFakeTimers({ toFake: ['Date'] });
vi.setSystemTime(Date.now() - 35_000);
const bootInfo = await api('/api/auth/bootstrap');
const secretBase32 = String(bootInfo.data.secretBase32);
const totp = new OTPAuth.TOTP({
@ -226,6 +228,10 @@ describe('WebAuthn Passkey Registration, Login & Step-Up', () => {
})
).status,
).toBe(201);
vi.useRealTimers();
expect(
(await api('/api/auth/step-up', { method: 'POST', body: { code: totp.generate() } })).status,
).toBe(200);
await api('/api/vault/init', { method: 'POST', body: {} });
await api('/api/vault/generate-ed25519', {