mirror of
https://github.com/khairul169/code-share.git
synced 2025-04-28 16:49:36 +07:00
14 lines
296 B
TypeScript
14 lines
296 B
TypeScript
import bcrypt from "bcrypt";
|
|
|
|
export const hashPassword = (password: string) => {
|
|
return bcrypt.hash(password, 10);
|
|
};
|
|
|
|
export const verifyPassword = async (hash: string, password: string) => {
|
|
try {
|
|
return await bcrypt.compare(password, hash);
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
};
|