decryptUint8List method

  1. @override
Uint8List decryptUint8List({
  1. Uint8List? data,
  2. bool? useCompress,
})

Decrypt given Uint8List data.

After decryption returns decrypted Uint8List

Implementation

@override
Uint8List decryptUint8List({Uint8List? data, bool? useCompress}) {
  bool _useCompress = useCompress == null ? this.useCompress : useCompress;
  if (data == null) {
    throw Exception("data cannot be null");
  }
  final Encrypter _encrypter = Encrypter(AES(_key));

  List<int>? compressedContent;

  if (_useCompress) {
    compressedContent = GZipDecoder().decodeBytes(data);
  }

  final Encrypted _encrypted =
      Encrypted(_useCompress ? Uint8List.fromList(compressedContent!) : data);
  final _decryptedData = _encrypter.decryptBytes(_encrypted, iv: _iv);

  return Uint8List.fromList(_decryptedData);
}