@techie04/xpresser-bcrypt
v0.0.2
Published
Bcrypt helper using bcrypt
Downloads
2
Readme
XpresserJs Bcrypt Plugin
A library to help you hash passwords using Bcrypt.
This plugin makes use of bcrypt.
MENU
Installation
npm i @techie04/xpresser-bcrypt
# OR
yarn add @techie04/xpresser-bcrypt
Add to plugins.json
{
"npm://@techie04/xpresser-bcrypt": true
}
Add to your project config.
({
// ... Other Configs
"bcrypt": {
salt: 10,
},
})
Usage
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
Typescript support
import { compare, hash } from "@techie04/xpresser-bcrypt";
const password: string = "password"
// hash password
const hashed = hash(password)
//compare password and hash
compare(password, hashed)