From 38272bbbd3171c5e66e0e385f6dbcfcc43fc6627 Mon Sep 17 00:00:00 2001 From: Jared Kantrowitz Date: Fri, 13 Mar 2020 16:04:09 -0400 Subject: [PATCH] fix buffer deprecation --- lib/scrypt-for-humans.coffee | 2 +- lib/scrypt-for-humans.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/scrypt-for-humans.coffee b/lib/scrypt-for-humans.coffee index b8d201e..148ba2e 100644 --- a/lib/scrypt-for-humans.coffee +++ b/lib/scrypt-for-humans.coffee @@ -68,7 +68,7 @@ module.exports = verifyHash: (password, hash, callback) -> (new Promise (resolve, reject) -> - hashBuffer = new Buffer(hash, "base64") + hashBuffer = Buffer.from(hash, "base64") scrypt.verifyKdf hashBuffer, normalizePassword(password), scryptHandler(resolve, reject) ).nodeify(callback) diff --git a/lib/scrypt-for-humans.js b/lib/scrypt-for-humans.js index 4bace34..7bb3da5 100644 --- a/lib/scrypt-for-humans.js +++ b/lib/scrypt-for-humans.js @@ -56,7 +56,7 @@ normalizePassword = function(password) { if (Buffer.isBuffer(password)) { return password; } else { - return new Buffer(password); + return Buffer.from(password); } }; @@ -113,7 +113,7 @@ module.exports = { verifyHash: function(password, hash, callback) { return (new Promise(function(resolve, reject) { var hashBuffer; - hashBuffer = new Buffer(hash, "base64"); + hashBuffer = Buffer.from(hash, "base64"); return scrypt.verifyKdf(hashBuffer, normalizePassword(password), scryptHandler(resolve, reject)); })).nodeify(callback); },