childKey method
Derives a child BIP-32 key from the current key.
Implementation
@override
Bip32Slip10Ed25519Blake2b childKey(Bip32KeyIndex index) {
final isPublic = isPublicOnly;
if (!isPublic) {
if (!index.isHardened && !isPublicDerivationSupported) {
throw Bip32KeyError.notHardenedIndexNotSupported;
}
assert(!isPublicOnly);
final result = keyDerivator.deriveFromSecret(
parent: privateKey,
ctx: publicKey,
index: index,
type: curveType,
);
return Bip32Slip10Ed25519Blake2b(
keyData: Bip32KeyData(
chainCode: result.chainCode,
depth: depth.increase(),
index: index,
fingerPrint: fingerPrint,
),
keyNetVer: keyNetVersions,
privKey: result.key,
pubKey: null,
);
}
throw Bip32KeyError.publicDerivationNotSupported;
}