@protontech/openpgp 6.1.1-patch.0 → 6.1.1-patch.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/lightweight/argon2id.min.mjs +1 -1
  2. package/dist/lightweight/argon2id.mjs +1 -1
  3. package/dist/lightweight/legacy_ciphers.min.mjs +1 -1
  4. package/dist/lightweight/legacy_ciphers.mjs +1 -1
  5. package/dist/lightweight/noble_curves.min.mjs +1 -1
  6. package/dist/lightweight/noble_curves.mjs +1 -1
  7. package/dist/lightweight/noble_hashes.min.mjs +1 -1
  8. package/dist/lightweight/noble_hashes.mjs +1 -1
  9. package/dist/lightweight/noble_post_quantum.min.mjs +1 -1
  10. package/dist/lightweight/noble_post_quantum.mjs +1 -1
  11. package/dist/lightweight/openpgp.min.mjs +4 -4
  12. package/dist/lightweight/openpgp.min.mjs.map +1 -1
  13. package/dist/lightweight/openpgp.mjs +190 -27
  14. package/dist/lightweight/seek-bzip.min.mjs +1 -1
  15. package/dist/lightweight/seek-bzip.mjs +1 -1
  16. package/dist/lightweight/sha3.min.mjs +1 -1
  17. package/dist/lightweight/sha3.mjs +1 -1
  18. package/dist/lightweight/sha512.min.mjs +1 -1
  19. package/dist/lightweight/sha512.mjs +1 -1
  20. package/dist/node/openpgp.cjs +190 -26
  21. package/dist/node/openpgp.min.cjs +16 -16
  22. package/dist/node/openpgp.min.cjs.map +1 -1
  23. package/dist/node/openpgp.min.mjs +16 -16
  24. package/dist/node/openpgp.min.mjs.map +1 -1
  25. package/dist/node/openpgp.mjs +190 -27
  26. package/dist/openpgp.js +190 -26
  27. package/dist/openpgp.min.js +16 -16
  28. package/dist/openpgp.min.js.map +1 -1
  29. package/dist/openpgp.min.mjs +16 -16
  30. package/dist/openpgp.min.mjs.map +1 -1
  31. package/dist/openpgp.mjs +190 -27
  32. package/openpgp.d.ts +4 -241
  33. package/package.json +3 -2
  34. package/src/config/config.d.ts +68 -0
  35. package/src/config/index.d.ts +13 -0
  36. package/src/enums.d.ts +195 -0
@@ -1,4 +1,4 @@
1
- /*! OpenPGP.js v6.1.1-patch.0 - 2025-02-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v6.1.1-patch.2 - 2025-05-14 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  const globalThis = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3
3
 
4
4
  const doneWritingPromise = Symbol('doneWritingPromise');
@@ -1530,6 +1530,8 @@ var config = {
1530
1530
  * by v6 keys and v6 signatures, respectively.
1531
1531
  * However, generation of v5 entities was supported behind config flag in OpenPGP.js v5, and some other libraries,
1532
1532
  * hence parsing them might be necessary in some cases.
1533
+ * @memberof module:config
1534
+ * @property {Boolean} enableParsingV5Entities
1533
1535
  */
1534
1536
  enableParsingV5Entities: false,
1535
1537
  /**
@@ -1666,10 +1668,22 @@ var config = {
1666
1668
  * @property {Boolean} ignoreMalformedPackets Ignore malformed packets on parsing instead of throwing an error
1667
1669
  */
1668
1670
  ignoreMalformedPackets: false,
1671
+ /**
1672
+ * @memberof module:config
1673
+ * @property {Boolean} enforceGrammar whether parsed OpenPGP messages must comform to the OpenPGP grammar
1674
+ * defined in https://www.rfc-editor.org/rfc/rfc9580.html#name-openpgp-messages .
1675
+ */
1676
+ enforceGrammar: true,
1677
+ /**
1678
+ * @memberof module:config
1679
+ * @property {function(string): any} pluggableGrammarErrorReporter callback meant to collect GrammarError reports even with `config.enforceGrammar` disabled.
1680
+ */
1681
+ pluggableGrammarErrorReporter: null,
1669
1682
  /**
1670
1683
  * Parsing of packets is normally restricted to a predefined set of packets. For example a Sym. Encrypted Integrity Protected Data Packet can only
1671
1684
  * contain a certain set of packets including LiteralDataPacket. With this setting we can allow additional packets, which is probably not advisable
1672
1685
  * as a global config setting, but can be used for specific function calls (e.g. decrypt method of Message).
1686
+ * NB: `config.enforceGrammar` may need to be disabled as well.
1673
1687
  * @memberof module:config
1674
1688
  * @property {Array} additionalAllowedPackets Allow additional packets on parsing. Defined as array of packet classes, e.g. [PublicKeyPacket]
1675
1689
  */
@@ -1688,7 +1702,7 @@ var config = {
1688
1702
  * @memberof module:config
1689
1703
  * @property {String} versionString A version string to be included in armored messages
1690
1704
  */
1691
- versionString: 'OpenPGP.js 6.1.1-patch.0',
1705
+ versionString: 'OpenPGP.js 6.1.1-patch.2',
1692
1706
  /**
1693
1707
  * @memberof module:config
1694
1708
  * @property {String} commentString A comment string to be included in armored messages
@@ -2055,6 +2069,21 @@ const util = {
2055
2069
  return true;
2056
2070
  },
2057
2071
 
2072
+ /**
2073
+ * Same as Array.findLastIndex, which is not supported on Safari 14 .
2074
+ * @param {Array} arr
2075
+ * @param {function(element, index, arr): boolean} findFn
2076
+ * @return index of last element matching `findFn`, -1 if not found
2077
+ */
2078
+ findLastIndex: function(arr, findFn) {
2079
+ for (let i = arr.length; i >= 0; i--) {
2080
+ if (findFn(arr[i], i, arr)) {
2081
+ return i;
2082
+ }
2083
+ }
2084
+ return -1;
2085
+ },
2086
+
2058
2087
  /**
2059
2088
  * Calculates a 16bit sum of a Uint8Array by adding each character
2060
2089
  * codes modulus 65535
@@ -6874,11 +6903,7 @@ async function generate$a(algo) {
6874
6903
  seed: b64ToUint8Array(privateKey.d, true)
6875
6904
  };
6876
6905
  } catch (err) {
6877
- if (
6878
- err.name !== 'NotSupportedError' &&
6879
- err.name !== 'OperationError' && // Temporary (hopefully) fix for WebKit on Linux
6880
- err.name !== 'SyntaxError' // Temporary fix for Palemoon throwing 'SyntaxError'
6881
- ) {
6906
+ if (err.name !== 'NotSupportedError' && err.name !== 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
6882
6907
  throw err;
6883
6908
  }
6884
6909
  const seed = getRandomBytes(getPayloadSize$1(algo));
@@ -6930,7 +6955,7 @@ async function sign$9(algo, hashAlgo, message, publicKey, privateKey, hashed) {
6930
6955
 
6931
6956
  return { RS: signature };
6932
6957
  } catch (err) {
6933
- if (err.name !== 'NotSupportedError' && err.name !== 'SyntaxError') { // Temporary fix for Palemoon throwing 'SyntaxError'
6958
+ if (err.name !== 'NotSupportedError') {
6934
6959
  throw err;
6935
6960
  }
6936
6961
  const secretKey = util.concatUint8Array([privateKey, publicKey]);
@@ -6976,7 +7001,7 @@ async function verify$9(algo, hashAlgo, { RS }, m, publicKey, hashed) {
6976
7001
  const verified = await webCrypto.verify('Ed25519', key, RS, hashed);
6977
7002
  return verified;
6978
7003
  } catch (err) {
6979
- if (err.name !== 'NotSupportedError' && err.name !== 'SyntaxError') { // Temporary fix for Palemoon throwing 'SyntaxError'
7004
+ if (err.name !== 'NotSupportedError') {
6980
7005
  throw err;
6981
7006
  }
6982
7007
  return verify$a(RS, hashed, publicKey);
@@ -15117,6 +15142,106 @@ OnePassSignaturePacket.prototype.hash = SignaturePacket.prototype.hash;
15117
15142
  OnePassSignaturePacket.prototype.toHash = SignaturePacket.prototype.toHash;
15118
15143
  OnePassSignaturePacket.prototype.toSign = SignaturePacket.prototype.toSign;
15119
15144
 
15145
+ class GrammarError extends Error {
15146
+ constructor(...params) {
15147
+ super(...params);
15148
+ if (Error.captureStackTrace) {
15149
+ Error.captureStackTrace(this, GrammarError);
15150
+ }
15151
+ this.name = 'GrammarError';
15152
+ }
15153
+ }
15154
+ const isValidLiteralMessage = (tagList, _acceptPartial) => tagList.length === 1 && tagList[0] === enums.packet.literalData;
15155
+ const isValidCompressedMessage = (tagList, _acceptPartial) => tagList.length === 1 && tagList[0] === enums.packet.compressedData;
15156
+ const isValidEncryptedMessage = (tagList, acceptPartial) => {
15157
+ // Encrypted Message: Encrypted Data | ESK Sequence, Encrypted Data.
15158
+ const isValidESKSequence = (tagList, _acceptPartial) => (tagList.every(packetTag => new Set([enums.packet.publicKeyEncryptedSessionKey, enums.packet.symEncryptedSessionKey]).has(packetTag)));
15159
+ const encryptedDataPacketIndex = tagList.findIndex(tag => new Set([enums.packet.aeadEncryptedData, enums.packet.symmetricallyEncryptedData, enums.packet.symEncryptedIntegrityProtectedData]).has(tag));
15160
+ if (encryptedDataPacketIndex < 0) {
15161
+ return isValidESKSequence(tagList);
15162
+ }
15163
+ return (encryptedDataPacketIndex === tagList.length - 1) &&
15164
+ isValidESKSequence(tagList.slice(0, encryptedDataPacketIndex));
15165
+ };
15166
+ const isValidSignedMessage = (tagList, acceptPartial) => {
15167
+ // Signature Packet, OpenPGP Message | One-Pass Signed Message.
15168
+ if (tagList.findIndex(tag => tag === enums.packet.signature) === 0) {
15169
+ return isValidOpenPGPMessage(tagList.slice(1), acceptPartial);
15170
+ }
15171
+ // One-Pass Signed Message:
15172
+ // One-Pass Signature Packet, OpenPGP Message, Corresponding Signature Packet.
15173
+ if (tagList.findIndex(tag => tag === enums.packet.onePassSignature) === 0) {
15174
+ const correspondingSigPacketIndex = util.findLastIndex(tagList, tag => tag === enums.packet.signature);
15175
+ if (correspondingSigPacketIndex !== tagList.length - 1 && !acceptPartial) {
15176
+ return false;
15177
+ }
15178
+ return isValidOpenPGPMessage(tagList.slice(1, correspondingSigPacketIndex < 0 ? undefined : correspondingSigPacketIndex), acceptPartial);
15179
+ }
15180
+ return false;
15181
+ };
15182
+ const isUnknownPacketTag = (tag) => {
15183
+ try {
15184
+ enums.read(enums.packet, tag);
15185
+ return false;
15186
+ }
15187
+ catch (e) {
15188
+ return true;
15189
+ }
15190
+ };
15191
+ /**
15192
+ * Implements grammar checks based on https://www.rfc-editor.org/rfc/rfc9580.html#section-10.3 .
15193
+ * @param notNormalizedList - list of packet tags to validate
15194
+ * @param acceptPartial - whether the list of tags corresponds to a partially-parsed message
15195
+ * @returns whether the list of tags is valid
15196
+ */
15197
+ const isValidOpenPGPMessage = (notNormalizedList /** might have unknown tags */, acceptPartial) => {
15198
+ // Take care of packet tags that can appear anywhere in the sequence:
15199
+ // 1. A Marker packet (Section 5.8) can appear anywhere in the sequence.
15200
+ // 2. An implementation MUST be able to process Padding packets anywhere else in an OpenPGP stream so that future revisions of this document may specify further locations for padding.
15201
+ // 3. An unknown non-critical packet MUST be ignored (criticality is enforced on parsing).
15202
+ const normalizedList = notNormalizedList.filter(tag => (tag !== enums.packet.marker &&
15203
+ tag !== enums.packet.padding &&
15204
+ !isUnknownPacketTag(tag)));
15205
+ return isValidLiteralMessage(normalizedList) ||
15206
+ isValidCompressedMessage(normalizedList) ||
15207
+ isValidEncryptedMessage(normalizedList) ||
15208
+ isValidSignedMessage(normalizedList, acceptPartial);
15209
+ };
15210
+ /**
15211
+ * If `delayReporting === false`, the grammar validator throws as soon as an invalid packet sequence is detected during parsing.
15212
+ * This setting MUST NOT be used when parsing unauthenticated decrypted data, to avoid instantiating decryption oracles.
15213
+ * Passing `delayReporting === true` allows checking the grammar validity in an async manner, by
15214
+ * only reporting the validity status after parsing is done (i.e. and authentication is expected to
15215
+ * have been enstablished)
15216
+ */
15217
+ const getMessageGrammarValidator = ({ delayReporting }) => {
15218
+ let logged = false;
15219
+ /**
15220
+ * @returns `true` on successful grammar validation; if `delayReporting` is set, `null` is returned
15221
+ * if validation is still pending (partial parsing, waiting for authentication to be confirmed).
15222
+ * @throws on grammar error, provided `config.enforceGrammar` is enabled.
15223
+ */
15224
+ return (list, isPartial, config) => {
15225
+ if (delayReporting && isPartial)
15226
+ return null; // delay until the full message has been parsed (i.e. authenticated)
15227
+ if (!isValidOpenPGPMessage(list, isPartial)) {
15228
+ const error = new GrammarError(`Data does not respect OpenPGP grammar [${list}]`);
15229
+ if (!logged) {
15230
+ config.pluggableGrammarErrorReporter?.(error.message);
15231
+ util.printDebugError(error);
15232
+ logged = true;
15233
+ }
15234
+ if (config.enforceGrammar) {
15235
+ throw error;
15236
+ }
15237
+ else {
15238
+ return true;
15239
+ }
15240
+ }
15241
+ return true;
15242
+ };
15243
+ };
15244
+
15120
15245
  /**
15121
15246
  * Instantiate a new packet given its tag
15122
15247
  * @function newPacketFromTag
@@ -15156,9 +15281,9 @@ class PacketList extends Array {
15156
15281
  * @throws on parsing errors
15157
15282
  * @async
15158
15283
  */
15159
- static async fromBinary(bytes, allowedPackets, config$1 = config) {
15284
+ static async fromBinary(bytes, allowedPackets, config$1 = config, grammarValidator = null) {
15160
15285
  const packets = new PacketList();
15161
- await packets.read(bytes, allowedPackets, config$1);
15286
+ await packets.read(bytes, allowedPackets, config$1, grammarValidator);
15162
15287
  return packets;
15163
15288
  }
15164
15289
 
@@ -15167,15 +15292,17 @@ class PacketList extends Array {
15167
15292
  * @param {Uint8Array | ReadableStream<Uint8Array>} bytes - binary data to parse
15168
15293
  * @param {Object} allowedPackets - mapping where keys are allowed packet tags, pointing to their Packet class
15169
15294
  * @param {Object} [config] - full configuration, defaults to openpgp.config
15295
+ * @param {function(enums.packet[], boolean, Object): void} [grammarValidator]
15170
15296
  * @throws on parsing errors
15171
15297
  * @async
15172
15298
  */
15173
- async read(bytes, allowedPackets, config$1 = config) {
15299
+ async read(bytes, allowedPackets, config$1 = config, grammarValidator = null) {
15174
15300
  if (config$1.additionalAllowedPackets.length) {
15175
15301
  allowedPackets = { ...allowedPackets, ...util.constructAllowedPackets(config$1.additionalAllowedPackets) };
15176
15302
  }
15177
15303
  this.stream = transformPair(bytes, async (readable, writable) => {
15178
15304
  const writer = getWriter(writable);
15305
+ const writtenTags = [];
15179
15306
  try {
15180
15307
  while (true) {
15181
15308
  await writer.ready;
@@ -15193,6 +15320,12 @@ class PacketList extends Array {
15193
15320
  packet.fromStream = util.isStream(parsed.packet);
15194
15321
  await packet.read(parsed.packet, config$1);
15195
15322
  await writer.write(packet);
15323
+ writtenTags.push(parsed.tag);
15324
+ // The `writtenTags` are only sensitive if we are parsing an _unauthenticated_ decrypted stream,
15325
+ // since they can enable an decryption oracle.
15326
+ // It's responsibility of the caller to pass a `grammarValidator` that takes care of
15327
+ // postponing error reporting until the data has been authenticated.
15328
+ grammarValidator?.(writtenTags, true, config$1);
15196
15329
  } catch (e) {
15197
15330
  // If an implementation encounters a critical packet where the packet type is unknown in a packet sequence,
15198
15331
  // it MUST reject the whole packet sequence. On the other hand, an unknown non-critical packet MUST be ignored.
@@ -15207,7 +15340,8 @@ class PacketList extends Array {
15207
15340
 
15208
15341
  const throwUnsupportedError = !config$1.ignoreUnsupportedPackets && e instanceof UnsupportedError;
15209
15342
  const throwMalformedError = !config$1.ignoreMalformedPackets && !(e instanceof UnsupportedError);
15210
- if (throwUnsupportedError || throwMalformedError || supportsStreaming(parsed.tag)) {
15343
+ const throwGrammarError = e instanceof GrammarError;
15344
+ if (throwUnsupportedError || throwMalformedError || throwGrammarError || supportsStreaming(parsed.tag)) {
15211
15345
  // The packets that support streaming are the ones that contain message data.
15212
15346
  // Those are also the ones we want to be more strict about and throw on parse errors
15213
15347
  // (since we likely cannot process the message without these packets anyway).
@@ -15215,11 +15349,16 @@ class PacketList extends Array {
15215
15349
  } else {
15216
15350
  const unparsedPacket = new UnparseablePacket(parsed.tag, parsed.packet);
15217
15351
  await writer.write(unparsedPacket);
15352
+ writtenTags.push(parsed.tag);
15353
+ grammarValidator?.(writtenTags, true, config$1);
15218
15354
  }
15219
15355
  util.printDebugError(e);
15220
15356
  }
15221
15357
  });
15222
15358
  if (done) {
15359
+ // Here we are past the MDC check for SEIPDv1 data, hence
15360
+ // the data is always authenticated at this point.
15361
+ grammarValidator?.(writtenTags, false, config$1);
15223
15362
  await writer.ready;
15224
15363
  await writer.close();
15225
15364
  return;
@@ -15442,7 +15581,8 @@ class CompressedDataPacket {
15442
15581
  throw new Error(`${compressionName} decompression not supported`);
15443
15582
  }
15444
15583
 
15445
- this.packets = await PacketList.fromBinary(await decompressionFn(this.compressed), allowedPackets$5, config$1);
15584
+ // Decompressing a Compressed Data packet MUST also yield a valid OpenPGP Message
15585
+ this.packets = await PacketList.fromBinary(await decompressionFn(this.compressed), allowedPackets$5, config$1, getMessageGrammarValidator({ enforceDelay: false }));
15446
15586
  }
15447
15587
 
15448
15588
  /**
@@ -15732,16 +15872,23 @@ class SymEncryptedIntegrityProtectedDataPacket {
15732
15872
  if (isArrayStream(encrypted)) encrypted = await readToEnd(encrypted);
15733
15873
 
15734
15874
  let packetbytes;
15875
+ let grammarValidator;
15735
15876
  if (this.version === 2) {
15736
15877
  if (this.cipherAlgorithm !== sessionKeyAlgorithm) {
15737
15878
  // sanity check
15738
15879
  throw new Error('Unexpected session key algorithm');
15739
15880
  }
15740
15881
  packetbytes = await runAEAD(this, 'decrypt', key, encrypted);
15882
+ grammarValidator = getMessageGrammarValidator({ delayReporting: false });
15741
15883
  } else {
15742
15884
  const { blockSize } = getCipherParams(sessionKeyAlgorithm);
15743
15885
  const decrypted = await decrypt$1(sessionKeyAlgorithm, key, encrypted, new Uint8Array(blockSize));
15744
15886
 
15887
+ // Grammar validation cannot be run before message integrity has been enstablished,
15888
+ // to avoid leaking info about the unauthenticated message structure.
15889
+ const releaseUnauthenticatedStream = util.isStream(encrypted) && config$1.allowUnauthenticatedStream;
15890
+ grammarValidator = getMessageGrammarValidator({ delayReporting: releaseUnauthenticatedStream });
15891
+
15745
15892
  // there must be a modification detection code packet as the
15746
15893
  // last packet and everything gets hashed except the hash itself
15747
15894
  const realHash = slice(passiveClone(decrypted), -20);
@@ -15753,17 +15900,23 @@ class SymEncryptedIntegrityProtectedDataPacket {
15753
15900
  if (!util.equalsUint8Array(hash, mdc)) {
15754
15901
  throw new Error('Modification detected.');
15755
15902
  }
15903
+ // this last chunk comes at the end of the stream passed to Packetlist.read's streamTransformPair,
15904
+ // which can thus be 'done' only after the MDC has been checked.
15756
15905
  return new Uint8Array();
15757
15906
  });
15758
15907
  const bytes = slice(tohash, blockSize + 2); // Remove random prefix
15759
15908
  packetbytes = slice(bytes, 0, -2); // Remove MDC packet
15760
15909
  packetbytes = concat([packetbytes, fromAsync(() => verifyHash)]);
15761
- if (!util.isStream(encrypted) || !config$1.allowUnauthenticatedStream) {
15910
+ if (!releaseUnauthenticatedStream) {
15762
15911
  packetbytes = await readToEnd(packetbytes);
15763
15912
  }
15764
15913
  }
15765
15914
 
15766
- this.packets = await PacketList.fromBinary(packetbytes, allowedPackets$4, config$1);
15915
+ // - Decrypting a version 1 Symmetrically Encrypted and Integrity Protected Data packet
15916
+ // MUST yield a valid OpenPGP Message.
15917
+ // - Decrypting a version 2 Symmetrically Encrypted and Integrity Protected Data packet
15918
+ // MUST yield a valid Optionally Padded Message.
15919
+ this.packets = await PacketList.fromBinary(packetbytes, allowedPackets$4, config$1, grammarValidator);
15767
15920
  return true;
15768
15921
  }
15769
15922
  }
@@ -15978,7 +16131,8 @@ class AEADEncryptedDataPacket {
15978
16131
  this.packets = await PacketList.fromBinary(
15979
16132
  await runAEAD(this, 'decrypt', key, clone(this.encrypted)),
15980
16133
  allowedPackets$3,
15981
- config$1
16134
+ config$1,
16135
+ getMessageGrammarValidator({ enforceDelay: false })
15982
16136
  );
15983
16137
  }
15984
16138
 
@@ -16905,6 +17059,10 @@ class SymmetricallyEncryptedDataPacket {
16905
17059
  encrypted.subarray(2, blockSize + 2)
16906
17060
  );
16907
17061
 
17062
+ // Decrypting a Symmetrically Encrypted Data packet MUST yield a valid OpenPGP Message.
17063
+ // But due to the lack of authentication over the decrypted data,
17064
+ // we do not run any grammarValidator, to avoid enabling a decryption oracle
17065
+ // (plus, there is probably a higher chance that these messages have an expected structure).
16908
17066
  this.packets = await PacketList.fromBinary(decrypted, allowedPackets$2, config$1);
16909
17067
  }
16910
17068
 
@@ -21507,7 +21665,7 @@ async function readMessage({ armoredMessage, binaryMessage, config: config$1, ..
21507
21665
  }
21508
21666
  input = data;
21509
21667
  }
21510
- const packetlist = await PacketList.fromBinary(input, allowedMessagePackets, config$1);
21668
+ const packetlist = await PacketList.fromBinary(input, allowedMessagePackets, config$1, getMessageGrammarValidator({ delayReporting: false }));
21511
21669
  const message = new Message(packetlist);
21512
21670
  message.fromStream = streamType;
21513
21671
  return message;
@@ -22127,7 +22285,7 @@ async function decrypt({ message, decryptionKeys, passwords, sessionKeys, verifi
22127
22285
  result.signatures = signature ? await decrypted.verifyDetached(signature, verificationKeys, date, config$1) : await decrypted.verify(verificationKeys, date, config$1);
22128
22286
  result.data = format === 'binary' ? decrypted.getLiteralData() : decrypted.getText();
22129
22287
  result.filename = decrypted.getFilename();
22130
- linkStreams(result, message);
22288
+ linkStreams(result, message, ...new Set([decrypted, decrypted.unwrapCompressed()]));
22131
22289
  if (expectSigned) {
22132
22290
  if (verificationKeys.length === 0) {
22133
22291
  throw new Error('Verification keys are required to verify message signatures');
@@ -22262,7 +22420,9 @@ async function verify({ message, verificationKeys, expectSigned = false, format
22262
22420
  result.signatures = await message.verify(verificationKeys, date, config$1);
22263
22421
  }
22264
22422
  result.data = format === 'binary' ? message.getLiteralData() : message.getText();
22265
- if (message.fromStream && !signature) linkStreams(result, message);
22423
+ if (message.fromStream && !signature) {
22424
+ linkStreams(result, ...new Set([message, message.unwrapCompressed()]));
22425
+ }
22266
22426
  if (expectSigned) {
22267
22427
  if (result.signatures.length === 0) {
22268
22428
  throw new Error('Message is not signed');
@@ -22459,22 +22619,25 @@ async function convertStream(data) {
22459
22619
  }
22460
22620
 
22461
22621
  /**
22462
- * Link result.data to the message stream for cancellation.
22463
- * Also, forward errors in the message to result.data.
22622
+ * Link result.data to the input message stream for cancellation.
22623
+ * Also, forward errors in the input message and intermediate messages to result.data.
22464
22624
  * @param {Object} result - the data to convert
22465
- * @param {Message} message - message object
22625
+ * @param {Message} message - message object provided by the user
22626
+ * @param {Message} intermediateMessages - intermediate message object with packet streams to link
22466
22627
  * @returns {Object}
22467
22628
  * @private
22468
22629
  */
22469
- function linkStreams(result, message) {
22470
- result.data = transformPair(message.packets.stream, async (readable, writable) => {
22630
+ function linkStreams(result, inputMessage, ...intermediateMessages) {
22631
+ result.data = transformPair(inputMessage.packets.stream, async (readable, writable) => {
22471
22632
  await pipe(result.data, writable, {
22472
22633
  preventClose: true
22473
22634
  });
22474
22635
  const writer = getWriter(writable);
22475
22636
  try {
22476
- // Forward errors in the message stream to result.data.
22637
+ // Forward errors in the message streams to result.data.
22477
22638
  await readToEnd(readable, _ => _);
22639
+ await Promise.all(intermediateMessages.map(intermediate => readToEnd(intermediate.packets.stream, _ => _)));
22640
+ // if result.data throws, the writable will be in errored state, and `close()` fails, but its ok.
22478
22641
  await writer.close();
22479
22642
  } catch (e) {
22480
22643
  await writer.abort(e);
@@ -22502,4 +22665,4 @@ function formatObject(object, format, config) {
22502
22665
  }
22503
22666
  }
22504
22667
 
22505
- export { AEADEncryptedDataPacket, Argon2OutOfMemoryError, Argon2S2K, CleartextMessage, CompressedDataPacket, KDFParams, LiteralDataPacket, MarkerPacket, Message, OnePassSignaturePacket, PacketList, PaddingPacket, PrivateKey, PublicKey, PublicKeyEncryptedSessionKeyPacket, PublicKeyPacket, PublicSubkeyPacket, SecretKeyPacket, SecretSubkeyPacket, Signature, SignaturePacket, Subkey, SymEncryptedIntegrityProtectedDataPacket, SymEncryptedSessionKeyPacket, SymmetricallyEncryptedDataPacket, TrustPacket, UnparseablePacket, UserAttributePacket, UserIDPacket, armor, config, createCleartextMessage, createMessage, decrypt, decryptKey, decryptSessionKeys, encrypt, encryptKey, encryptSessionKey, enums, generateKey, generateSessionKey, readCleartextMessage, readKey, readKeys, readMessage, readPrivateKey, readPrivateKeys, readSignature, reformatKey, revokeKey, sign, unarmor, verify };
22668
+ export { AEADEncryptedDataPacket, Argon2OutOfMemoryError, Argon2S2K, CleartextMessage, CompressedDataPacket, GrammarError, KDFParams, LiteralDataPacket, MarkerPacket, Message, OnePassSignaturePacket, PacketList, PaddingPacket, PrivateKey, PublicKey, PublicKeyEncryptedSessionKeyPacket, PublicKeyPacket, PublicSubkeyPacket, SecretKeyPacket, SecretSubkeyPacket, Signature, SignaturePacket, Subkey, SymEncryptedIntegrityProtectedDataPacket, SymEncryptedSessionKeyPacket, SymmetricallyEncryptedDataPacket, TrustPacket, UnparseablePacket, UserAttributePacket, UserIDPacket, armor, config, createCleartextMessage, createMessage, decrypt, decryptKey, decryptSessionKeys, encrypt, encryptKey, encryptSessionKey, enums, generateKey, generateSessionKey, readCleartextMessage, readKey, readKeys, readMessage, readPrivateKey, readPrivateKeys, readSignature, reformatKey, revokeKey, sign, unarmor, verify };
@@ -1,3 +1,3 @@
1
- /*! OpenPGP.js v6.1.1-patch.0 - 2025-02-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v6.1.1-patch.2 - 2025-05-14 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  "undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function t(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(r){if("default"!==r&&!(r in t)){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}}))})),Object.freeze(t)}var e=[0,1,3,7,15,31,63,127,255],r=function(t){this.stream=t,this.bitOffset=0,this.curByte=0,this.hasByte=!1};r.prototype._ensureByte=function(){this.hasByte||(this.curByte=this.stream.readByte(),this.hasByte=!0)},r.prototype.read=function(t){for(var r=0;t>0;){this._ensureByte();var i=8-this.bitOffset;if(t>=i)r<<=i,r|=e[i]&this.curByte,this.hasByte=!1,this.bitOffset=0,t-=i;else{r<<=t;var n=i-t;r|=(this.curByte&e[t]<<n)>>n,this.bitOffset+=t,t=0}}return r},r.prototype.seek=function(t){var e=t%8,r=(t-e)/8;this.bitOffset=e,this.stream.seek(r),this.hasByte=!1},r.prototype.pi=function(){var t,e=new Uint8Array(6);for(t=0;t<e.length;t++)e[t]=this.read(8);return function(t){return Array.prototype.map.call(t,(t=>("00"+t.toString(16)).slice(-2))).join("")}(e)};var i=r,n=function(){};n.prototype.readByte=function(){throw Error("abstract method readByte() not implemented")},n.prototype.read=function(t,e,r){for(var i=0;i<r;){var n=this.readByte();if(n<0)return 0===i?-1:i;t[e++]=n,i++}return i},n.prototype.seek=function(t){throw Error("abstract method seek() not implemented")},n.prototype.writeByte=function(t){throw Error("abstract method readByte() not implemented")},n.prototype.write=function(t,e,r){var i;for(i=0;i<r;i++)this.writeByte(t[e++]);return r},n.prototype.flush=function(){};var o,a=n,s=(o=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]),function(){var t=4294967295;this.getCRC=function(){return~t>>>0},this.updateCRC=function(e){t=t<<8^o[255&(t>>>24^e)]},this.updateCRCRun=function(e,r){for(;r-- >0;)t=t<<8^o[255&(t>>>24^e)]}}),f=i,u=a,h=s,p=function(t,e){var r,i=t[e];for(r=e;r>0;r--)t[r]=t[r-1];return t[0]=i,i},d={OK:0,LAST_BLOCK:-1,NOT_BZIP_DATA:-2,UNEXPECTED_INPUT_EOF:-3,UNEXPECTED_OUTPUT_EOF:-4,DATA_ERROR:-5,OUT_OF_MEMORY:-6,OBSOLETE_INPUT:-7,END_OF_BLOCK:-8},c={};c[d.LAST_BLOCK]="Bad file checksum",c[d.NOT_BZIP_DATA]="Not bzip data",c[d.UNEXPECTED_INPUT_EOF]="Unexpected input EOF",c[d.UNEXPECTED_OUTPUT_EOF]="Unexpected output EOF",c[d.DATA_ERROR]="Data error",c[d.OUT_OF_MEMORY]="Out of memory",c[d.OBSOLETE_INPUT]="Obsolete (pre 0.9.5) bzip format not supported.";var _=function(t,e){var r=c[t]||"unknown error";e&&(r+=": "+e);var i=new TypeError(r);throw i.errorCode=t,i},b=function(t,e){this.writePos=this.writeCurrent=this.writeCount=0,this._start_bunzip(t,e)};b.prototype._init_block=function(){return this._get_next_block()?(this.blockCRC=new h,!0):(this.writeCount=-1,!1)},b.prototype._start_bunzip=function(t,e){var r=new Uint8Array(4);4===t.read(r,0,4)&&"BZh"===String.fromCharCode(r[0],r[1],r[2])||_(d.NOT_BZIP_DATA,"bad magic");var i=r[3]-48;(i<1||i>9)&&_(d.NOT_BZIP_DATA,"level out of range"),this.reader=new f(t),this.dbufSize=1e5*i,this.nextoutput=0,this.outputStream=e,this.streamCRC=0},b.prototype._get_next_block=function(){var t,e,r,i=this.reader,n=i.pi();if("177245385090"===n)return!1;"314159265359"!==n&&_(d.NOT_BZIP_DATA),this.targetBlockCRC=i.read(32)>>>0,this.streamCRC=(this.targetBlockCRC^(this.streamCRC<<1|this.streamCRC>>>31))>>>0,i.read(1)&&_(d.OBSOLETE_INPUT);var o=i.read(24);o>this.dbufSize&&_(d.DATA_ERROR,"initial position out of bounds");var a=i.read(16),s=new Uint8Array(256),f=0;for(t=0;t<16;t++)if(a&1<<15-t){var u=16*t;for(r=i.read(16),e=0;e<16;e++)r&1<<15-e&&(s[f++]=u+e)}var h=i.read(3);(h<2||h>6)&&_(d.DATA_ERROR);var c=i.read(15);0===c&&_(d.DATA_ERROR);var b=new Uint8Array(256);for(t=0;t<h;t++)b[t]=t;var y=new Uint8Array(c);for(t=0;t<c;t++){for(e=0;i.read(1);e++)e>=h&&_(d.DATA_ERROR);y[t]=p(b,e)}var R,l=f+2,C=[];for(e=0;e<h;e++){var A,w,O=new Uint8Array(l),B=new Uint16Array(21);for(a=i.read(5),t=0;t<l;t++){for(;(a<1||a>20)&&_(d.DATA_ERROR),i.read(1);)i.read(1)?a--:a++;O[t]=a}for(A=w=O[0],t=1;t<l;t++)O[t]>w?w=O[t]:O[t]<A&&(A=O[t]);R={},C.push(R),R.permute=new Uint16Array(258),R.limit=new Uint32Array(22),R.base=new Uint32Array(21),R.minLen=A,R.maxLen=w;var v=0;for(t=A;t<=w;t++)for(B[t]=R.limit[t]=0,a=0;a<l;a++)O[a]===t&&(R.permute[v++]=a);for(t=0;t<l;t++)B[O[t]]++;for(v=a=0,t=A;t<w;t++)v+=B[t],R.limit[t]=v-1,v<<=1,a+=B[t],R.base[t+1]=v-a;R.limit[w+1]=Number.MAX_VALUE,R.limit[w]=v+B[w]-1,R.base[A]=0}var E=new Uint32Array(256);for(t=0;t<256;t++)b[t]=t;var m,T=0,g=0,U=0,k=this.dbuf=new Uint32Array(this.dbufSize);for(l=0;;){for(l--||(l=49,U>=c&&_(d.DATA_ERROR),R=C[y[U++]]),t=R.minLen,e=i.read(t);t>R.maxLen&&_(d.DATA_ERROR),!(e<=R.limit[t]);t++)e=e<<1|i.read(1);((e-=R.base[t])<0||e>=258)&&_(d.DATA_ERROR);var D=R.permute[e];if(0!==D&&1!==D){if(T)for(T=0,g+a>this.dbufSize&&_(d.DATA_ERROR),E[m=s[b[0]]]+=a;a--;)k[g++]=m;if(D>f)break;g>=this.dbufSize&&_(d.DATA_ERROR),E[m=s[m=p(b,t=D-1)]]++,k[g++]=m}else T||(T=1,a=0),a+=0===D?T:2*T,T<<=1}for((o<0||o>=g)&&_(d.DATA_ERROR),e=0,t=0;t<256;t++)r=e+E[t],E[t]=e,e=r;for(t=0;t<g;t++)k[E[m=255&k[t]]]|=t<<8,E[m]++;var z=0,P=0,S=0;return g&&(P=255&(z=k[o]),z>>=8,S=-1),this.writePos=z,this.writeCurrent=P,this.writeCount=g,this.writeRun=S,!0},b.prototype._read_bunzip=function(t,e){var r,i,n;if(this.writeCount<0)return 0;var o=this.dbuf,a=this.writePos,s=this.writeCurrent,f=this.writeCount;this.outputsize;for(var u=this.writeRun;f;){for(f--,i=s,s=255&(a=o[a]),a>>=8,3==u++?(r=s,n=i,s=-1):(r=1,n=s),this.blockCRC.updateCRCRun(n,r);r--;)this.outputStream.writeByte(n),this.nextoutput++;s!=i&&(u=0)}return this.writeCount=f,this.blockCRC.getCRC()!==this.targetBlockCRC&&_(d.DATA_ERROR,"Bad block CRC (got "+this.blockCRC.getCRC().toString(16)+" expected "+this.targetBlockCRC.toString(16)+")"),this.nextoutput};var y=function(t){if("readByte"in t)return t;var e=new u;return e.pos=0,e.readByte=function(){return t[this.pos++]},e.seek=function(t){this.pos=t},e.eof=function(){return this.pos>=t.length},e},R=function(t){var e=new u,r=!0;if(t)if("number"==typeof t)e.buffer=new Uint8Array(t),r=!1;else{if("writeByte"in t)return t;e.buffer=t,r=!1}else e.buffer=new Uint8Array(16384);return e.pos=0,e.writeByte=function(t){if(r&&this.pos>=this.buffer.length){var e=new Uint8Array(2*this.buffer.length);e.set(this.buffer),this.buffer=e}this.buffer[this.pos++]=t},e.getBuffer=function(){if(this.pos!==this.buffer.length){if(!r)throw new TypeError("outputsize does not match decoded input");var t=new Uint8Array(this.pos);t.set(this.buffer.subarray(0,this.pos)),this.buffer=t}return this.buffer},e._coerced=!0,e};var l=/*#__PURE__*/t({__proto__:null},[{Bunzip:b,Stream:u,Err:d,decode:function(t,e,r){for(var i=y(t),n=R(e),o=new b(i,n);!("eof"in i)||!i.eof();)if(o._init_block())o._read_bunzip();else{var a=o.reader.read(32)>>>0;if(a!==o.streamCRC&&_(d.DATA_ERROR,"Bad stream CRC (got "+o.streamCRC.toString(16)+" expected "+a.toString(16)+")"),!r||!("eof"in i)||i.eof())break;o._start_bunzip(i,n)}if("getBuffer"in n)return n.getBuffer()},decodeBlock:function(t,e,r){var i=y(t),n=R(r),o=new b(i,n);if(o.reader.seek(e),o._get_next_block()&&(o.blockCRC=new h,o.writeCopies=0,o._read_bunzip()),"getBuffer"in n)return n.getBuffer()},table:function(t,e,r){var i=new u;i.delegate=y(t),i.pos=0,i.readByte=function(){return this.pos++,this.delegate.readByte()},i.delegate.eof&&(i.eof=i.delegate.eof.bind(i.delegate));var n=new u;n.pos=0,n.writeByte=function(){this.pos++};for(var o=new b(i,n),a=o.dbufSize;!("eof"in i)||!i.eof();){var s=8*i.pos+o.reader.bitOffset;if(o.reader.hasByte&&(s-=8),o._init_block()){var f=n.pos;o._read_bunzip(),e(s,n.pos-f)}else{if(o.reader.read(32),!r||!("eof"in i)||i.eof())break;o._start_bunzip(i,n),console.assert(o.dbufSize===a,"shouldn't change block size within multistream file")}}}}]);export{l as i};
3
3
  //# sourceMappingURL=seek-bzip.min.mjs.map
@@ -1,4 +1,4 @@
1
- /*! OpenPGP.js v6.1.1-patch.0 - 2025-02-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v6.1.1-patch.2 - 2025-05-14 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  const globalThis = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3
3
 
4
4
  function _mergeNamespaces(n, m) {
@@ -1,4 +1,4 @@
1
- /*! OpenPGP.js v6.1.1-patch.0 - 2025-02-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v6.1.1-patch.2 - 2025-05-14 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  const t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){if(!Number.isSafeInteger(t)||t<0)throw Error("positive integer expected, got "+t)}function n(t,...e){if(!((n=t)instanceof Uint8Array||ArrayBuffer.isView(n)&&"Uint8Array"===n.constructor.name))throw Error("Uint8Array expected");var n;if(e.length>0&&!e.includes(t.length))throw Error("Uint8Array expected of length "+e+", got length="+t.length)}function s(t){if("function"!=typeof t||"function"!=typeof t.create)throw Error("Hash should be wrapped by utils.wrapConstructor");e(t.outputLen),e(t.blockLen)}function o(t,e=!0){if(t.destroyed)throw Error("Hash instance has been destroyed");if(e&&t.finished)throw Error("Hash#digest() has already been called")}function r(t,e){n(t);const s=e.outputLen;if(t.length<s)throw Error("digestInto() expects output buffer of length at least "+s)}const i="object"==typeof t&&"crypto"in t?t.crypto:void 0,h=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),a=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),f=(t,e)=>t<<32-e|t>>>e,u=(t,e)=>t<<e|t>>>32-e>>>0,c=/* @__PURE__ */(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();
3
3
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function l(t){for(let n=0;n<t.length;n++)t[n]=(e=t[n])<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;var e}function d(t){if("string"!=typeof t)throw Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}function p(t){return"string"==typeof t&&(t=d(t)),n(t),t}function g(...t){let e=0;for(let s=0;s<t.length;s++){const o=t[s];n(o),e+=o.length}const s=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const o=t[e];s.set(o,n),n+=o.length}return s}class y{clone(){return this._cloneInto()}}function w(t){const e=e=>t().update(p(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function b(t=32){if(i&&"function"==typeof i.getRandomValues)return i.getRandomValues(new Uint8Array(t));if(i&&"function"==typeof i.randomBytes)return i.randomBytes(t);throw Error("crypto.getRandomValues must be defined")}const L=/* @__PURE__ */BigInt(2**32-1),k=/* @__PURE__ */BigInt(32);function I(t,e=!1){return e?{h:Number(t&L),l:Number(t>>k&L)}:{h:0|Number(t>>k&L),l:0|Number(t&L)}}function B(t,e=!1){let n=new Uint32Array(t.length),s=new Uint32Array(t.length);for(let o=0;o<t.length;o++){const{h:r,l:i}=I(t[o],e);[n[o],s[o]]=[r,i]}return[n,s]}const A=(t,e,n)=>t<<n|e>>>32-n,m=(t,e,n)=>e<<n|t>>>32-n,O=(t,e,n)=>e<<n-32|t>>>64-n,U=(t,e,n)=>t<<n-32|e>>>64-n;const x={fromBig:I,split:B,toBig:(t,e)=>BigInt(t>>>0)<<k|BigInt(e>>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:A,rotlSL:m,rotlBH:O,rotlBL:U,add:function(t,e,n,s){const o=(e>>>0)+(s>>>0);return{h:t+n+(o/2**32|0)|0,l:0|o}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,s)=>e+n+s+(t/2**32|0)|0,add4L:(t,e,n,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(s>>>0),add4H:(t,e,n,s,o)=>e+n+s+o+(t/2**32|0)|0,add5H:(t,e,n,s,o,r)=>e+n+s+o+r+(t/2**32|0)|0,add5L:(t,e,n,s,o)=>(t>>>0)+(e>>>0)+(n>>>0)+(s>>>0)+(o>>>0)},E=[],H=[],S=[],v=/* @__PURE__ */BigInt(0),F=/* @__PURE__ */BigInt(1),N=/* @__PURE__ */BigInt(2),V=/* @__PURE__ */BigInt(7),X=/* @__PURE__ */BigInt(256),M=/* @__PURE__ */BigInt(113);for(let t=0,e=F,n=1,s=0;t<24;t++){[n,s]=[s,(2*n+3*s)%5],E.push(2*(5*s+n)),H.push((t+1)*(t+2)/2%64);let o=v;for(let t=0;t<7;t++)e=(e<<F^(e>>V)*M)%X,e&N&&(o^=F<<(F<</* @__PURE__ */BigInt(t))-F);S.push(o)}const[R,j]=/* @__PURE__ */B(S,!0),T=(t,e,n)=>n>32?O(t,e,n):A(t,e,n),_=(t,e,n)=>n>32?U(t,e,n):m(t,e,n);class C extends y{constructor(t,n,s,o=!1,r=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=s,this.enableXOF=o,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,e(s),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=h(this.state)}keccak(){c||l(this.state32),function(t,e=24){const n=new Uint32Array(10);for(let s=24-e;s<24;s++){for(let e=0;e<10;e++)n[e]=t[e]^t[e+10]^t[e+20]^t[e+30]^t[e+40];for(let e=0;e<10;e+=2){const s=(e+8)%10,o=(e+2)%10,r=n[o],i=n[o+1],h=T(r,i,1)^n[s],a=_(r,i,1)^n[s+1];for(let n=0;n<50;n+=10)t[e+n]^=h,t[e+n+1]^=a}let e=t[2],o=t[3];for(let n=0;n<24;n++){const s=H[n],r=T(e,o,s),i=_(e,o,s),h=E[n];e=t[h],o=t[h+1],t[h]=r,t[h+1]=i}for(let e=0;e<50;e+=10){for(let s=0;s<10;s++)n[s]=t[e+s];for(let s=0;s<10;s++)t[e+s]^=~n[(s+2)%10]&n[(s+4)%10]}t[0]^=R[s],t[1]^=j[s]}n.fill(0)}(this.state32,this.rounds),c||l(this.state32),this.posOut=0,this.pos=0}update(t){o(this);const{blockLen:e,state:n}=this,s=(t=p(t)).length;for(let o=0;o<s;){const r=Math.min(e-this.pos,s-o);for(let e=0;e<r;e++)n[this.pos++]^=t[o++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:s}=this;t[n]^=e,128&e&&n===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){o(this,!1),n(t),this.finish();const e=this.state,{blockLen:s}=this;for(let n=0,o=t.length;n<o;){this.posOut>=s&&this.keccak();const r=Math.min(s-this.posOut,o-n);t.set(e.subarray(this.posOut,this.posOut+r),n),this.posOut+=r,n+=r}return t}xofInto(t){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return e(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(r(t,this),this.finished)throw Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:s,rounds:o,enableXOF:r}=this;return t||(t=new C(e,n,s,r,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=s,t.enableXOF=r,t.destroyed=this.destroyed,t}}const D=(t,e,n)=>w((()=>new C(e,t,n))),q=/* @__PURE__ */D(6,136,32),z=/* @__PURE__ */D(6,72,64),G=(t,e,n)=>function(t){const e=(e,n)=>t(n).update(p(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e}(((s={})=>new C(e,t,void 0===s.dkLen?n:s.dkLen,!0))),J=/* @__PURE__ */G(31,168,16),K=/* @__PURE__ */G(31,136,32);export{y as H,s as a,o as b,n as c,g as d,u as e,q as f,z as g,a as h,r as i,f as j,x as k,J as l,h as m,b as r,K as s,p as t,d as u,w};
4
4
  //# sourceMappingURL=sha3.min.mjs.map
@@ -1,4 +1,4 @@
1
- /*! OpenPGP.js v6.1.1-patch.0 - 2025-02-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v6.1.1-patch.2 - 2025-05-14 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  const globalThis = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3
3
 
4
4
  function anumber(n) {
@@ -1,3 +1,3 @@
1
- /*! OpenPGP.js v6.1.1-patch.0 - 2025-02-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v6.1.1-patch.2 - 2025-05-14 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  "undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;import{H as t,h as s,b as h,t as e,i,w as c,j as a,k as r}from"./sha3.min.mjs";const f=(t,s,h)=>t&s^~t&h,d=(t,s,h)=>t&s^t&h^s&h;class o extends t{constructor(t,h,e,i){super(),this.blockLen=t,this.outputLen=h,this.padOffset=e,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=s(this.buffer)}update(t){h(this);const{view:i,buffer:c,blockLen:a}=this,r=(t=e(t)).length;for(let h=0;h<r;){const e=Math.min(a-this.pos,r-h);if(e!==a)c.set(t.subarray(h,h+e),this.pos),this.pos+=e,h+=e,this.pos===a&&(this.process(i,0),this.pos=0);else{const e=s(t);for(;a<=r-h;h+=a)this.process(e,h)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){h(this),i(t,this),this.finished=!0;const{buffer:e,view:c,blockLen:a,isLE:r}=this;let{pos:f}=this;e[f++]=128,this.buffer.subarray(f).fill(0),this.padOffset>a-f&&(this.process(c,0),f=0);for(let t=f;t<a;t++)e[t]=0;!function(t,s,h,e){if("function"==typeof t.setBigUint64)return t.setBigUint64(s,h,e);const i=BigInt(32),c=BigInt(4294967295),a=Number(h>>i&c),r=Number(h&c),f=e?4:0,d=e?0:4;t.setUint32(s+f,a,e),t.setUint32(s+d,r,e)}(c,a-8,BigInt(8*this.length),r),this.process(c,0);const d=s(t),o=this.outputLen;if(o%4)throw Error("_sha2: outputLen should be aligned to 32bit");const b=o/4,n=this.get();if(b>n.length)throw Error("_sha2: outputLen bigger than state");for(let t=0;t<b;t++)d.setUint32(4*t,n[t],r)}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const h=t.slice(0,s);return this.destroy(),h}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:s,buffer:h,length:e,finished:i,destroyed:c,pos:a}=this;return t.length=e,t.pos=a,t.finished=i,t.destroyed=c,e%s&&t.buffer.set(h),t}}const b=/* @__PURE__ */new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),n=/* @__PURE__ */new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),l=/* @__PURE__ */new Uint32Array(64);class x extends o{constructor(){super(64,32,8,!1),this.A=0|n[0],this.B=0|n[1],this.C=0|n[2],this.D=0|n[3],this.E=0|n[4],this.F=0|n[5],this.G=0|n[6],this.H=0|n[7]}get(){const{A:t,B:s,C:h,D:e,E:i,F:c,G:a,H:r}=this;return[t,s,h,e,i,c,a,r]}set(t,s,h,e,i,c,a,r){this.A=0|t,this.B=0|s,this.C=0|h,this.D=0|e,this.E=0|i,this.F=0|c,this.G=0|a,this.H=0|r}process(t,s){for(let h=0;h<16;h++,s+=4)l[h]=t.getUint32(s,!1);for(let t=16;t<64;t++){const s=l[t-15],h=l[t-2],e=a(s,7)^a(s,18)^s>>>3,i=a(h,17)^a(h,19)^h>>>10;l[t]=i+l[t-7]+e+l[t-16]|0}let{A:h,B:e,C:i,D:c,E:r,F:o,G:n,H:x}=this;for(let t=0;t<64;t++){const s=x+(a(r,6)^a(r,11)^a(r,25))+f(r,o,n)+b[t]+l[t]|0,u=(a(h,2)^a(h,13)^a(h,22))+d(h,e,i)|0;x=n,n=o,o=r,r=c+s|0,c=i,i=e,e=h,h=s+u|0}h=h+this.A|0,e=e+this.B|0,i=i+this.C|0,c=c+this.D|0,r=r+this.E|0,o=o+this.F|0,n=n+this.G|0,x=x+this.H|0,this.set(h,e,i,c,r,o,n,x)}roundClean(){l.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class u extends x{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const p=/* @__PURE__ */c((()=>new x)),H=/* @__PURE__ */c((()=>new u)),[B,g]=/* @__PURE__ */(()=>r.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((t=>BigInt(t)))))(),L=/* @__PURE__ */new Uint32Array(80),A=/* @__PURE__ */new Uint32Array(80);class C extends o{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:s,Bh:h,Bl:e,Ch:i,Cl:c,Dh:a,Dl:r,Eh:f,El:d,Fh:o,Fl:b,Gh:n,Gl:l,Hh:x,Hl:u}=this;return[t,s,h,e,i,c,a,r,f,d,o,b,n,l,x,u]}set(t,s,h,e,i,c,a,r,f,d,o,b,n,l,x,u){this.Ah=0|t,this.Al=0|s,this.Bh=0|h,this.Bl=0|e,this.Ch=0|i,this.Cl=0|c,this.Dh=0|a,this.Dl=0|r,this.Eh=0|f,this.El=0|d,this.Fh=0|o,this.Fl=0|b,this.Gh=0|n,this.Gl=0|l,this.Hh=0|x,this.Hl=0|u}process(t,s){for(let h=0;h<16;h++,s+=4)L[h]=t.getUint32(s),A[h]=t.getUint32(s+=4);for(let t=16;t<80;t++){const s=0|L[t-15],h=0|A[t-15],e=r.rotrSH(s,h,1)^r.rotrSH(s,h,8)^r.shrSH(s,h,7),i=r.rotrSL(s,h,1)^r.rotrSL(s,h,8)^r.shrSL(s,h,7),c=0|L[t-2],a=0|A[t-2],f=r.rotrSH(c,a,19)^r.rotrBH(c,a,61)^r.shrSH(c,a,6),d=r.rotrSL(c,a,19)^r.rotrBL(c,a,61)^r.shrSL(c,a,6),o=r.add4L(i,d,A[t-7],A[t-16]),b=r.add4H(o,e,f,L[t-7],L[t-16]);L[t]=0|b,A[t]=0|o}let{Ah:h,Al:e,Bh:i,Bl:c,Ch:a,Cl:f,Dh:d,Dl:o,Eh:b,El:n,Fh:l,Fl:x,Gh:u,Gl:p,Hh:H,Hl:C}=this;for(let t=0;t<80;t++){const s=r.rotrSH(b,n,14)^r.rotrSH(b,n,18)^r.rotrBH(b,n,41),E=r.rotrSL(b,n,14)^r.rotrSL(b,n,18)^r.rotrBL(b,n,41),w=b&l^~b&u,y=n&x^~n&p,D=r.add5L(C,E,y,g[t],A[t]),F=r.add5H(D,H,s,w,B[t],L[t]),G=0|D,S=r.rotrSH(h,e,28)^r.rotrBH(h,e,34)^r.rotrBH(h,e,39),U=r.rotrSL(h,e,28)^r.rotrBL(h,e,34)^r.rotrBL(h,e,39),m=h&i^h&a^i&a,I=e&c^e&f^c&f;H=0|u,C=0|p,u=0|l,p=0|x,l=0|b,x=0|n,({h:b,l:n}=r.add(0|d,0|o,0|F,0|G)),d=0|a,o=0|f,a=0|i,f=0|c,i=0|h,c=0|e;const k=r.add3L(G,U,I);h=r.add3H(k,F,S,m),e=0|k}({h,l:e}=r.add(0|this.Ah,0|this.Al,0|h,0|e)),({h:i,l:c}=r.add(0|this.Bh,0|this.Bl,0|i,0|c)),({h:a,l:f}=r.add(0|this.Ch,0|this.Cl,0|a,0|f)),({h:d,l:o}=r.add(0|this.Dh,0|this.Dl,0|d,0|o)),({h:b,l:n}=r.add(0|this.Eh,0|this.El,0|b,0|n)),({h:l,l:x}=r.add(0|this.Fh,0|this.Fl,0|l,0|x)),({h:u,l:p}=r.add(0|this.Gh,0|this.Gl,0|u,0|p)),({h:H,l:C}=r.add(0|this.Hh,0|this.Hl,0|H,0|C)),this.set(h,e,i,c,a,f,d,o,b,n,l,x,u,p,H,C)}roundClean(){L.fill(0),A.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class E extends C{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}const w=/* @__PURE__ */c((()=>new C)),y=/* @__PURE__ */c((()=>new E));export{f as C,o as H,d as M,y as a,w as b,H as c,p as s};
3
3
  //# sourceMappingURL=sha512.min.mjs.map
@@ -1,4 +1,4 @@
1
- /*! OpenPGP.js v6.1.1-patch.0 - 2025-02-12 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v6.1.1-patch.2 - 2025-05-14 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  const globalThis = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3
3
 
4
4
  import { H as Hash, h as createView, b as aexists, t as toBytes, i as aoutput, w as wrapConstructor, j as rotr, k as u64 } from './sha3.mjs';