Promised bcrypt goodness. git rebase
bcrypt v1.0.0
.npm install --save promised-bcrypt
.hash(string, rounds)
- {rounds} defaults to 10
..compare(string, hash)
.genSalt(rounds)
- {rounds} defaults to 10
..getRounds(hash)
All of these return a Promise
.
const bcrypt = require('promised-bcrypt');
bcrypt.hash('Hello')
.then(hash => {
console.log(hash);
});
// '$2a$10$LriA/LnuQRIh63uyGU8t6TFwp)9y^wnLd3fw0duLnhe0SN.vS.Pka'
const bcrypt = require('promised-bcrypt');
bcrypt.compare('Hello', hash)
.then(pass => {
console.log(pass);
});
// true
const bcrypt = require('promised-bcrypt');
bcrypt.getRounds(hash)
.then(rounds => {
console.log(rounds);
});
// 10
fork https://github.com/aichholzer/promised-bcrypt
https://github.com/kelektiv/node.bcrypt.js