Phase 1: lock cron, reload chaud, argon2, providers, IMDb lookup, cache LRU, /health, /metrics, rate limit, UI dark, biome

This commit is contained in:
unfr
2026-04-24 07:35:10 +02:00
parent f9745a2390
commit a184a21f57
36 changed files with 2060 additions and 364 deletions

21
lib/password.js Normal file
View File

@@ -0,0 +1,21 @@
import { Algorithm, hash, verify } from '@node-rs/argon2';
const OPTS = {
algorithm: Algorithm.Argon2id,
memoryCost: 19456, // 19 MiB (OWASP 2024 recommendation)
timeCost: 2,
parallelism: 1,
};
export async function hashPassword(plain) {
return await hash(plain, OPTS);
}
export async function verifyPassword(stored, plain) {
if (!stored || !plain) return false;
try {
return await verify(stored, plain);
} catch {
return false;
}
}