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