deriveKey method
Derives an ECDH-1PU shared key for authenticated encryption.
Throws an AskarKeyException if key derivation fails.
Implementation
Key deriveKey({
required KeyAlgorithm encryptionAlgorithm,
required Key ephemeralKey,
required Key senderKey,
required Key recipientKey,
required bool receive,
Uint8List? ccTag,
}) {
try {
return Key(
askarKeyDeriveEcdh1pu(
encryptionAlgorithm,
ephemeralKey.handle,
senderKey.handle,
recipientKey.handle,
algId,
apu,
apv,
ccTag: ccTag,
receive: receive,
).getValueOrException(),
);
} catch (e) {
throw AskarKeyException('Failed to derive key: $e');
}
}