Versie 0.2.0

This commit is contained in:
Atreides Assets committed 2026-10-29 11:57:29 +01:00
commit e77d8fd373
495 files changed
+81026

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
// Generated, do not edit. sha256:ffc38e35f09c2a28784811c7505bad194c65e207ac58b284c202aff9a6c08ec2
import { randomBytes } from 'node:crypto';
import { readSecretsStore, writeSecretsStore, secretsFile } from '../keys.mjs';
const SLEUTEL = 'ai_handle_secret';
const cache = new Map();
export async function handleSecret() {
const pad = secretsFile();
if (cache.has(pad)) return cache.get(pad);
const store = await readSecretsStore();
const bestaand = store[SLEUTEL];
if (typeof bestaand === 'string' && bestaand.length >= 32) {
cache.set(pad, bestaand);
return bestaand;
}
const nieuw = randomBytes(32).toString('hex');
await writeSecretsStore({ ...store, [SLEUTEL]: nieuw });
cache.set(pad, nieuw);
return nieuw;
}
export function _resetHandleSecret() { cache.clear(); }