How to use the genSaltAsync function from bcrypt-nodejs
Find comprehensive JavaScript bcrypt-nodejs.genSaltAsync code examples handpicked from public code repositorys.
GitHub: FlipSideHR/FlyptoX

40 41 42 43 44 45 46 47 48 49
// normalize email address self.set('email', self.get('email').toLowerCase().trim()); // salt and hash return bcrypt.genSaltAsync(10).then(function(salt){ return bcrypt.hashAsync(self.get('password'), salt, null).then(function(hash){ self.set('password', hash); self.set('salt', salt); return;
GitHub: Foodujour/Foodujour

60 61 62 63 64 65 66 67 68 69
}); }; // generates hash async User.generateHash = function(password) { return bcrypt.genSaltAsync(8) .then(function(salt) { return bcrypt.hashAsync(password, salt, null); }); };
24 25 26 27 28 29 30 31 32 33
comparePassword: function(attempted) { return bcrypt.compareAsync(attempted, this.get('password')); }, generatePassword: function(password) { return bcrypt.genSaltAsync(null) .then(salt => { this.set('salt', salt); return bcrypt.hashAsync(password, salt, null); });
GitHub: shelleywang/partyof4

1 2 3 4 5 6 7 8 9 10
var bBird = require("bluebird"); var bcrypt = bBird.promisifyAll(require('bcrypt-nodejs')); var instanceMethods = {}; instanceMethods.hashPassword = function (newUser) { return bcrypt.genSaltAsync(10) .then(function (salt) { return bcrypt.hashAsync(newUser.password, salt, null); }) .then(function (hash) {
GitHub: npoling/scratch-track

54 55 56 57 58 59 60 61 62 63
}; // generates hash async User.generateHash = function(password) { // Use a work factor of 12 for hashing return bcrypt.genSaltAsync(12) .then(function(salt) { return bcrypt.hashAsync(password, salt, null) .then(function (passHash) { console.log('Salt:', salt, 'Passhash:', passHash);
GitHub: kincjf/ankroom

83 84 85 86 87 88 89 90 91 92
if (!member.changed('password')) { return sequelize.Promise.reject("not modified"); } // bcrypt가 async이기 때문에 promise return bcrypt.genSaltAsync(SALT_FACTOR).then(function(salt) { return bcrypt.hashAsync(member.password, salt, null); }).then(function(hash) { member.setDataValue('password', hash); }).catch(function(err) {
bcrypt-nodejs.hashSync is the most popular function in bcrypt-nodejs (111 examples)