decryptFileBytes function

List<int> decryptFileBytes({
  1. required File file,
  2. required String encryptionKey,
})

Decrypt and return the contents of the given file, using the given encryptionKey as a list of bytes.

Implementation

List<int> decryptFileBytes({
  required final File file,
  required final String encryptionKey,
}) {
  final encrypter = Encrypter(AES(Key.fromBase64(encryptionKey)));
  final iv = IV.fromLength(16);
  final encrypted = Encrypted(file.readAsBytesSync());
  return encrypter.decryptBytes(encrypted, iv: iv);
}