@protontech/openpgp 6.0.1 → 6.0.2-patch.1

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.
package/dist/openpgp.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! OpenPGP.js v6.0.1 - 2024-11-25 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v6.0.2-patch.1 - 2024-12-13 - 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) {
@@ -1702,7 +1702,7 @@ var config = {
1702
1702
  * @memberof module:config
1703
1703
  * @property {String} versionString A version string to be included in armored messages
1704
1704
  */
1705
- versionString: 'OpenPGP.js 6.0.1',
1705
+ versionString: 'OpenPGP.js 6.0.2-patch.1',
1706
1706
  /**
1707
1707
  * @memberof module:config
1708
1708
  * @property {String} commentString A comment string to be included in armored messages
@@ -9281,7 +9281,11 @@ async function generate$a(algo) {
9281
9281
  seed: b64ToUint8Array(privateKey.d, true)
9282
9282
  };
9283
9283
  } catch (err) {
9284
- if (err.name !== 'NotSupportedError' && err.name !== 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
9284
+ if (
9285
+ err.name !== 'NotSupportedError' &&
9286
+ err.name !== 'OperationError' && // Temporary (hopefully) fix for WebKit on Linux
9287
+ err.name !== 'SyntaxError' // Temporary fix for Palemoon throwing 'SyntaxError'
9288
+ ) {
9285
9289
  throw err;
9286
9290
  }
9287
9291
  const seed = getRandomBytes(getPayloadSize$1(algo));
@@ -9333,7 +9337,7 @@ async function sign$9(algo, hashAlgo, message, publicKey, privateKey, hashed) {
9333
9337
 
9334
9338
  return { RS: signature };
9335
9339
  } catch (err) {
9336
- if (err.name !== 'NotSupportedError') {
9340
+ if (err.name !== 'NotSupportedError' && err.name !== 'SyntaxError') { // Temporary fix for Palemoon throwing 'SyntaxError'
9337
9341
  throw err;
9338
9342
  }
9339
9343
  const secretKey = util.concatUint8Array([privateKey, publicKey]);
@@ -9379,7 +9383,7 @@ async function verify$9(algo, hashAlgo, { RS }, m, publicKey, hashed) {
9379
9383
  const verified = await webCrypto.verify('Ed25519', key, RS, hashed);
9380
9384
  return verified;
9381
9385
  } catch (err) {
9382
- if (err.name !== 'NotSupportedError') {
9386
+ if (err.name !== 'NotSupportedError' && err.name !== 'SyntaxError') { // Temporary fix for Palemoon throwing 'SyntaxError'
9383
9387
  throw err;
9384
9388
  }
9385
9389
  return verify$a(RS, hashed, publicKey);
@@ -11326,12 +11330,8 @@ async function generate$6(algo) {
11326
11330
  async function encaps$1(eccAlgo, eccRecipientPublicKey) {
11327
11331
  switch (eccAlgo) {
11328
11332
  case enums.publicKey.pqc_mlkem_x25519: {
11329
- const { ephemeralPublicKey: eccCipherText, sharedSecret: eccSharedSecret } = await generateEphemeralEncryptionMaterial(enums.publicKey.x25519, eccRecipientPublicKey);
11330
- const eccKeyShare = await hash.sha3_256(util.concatUint8Array([
11331
- eccSharedSecret,
11332
- eccCipherText,
11333
- eccRecipientPublicKey
11334
- ]));
11333
+ const { ephemeralPublicKey: eccCipherText, sharedSecret: eccKeyShare } = await generateEphemeralEncryptionMaterial(enums.publicKey.x25519, eccRecipientPublicKey);
11334
+
11335
11335
  return {
11336
11336
  eccCipherText,
11337
11337
  eccKeyShare
@@ -11345,12 +11345,7 @@ async function encaps$1(eccAlgo, eccRecipientPublicKey) {
11345
11345
  async function decaps$1(eccAlgo, eccCipherText, eccSecretKey, eccPublicKey) {
11346
11346
  switch (eccAlgo) {
11347
11347
  case enums.publicKey.pqc_mlkem_x25519: {
11348
- const eccSharedSecret = await recomputeSharedSecret(enums.publicKey.x25519, eccCipherText, eccPublicKey, eccSecretKey);
11349
- const eccKeyShare = await hash.sha3_256(util.concatUint8Array([
11350
- eccSharedSecret,
11351
- eccCipherText,
11352
- eccPublicKey
11353
- ]));
11348
+ const eccKeyShare = await recomputeSharedSecret(enums.publicKey.x25519, eccCipherText, eccPublicKey, eccSecretKey);
11354
11349
  return eccKeyShare;
11355
11350
  }
11356
11351
  default:
@@ -11462,7 +11457,7 @@ async function decrypt$1(algo, eccCipherText, mlkemCipherText, eccSecretKey, ecc
11462
11457
  async function multiKeyCombine(algo, ecdhKeyShare, ecdhCipherText, ecdhPublicKey, mlkemKeyShare, mlkemCipherText, mlkemPublicKey) {
11463
11458
  // LAMPS-aligned and NIST compatible combiner, proposed in: https://mailarchive.ietf.org/arch/msg/openpgp/NMTCy707LICtxIhP3Xt1U5C8MF0/
11464
11459
  // 2a. KDF(mlkemSS || tradSS || tradCT || tradPK || Domain)
11465
- // where Domain is "Domain" for LAMPS, and "mlkemCT || mlkemPK || algId" for OpenPGP
11460
+ // where Domain is "Domain" for LAMPS, and "mlkemCT || mlkemPK || algId || const" for OpenPGP
11466
11461
  const encData = util.concatUint8Array([
11467
11462
  mlkemKeyShare,
11468
11463
  ecdhKeyShare,
@@ -11471,7 +11466,8 @@ async function multiKeyCombine(algo, ecdhKeyShare, ecdhCipherText, ecdhPublicKey
11471
11466
  // domSep
11472
11467
  mlkemCipherText,
11473
11468
  mlkemPublicKey,
11474
- new Uint8Array([algo])
11469
+ new Uint8Array([algo]),
11470
+ util.encodeUTF8('OpenPGPCompositeKDFv1')
11475
11471
  ]);
11476
11472
 
11477
11473
  const kek = await hash.digest(enums.hash.sha3_256, encData);
package/openpgp.d.ts CHANGED
@@ -825,7 +825,7 @@ export namespace enums {
825
825
  aeadEncryptedData = 20
826
826
  }
827
827
 
828
- export type publicKeyNames = 'rsaEncryptSign' | 'rsaEncrypt' | 'rsaSign' | 'elgamal' | 'dsa' | 'ecdh' | 'ecdsa' | 'eddsaLegacy' | 'aedh' | 'aedsa' | 'ed25519' | 'x25519' | 'ed448' | 'x448';
828
+ export type publicKeyNames = 'rsaEncryptSign' | 'rsaEncrypt' | 'rsaSign' | 'elgamal' | 'dsa' | 'ecdh' | 'ecdsa' | 'eddsaLegacy' | 'aedh' | 'aedsa' | 'ed25519' | 'x25519' | 'ed448' | 'x448' | 'pqc_mlkem_x25519' | 'pqc_mldsa_ed25519';
829
829
  export enum publicKey {
830
830
  rsaEncryptSign = 1,
831
831
  rsaEncrypt = 2,
@@ -840,7 +840,9 @@ export namespace enums {
840
840
  x25519 = 25,
841
841
  x448 = 26,
842
842
  ed25519 = 27,
843
- ed448 = 28
843
+ ed448 = 28,
844
+ pqc_mlkem_x25519 = 105,
845
+ pqc_mldsa_ed25519 = 107
844
846
  }
845
847
 
846
848
  export enum curve {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@protontech/openpgp",
3
3
  "description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.",
4
- "version": "6.0.1",
4
+ "version": "6.0.2-patch.1",
5
5
  "license": "LGPL-3.0+",
6
6
  "homepage": "https://openpgpjs.org/",
7
7
  "engines": {