Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error poped out when user register #2

Open
simonmatt opened this issue Aug 19, 2018 · 0 comments
Open

An error poped out when user register #2

simonmatt opened this issue Aug 19, 2018 · 0 comments

Comments

@simonmatt
Copy link

simonmatt commented Aug 19, 2018

Error message: The "digest" argument must be one of type string or null. Received type undefined

Solution:
Update [./utility/hash.js]

exports.hash = function (pwd, salt, fn) {
    if (3 == arguments.length) {
        crypto.pbkdf2(pwd, salt, iterations, len, **null**, function (err, hash) {
            fn(err, hash.toString('base64'));
        });
    } else {
        fn = salt;
        crypto.randomBytes(len, function (err, salt) {
            if (err) {
                return fn(err);
            }
            salt = salt.toString('base64');
            crypto.pbkdf2(pwd, salt, iterations, len, **null**, function (err, hash) {
                if (err) return fn(err);
                fn(null, salt, hash.toString('base64'));
            });
        });
    }
};

Added a null value as default value of 'hex' variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant