pass-hasher
v0.2.1
Published
Generate hashing string and salt and pepper for your user username and password
Downloads
9
Maintainers
Readme
Install
pass-hasher installation is possible from npm
npm install pass-hasher --save --save-exat
Introduction
The pass-hasher is a little and simple package which used the bcrypt package for create salt and hashing the password. The pass-hasher in another side add the random generated pepper on user password for to be more secured.
How to use
pass-hasher is have three simple methods.
const passHasher = require('pass-hasher')
// for beggining is possible to set how many salt rounds to have (by default = 14)
let securityStuff = passHasher.generateKeys('username', 'password')
// passHasher.generateKeys is return the object with hash and salt parameters
// {
// salt: '$2a$14$YW9hTocIftJFw.P1Bshlee',
// hash: '$2a$14$YW9hTocIftJFw.P1BshleeVDS8Rzjk6fGXMSOFXIyUKknIt/y0DyO'
// }
let salt = 'some salt from password db' // get salt from password db
// return hashing string for current password
let hash = passHasher.checkPassword('username', 'password', salt)
let hash = 'some hash from password db' // get hash from password db
// return boolean variable do can user authenticate with that password and username
let isAuthenticated = passHasher.checkPassword('username', 'password', salt, hash)