feat: migrate runtime backend to node server
This commit is contained in:
16
server-node/src/auth/password.ts
Normal file
16
server-node/src/auth/password.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Algorithm, hash, verify } from '@node-rs/argon2';
|
||||
|
||||
export async function hashPassword(password: string) {
|
||||
return hash(password, {
|
||||
algorithm: Algorithm.Argon2id,
|
||||
memoryCost: 19456,
|
||||
timeCost: 2,
|
||||
parallelism: 1,
|
||||
});
|
||||
}
|
||||
|
||||
export async function verifyPassword(passwordHash: string, password: string) {
|
||||
return verify(passwordHash, password, {
|
||||
algorithm: Algorithm.Argon2id,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user