Fix hash password

Took 30 minutes
This commit is contained in:
Lucàs
2023-03-22 17:52:22 +01:00
parent 1e618cefd0
commit 88d954e23c
4 changed files with 29 additions and 10 deletions
+13
View File
@@ -0,0 +1,13 @@
import bcrypt from "bcrypt";
export async function hashPassword(unHashedPassword: string): Promise<string> {
return await bcrypt.hash(unHashedPassword, 10).then((hash: string) => hash);
}
export async function isSamePassword(
unHashedPassword: string,
hashedPassword: string
): Promise<boolean> {
return await bcrypt.compare(unHashedPassword, hashedPassword).
then((result: boolean) => result);
}