Phase1
This commit is contained in:
16
packages/auth/src/password.ts
Normal file
16
packages/auth/src/password.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { hash, verify } from '@node-rs/argon2';
|
||||
|
||||
export async function hashPassword(password: string): Promise<string> {
|
||||
return hash(password);
|
||||
}
|
||||
|
||||
export async function verifyPassword(
|
||||
plain: string,
|
||||
hashed: string,
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
return await verify(hashed, plain);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user