A library to help you hash passwords using Bcrypt.
This plugin makes use of bcrypt.
MENU
npm i @techie_oriname/xpresser-bcrypt
# OR
yarn add @techie_oriname/xpresser-bcrypt
{
"npm://@techie_oriname/xpresser-bcrypt": true
}
({
// ... Other Configs
"bcrypt": {
salt: 10,
},
})
In your controller or anywhere in your project.
const { compare, hash } = require("@techie_oriname/xpresser-bcrypt");
const password = "password"
// hash password
const hashed = hash(password)
// compare password and hash
compare(password, hashed) // return true
import { compare, hash } from "@techie_oriname/xpresser-bcrypt";
const password: string = "password"
// hash password
const hashed = hash(password)
//compare password and hash
compare(password, hashed)