@protontech/openpgp 5.9.0 → 5.9.1-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/lightweight/argon2id.min.mjs +2 -2
- package/dist/lightweight/argon2id.min.mjs.map +1 -1
- package/dist/lightweight/argon2id.mjs +4 -3
- package/dist/lightweight/bn.interface.min.mjs +1 -1
- package/dist/lightweight/bn.interface.mjs +1 -1
- package/dist/lightweight/bn.min.mjs +1 -1
- package/dist/lightweight/bn.mjs +1 -1
- package/dist/lightweight/elliptic.min.mjs +1 -1
- package/dist/lightweight/elliptic.mjs +1 -1
- package/dist/lightweight/openpgp.min.mjs +2 -2
- package/dist/lightweight/openpgp.min.mjs.map +1 -1
- package/dist/lightweight/openpgp.mjs +24 -9
- package/dist/lightweight/ponyfill.es6.min.mjs +1 -1
- package/dist/lightweight/ponyfill.es6.mjs +1 -1
- package/dist/lightweight/web-streams-adapter.min.mjs +1 -1
- package/dist/lightweight/web-streams-adapter.mjs +1 -1
- package/dist/node/openpgp.js +27 -11
- package/dist/node/openpgp.min.js +3 -3
- package/dist/node/openpgp.min.js.map +1 -1
- package/dist/node/openpgp.min.mjs +3 -3
- package/dist/node/openpgp.min.mjs.map +1 -1
- package/dist/node/openpgp.mjs +27 -11
- package/dist/openpgp.js +27 -11
- package/dist/openpgp.min.js +3 -3
- package/dist/openpgp.min.js.map +1 -1
- package/dist/openpgp.min.mjs +3 -3
- package/dist/openpgp.min.mjs.map +1 -1
- package/dist/openpgp.mjs +27 -11
- package/openpgp.d.ts +2 -0
- package/package.json +2 -2
package/dist/node/openpgp.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v5.9.
|
|
1
|
+
/*! OpenPGP.js v5.9.1-1 - 2023-09-06 - 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 buffer from 'buffer';
|
|
@@ -2935,7 +2935,7 @@ var config = {
|
|
|
2935
2935
|
* @memberof module:config
|
|
2936
2936
|
* @property {String} versionString A version string to be included in armored messages
|
|
2937
2937
|
*/
|
|
2938
|
-
versionString: 'OpenPGP.js 5.9.
|
|
2938
|
+
versionString: 'OpenPGP.js 5.9.1-1',
|
|
2939
2939
|
/**
|
|
2940
2940
|
* @memberof module:config
|
|
2941
2941
|
* @property {String} commentString A comment string to be included in armored messages
|
|
@@ -16009,10 +16009,12 @@ class Argon2S2K {
|
|
|
16009
16009
|
const decodedM = 2 << (this.encodedM - 1);
|
|
16010
16010
|
|
|
16011
16011
|
try {
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16015
|
-
}
|
|
16012
|
+
// on first load, the argon2 lib is imported and the WASM module is initialized.
|
|
16013
|
+
// the two steps need to be atomic to avoid race conditions causing multiple wasm modules
|
|
16014
|
+
// being loaded when `argon2Promise` is not initialized.
|
|
16015
|
+
loadArgonWasmModule = loadArgonWasmModule || (await Promise.resolve().then(function () { return index; })).default;
|
|
16016
|
+
argon2Promise = argon2Promise || loadArgonWasmModule();
|
|
16017
|
+
|
|
16016
16018
|
// important to keep local ref to argon2 in case the module is reloaded by another instance
|
|
16017
16019
|
const argon2 = await argon2Promise;
|
|
16018
16020
|
|
|
@@ -16032,6 +16034,7 @@ class Argon2S2K {
|
|
|
16032
16034
|
if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
|
|
16033
16035
|
// it will be awaited if needed at the next `produceKey` invocation
|
|
16034
16036
|
argon2Promise = loadArgonWasmModule();
|
|
16037
|
+
argon2Promise.catch(() => {});
|
|
16035
16038
|
}
|
|
16036
16039
|
return hash;
|
|
16037
16040
|
} catch (e) {
|
|
@@ -27563,7 +27566,9 @@ async function createBindingSignature(subkey, primaryKey, options, config) {
|
|
|
27563
27566
|
signatureType: enums.signature.keyBinding
|
|
27564
27567
|
}, options.date, undefined, undefined, undefined, config);
|
|
27565
27568
|
} else {
|
|
27566
|
-
subkeySignaturePacket.keyFlags =
|
|
27569
|
+
subkeySignaturePacket.keyFlags = options.forwarding ?
|
|
27570
|
+
[enums.keyFlags.forwardedCommunication] :
|
|
27571
|
+
[enums.keyFlags.encryptCommunication | enums.keyFlags.encryptStorage];
|
|
27567
27572
|
}
|
|
27568
27573
|
if (options.keyExpirationTime > 0) {
|
|
27569
27574
|
subkeySignaturePacket.keyExpirationTime = options.keyExpirationTime;
|
|
@@ -27801,6 +27806,10 @@ function sanitizeKeyOptions(options, subkeyDefaults = {}) {
|
|
|
27801
27806
|
options.date = options.date || subkeyDefaults.date;
|
|
27802
27807
|
|
|
27803
27808
|
options.sign = options.sign || false;
|
|
27809
|
+
options.forwarding = options.forwarding || false;
|
|
27810
|
+
if (options.sign && options.forwarding) {
|
|
27811
|
+
throw new Error('Incompatible options: "sign" and "forwarding" cannot be set together');
|
|
27812
|
+
}
|
|
27804
27813
|
|
|
27805
27814
|
switch (options.type) {
|
|
27806
27815
|
case 'ecc':
|
|
@@ -27857,7 +27866,12 @@ function isValidEncryptionKeyPacket(keyPacket, signature) {
|
|
|
27857
27866
|
}
|
|
27858
27867
|
|
|
27859
27868
|
function isValidDecryptionKeyPacket(signature, config) {
|
|
27860
|
-
|
|
27869
|
+
const isSigningKey = !signature.keyFlags ||
|
|
27870
|
+
(signature.keyFlags[0] & enums.keyFlags.sign) !== 0 ||
|
|
27871
|
+
(signature.keyFlags[0] & enums.keyFlags.certifyKeys) !== 0 ||
|
|
27872
|
+
(signature.keyFlags[0] & enums.keyFlags.authentication) !== 0;
|
|
27873
|
+
|
|
27874
|
+
if (isSigningKey && config.allowInsecureDecryptionWithSigningKeys) {
|
|
27861
27875
|
// This is only relevant for RSA keys, all other signing algorithms cannot decrypt
|
|
27862
27876
|
return true;
|
|
27863
27877
|
}
|
|
@@ -29456,7 +29470,8 @@ async function reformat(options, config) {
|
|
|
29456
29470
|
getLatestValidSignature(subkey.bindingSignatures, secretKeyPacket, enums.signature.subkeyBinding, dataToVerify, null, config)
|
|
29457
29471
|
).catch(() => ({}));
|
|
29458
29472
|
return {
|
|
29459
|
-
sign: bindingSignature.keyFlags && (bindingSignature.keyFlags[0] & enums.keyFlags.signData)
|
|
29473
|
+
sign: bindingSignature.keyFlags && (bindingSignature.keyFlags[0] & enums.keyFlags.signData),
|
|
29474
|
+
forwarding: bindingSignature.keyFlags && (bindingSignature.keyFlags[0] & enums.keyFlags.forwardedCommunication)
|
|
29460
29475
|
};
|
|
29461
29476
|
}));
|
|
29462
29477
|
}
|
|
@@ -44678,8 +44693,9 @@ async function wasmLoader(memory, getSIMD, getNonSIMD) {
|
|
|
44678
44693
|
const importObject = { env: { memory } };
|
|
44679
44694
|
if (isSIMDSupported === undefined) {
|
|
44680
44695
|
try {
|
|
44681
|
-
|
|
44682
|
-
|
|
44696
|
+
const loaded = await getSIMD(importObject);
|
|
44697
|
+
isSIMDSupported = true;
|
|
44698
|
+
return loaded;
|
|
44683
44699
|
} catch(e) {
|
|
44684
44700
|
isSIMDSupported = false;
|
|
44685
44701
|
}
|
package/dist/openpgp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v5.9.
|
|
1
|
+
/*! OpenPGP.js v5.9.1-1 - 2023-09-06 - 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
|
|
|
@@ -2932,7 +2932,7 @@ var openpgp = (function (exports) {
|
|
|
2932
2932
|
* @memberof module:config
|
|
2933
2933
|
* @property {String} versionString A version string to be included in armored messages
|
|
2934
2934
|
*/
|
|
2935
|
-
versionString: 'OpenPGP.js 5.9.
|
|
2935
|
+
versionString: 'OpenPGP.js 5.9.1-1',
|
|
2936
2936
|
/**
|
|
2937
2937
|
* @memberof module:config
|
|
2938
2938
|
* @property {String} commentString A comment string to be included in armored messages
|
|
@@ -16000,10 +16000,12 @@ var openpgp = (function (exports) {
|
|
|
16000
16000
|
const decodedM = 2 << (this.encodedM - 1);
|
|
16001
16001
|
|
|
16002
16002
|
try {
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
|
|
16006
|
-
}
|
|
16003
|
+
// on first load, the argon2 lib is imported and the WASM module is initialized.
|
|
16004
|
+
// the two steps need to be atomic to avoid race conditions causing multiple wasm modules
|
|
16005
|
+
// being loaded when `argon2Promise` is not initialized.
|
|
16006
|
+
loadArgonWasmModule = loadArgonWasmModule || (await Promise.resolve().then(function () { return index; })).default;
|
|
16007
|
+
argon2Promise = argon2Promise || loadArgonWasmModule();
|
|
16008
|
+
|
|
16007
16009
|
// important to keep local ref to argon2 in case the module is reloaded by another instance
|
|
16008
16010
|
const argon2 = await argon2Promise;
|
|
16009
16011
|
|
|
@@ -16023,6 +16025,7 @@ var openpgp = (function (exports) {
|
|
|
16023
16025
|
if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
|
|
16024
16026
|
// it will be awaited if needed at the next `produceKey` invocation
|
|
16025
16027
|
argon2Promise = loadArgonWasmModule();
|
|
16028
|
+
argon2Promise.catch(() => {});
|
|
16026
16029
|
}
|
|
16027
16030
|
return hash;
|
|
16028
16031
|
} catch (e) {
|
|
@@ -27554,7 +27557,9 @@ var openpgp = (function (exports) {
|
|
|
27554
27557
|
signatureType: enums.signature.keyBinding
|
|
27555
27558
|
}, options.date, undefined, undefined, undefined, config);
|
|
27556
27559
|
} else {
|
|
27557
|
-
subkeySignaturePacket.keyFlags =
|
|
27560
|
+
subkeySignaturePacket.keyFlags = options.forwarding ?
|
|
27561
|
+
[enums.keyFlags.forwardedCommunication] :
|
|
27562
|
+
[enums.keyFlags.encryptCommunication | enums.keyFlags.encryptStorage];
|
|
27558
27563
|
}
|
|
27559
27564
|
if (options.keyExpirationTime > 0) {
|
|
27560
27565
|
subkeySignaturePacket.keyExpirationTime = options.keyExpirationTime;
|
|
@@ -27792,6 +27797,10 @@ var openpgp = (function (exports) {
|
|
|
27792
27797
|
options.date = options.date || subkeyDefaults.date;
|
|
27793
27798
|
|
|
27794
27799
|
options.sign = options.sign || false;
|
|
27800
|
+
options.forwarding = options.forwarding || false;
|
|
27801
|
+
if (options.sign && options.forwarding) {
|
|
27802
|
+
throw new Error('Incompatible options: "sign" and "forwarding" cannot be set together');
|
|
27803
|
+
}
|
|
27795
27804
|
|
|
27796
27805
|
switch (options.type) {
|
|
27797
27806
|
case 'ecc':
|
|
@@ -27848,7 +27857,12 @@ var openpgp = (function (exports) {
|
|
|
27848
27857
|
}
|
|
27849
27858
|
|
|
27850
27859
|
function isValidDecryptionKeyPacket(signature, config) {
|
|
27851
|
-
|
|
27860
|
+
const isSigningKey = !signature.keyFlags ||
|
|
27861
|
+
(signature.keyFlags[0] & enums.keyFlags.sign) !== 0 ||
|
|
27862
|
+
(signature.keyFlags[0] & enums.keyFlags.certifyKeys) !== 0 ||
|
|
27863
|
+
(signature.keyFlags[0] & enums.keyFlags.authentication) !== 0;
|
|
27864
|
+
|
|
27865
|
+
if (isSigningKey && config.allowInsecureDecryptionWithSigningKeys) {
|
|
27852
27866
|
// This is only relevant for RSA keys, all other signing algorithms cannot decrypt
|
|
27853
27867
|
return true;
|
|
27854
27868
|
}
|
|
@@ -29447,7 +29461,8 @@ var openpgp = (function (exports) {
|
|
|
29447
29461
|
getLatestValidSignature(subkey.bindingSignatures, secretKeyPacket, enums.signature.subkeyBinding, dataToVerify, null, config)
|
|
29448
29462
|
).catch(() => ({}));
|
|
29449
29463
|
return {
|
|
29450
|
-
sign: bindingSignature.keyFlags && (bindingSignature.keyFlags[0] & enums.keyFlags.signData)
|
|
29464
|
+
sign: bindingSignature.keyFlags && (bindingSignature.keyFlags[0] & enums.keyFlags.signData),
|
|
29465
|
+
forwarding: bindingSignature.keyFlags && (bindingSignature.keyFlags[0] & enums.keyFlags.forwardedCommunication)
|
|
29451
29466
|
};
|
|
29452
29467
|
}));
|
|
29453
29468
|
}
|
|
@@ -44669,8 +44684,9 @@ var openpgp = (function (exports) {
|
|
|
44669
44684
|
const importObject = { env: { memory } };
|
|
44670
44685
|
if (isSIMDSupported === undefined) {
|
|
44671
44686
|
try {
|
|
44672
|
-
|
|
44673
|
-
|
|
44687
|
+
const loaded = await getSIMD(importObject);
|
|
44688
|
+
isSIMDSupported = true;
|
|
44689
|
+
return loaded;
|
|
44674
44690
|
} catch(e) {
|
|
44675
44691
|
isSIMDSupported = false;
|
|
44676
44692
|
}
|