decryptChaCha20 function
Implementation
Future<Uint8List> decryptChaCha20(
Uint8List key,
Uint8List nonce,
Uint8List ciphertext,
) async {
final algorithm = Chacha20(macAlgorithm: MacAlgorithm.empty);
final skey = SecretKey(key);
final secretBox = SecretBox(ciphertext, nonce: nonce, mac: Mac.empty);
final plaintext = await algorithm.decrypt(secretBox, secretKey: skey);
return Uint8List.fromList(plaintext);
}