From b03eae5eca6c2a181be173d892fd5e90a983b690 Mon Sep 17 00:00:00 2001 From: Daniel Huigens Date: Mon, 26 May 2025 15:23:51 +0200 Subject: [PATCH] Allow additional unexpected packets in the grammar checker To make the grammar checker less of a breaking change in v6. This should be reverted in v7. --- src/config/config.js | 1 - src/packet/grammar.ts | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/config/config.js b/src/config/config.js index dc53a12f..135a02ec 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -228,7 +228,6 @@ export default { * Parsing of packets is normally restricted to a predefined set of packets. For example a Sym. Encrypted Integrity Protected Data Packet can only * contain a certain set of packets including LiteralDataPacket. With this setting we can allow additional packets, which is probably not advisable * as a global config setting, but can be used for specific function calls (e.g. decrypt method of Message). - * NB: `config.enforceGrammar` may need to be disabled as well. * @memberof module:config * @property {Array} additionalAllowedPackets Allow additional packets on parsing. Defined as array of packet classes, e.g. [PublicKeyPacket] */ diff --git a/src/packet/grammar.ts b/src/packet/grammar.ts index 6e0e7038..77e4dcf0 100644 --- a/src/packet/grammar.ts +++ b/src/packet/grammar.ts @@ -58,8 +58,6 @@ export class MessageGrammarValidator { throw new GrammarError('Non-encrypted data packet following ESK packet'); } this.sawDataPacket = true; - } else { - throw new GrammarError(`Unexpected packet: ${packet}`); } }