decodeAesGcm function
Implementation
Uint8List decodeAesGcm(
ct.SharedKey256 Function(dynamic, ct.PublicKey) deriveSharedKey,
dynamic keyPair,
ct.PublicKey recipientPublicKey,
Uint8List encodedMessage) {
final decoded = decode(AesGcmCipher.TAG_SIZE, GCM_IV_SIZE, encodedMessage);
final sharedKey = deriveSharedKey(keyPair, recipientPublicKey);
final cipher = AesGcmCipher(Uint8List.fromList(sharedKey.bytes));
return cipher.decrypt(
Uint8List.fromList(decoded['encodedMessageData']! + decoded['tag']!),
decoded['initializationVector']!);
}