@protontech/openpgp 5.8.0-0 → 5.9.1-0
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 +58 -40
- 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 +61 -41
- 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 +61 -42
- package/dist/openpgp.js +61 -41
- 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 +61 -42
- package/openpgp.d.ts +21 -8
- package/package.json +2 -2
package/dist/node/openpgp.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v5.
|
|
1
|
+
/*! OpenPGP.js v5.9.1-0 - 2023-08-03 - 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';
|
|
@@ -1913,7 +1913,7 @@ const util = {
|
|
|
1913
1913
|
if (!util.isString(data)) {
|
|
1914
1914
|
return false;
|
|
1915
1915
|
}
|
|
1916
|
-
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}
|
|
1916
|
+
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}[0-9]*|xn--[a-zA-Z\-0-9]+)))$/;
|
|
1917
1917
|
return re.test(data);
|
|
1918
1918
|
},
|
|
1919
1919
|
|
|
@@ -2624,6 +2624,8 @@ var enums = {
|
|
|
2624
2624
|
splitPrivateKey: 16,
|
|
2625
2625
|
/** 0x20 - This key may be used for authentication. */
|
|
2626
2626
|
authentication: 32,
|
|
2627
|
+
/** This key may be used for forwarded communications */
|
|
2628
|
+
forwardedCommunication: 64,
|
|
2627
2629
|
/** 0x80 - The private component of this key may be in the
|
|
2628
2630
|
* possession of more than one person. */
|
|
2629
2631
|
sharedPrivateKey: 128
|
|
@@ -2828,6 +2830,13 @@ var config = {
|
|
|
2828
2830
|
* @property {Boolean} allowUnauthenticatedStream
|
|
2829
2831
|
*/
|
|
2830
2832
|
allowUnauthenticatedStream: false,
|
|
2833
|
+
/**
|
|
2834
|
+
* Allow decrypting forwarded messages, using keys with 0x40 ('forwarded communication') flag.
|
|
2835
|
+
* Note: this is related to a **non-standard feature**.
|
|
2836
|
+
* @memberof module:config
|
|
2837
|
+
* @property {Boolean} allowForwardedMessages
|
|
2838
|
+
*/
|
|
2839
|
+
allowForwardedMessages: false,
|
|
2831
2840
|
/**
|
|
2832
2841
|
* @memberof module:config
|
|
2833
2842
|
* @property {Boolean} checksumRequired Do not throw error when armor is missing a checksum
|
|
@@ -2904,6 +2913,14 @@ var config = {
|
|
|
2904
2913
|
* @property {Boolean} ignoreMalformedPackets Ignore malformed packets on parsing instead of throwing an error
|
|
2905
2914
|
*/
|
|
2906
2915
|
ignoreMalformedPackets: false,
|
|
2916
|
+
/**
|
|
2917
|
+
* Parsing of packets is normally restricted to a predefined set of packets. For example a Sym. Encrypted Integrity Protected Data Packet can only
|
|
2918
|
+
* contain a certain set of packets including LiteralDataPacket. With this setting we can allow additional packets, which is probably not advisable
|
|
2919
|
+
* as a global config setting, but can be used for specific function calls (e.g. decrypt method of Message).
|
|
2920
|
+
* @memberof module:config
|
|
2921
|
+
* @property {Array} additionalAllowedPackets Allow additional packets on parsing. Defined as array of packet classes, e.g. [PublicKeyPacket]
|
|
2922
|
+
*/
|
|
2923
|
+
additionalAllowedPackets: [],
|
|
2907
2924
|
/**
|
|
2908
2925
|
* @memberof module:config
|
|
2909
2926
|
* @property {Boolean} showVersion Whether to include {@link module:config/config.versionString} in armored messages
|
|
@@ -2918,7 +2935,7 @@ var config = {
|
|
|
2918
2935
|
* @memberof module:config
|
|
2919
2936
|
* @property {String} versionString A version string to be included in armored messages
|
|
2920
2937
|
*/
|
|
2921
|
-
versionString: 'OpenPGP.js 5.
|
|
2938
|
+
versionString: 'OpenPGP.js 5.9.1-0',
|
|
2922
2939
|
/**
|
|
2923
2940
|
* @memberof module:config
|
|
2924
2941
|
* @property {String} commentString A comment string to be included in armored messages
|
|
@@ -14414,7 +14431,7 @@ function buildEcdhParam(public_algo, oid, kdfParams, fingerprint) {
|
|
|
14414
14431
|
return util.concatUint8Array([
|
|
14415
14432
|
oid.write(),
|
|
14416
14433
|
new Uint8Array([public_algo]),
|
|
14417
|
-
kdfParams.
|
|
14434
|
+
kdfParams.write(true),
|
|
14418
14435
|
util.stringToUint8Array('Anonymous Sender '),
|
|
14419
14436
|
kdfParams.replacementFingerprint || fingerprint.subarray(0, 20)
|
|
14420
14437
|
]);
|
|
@@ -15256,32 +15273,28 @@ class ECDHSymmetricKey {
|
|
|
15256
15273
|
|
|
15257
15274
|
// OpenPGP.js - An OpenPGP implementation in javascript
|
|
15258
15275
|
|
|
15276
|
+
const VERSION_FORWARDING = 0xFF;
|
|
15277
|
+
|
|
15259
15278
|
class KDFParams {
|
|
15260
15279
|
/**
|
|
15261
15280
|
* @param {Integer} version Version, defaults to 1
|
|
15262
15281
|
* @param {enums.hash} hash Hash algorithm
|
|
15263
15282
|
* @param {enums.symmetric} cipher Symmetric algorithm
|
|
15264
|
-
* @param {
|
|
15265
|
-
* @param {Uint8Array} replacementFingerprint (v2 only) fingerprint to use instead of recipient one (v5 keys, the 20 leftmost bytes of the fingerprint)
|
|
15266
|
-
* @param {Uint8Array} replacementKDFParams (v2 only) serialized KDF params to use in KDF digest computation
|
|
15283
|
+
* @param {Uint8Array} replacementFingerprint (forwarding only) fingerprint to use instead of recipient one (v5 keys, the 20 leftmost bytes of the fingerprint)
|
|
15267
15284
|
*/
|
|
15268
15285
|
constructor(data) {
|
|
15269
15286
|
if (data) {
|
|
15270
|
-
const { version, hash, cipher,
|
|
15287
|
+
const { version, hash, cipher, replacementFingerprint } = data;
|
|
15271
15288
|
this.version = version || 1;
|
|
15272
15289
|
this.hash = hash;
|
|
15273
15290
|
this.cipher = cipher;
|
|
15274
15291
|
|
|
15275
|
-
this.flags = flags;
|
|
15276
15292
|
this.replacementFingerprint = replacementFingerprint;
|
|
15277
|
-
this.replacementKDFParams = replacementKDFParams;
|
|
15278
15293
|
} else {
|
|
15279
15294
|
this.version = null;
|
|
15280
15295
|
this.hash = null;
|
|
15281
15296
|
this.cipher = null;
|
|
15282
|
-
this.flags = null;
|
|
15283
15297
|
this.replacementFingerprint = null;
|
|
15284
|
-
this.replacementKDFParams = null;
|
|
15285
15298
|
}
|
|
15286
15299
|
}
|
|
15287
15300
|
|
|
@@ -15291,44 +15304,41 @@ class KDFParams {
|
|
|
15291
15304
|
* @returns {Number} Number of read bytes.
|
|
15292
15305
|
*/
|
|
15293
15306
|
read(input) {
|
|
15307
|
+
const totalBytes = input[0];
|
|
15294
15308
|
this.version = input[1];
|
|
15295
15309
|
this.hash = input[2];
|
|
15296
15310
|
this.cipher = input[3];
|
|
15297
15311
|
let readBytes = 4;
|
|
15298
15312
|
|
|
15299
|
-
if (this.version ===
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
readBytes += 20;
|
|
15304
|
-
}
|
|
15305
|
-
if (this.flags & enums.kdfFlags.replace_kdf_params) {
|
|
15306
|
-
const fieldLength = input[readBytes] + 1; // account for length
|
|
15307
|
-
this.replacementKDFParams = input.slice(readBytes, readBytes + fieldLength);
|
|
15308
|
-
readBytes += fieldLength;
|
|
15309
|
-
}
|
|
15313
|
+
if (this.version === VERSION_FORWARDING) {
|
|
15314
|
+
const fingerprintLength = totalBytes - readBytes + 1; // acount for length byte
|
|
15315
|
+
this.replacementFingerprint = input.slice(readBytes, readBytes + fingerprintLength);
|
|
15316
|
+
readBytes += fingerprintLength;
|
|
15310
15317
|
}
|
|
15311
15318
|
return readBytes;
|
|
15312
15319
|
}
|
|
15313
15320
|
|
|
15314
15321
|
/**
|
|
15315
15322
|
* Write KDFParams to an Uint8Array
|
|
15323
|
+
* @param {Boolean} [forReplacementParams] - forwarding only: whether to serialize data to use for replacement params
|
|
15316
15324
|
* @returns {Uint8Array} Array with the KDFParams value
|
|
15317
15325
|
*/
|
|
15318
|
-
write() {
|
|
15319
|
-
if (!this.version || this.version === 1) {
|
|
15326
|
+
write(forReplacementParams) {
|
|
15327
|
+
if (!this.version || this.version === 1 || forReplacementParams) {
|
|
15320
15328
|
return new Uint8Array([3, 1, this.hash, this.cipher]);
|
|
15321
15329
|
}
|
|
15322
15330
|
|
|
15323
|
-
const
|
|
15324
|
-
new Uint8Array([
|
|
15325
|
-
|
|
15326
|
-
|
|
15331
|
+
const forwardingFields = util.concatUint8Array([
|
|
15332
|
+
new Uint8Array([
|
|
15333
|
+
3 + this.replacementFingerprint.length,
|
|
15334
|
+
this.version,
|
|
15335
|
+
this.hash,
|
|
15336
|
+
this.cipher
|
|
15337
|
+
]),
|
|
15338
|
+
this.replacementFingerprint
|
|
15327
15339
|
]);
|
|
15328
15340
|
|
|
15329
|
-
|
|
15330
|
-
v2Fields[0] = v2Fields.length - 1;
|
|
15331
|
-
return new Uint8Array(v2Fields);
|
|
15341
|
+
return forwardingFields;
|
|
15332
15342
|
}
|
|
15333
15343
|
}
|
|
15334
15344
|
|
|
@@ -15999,10 +16009,12 @@ class Argon2S2K {
|
|
|
15999
16009
|
const decodedM = 2 << (this.encodedM - 1);
|
|
16000
16010
|
|
|
16001
16011
|
try {
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
|
|
16005
|
-
}
|
|
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
|
+
|
|
16006
16018
|
// important to keep local ref to argon2 in case the module is reloaded by another instance
|
|
16007
16019
|
const argon2 = await argon2Promise;
|
|
16008
16020
|
|
|
@@ -16022,6 +16034,7 @@ class Argon2S2K {
|
|
|
16022
16034
|
if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
|
|
16023
16035
|
// it will be awaited if needed at the next `produceKey` invocation
|
|
16024
16036
|
argon2Promise = loadArgonWasmModule();
|
|
16037
|
+
argon2Promise.catch(() => {});
|
|
16025
16038
|
}
|
|
16026
16039
|
return hash;
|
|
16027
16040
|
} catch (e) {
|
|
@@ -24298,6 +24311,9 @@ class PacketList extends Array {
|
|
|
24298
24311
|
* @async
|
|
24299
24312
|
*/
|
|
24300
24313
|
async read(bytes, allowedPackets, config$1 = config) {
|
|
24314
|
+
if (config$1.additionalAllowedPackets.length) {
|
|
24315
|
+
allowedPackets = { ...allowedPackets, ...util.constructAllowedPackets(config$1.additionalAllowedPackets) };
|
|
24316
|
+
}
|
|
24301
24317
|
this.stream = transformPair(bytes, async (readable, writable) => {
|
|
24302
24318
|
const writer = getWriter(writable);
|
|
24303
24319
|
try {
|
|
@@ -27851,7 +27867,8 @@ function isValidDecryptionKeyPacket(signature, config) {
|
|
|
27851
27867
|
|
|
27852
27868
|
return !signature.keyFlags ||
|
|
27853
27869
|
(signature.keyFlags[0] & enums.keyFlags.encryptCommunication) !== 0 ||
|
|
27854
|
-
(signature.keyFlags[0] & enums.keyFlags.encryptStorage) !== 0
|
|
27870
|
+
(signature.keyFlags[0] & enums.keyFlags.encryptStorage) !== 0 ||
|
|
27871
|
+
(config.allowForwardedMessages && (signature.keyFlags[0] & enums.keyFlags.forwardedCommunication) !== 0);
|
|
27855
27872
|
}
|
|
27856
27873
|
|
|
27857
27874
|
/**
|
|
@@ -28799,7 +28816,7 @@ class Key {
|
|
|
28799
28816
|
throw exception || new Error('Could not find primary user');
|
|
28800
28817
|
}
|
|
28801
28818
|
await Promise.all(users.map(async function (a) {
|
|
28802
|
-
return a.
|
|
28819
|
+
return a.selfCertification.revoked || a.user.isRevoked(a.selfCertification, null, date, config$1);
|
|
28803
28820
|
}));
|
|
28804
28821
|
// sort by primary user flag and signature creation time
|
|
28805
28822
|
const primaryUser = users.sort(function(a, b) {
|
|
@@ -29022,7 +29039,8 @@ class Key {
|
|
|
29022
29039
|
|
|
29023
29040
|
results.push(...signatures.map(
|
|
29024
29041
|
signature => ({
|
|
29025
|
-
userID: user.userID.userID,
|
|
29042
|
+
userID: user.userID ? user.userID.userID : null,
|
|
29043
|
+
userAttribute: user.userAttribute,
|
|
29026
29044
|
keyID: signature.keyID,
|
|
29027
29045
|
valid: signature.valid
|
|
29028
29046
|
}))
|
|
@@ -44663,8 +44681,9 @@ async function wasmLoader(memory, getSIMD, getNonSIMD) {
|
|
|
44663
44681
|
const importObject = { env: { memory } };
|
|
44664
44682
|
if (isSIMDSupported === undefined) {
|
|
44665
44683
|
try {
|
|
44666
|
-
|
|
44667
|
-
|
|
44684
|
+
const loaded = await getSIMD(importObject);
|
|
44685
|
+
isSIMDSupported = true;
|
|
44686
|
+
return loaded;
|
|
44668
44687
|
} catch(e) {
|
|
44669
44688
|
isSIMDSupported = false;
|
|
44670
44689
|
}
|
|
@@ -44760,4 +44779,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
44760
44779
|
'default': loadWasm
|
|
44761
44780
|
});
|
|
44762
44781
|
|
|
44763
|
-
export { AEADEncryptedDataPacket, CleartextMessage, CompressedDataPacket, LiteralDataPacket, MarkerPacket, Message, OnePassSignaturePacket, PacketList, PrivateKey, PublicKey, PublicKeyEncryptedSessionKeyPacket, PublicKeyPacket, PublicSubkeyPacket, SecretKeyPacket, SecretSubkeyPacket, Signature, SignaturePacket, Subkey, SymEncryptedIntegrityProtectedDataPacket, SymEncryptedSessionKeyPacket, SymmetricallyEncryptedDataPacket, TrustPacket, UnparseablePacket, UserAttributePacket, UserIDPacket, armor, config, createCleartextMessage, createMessage, decrypt$4 as decrypt, decryptKey, decryptSessionKeys, encrypt$4 as encrypt, encryptKey, encryptSessionKey, enums, generateKey, generateSessionKey$1 as generateSessionKey, readCleartextMessage, readKey, readKeys, readMessage, readPrivateKey, readPrivateKeys, readSignature, reformatKey, revokeKey, sign$5 as sign, unarmor, verify$5 as verify };
|
|
44782
|
+
export { AEADEncryptedDataPacket, CleartextMessage, CompressedDataPacket, KDFParams, LiteralDataPacket, MarkerPacket, Message, OnePassSignaturePacket, PacketList, PrivateKey, PublicKey, PublicKeyEncryptedSessionKeyPacket, PublicKeyPacket, PublicSubkeyPacket, SecretKeyPacket, SecretSubkeyPacket, Signature, SignaturePacket, Subkey, SymEncryptedIntegrityProtectedDataPacket, SymEncryptedSessionKeyPacket, SymmetricallyEncryptedDataPacket, TrustPacket, UnparseablePacket, UserAttributePacket, UserIDPacket, armor, config, createCleartextMessage, createMessage, decrypt$4 as decrypt, decryptKey, decryptSessionKeys, encrypt$4 as encrypt, encryptKey, encryptSessionKey, enums, generateKey, generateSessionKey$1 as generateSessionKey, readCleartextMessage, readKey, readKeys, readMessage, readPrivateKey, readPrivateKeys, readSignature, reformatKey, revokeKey, sign$5 as sign, unarmor, verify$5 as verify };
|
package/dist/openpgp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v5.
|
|
1
|
+
/*! OpenPGP.js v5.9.1-0 - 2023-08-03 - 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
|
|
|
@@ -1910,7 +1910,7 @@ var openpgp = (function (exports) {
|
|
|
1910
1910
|
if (!util.isString(data)) {
|
|
1911
1911
|
return false;
|
|
1912
1912
|
}
|
|
1913
|
-
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}
|
|
1913
|
+
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}[0-9]*|xn--[a-zA-Z\-0-9]+)))$/;
|
|
1914
1914
|
return re.test(data);
|
|
1915
1915
|
},
|
|
1916
1916
|
|
|
@@ -2621,6 +2621,8 @@ var openpgp = (function (exports) {
|
|
|
2621
2621
|
splitPrivateKey: 16,
|
|
2622
2622
|
/** 0x20 - This key may be used for authentication. */
|
|
2623
2623
|
authentication: 32,
|
|
2624
|
+
/** This key may be used for forwarded communications */
|
|
2625
|
+
forwardedCommunication: 64,
|
|
2624
2626
|
/** 0x80 - The private component of this key may be in the
|
|
2625
2627
|
* possession of more than one person. */
|
|
2626
2628
|
sharedPrivateKey: 128
|
|
@@ -2825,6 +2827,13 @@ var openpgp = (function (exports) {
|
|
|
2825
2827
|
* @property {Boolean} allowUnauthenticatedStream
|
|
2826
2828
|
*/
|
|
2827
2829
|
allowUnauthenticatedStream: false,
|
|
2830
|
+
/**
|
|
2831
|
+
* Allow decrypting forwarded messages, using keys with 0x40 ('forwarded communication') flag.
|
|
2832
|
+
* Note: this is related to a **non-standard feature**.
|
|
2833
|
+
* @memberof module:config
|
|
2834
|
+
* @property {Boolean} allowForwardedMessages
|
|
2835
|
+
*/
|
|
2836
|
+
allowForwardedMessages: false,
|
|
2828
2837
|
/**
|
|
2829
2838
|
* @memberof module:config
|
|
2830
2839
|
* @property {Boolean} checksumRequired Do not throw error when armor is missing a checksum
|
|
@@ -2901,6 +2910,14 @@ var openpgp = (function (exports) {
|
|
|
2901
2910
|
* @property {Boolean} ignoreMalformedPackets Ignore malformed packets on parsing instead of throwing an error
|
|
2902
2911
|
*/
|
|
2903
2912
|
ignoreMalformedPackets: false,
|
|
2913
|
+
/**
|
|
2914
|
+
* Parsing of packets is normally restricted to a predefined set of packets. For example a Sym. Encrypted Integrity Protected Data Packet can only
|
|
2915
|
+
* contain a certain set of packets including LiteralDataPacket. With this setting we can allow additional packets, which is probably not advisable
|
|
2916
|
+
* as a global config setting, but can be used for specific function calls (e.g. decrypt method of Message).
|
|
2917
|
+
* @memberof module:config
|
|
2918
|
+
* @property {Array} additionalAllowedPackets Allow additional packets on parsing. Defined as array of packet classes, e.g. [PublicKeyPacket]
|
|
2919
|
+
*/
|
|
2920
|
+
additionalAllowedPackets: [],
|
|
2904
2921
|
/**
|
|
2905
2922
|
* @memberof module:config
|
|
2906
2923
|
* @property {Boolean} showVersion Whether to include {@link module:config/config.versionString} in armored messages
|
|
@@ -2915,7 +2932,7 @@ var openpgp = (function (exports) {
|
|
|
2915
2932
|
* @memberof module:config
|
|
2916
2933
|
* @property {String} versionString A version string to be included in armored messages
|
|
2917
2934
|
*/
|
|
2918
|
-
versionString: 'OpenPGP.js 5.
|
|
2935
|
+
versionString: 'OpenPGP.js 5.9.1-0',
|
|
2919
2936
|
/**
|
|
2920
2937
|
* @memberof module:config
|
|
2921
2938
|
* @property {String} commentString A comment string to be included in armored messages
|
|
@@ -14405,7 +14422,7 @@ var openpgp = (function (exports) {
|
|
|
14405
14422
|
return util.concatUint8Array([
|
|
14406
14423
|
oid.write(),
|
|
14407
14424
|
new Uint8Array([public_algo]),
|
|
14408
|
-
kdfParams.
|
|
14425
|
+
kdfParams.write(true),
|
|
14409
14426
|
util.stringToUint8Array('Anonymous Sender '),
|
|
14410
14427
|
kdfParams.replacementFingerprint || fingerprint.subarray(0, 20)
|
|
14411
14428
|
]);
|
|
@@ -15247,32 +15264,28 @@ var openpgp = (function (exports) {
|
|
|
15247
15264
|
|
|
15248
15265
|
// OpenPGP.js - An OpenPGP implementation in javascript
|
|
15249
15266
|
|
|
15267
|
+
const VERSION_FORWARDING = 0xFF;
|
|
15268
|
+
|
|
15250
15269
|
class KDFParams {
|
|
15251
15270
|
/**
|
|
15252
15271
|
* @param {Integer} version Version, defaults to 1
|
|
15253
15272
|
* @param {enums.hash} hash Hash algorithm
|
|
15254
15273
|
* @param {enums.symmetric} cipher Symmetric algorithm
|
|
15255
|
-
* @param {
|
|
15256
|
-
* @param {Uint8Array} replacementFingerprint (v2 only) fingerprint to use instead of recipient one (v5 keys, the 20 leftmost bytes of the fingerprint)
|
|
15257
|
-
* @param {Uint8Array} replacementKDFParams (v2 only) serialized KDF params to use in KDF digest computation
|
|
15274
|
+
* @param {Uint8Array} replacementFingerprint (forwarding only) fingerprint to use instead of recipient one (v5 keys, the 20 leftmost bytes of the fingerprint)
|
|
15258
15275
|
*/
|
|
15259
15276
|
constructor(data) {
|
|
15260
15277
|
if (data) {
|
|
15261
|
-
const { version, hash, cipher,
|
|
15278
|
+
const { version, hash, cipher, replacementFingerprint } = data;
|
|
15262
15279
|
this.version = version || 1;
|
|
15263
15280
|
this.hash = hash;
|
|
15264
15281
|
this.cipher = cipher;
|
|
15265
15282
|
|
|
15266
|
-
this.flags = flags;
|
|
15267
15283
|
this.replacementFingerprint = replacementFingerprint;
|
|
15268
|
-
this.replacementKDFParams = replacementKDFParams;
|
|
15269
15284
|
} else {
|
|
15270
15285
|
this.version = null;
|
|
15271
15286
|
this.hash = null;
|
|
15272
15287
|
this.cipher = null;
|
|
15273
|
-
this.flags = null;
|
|
15274
15288
|
this.replacementFingerprint = null;
|
|
15275
|
-
this.replacementKDFParams = null;
|
|
15276
15289
|
}
|
|
15277
15290
|
}
|
|
15278
15291
|
|
|
@@ -15282,44 +15295,41 @@ var openpgp = (function (exports) {
|
|
|
15282
15295
|
* @returns {Number} Number of read bytes.
|
|
15283
15296
|
*/
|
|
15284
15297
|
read(input) {
|
|
15298
|
+
const totalBytes = input[0];
|
|
15285
15299
|
this.version = input[1];
|
|
15286
15300
|
this.hash = input[2];
|
|
15287
15301
|
this.cipher = input[3];
|
|
15288
15302
|
let readBytes = 4;
|
|
15289
15303
|
|
|
15290
|
-
if (this.version ===
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
readBytes += 20;
|
|
15295
|
-
}
|
|
15296
|
-
if (this.flags & enums.kdfFlags.replace_kdf_params) {
|
|
15297
|
-
const fieldLength = input[readBytes] + 1; // account for length
|
|
15298
|
-
this.replacementKDFParams = input.slice(readBytes, readBytes + fieldLength);
|
|
15299
|
-
readBytes += fieldLength;
|
|
15300
|
-
}
|
|
15304
|
+
if (this.version === VERSION_FORWARDING) {
|
|
15305
|
+
const fingerprintLength = totalBytes - readBytes + 1; // acount for length byte
|
|
15306
|
+
this.replacementFingerprint = input.slice(readBytes, readBytes + fingerprintLength);
|
|
15307
|
+
readBytes += fingerprintLength;
|
|
15301
15308
|
}
|
|
15302
15309
|
return readBytes;
|
|
15303
15310
|
}
|
|
15304
15311
|
|
|
15305
15312
|
/**
|
|
15306
15313
|
* Write KDFParams to an Uint8Array
|
|
15314
|
+
* @param {Boolean} [forReplacementParams] - forwarding only: whether to serialize data to use for replacement params
|
|
15307
15315
|
* @returns {Uint8Array} Array with the KDFParams value
|
|
15308
15316
|
*/
|
|
15309
|
-
write() {
|
|
15310
|
-
if (!this.version || this.version === 1) {
|
|
15317
|
+
write(forReplacementParams) {
|
|
15318
|
+
if (!this.version || this.version === 1 || forReplacementParams) {
|
|
15311
15319
|
return new Uint8Array([3, 1, this.hash, this.cipher]);
|
|
15312
15320
|
}
|
|
15313
15321
|
|
|
15314
|
-
const
|
|
15315
|
-
new Uint8Array([
|
|
15316
|
-
|
|
15317
|
-
|
|
15322
|
+
const forwardingFields = util.concatUint8Array([
|
|
15323
|
+
new Uint8Array([
|
|
15324
|
+
3 + this.replacementFingerprint.length,
|
|
15325
|
+
this.version,
|
|
15326
|
+
this.hash,
|
|
15327
|
+
this.cipher
|
|
15328
|
+
]),
|
|
15329
|
+
this.replacementFingerprint
|
|
15318
15330
|
]);
|
|
15319
15331
|
|
|
15320
|
-
|
|
15321
|
-
v2Fields[0] = v2Fields.length - 1;
|
|
15322
|
-
return new Uint8Array(v2Fields);
|
|
15332
|
+
return forwardingFields;
|
|
15323
15333
|
}
|
|
15324
15334
|
}
|
|
15325
15335
|
|
|
@@ -15990,10 +16000,12 @@ var openpgp = (function (exports) {
|
|
|
15990
16000
|
const decodedM = 2 << (this.encodedM - 1);
|
|
15991
16001
|
|
|
15992
16002
|
try {
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
|
|
15996
|
-
}
|
|
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
|
+
|
|
15997
16009
|
// important to keep local ref to argon2 in case the module is reloaded by another instance
|
|
15998
16010
|
const argon2 = await argon2Promise;
|
|
15999
16011
|
|
|
@@ -16013,6 +16025,7 @@ var openpgp = (function (exports) {
|
|
|
16013
16025
|
if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
|
|
16014
16026
|
// it will be awaited if needed at the next `produceKey` invocation
|
|
16015
16027
|
argon2Promise = loadArgonWasmModule();
|
|
16028
|
+
argon2Promise.catch(() => {});
|
|
16016
16029
|
}
|
|
16017
16030
|
return hash;
|
|
16018
16031
|
} catch (e) {
|
|
@@ -24289,6 +24302,9 @@ var openpgp = (function (exports) {
|
|
|
24289
24302
|
* @async
|
|
24290
24303
|
*/
|
|
24291
24304
|
async read(bytes, allowedPackets, config$1 = config) {
|
|
24305
|
+
if (config$1.additionalAllowedPackets.length) {
|
|
24306
|
+
allowedPackets = { ...allowedPackets, ...util.constructAllowedPackets(config$1.additionalAllowedPackets) };
|
|
24307
|
+
}
|
|
24292
24308
|
this.stream = transformPair(bytes, async (readable, writable) => {
|
|
24293
24309
|
const writer = getWriter(writable);
|
|
24294
24310
|
try {
|
|
@@ -27842,7 +27858,8 @@ var openpgp = (function (exports) {
|
|
|
27842
27858
|
|
|
27843
27859
|
return !signature.keyFlags ||
|
|
27844
27860
|
(signature.keyFlags[0] & enums.keyFlags.encryptCommunication) !== 0 ||
|
|
27845
|
-
(signature.keyFlags[0] & enums.keyFlags.encryptStorage) !== 0
|
|
27861
|
+
(signature.keyFlags[0] & enums.keyFlags.encryptStorage) !== 0 ||
|
|
27862
|
+
(config.allowForwardedMessages && (signature.keyFlags[0] & enums.keyFlags.forwardedCommunication) !== 0);
|
|
27846
27863
|
}
|
|
27847
27864
|
|
|
27848
27865
|
/**
|
|
@@ -28790,7 +28807,7 @@ var openpgp = (function (exports) {
|
|
|
28790
28807
|
throw exception || new Error('Could not find primary user');
|
|
28791
28808
|
}
|
|
28792
28809
|
await Promise.all(users.map(async function (a) {
|
|
28793
|
-
return a.
|
|
28810
|
+
return a.selfCertification.revoked || a.user.isRevoked(a.selfCertification, null, date, config$1);
|
|
28794
28811
|
}));
|
|
28795
28812
|
// sort by primary user flag and signature creation time
|
|
28796
28813
|
const primaryUser = users.sort(function(a, b) {
|
|
@@ -29013,7 +29030,8 @@ var openpgp = (function (exports) {
|
|
|
29013
29030
|
|
|
29014
29031
|
results.push(...signatures.map(
|
|
29015
29032
|
signature => ({
|
|
29016
|
-
userID: user.userID.userID,
|
|
29033
|
+
userID: user.userID ? user.userID.userID : null,
|
|
29034
|
+
userAttribute: user.userAttribute,
|
|
29017
29035
|
keyID: signature.keyID,
|
|
29018
29036
|
valid: signature.valid
|
|
29019
29037
|
}))
|
|
@@ -44654,8 +44672,9 @@ var openpgp = (function (exports) {
|
|
|
44654
44672
|
const importObject = { env: { memory } };
|
|
44655
44673
|
if (isSIMDSupported === undefined) {
|
|
44656
44674
|
try {
|
|
44657
|
-
|
|
44658
|
-
|
|
44675
|
+
const loaded = await getSIMD(importObject);
|
|
44676
|
+
isSIMDSupported = true;
|
|
44677
|
+
return loaded;
|
|
44659
44678
|
} catch(e) {
|
|
44660
44679
|
isSIMDSupported = false;
|
|
44661
44680
|
}
|
|
@@ -44748,6 +44767,7 @@ var openpgp = (function (exports) {
|
|
|
44748
44767
|
exports.AEADEncryptedDataPacket = AEADEncryptedDataPacket;
|
|
44749
44768
|
exports.CleartextMessage = CleartextMessage;
|
|
44750
44769
|
exports.CompressedDataPacket = CompressedDataPacket;
|
|
44770
|
+
exports.KDFParams = KDFParams;
|
|
44751
44771
|
exports.LiteralDataPacket = LiteralDataPacket;
|
|
44752
44772
|
exports.MarkerPacket = MarkerPacket;
|
|
44753
44773
|
exports.Message = Message;
|