dh_demo

DreamHanks demo project
git clone git://git.lair.cx/dh_demo
Log | Files | Refs | README

password.ts (279B)


      1 import bcrypt from 'bcrypt'
      2 
      3 const saltRounds = 10
      4 
      5 export function hashPassword (password: string | Buffer) {
      6   return bcrypt.hash(password, saltRounds)
      7 }
      8 
      9 export function comparePasswordHash (password: string | Buffer, hash: string) {
     10   return bcrypt.compare(password, hash)
     11 }