encryptUint8List static method

String encryptUint8List({
  1. required Uint8List data,
  2. required String key,
  3. required String iv,
})

AES-256-CBC/PKCS7 with UTF-8 key (32 chars) and IV (16 chars).

Implementation

static String encryptUint8List({required Uint8List data, required String key, required String iv}) {
  if (key.length != 32) throw ArgumentError("Key must be 32 bytes for AES-256.");
  if (iv.length != 16) throw ArgumentError("IV must be 16 bytes for AES.");
  return base64.encode(_aesCbc(_u8(key), _u8(iv), data, true, true));
}