decryptWithPassphrase function
Stream<List<int> >
decryptWithPassphrase(
- Stream<
List< content, {int> > - 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);
}