Description
In old version of NodeJS, crypto.pbkdf2Sync method does not mandatory requiring the digest parameter. Since nodejs 6, calling this method without the digest parameter would having a warning. Since nodejs 8, calling this method without the digest parameter would throw error which breaking some existing codes. For forward compatible concern, we should add the digest parameter which is the default value of 'sha1'.
I tested the existing code of opentoken module in Nodejs version6,7,8.
Version 6 is OK. Version 7 is also OK but having a warning. Version 8 would throw error like this:
node .\test\opentoken_test.js
crypto.js:635
throw new TypeError(
^TypeError: The "digest" argument is required and must not be undefined
at pbkdf2 (crypto.js:635:11)
at Object.exports.pbkdf2Sync (crypto.js:628:10)
at generateKey (...\node-opentoken\lib\ciphersuites.js:69:27)
at decode (...\node-opentoken\lib\token.js:166:23)
at OpenTokenAPI.parseToken (...\node-opentoken\opentoken.js:47:3)
at ...\node-opentoken\test\opentoken_test.js:15:10
at Object. (...\node-opentoken\test\opentoken_test.js:21:2)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
I found the error throwing code and added the default value digest parameter 'sha1'. And then the test cases are passed.