open method
Decrypts a counter(4) ‖ ciphertext frame, or returns null if the frame
is malformed, the key has already been ratcheted past, or authentication
fails.
Implementation
Future<List<int>?> open(List<int> framed) async {
if (framed.length < 4) return null;
final counter = _readU32(framed);
final messageKey = _recv.keyFor(counter);
if (messageKey == null) return null;
try {
final plain = await _cipherFor(messageKey).decrypt(framed.sublist(4));
_wipe(messageKey);
return plain;
} catch (_) {
_wipe(messageKey);
return null;
}
}