decryptSecretBytes method

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

Decrypts bytes from the given symmetric secret key.

Implementation

Future<List<int>> decryptSecretBytes(
  SecretKey secretKey,
  List<int> bytes, {
  List<int>? aad,
}) async {
  final secretBox = SecretBox.fromConcatenation(
    bytes,
    nonceLength: _nonceLength,
    macLength: _macLength,
  );
  return _cipher.decrypt(
    secretBox,
    secretKey: secretKey,
    aad: aad ?? const [],
  );
}