- Add transactions_dirty table and zero-tolerance cleansing action - Implement bookkeeping workbench (/bookkeeping) with searchable Combobox channel selector and card suffix / account identifier - Implement transaction ledger (/transactions) with date groupings, multi-currency metrics, and filters - Update AGENTS.md guidelines for Base UI Select and Combobox bindings
25 lines
519 B
TypeScript
25 lines
519 B
TypeScript
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
|
|
}
|
|
}
|