feat(api): wire multi-factor endpoints, policy-aware step-up guard, and recovery backup auto-unlock

This commit is contained in:
tyuXX 2026-11-26 21:21:21 +00:00
parent 99ee259cec
commit 4915bce1e4
5 changed files with 463 additions and 63 deletions

View file

@ -2,6 +2,7 @@ import fs from 'node:fs';
import path from 'node:path';
import readline from 'node:readline/promises';
import { parseArgs } from 'node:util';
import { EmergencyRecoveryService } from '../server/security/recovery-store.js';
import { VaultService } from '../server/security/vault.js';
function printUsage(): void {
@ -70,6 +71,11 @@ async function runRotateKey(args: string[]): Promise<number> {
return 1;
}
const recovery = new EmergencyRecoveryService(dataDir);
if (recovery.readBundle() !== null) {
recovery.syncState({ enabled: true, vault, snapshotReason: 'cli-rotate-key' });
}
if (parsed.values['new-key-out']) {
const outPath = path.resolve(parsed.values['new-key-out']);
fs.mkdirSync(path.dirname(outPath), { recursive: true });