Skip to content

Commit 9e0a1ef

Browse files
committed
added digest argument to crypto.pbkdf2
- it's an optional argument that in node 6 became non-optional - also added 5th arg to mock Crypto.pbkdf2 in test
1 parent 674d056 commit 9e0a1ef

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ exports.generateKey = function (password, options, callback) {
126126

127127
const generateKey = (salt) => {
128128

129-
Crypto.pbkdf2(password, salt, options.iterations, algorithm.keyBits / 8, (err, derivedKey) => {
129+
Crypto.pbkdf2(password, salt, options.iterations, algorithm.keyBits / 8, 'sha1', (err, derivedKey) => {
130130

131131
if (err) {
132132
return callback(err);
@@ -416,4 +416,3 @@ exports.unseal = function (sealed, password, options, callback) {
416416
});
417417
});
418418
};
419-

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ describe('Iron', () => {
275275
it('returns an error when Crypto.pbkdf2 fails', (done) => {
276276

277277
const orig = Crypto.pbkdf2;
278-
Crypto.pbkdf2 = function (v1, v2, v3, v4, callback) {
278+
Crypto.pbkdf2 = function (v1, v2, v3, v4, v5, callback) {
279279

280280
return callback(new Error('fake'));
281281
};

0 commit comments

Comments
 (0)