narinder1231's picture
create function to campare hashed password
3871436
raw
history blame contribute delete
371 Bytes
import bcrypt from 'bcryptjs';
export const hashPassword = async (password: string) => {
const salt = await bcrypt.genSalt(10);
const hashedPassword = await bcrypt.hash(password, salt);
return hashedPassword;
}
export const comparePassword = async (password: string, hashedPassword: string) => {
return await bcrypt.compare(password, hashedPassword);
}