Skip to content

Commit

Permalink
added digest argument to crypto.pbkdf2
Browse files Browse the repository at this point in the history
- it's an optional argument that in node 6 became non-optional
- also added 5th arg to mock Crypto.pbkdf2 in test
  • Loading branch information
nfcampos committed Apr 29, 2016
1 parent 674d056 commit 9e0a1ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ exports.generateKey = function (password, options, callback) {

const generateKey = (salt) => {

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

if (err) {
return callback(err);
Expand Down Expand Up @@ -416,4 +416,3 @@ exports.unseal = function (sealed, password, options, callback) {
});
});
};

2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ describe('Iron', () => {
it('returns an error when Crypto.pbkdf2 fails', (done) => {

const orig = Crypto.pbkdf2;
Crypto.pbkdf2 = function (v1, v2, v3, v4, callback) {
Crypto.pbkdf2 = function (v1, v2, v3, v4, v5, callback) {

return callback(new Error('fake'));
};
Expand Down

0 comments on commit 9e0a1ef

Please sign in to comment.