We found a flaw with the string typed key derivation function at the following call:
|
HDPrivateKey.isValidPath = function(arg, hardened) { |
|
if (_.isString(arg)) { |
|
var indexes = HDPrivateKey._getDerivationIndexes(arg); |
|
return indexes !== null && _.every(indexes, HDPrivateKey.isValidPath); |
|
} |
_.every calls the function HDPrivateKey.isValidPath with two args:
- The first arg is the expected parsed number of the derivation path
- The second (unexpected) arg is the index of the root array which toggles the hardening parameter of the function (
isValidPath), which is clearly unintended
An easy fix is to introduce an anonymous function as shown in this PR: #3359