How to use the genSalt function from bcrypt-nodejs

Find comprehensive JavaScript bcrypt-nodejs.genSalt code examples handpicked from public code repositorys.

26
27
28
29
30
31
32
33
34
35
36
  return insertTempUser(hash, tempUserData, callback);
};*/


// async version of hashing function
/*var myHasher = function(password, tempUserData, insertTempUser, callback) {
  bcrypt.genSalt(10, function(err, salt) {
    bcrypt.hash(password, salt, function(err, hash) {
     console.log("Temp user password is -"+hash);

      return insertTempUser(hash, tempUserData, callback);
fork icon0
star icon0
watch icon1

1
2
3
4
5
6
7
8
9
10
var BluePromise = require('bluebird');

module.exports = {
  genSaltAsync: function(rounds) {
    return new BluePromise(function(resolve, reject) {
      bcrypt.genSalt(rounds, function(error, generatedSalt) {
        if (error) {
          reject(error);
        }
        resolve(generatedSalt);
fork icon0
star icon0
watch icon2