UNPKG

@accounts/password

Version:

[![npm](https://img.shields.io/npm/v/@accounts/password)](https://www.npmjs.com/package/@accounts/password) [![npm downloads](https://img.shields.io/npm/dm/@accounts/password)](https://www.npmjs.com/package/@accounts/password) [![codecov](https://img.shie

11 lines (8 loc) 362 B
import { genSalt, hash, compare } from 'bcryptjs'; export const bcryptPassword = async (password: string): Promise<string> => { const salt = await genSalt(10); const hashedPassword = await hash(password, salt); return hashedPassword; }; export const verifyPassword = async (password: string, hash: string): Promise<boolean> => compare(password, hash);