derivePath method
Derives a new BIP-32 key using a derivation path.
The path parameter represents the derivation path, such as "m/0/1/2".
Implementation
BIP derivePath(String path) {
final pathInstance = Bip32PathParser.parse(path);
if (depth.depth > 0 && pathInstance.isAbsolute) {
throw ArgumentException.invalidOperationArguments(
"derivePath",
name: "path",
reason:
'Absolute paths can only be derived from a master key, not child ones',
);
}
BIP derivedObject = this as BIP;
for (final pathElement in pathInstance.elems) {
derivedObject = derivedObject.childKey(pathElement);
}
return derivedObject;
}