feat: impl accounts and channels

This commit is contained in:
2026-09-06 18:17:42 +08:00
parent aa9999a940
commit 1ccee1414c
70 changed files with 9879 additions and 31 deletions
+21
View File
@@ -0,0 +1,21 @@
import { hash, verify } from "@node-rs/argon2";
// 遵循 OWASP 密码哈希安全推荐配置
const ARGON2_OPTIONS = {
memoryCost: 19456, // 19 MiB
timeCost: 2,
outputLen: 32,
parallelism: 1,
};
export async function hashPassword(password: string): Promise<string> {
return await hash(password, ARGON2_OPTIONS);
}
export async function verifyPassword(password: string, passwordHash: string): Promise<boolean> {
try {
return await verify(passwordHash, password);
} catch {
return false;
}
}