encrypt method

  1. @override
Future<Uint8List> encrypt(
  1. Uint8List input
)
override

Implementation

@override
Future<Uint8List> encrypt(Uint8List input) async {
  final nonce = algorithm.newNonce();

  var secretBox = await algorithm.encrypt(
    input,
    secretKey: await secretKey,
    nonce: nonce,
  );

  // print('Nonce: ${secretBox.nonce}');
  // print('Ciphertext: ${secretBox.cipherText}');
  // print('MAC: ${secretBox.mac.bytes}');

  return secretBox.concatenation(nonce: true, mac: true);
}