diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/pbkdf2/lib/precondition.js | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/pbkdf2/lib/precondition.js')
-rw-r--r-- | node_modules/pbkdf2/lib/precondition.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/node_modules/pbkdf2/lib/precondition.js b/node_modules/pbkdf2/lib/precondition.js index 1519b0092..683db5630 100644 --- a/node_modules/pbkdf2/lib/precondition.js +++ b/node_modules/pbkdf2/lib/precondition.js @@ -1,5 +1,15 @@ var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs -module.exports = function (iterations, keylen) { + +function checkBuffer (buf, name) { + if (typeof buf !== 'string' && !Buffer.isBuffer(buf)) { + throw new TypeError(name + ' must be a buffer or string') + } +} + +module.exports = function (password, salt, iterations, keylen) { + checkBuffer(password, 'Password') + checkBuffer(salt, 'Salt') + if (typeof iterations !== 'number') { throw new TypeError('Iterations not a number') } |