encryptChaCha20 function
Implementation
Future<Uint8List> encryptChaCha20(
Uint8List key, Uint8List nonce, Uint8List data) async {
final algorithm = Chacha20(macAlgorithm: MacAlgorithm.empty);
final skey = SecretKey(key);
final secretBox = await algorithm.encrypt(
data,
secretKey: skey,
nonce: nonce,
);
return Uint8List.fromList(secretBox.cipherText);
}