feat: add password hashing and JWT utils

Made-with: Cursor
This commit is contained in:
Anton
2026-03-04 14:04:24 +03:00
parent 41b4f48a0f
commit 5cd13cd8ea
2 changed files with 62 additions and 0 deletions

15
src/utils/password.ts Normal file
View File

@@ -0,0 +1,15 @@
import * as argon2 from 'argon2';
const HASH_OPTIONS: argon2.Options = {
type: argon2.argon2id,
memoryCost: 19456,
timeCost: 2,
};
export async function hashPassword(plain: string): Promise<string> {
return argon2.hash(plain, HASH_OPTIONS);
}
export async function verifyPassword(hash: string, plain: string): Promise<boolean> {
return argon2.verify(hash, plain);
}