Skip to content

Commit

Permalink
fix: use Buffer.from instead of new Buffer
Browse files Browse the repository at this point in the history
new Buffer is deprecated in node 10
  • Loading branch information
saintedlama committed Aug 15, 2018
1 parent 807d9cf commit 37375b8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ module.exports = function(schema, options) {
})
.then(salt => pbkdf2Promisified(password, salt, options))
.then(hashRaw => {
this.set(options.hashField, new Buffer(hashRaw, 'binary').toString(options.encoding));
this.set(options.hashField, Buffer.from(hashRaw, 'binary').toString(options.encoding));
})
.then(() => this);

Expand Down
2 changes: 1 addition & 1 deletion lib/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function authenticate(user, password, options, cb) {
return cb(err);
}

if (scmp(hashBuffer, new Buffer(user.get(options.hashField), options.encoding))) {
if (scmp(hashBuffer, Buffer.from(user.get(options.hashField), options.encoding))) {
if (options.limitAttempts) {
user.set(options.lastLoginField, Date.now());
user.set(options.attemptsField, 0);
Expand Down

0 comments on commit 37375b8

Please sign in to comment.