decryptFileInBackground static method

Future<PqStreamingHeader> decryptFileInBackground({
  1. required Uint8List recipientSecretKey,
  2. required String inputPath,
  3. required String outputPath,
  4. Uint8List? recipientKexSecretKey,
  5. String? recipientKeyId,
  6. Uint8List? signerPublicKey,
  7. Uint8List? aad,
  8. PqForgeEngineProvider engineProvider = PqForgeEngineProvider.nativeCryptography,
})

Runs decryptFile on a background isolate (Axis A offload).

aad is the already-resolved associated data; read the header first (see readHeader) when it depends on the envelope's metadata.

Implementation

static Future<PqStreamingHeader> decryptFileInBackground({
  required Uint8List recipientSecretKey,
  required String inputPath,
  required String outputPath,
  Uint8List? recipientKexSecretKey,
  String? recipientKeyId,
  Uint8List? signerPublicKey,
  Uint8List? aad,
  PqForgeEngineProvider engineProvider =
      PqForgeEngineProvider.nativeCryptography,
}) {
  return Isolate.run(
    () => PqForgeStreamCipher.forProvider(engineProvider).decryptFile(
      recipientSecretKey: recipientSecretKey,
      recipientKexSecretKey: recipientKexSecretKey,
      recipientKeyId: recipientKeyId,
      input: File(inputPath),
      output: File(outputPath),
      signerPublicKey: signerPublicKey,
      aadResolver: aad == null ? null : (_) => aad,
    ),
  );
}