encryptFile method

  1. @override
Future<bool> encryptFile({
  1. required String inputPath,
  2. required String outputPath,
  3. required String key,
  4. String? iv,
})
override

Encrypts the file at inputPath and writes the result to outputPath.

Implementation

@override
Future<bool> encryptFile({
  required String inputPath,
  required String outputPath,
  required String key,
  String? iv,
}) async {
  try {
    final inputBytes = await _readFile(inputPath);
    final encryptedBytes = await encryptBytes(plainBytes: inputBytes, key: key, iv: iv);
    _virtualFileSystem[outputPath] = encryptedBytes;
    return true;
  } catch (e, st) {
    dev.log('encryptFile failed: $e', name: 'AesEncryptFileWeb', error: e, stackTrace: st);
    return false;
  }
}