How to use the hashAsync function from bcrypt-nodejs
Find comprehensive JavaScript bcrypt-nodejs.hashAsync code examples handpicked from public code repositorys.
GitHub: codyseibert/tab-tracker

7 8 9 10 11 12 13 14 15 16
return } return bcrypt .genSaltAsync(SALT_FACTOR) .then(salt => bcrypt.hashAsync(user.password, salt, null)) .then(hash => { user.setDataValue('password', hash) }) }
GitHub: FlipSideHR/FlyptoX

41 42 43 44 45 46 47 48 49 50
// 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

62 63 64 65 66 67 68 69 70 71
// generates hash async User.generateHash = function(password) { return bcrypt.genSaltAsync(8) .then(function(salt) { return bcrypt.hashAsync(password, salt, null); }); }; // checks password async with stored password
GitHub: npoling/scratch-track

56 57 58 59 60 61 62 63 64 65
// 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); return passHash; });
GitHub: filmedin/filmedin

40 41 42 43 44 45 46 47 48 49
next(new Error('Failed to connect to database')); } if (rows.length !== 0) { next(new Error('User already exists')); } else { bcrypt.hashAsync(password, null, null) .then(function(hash) { db.user.post(username, hash, function (err, rows) { if (err) { next(new Error('Failed to create user'));
6 7 8 9 10 11 12 13 14 15
callback(err, hash); }); } else { //no idea why empty callback has to be used, but its necessary for promise to work return bcrypt.hashAsync(password, null, function() {}); } } function retrievePassword(password, hash, callback, async=false) {
GitHub: shelleywang/partyof4

3 4 5 6 7 8 9 10 11 12
var instanceMethods = {}; instanceMethods.hashPassword = function (newUser) { return bcrypt.genSaltAsync(10) .then(function (salt) { return bcrypt.hashAsync(newUser.password, salt, null); }) .then(function (hash) { return newUser.set('password', hash); })
GitHub: kincjf/ankroom

84 85 86 87 88 89 90 91 92 93
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) { return sequelize.Promise.reject(err);
5 6 7 8 9 10 11 12 13 14
function hashPassword (password) { const SALT_FACTOR = 8 return bcrypt .genSaltAsync(SALT_FACTOR) .then(salt => bcrypt.hashAsync(password, salt, null)) .then(hash => hash) } const User = {
bcrypt-nodejs.hashSync is the most popular function in bcrypt-nodejs (111 examples)