encrypt method

  1. @override
Future<SecretBox> encrypt(
  1. List<int> clearText, {
  2. required SecretKey secretKey,
  3. List<int>? nonce,
  4. List<int> aad = const <int>[],
  5. int keyStreamIndex = 0,
  6. Uint8List? possibleBuffer,
})
override

Encrypts a cleartext.

Parameter keyStreamIndex allows you to choose offset in the keystream.

For other arguments, see Cipher.encrypt.

Implementation

@override
Future<SecretBox> encrypt(
  List<int> clearText, {
  required SecretKey secretKey,
  List<int>? nonce,
  List<int> aad = const <int>[],
  int keyStreamIndex = 0,
  Uint8List? possibleBuffer,
}) async {
  final secretKeyData = await secretKey.extract();
  return encryptSync(
    clearText,
    secretKey: secretKeyData,
    nonce: nonce,
    aad: aad,
    keyStreamIndex: keyStreamIndex,
  );
}