@protontech/openpgp 6.1.1-patch.3 → 6.1.1-patch.4

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.1.1-patch.3 - 2025-06-18 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v6.1.1-patch.4 - 2025-07-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) {
@@ -1716,7 +1716,7 @@ var config = {
1716
1716
  * @memberof module:config
1717
1717
  * @property {String} versionString A version string to be included in armored messages
1718
1718
  */
1719
- versionString: 'OpenPGP.js 6.1.1-patch.3',
1719
+ versionString: 'OpenPGP.js 6.1.1-patch.4',
1720
1720
  /**
1721
1721
  * @memberof module:config
1722
1722
  * @property {String} commentString A comment string to be included in armored messages
@@ -6913,7 +6913,15 @@ async function generate$a(algo) {
6913
6913
  case enums.publicKey.ed25519:
6914
6914
  try {
6915
6915
  const webCrypto = util.getWebCrypto();
6916
- const webCryptoKey = await webCrypto.generateKey('Ed25519', true, ['sign', 'verify']);
6916
+ const webCryptoKey = await webCrypto.generateKey('Ed25519', true, ['sign', 'verify'])
6917
+ .catch(err => {
6918
+ if (err.name === 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
6919
+ const newErr = new Error('Unexpected key generation issue');
6920
+ newErr.name = 'NotSupportedError';
6921
+ throw newErr;
6922
+ }
6923
+ throw err;
6924
+ });
6917
6925
 
6918
6926
  const privateKey = await webCrypto.exportKey('jwk', webCryptoKey.privateKey);
6919
6927
  const publicKey = await webCrypto.exportKey('jwk', webCryptoKey.publicKey);
@@ -6923,7 +6931,7 @@ async function generate$a(algo) {
6923
6931
  seed: b64ToUint8Array(privateKey.d, true)
6924
6932
  };
6925
6933
  } catch (err) {
6926
- if (err.name !== 'NotSupportedError' && err.name !== 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
6934
+ if (err.name !== 'NotSupportedError') {
6927
6935
  throw err;
6928
6936
  }
6929
6937
  const seed = getRandomBytes(getPayloadSize$1(algo));
@@ -8341,11 +8349,25 @@ async function generate$9(algo) {
8341
8349
  case enums.publicKey.x25519:
8342
8350
  try {
8343
8351
  const webCrypto = util.getWebCrypto();
8344
- const webCryptoKey = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits']);
8352
+ const webCryptoKey = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits'])
8353
+ .catch(err => {
8354
+ if (err.name === 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
8355
+ const newErr = new Error('Unexpected key generation issue');
8356
+ newErr.name = 'NotSupportedError';
8357
+ throw newErr;
8358
+ }
8359
+ throw err;
8360
+ });
8345
8361
 
8346
8362
  const privateKey = await webCrypto.exportKey('jwk', webCryptoKey.privateKey);
8347
8363
  const publicKey = await webCrypto.exportKey('jwk', webCryptoKey.publicKey);
8348
8364
 
8365
+ if (privateKey.x !== publicKey.x) { // Weird issue with Webkit on Linux: https://bugs.webkit.org/show_bug.cgi?id=289693
8366
+ const err = new Error('Unexpected mismatching public point');
8367
+ err.name = 'NotSupportedError';
8368
+ throw err;
8369
+ }
8370
+
8349
8371
  return {
8350
8372
  A: new Uint8Array(b64ToUint8Array(publicKey.x)),
8351
8373
  k: b64ToUint8Array(privateKey.d)
@@ -8503,15 +8525,29 @@ async function generateEphemeralEncryptionMaterial(algo, recipientA) {
8503
8525
  case enums.publicKey.x25519:
8504
8526
  try {
8505
8527
  const webCrypto = util.getWebCrypto();
8528
+ const ephemeralKeyPair = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits'])
8529
+ .catch(err => {
8530
+ if (err.name === 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
8531
+ const newErr = new Error('Unexpected key generation issue');
8532
+ newErr.name = 'NotSupportedError';
8533
+ throw newErr;
8534
+ }
8535
+ throw err;
8536
+ });
8537
+ const ephemeralPublicKeyJwt = await webCrypto.exportKey('jwk', ephemeralKeyPair.publicKey);
8538
+ const ephemeralPrivateKeyJwt = await webCrypto.exportKey('jwk', ephemeralKeyPair.privateKey);
8539
+ if (ephemeralPrivateKeyJwt.x !== ephemeralPublicKeyJwt.x) { // Weird issue with Webkit on Linux: https://bugs.webkit.org/show_bug.cgi?id=289693
8540
+ const err = new Error('Unexpected mismatching public point');
8541
+ err.name = 'NotSupportedError';
8542
+ throw err;
8543
+ }
8506
8544
  const jwk = publicKeyToJWK(algo, recipientA);
8507
- const ephemeralKeyPair = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits']);
8508
8545
  const recipientPublicKey = await webCrypto.importKey('jwk', jwk, 'X25519', false, []);
8509
8546
  const sharedSecretBuffer = await webCrypto.deriveBits(
8510
8547
  { name: 'X25519', public: recipientPublicKey },
8511
8548
  ephemeralKeyPair.privateKey,
8512
8549
  getPayloadSize(algo) * 8 // in bits
8513
8550
  );
8514
- const ephemeralPublicKeyJwt = await webCrypto.exportKey('jwk', ephemeralKeyPair.publicKey);
8515
8551
  return {
8516
8552
  sharedSecret: new Uint8Array(sharedSecretBuffer),
8517
8553
  ephemeralPublicKey: new Uint8Array(b64ToUint8Array(ephemeralPublicKeyJwt.x))
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.1.1-patch.3",
4
+ "version": "6.1.1-patch.4",
5
5
  "license": "LGPL-3.0+",
6
6
  "homepage": "https://openpgpjs.org/",
7
7
  "engines": {