decryptSharedSecret method
Decrypts shared secret bytes from the remote sender using their encryption
public key and the current peer's encryption private key.
Implementation
Future<List<int>> decryptSharedSecret(
List<int> bytes,
String senderPublicKey,
) async {
final sharedSecret = await _algorithm.sharedSecretKey(
keyPair: _keyPair,
remotePublicKey: parsePublicKey(senderPublicKey),
);
final secretKey = await _kdf.deriveKey(
secretKey: await sharedSecret.extract(),
info: _kdfInfoVersion,
);
final secretBox = SecretBox.fromConcatenation(
bytes,
nonceLength: _nonceLength,
macLength: _macLength,
);
return await _cipher.decrypt(secretBox, secretKey: secretKey);
}