encryptFile function

Future<EncryptedFile> encryptFile(
  1. Uint8List input
)

Implementation

Future<EncryptedFile> encryptFile(Uint8List input) async {
  final key = secureRandomBytes(32);
  final iv = secureRandomBytes(16);
  final data = await aesCtr.encrypt(input, key, iv);
  final hash = await sha256(data);
  return EncryptedFile(
    data: data,
    k: base64Url.encode(key).replaceAll('=', ''),
    iv: base64.encode(iv).replaceAll('=', ''),
    sha256: base64.encode(hash).replaceAll('=', ''),
  );
}