Skip to content

Commit e18e047

Browse files
authored
Merge pull request #1 from SmartArray/fix/key-derivation
Fix key derivation when path is given as string
2 parents bed0702 + b6ec5eb commit e18e047

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/bitcore-lib/lib/hdprivatekey.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ function HDPrivateKey(arg) {
7474
HDPrivateKey.isValidPath = function(arg, hardened) {
7575
if (_.isString(arg)) {
7676
var indexes = HDPrivateKey._getDerivationIndexes(arg);
77-
return indexes !== null && _.every(indexes, HDPrivateKey.isValidPath);
77+
return indexes !== null && _.every(indexes, function (index) {
78+
return HDPrivateKey.isValidPath(index, hardened);
79+
});
7880
}
7981

8082
if (_.isNumber(arg)) {
@@ -116,7 +118,7 @@ HDPrivateKey._getDerivationIndexes = function(path) {
116118
return NaN;
117119
}
118120
var index = +step; // cast to number
119-
if (isHardened) {
121+
if (index < HDPrivateKey.Hardened && isHardened === true) {
120122
index += HDPrivateKey.Hardened;
121123
}
122124

0 commit comments

Comments
 (0)