better initial load
This commit is contained in:
16
src/server/password.ts
Normal file
16
src/server/password.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import * as bcrypt from "bcrypt";
|
||||
|
||||
export async function hashPassword(password: string): Promise<string> {
|
||||
const saltRounds = 10;
|
||||
const salt = await bcrypt.genSalt(saltRounds);
|
||||
const hashedPassword = await bcrypt.hash(password, salt);
|
||||
return hashedPassword;
|
||||
}
|
||||
|
||||
export async function checkPassword(
|
||||
password: string,
|
||||
hash: string
|
||||
): Promise<boolean> {
|
||||
const match = await bcrypt.compare(password, hash);
|
||||
return match;
|
||||
}
|
||||
Reference in New Issue
Block a user