feat: initial commit

This commit is contained in:
2026-06-29 23:07:14 +00:00
commit 3b9a6bc85c
152 changed files with 12558 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import { argon2id, argon2Verify } from "hash-wasm";
export async function validatePassword(
password: string,
hash: string
): Promise<boolean> {
return await argon2Verify({ password, hash });
}
export async function hashPassword(
password: string
): Promise<`$${string}$${string}`> {
const salt = new Uint8Array(16);
crypto.getRandomValues(salt);
const hash = await argon2id({
password,
outputType: "encoded",
hashLength: 32,
iterations: 3,
memorySize: 65536,
parallelism: 4,
salt,
});
return hash as `$${string}$${string}`;
}