Rename config.unsafe_stream to allow_unauthenticated_stream

This commit is contained in:
Daniel Huigens
2018-06-28 19:22:53 +02:00
parent 2b30ab9c8f
commit e66d44e42d
3 changed files with 30 additions and 25 deletions

View File

@@ -93,6 +93,11 @@ export default {
* @property {Boolean} ignore_mdc_error Fail on decrypt if message is not integrity protected
*/
ignore_mdc_error: false,
/**
* @memberof module:config
* @property {Boolean} allow_unauthenticated_stream Stream unauthenticated data before integrity has been checked
*/
allow_unauthenticated_stream: false,
/**
* @memberof module:config
* @property {Boolean} checksum_required Do not throw error when armor is missing a checksum

View File

@@ -148,7 +148,7 @@ SymEncryptedIntegrityProtected.prototype.decrypt = async function (sessionKeyAlg
});
let packetbytes = stream.slice(bytes, 0, -2);
packetbytes = stream.concat([packetbytes, stream.fromAsync(() => verifyHash)]);
if (!util.isStream(encrypted) || !config.unsafe_stream) {
if (!util.isStream(encrypted) || !config.allow_unauthenticated_stream) {
packetbytes = await stream.readToEnd(packetbytes);
}
await this.packets.read(packetbytes);