@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.
@@ -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
  import { createRequire } from 'module';
@@ -1720,7 +1720,7 @@ var config = {
1720
1720
  * @memberof module:config
1721
1721
  * @property {String} versionString A version string to be included in armored messages
1722
1722
  */
1723
- versionString: 'OpenPGP.js 6.1.1-patch.3',
1723
+ versionString: 'OpenPGP.js 6.1.1-patch.4',
1724
1724
  /**
1725
1725
  * @memberof module:config
1726
1726
  * @property {String} commentString A comment string to be included in armored messages
@@ -6923,7 +6923,15 @@ async function generate$a(algo) {
6923
6923
  case enums.publicKey.ed25519:
6924
6924
  try {
6925
6925
  const webCrypto = util.getWebCrypto();
6926
- const webCryptoKey = await webCrypto.generateKey('Ed25519', true, ['sign', 'verify']);
6926
+ const webCryptoKey = await webCrypto.generateKey('Ed25519', true, ['sign', 'verify'])
6927
+ .catch(err => {
6928
+ if (err.name === 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
6929
+ const newErr = new Error('Unexpected key generation issue');
6930
+ newErr.name = 'NotSupportedError';
6931
+ throw newErr;
6932
+ }
6933
+ throw err;
6934
+ });
6927
6935
 
6928
6936
  const privateKey = await webCrypto.exportKey('jwk', webCryptoKey.privateKey);
6929
6937
  const publicKey = await webCrypto.exportKey('jwk', webCryptoKey.publicKey);
@@ -6933,7 +6941,7 @@ async function generate$a(algo) {
6933
6941
  seed: b64ToUint8Array(privateKey.d, true)
6934
6942
  };
6935
6943
  } catch (err) {
6936
- if (err.name !== 'NotSupportedError' && err.name !== 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
6944
+ if (err.name !== 'NotSupportedError') {
6937
6945
  throw err;
6938
6946
  }
6939
6947
  const seed = getRandomBytes(getPayloadSize$1(algo));
@@ -8351,11 +8359,25 @@ async function generate$9(algo) {
8351
8359
  case enums.publicKey.x25519:
8352
8360
  try {
8353
8361
  const webCrypto = util.getWebCrypto();
8354
- const webCryptoKey = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits']);
8362
+ const webCryptoKey = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits'])
8363
+ .catch(err => {
8364
+ if (err.name === 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
8365
+ const newErr = new Error('Unexpected key generation issue');
8366
+ newErr.name = 'NotSupportedError';
8367
+ throw newErr;
8368
+ }
8369
+ throw err;
8370
+ });
8355
8371
 
8356
8372
  const privateKey = await webCrypto.exportKey('jwk', webCryptoKey.privateKey);
8357
8373
  const publicKey = await webCrypto.exportKey('jwk', webCryptoKey.publicKey);
8358
8374
 
8375
+ if (privateKey.x !== publicKey.x) { // Weird issue with Webkit on Linux: https://bugs.webkit.org/show_bug.cgi?id=289693
8376
+ const err = new Error('Unexpected mismatching public point');
8377
+ err.name = 'NotSupportedError';
8378
+ throw err;
8379
+ }
8380
+
8359
8381
  return {
8360
8382
  A: new Uint8Array(b64ToUint8Array(publicKey.x)),
8361
8383
  k: b64ToUint8Array(privateKey.d)
@@ -8513,15 +8535,29 @@ async function generateEphemeralEncryptionMaterial(algo, recipientA) {
8513
8535
  case enums.publicKey.x25519:
8514
8536
  try {
8515
8537
  const webCrypto = util.getWebCrypto();
8538
+ const ephemeralKeyPair = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits'])
8539
+ .catch(err => {
8540
+ if (err.name === 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
8541
+ const newErr = new Error('Unexpected key generation issue');
8542
+ newErr.name = 'NotSupportedError';
8543
+ throw newErr;
8544
+ }
8545
+ throw err;
8546
+ });
8547
+ const ephemeralPublicKeyJwt = await webCrypto.exportKey('jwk', ephemeralKeyPair.publicKey);
8548
+ const ephemeralPrivateKeyJwt = await webCrypto.exportKey('jwk', ephemeralKeyPair.privateKey);
8549
+ if (ephemeralPrivateKeyJwt.x !== ephemeralPublicKeyJwt.x) { // Weird issue with Webkit on Linux: https://bugs.webkit.org/show_bug.cgi?id=289693
8550
+ const err = new Error('Unexpected mismatching public point');
8551
+ err.name = 'NotSupportedError';
8552
+ throw err;
8553
+ }
8516
8554
  const jwk = publicKeyToJWK(algo, recipientA);
8517
- const ephemeralKeyPair = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits']);
8518
8555
  const recipientPublicKey = await webCrypto.importKey('jwk', jwk, 'X25519', false, []);
8519
8556
  const sharedSecretBuffer = await webCrypto.deriveBits(
8520
8557
  { name: 'X25519', public: recipientPublicKey },
8521
8558
  ephemeralKeyPair.privateKey,
8522
8559
  getPayloadSize(algo) * 8 // in bits
8523
8560
  );
8524
- const ephemeralPublicKeyJwt = await webCrypto.exportKey('jwk', ephemeralKeyPair.publicKey);
8525
8561
  return {
8526
8562
  sharedSecret: new Uint8Array(sharedSecretBuffer),
8527
8563
  ephemeralPublicKey: new Uint8Array(b64ToUint8Array(ephemeralPublicKeyJwt.x))
package/dist/openpgp.js 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
  var openpgp = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1719,7 +1719,7 @@ var openpgp = (function (exports) {
1719
1719
  * @memberof module:config
1720
1720
  * @property {String} versionString A version string to be included in armored messages
1721
1721
  */
1722
- versionString: 'OpenPGP.js 6.1.1-patch.3',
1722
+ versionString: 'OpenPGP.js 6.1.1-patch.4',
1723
1723
  /**
1724
1724
  * @memberof module:config
1725
1725
  * @property {String} commentString A comment string to be included in armored messages
@@ -6916,7 +6916,15 @@ var openpgp = (function (exports) {
6916
6916
  case enums.publicKey.ed25519:
6917
6917
  try {
6918
6918
  const webCrypto = util.getWebCrypto();
6919
- const webCryptoKey = await webCrypto.generateKey('Ed25519', true, ['sign', 'verify']);
6919
+ const webCryptoKey = await webCrypto.generateKey('Ed25519', true, ['sign', 'verify'])
6920
+ .catch(err => {
6921
+ if (err.name === 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
6922
+ const newErr = new Error('Unexpected key generation issue');
6923
+ newErr.name = 'NotSupportedError';
6924
+ throw newErr;
6925
+ }
6926
+ throw err;
6927
+ });
6920
6928
 
6921
6929
  const privateKey = await webCrypto.exportKey('jwk', webCryptoKey.privateKey);
6922
6930
  const publicKey = await webCrypto.exportKey('jwk', webCryptoKey.publicKey);
@@ -6926,7 +6934,7 @@ var openpgp = (function (exports) {
6926
6934
  seed: b64ToUint8Array(privateKey.d, true)
6927
6935
  };
6928
6936
  } catch (err) {
6929
- if (err.name !== 'NotSupportedError' && err.name !== 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
6937
+ if (err.name !== 'NotSupportedError') {
6930
6938
  throw err;
6931
6939
  }
6932
6940
  const seed = getRandomBytes(getPayloadSize$1(algo));
@@ -8344,11 +8352,25 @@ var openpgp = (function (exports) {
8344
8352
  case enums.publicKey.x25519:
8345
8353
  try {
8346
8354
  const webCrypto = util.getWebCrypto();
8347
- const webCryptoKey = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits']);
8355
+ const webCryptoKey = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits'])
8356
+ .catch(err => {
8357
+ if (err.name === 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
8358
+ const newErr = new Error('Unexpected key generation issue');
8359
+ newErr.name = 'NotSupportedError';
8360
+ throw newErr;
8361
+ }
8362
+ throw err;
8363
+ });
8348
8364
 
8349
8365
  const privateKey = await webCrypto.exportKey('jwk', webCryptoKey.privateKey);
8350
8366
  const publicKey = await webCrypto.exportKey('jwk', webCryptoKey.publicKey);
8351
8367
 
8368
+ if (privateKey.x !== publicKey.x) { // Weird issue with Webkit on Linux: https://bugs.webkit.org/show_bug.cgi?id=289693
8369
+ const err = new Error('Unexpected mismatching public point');
8370
+ err.name = 'NotSupportedError';
8371
+ throw err;
8372
+ }
8373
+
8352
8374
  return {
8353
8375
  A: new Uint8Array(b64ToUint8Array(publicKey.x)),
8354
8376
  k: b64ToUint8Array(privateKey.d)
@@ -8506,15 +8528,29 @@ var openpgp = (function (exports) {
8506
8528
  case enums.publicKey.x25519:
8507
8529
  try {
8508
8530
  const webCrypto = util.getWebCrypto();
8531
+ const ephemeralKeyPair = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits'])
8532
+ .catch(err => {
8533
+ if (err.name === 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
8534
+ const newErr = new Error('Unexpected key generation issue');
8535
+ newErr.name = 'NotSupportedError';
8536
+ throw newErr;
8537
+ }
8538
+ throw err;
8539
+ });
8540
+ const ephemeralPublicKeyJwt = await webCrypto.exportKey('jwk', ephemeralKeyPair.publicKey);
8541
+ const ephemeralPrivateKeyJwt = await webCrypto.exportKey('jwk', ephemeralKeyPair.privateKey);
8542
+ if (ephemeralPrivateKeyJwt.x !== ephemeralPublicKeyJwt.x) { // Weird issue with Webkit on Linux: https://bugs.webkit.org/show_bug.cgi?id=289693
8543
+ const err = new Error('Unexpected mismatching public point');
8544
+ err.name = 'NotSupportedError';
8545
+ throw err;
8546
+ }
8509
8547
  const jwk = publicKeyToJWK(algo, recipientA);
8510
- const ephemeralKeyPair = await webCrypto.generateKey('X25519', true, ['deriveKey', 'deriveBits']);
8511
8548
  const recipientPublicKey = await webCrypto.importKey('jwk', jwk, 'X25519', false, []);
8512
8549
  const sharedSecretBuffer = await webCrypto.deriveBits(
8513
8550
  { name: 'X25519', public: recipientPublicKey },
8514
8551
  ephemeralKeyPair.privateKey,
8515
8552
  getPayloadSize(algo) * 8 // in bits
8516
8553
  );
8517
- const ephemeralPublicKeyJwt = await webCrypto.exportKey('jwk', ephemeralKeyPair.publicKey);
8518
8554
  return {
8519
8555
  sharedSecret: new Uint8Array(sharedSecretBuffer),
8520
8556
  ephemeralPublicKey: new Uint8Array(b64ToUint8Array(ephemeralPublicKeyJwt.x))