Skip to content

Commit 37375b8

Browse files
committedAug 15, 2018
fix: use Buffer.from instead of new Buffer
new Buffer is deprecated in node 10
1 parent 807d9cf commit 37375b8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ module.exports = function(schema, options) {
101101
})
102102
.then(salt => pbkdf2Promisified(password, salt, options))
103103
.then(hashRaw => {
104-
this.set(options.hashField, new Buffer(hashRaw, 'binary').toString(options.encoding));
104+
this.set(options.hashField, Buffer.from(hashRaw, 'binary').toString(options.encoding));
105105
})
106106
.then(() => this);
107107

‎lib/authenticate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function authenticate(user, password, options, cb) {
4444
return cb(err);
4545
}
4646

47-
if (scmp(hashBuffer, new Buffer(user.get(options.hashField), options.encoding))) {
47+
if (scmp(hashBuffer, Buffer.from(user.get(options.hashField), options.encoding))) {
4848
if (options.limitAttempts) {
4949
user.set(options.lastLoginField, Date.now());
5050
user.set(options.attemptsField, 0);

0 commit comments

Comments
 (0)
Please sign in to comment.