encryptSecretBytes method

Future<List<int>> encryptSecretBytes(
  1. SecretKey key,
  2. List<int> bytes, {
  3. List<int>? aad,
})

Encrypts bytes with the given symmetric secret key and returns the raw ciphertext bytes.

Implementation

Future<List<int>> encryptSecretBytes(
  SecretKey key,
  List<int> bytes, {
  List<int>? aad,
}) async {
  final secretBox = await _cipher.encrypt(
    bytes,
    secretKey: key,
    aad: aad ?? const [],
  );
  return secretBox.concatenation();
}