decryptWithPassphrase function

Stream<List<int>> decryptWithPassphrase(
  1. Stream<List<int>> content, {
  2. PassphraseProvider passphraseProvider = const PassphraseProvider(),
})

Implementation

Stream<List<int>> decryptWithPassphrase(Stream<List<int>> content,
    {PassphraseProvider passphraseProvider =
        const PassphraseProvider()}) async* {
  final split = AgeStream(content);
  final header = await AgeHeader.parseContent(split,
      passphraseProvider: passphraseProvider);
  if (header.stanzas.length != 1) {
    throw Exception('Only one recipient allowed!');
  }
  final stanza = header.stanzas.first;
  final symmetricFileKey = await stanza.decryptedFileKey(null);
  await header.checkMac(symmetricFileKey);
  yield* _decryptPayload(split.payload.stream,
      symmetricFileKey: symmetricFileKey);
}