feat(db,schemas): add migration 004, runtime throttle profile, and v1.1 Zod schemas
This commit is contained in:
parent
d7c3e11d7e
commit
afc2d6358a
30 changed files with 792 additions and 118 deletions
|
|
@ -4,7 +4,7 @@ import os from 'node:os';
|
|||
import path from 'node:path';
|
||||
import { promisify } from 'node:util';
|
||||
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';
|
||||
import { openDatabase } from '../src/server/db/database.js';
|
||||
import { VaultService } from '../src/server/security/vault.js';
|
||||
|
|
@ -84,6 +84,8 @@ describe('Phase 5: Portable .gcoord.enc Backup, Verify & Restore (API & gcoord C
|
|||
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({
|
||||
|
|
@ -104,7 +106,11 @@ describe('Phase 5: Portable .gcoord.enc Backup, Verify & Restore (API & gcoord C
|
|||
initialSafeMode: false,
|
||||
},
|
||||
});
|
||||
vi.useRealTimers();
|
||||
csrfToken = String(boot.data.csrfToken);
|
||||
expect(
|
||||
(await api('/api/auth/step-up', { method: 'POST', body: { code: totp.generate() } })).status,
|
||||
).toBe(200);
|
||||
|
||||
await api('/api/vault/init', { method: 'POST', body: {} });
|
||||
const keyRes = await api('/api/vault/generate-ed25519', {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue