+ // Check root key exists or else derivation path is useless!
+ if (!bip32RootKey) {
+ return "No root key";
+ }
+ // Check no hardened derivation path when using xpub keys
+ var hardened = path.indexOf("'") > -1;
+ var isXpubkey = !("privKey" in bip32RootKey);
+ if (hardened && isXpubkey) {
+ return "Hardened derivation path is invalid with xpub key";
+ }