childKey method
Derives a child key from the current key, based on the provided index.
Implementation
@override
Bip32Slip10Ed25519 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 Bip32Slip10Ed25519(
keyData: Bip32KeyData(
chainCode: result.chainCode,
depth: depth.increase(),
index: index,
fingerPrint: fingerPrint,
),
keyNetVer: keyNetVersions,
privKey: result.key,
pubKey: null,
);
}
throw Bip32KeyError.publicDerivationNotSupported;
}