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
Bip32Base derivePath(String path) {
final pathInstance = Bip32PathParser.parse(path);
if (depth.depth > 0 && pathInstance.isAbsolute) {
throw const ArgumentException(
'Absolute paths can only be derived from a master key, not child ones');
}
Bip32Base derivedObject = this;
for (final pathElement in pathInstance.elems) {
derivedObject = derivedObject.childKey(pathElement);
}
return derivedObject;
}