@protontech/openpgp 5.7.0 → 5.9.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/openpgp.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! OpenPGP.js v5.7.0 - 2023-03-06 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v5.9.0 - 2023-05-15 - 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,}|xn--[a-zA-Z\-0-9]+)))$/;
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
 
@@ -2306,6 +2306,7 @@ var openpgp = (function (exports) {
2306
2306
  simple: 0,
2307
2307
  salted: 1,
2308
2308
  iterated: 3,
2309
+ argon2: 4,
2309
2310
  gnu: 101
2310
2311
  },
2311
2312
 
@@ -2620,6 +2621,8 @@ var openpgp = (function (exports) {
2620
2621
  splitPrivateKey: 16,
2621
2622
  /** 0x20 - This key may be used for authentication. */
2622
2623
  authentication: 32,
2624
+ /** This key may be used for forwarded communications */
2625
+ forwardedCommunication: 64,
2623
2626
  /** 0x80 - The private component of this key may be in the
2624
2627
  * possession of more than one person. */
2625
2628
  sharedPrivateKey: 128
@@ -2770,12 +2773,41 @@ var openpgp = (function (exports) {
2770
2773
  */
2771
2774
  v5Keys: false,
2772
2775
  /**
2773
- * {@link https://tools.ietf.org/html/rfc4880#section-3.7.1.3|RFC4880 3.7.1.3}:
2774
- * Iteration Count Byte for S2K (String to Key)
2776
+ * S2K (String to Key) type, used for key derivation in the context of secret key encryption
2777
+ * and password-encrypted data. Weaker s2k options are not allowed.
2778
+ * Note: Argon2 is the strongest option but not all OpenPGP implementations are compatible with it
2779
+ * (pending standardisation).
2780
+ * @memberof module:config
2781
+ * @property {enums.s2k.argon2|enums.s2k.iterated} s2kType {@link module:enums.s2k}
2782
+ */
2783
+ s2kType: enums.s2k.iterated,
2784
+ /**
2785
+ * {@link https://tools.ietf.org/html/rfc4880#section-3.7.1.3| RFC4880 3.7.1.3}:
2786
+ * Iteration Count Byte for Iterated and Salted S2K (String to Key).
2787
+ * Only relevant if `config.s2kType` is set to `enums.s2k.iterated`.
2788
+ * Note: this is the exponent value, not the final number of iterations (refer to specs for more details).
2775
2789
  * @memberof module:config
2776
2790
  * @property {Integer} s2kIterationCountByte
2777
2791
  */
2778
2792
  s2kIterationCountByte: 224,
2793
+ /**
2794
+ * {@link https://tools.ietf.org/html/draft-ietf-openpgp-crypto-refresh-07.html#section-3.7.1.4| draft-crypto-refresh 3.7.1.4}:
2795
+ * Argon2 parameters for S2K (String to Key).
2796
+ * Only relevant if `config.s2kType` is set to `enums.s2k.argon2`.
2797
+ * Default settings correspond to the second recommendation from RFC9106 ("uniformly safe option"),
2798
+ * to ensure compatibility with memory-constrained environments.
2799
+ * For more details on the choice of parameters, see https://tools.ietf.org/html/rfc9106#section-4.
2800
+ * @memberof module:config
2801
+ * @property {Object} params
2802
+ * @property {Integer} params.passes - number of iterations t
2803
+ * @property {Integer} params.parallelism - degree of parallelism p
2804
+ * @property {Integer} params.memoryExponent - one-octet exponent indicating the memory size, which will be: 2**memoryExponent kibibytes.
2805
+ */
2806
+ s2kArgon2Params: {
2807
+ passes: 3,
2808
+ parallelism: 4, // lanes
2809
+ memoryExponent: 16 // 64 MiB of RAM
2810
+ },
2779
2811
  /**
2780
2812
  * Allow decryption of messages without integrity protection.
2781
2813
  * This is an **insecure** setting:
@@ -2795,6 +2827,13 @@ var openpgp = (function (exports) {
2795
2827
  * @property {Boolean} allowUnauthenticatedStream
2796
2828
  */
2797
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,
2798
2837
  /**
2799
2838
  * @memberof module:config
2800
2839
  * @property {Boolean} checksumRequired Do not throw error when armor is missing a checksum
@@ -2871,6 +2910,14 @@ var openpgp = (function (exports) {
2871
2910
  * @property {Boolean} ignoreMalformedPackets Ignore malformed packets on parsing instead of throwing an error
2872
2911
  */
2873
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: [],
2874
2921
  /**
2875
2922
  * @memberof module:config
2876
2923
  * @property {Boolean} showVersion Whether to include {@link module:config/config.versionString} in armored messages
@@ -2885,7 +2932,7 @@ var openpgp = (function (exports) {
2885
2932
  * @memberof module:config
2886
2933
  * @property {String} versionString A version string to be included in armored messages
2887
2934
  */
2888
- versionString: 'OpenPGP.js 5.7.0',
2935
+ versionString: 'OpenPGP.js 5.9.0',
2889
2936
  /**
2890
2937
  * @memberof module:config
2891
2938
  * @property {String} commentString A comment string to be included in armored messages
@@ -14375,7 +14422,7 @@ var openpgp = (function (exports) {
14375
14422
  return util.concatUint8Array([
14376
14423
  oid.write(),
14377
14424
  new Uint8Array([public_algo]),
14378
- kdfParams.replacementKDFParams || kdfParams.write(),
14425
+ kdfParams.write(true),
14379
14426
  util.stringToUint8Array('Anonymous Sender '),
14380
14427
  kdfParams.replacementFingerprint || fingerprint.subarray(0, 20)
14381
14428
  ]);
@@ -15217,32 +15264,28 @@ var openpgp = (function (exports) {
15217
15264
 
15218
15265
  // OpenPGP.js - An OpenPGP implementation in javascript
15219
15266
 
15267
+ const VERSION_FORWARDING = 0xFF;
15268
+
15220
15269
  class KDFParams {
15221
15270
  /**
15222
15271
  * @param {Integer} version Version, defaults to 1
15223
15272
  * @param {enums.hash} hash Hash algorithm
15224
15273
  * @param {enums.symmetric} cipher Symmetric algorithm
15225
- * @param {enums.kdfFlags} flags (v2 only) flags
15226
- * @param {Uint8Array} replacementFingerprint (v2 only) fingerprint to use instead of recipient one (v5 keys, the 20 leftmost bytes of the fingerprint)
15227
- * @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)
15228
15275
  */
15229
15276
  constructor(data) {
15230
15277
  if (data) {
15231
- const { version, hash, cipher, flags, replacementFingerprint, replacementKDFParams } = data;
15278
+ const { version, hash, cipher, replacementFingerprint } = data;
15232
15279
  this.version = version || 1;
15233
15280
  this.hash = hash;
15234
15281
  this.cipher = cipher;
15235
15282
 
15236
- this.flags = flags;
15237
15283
  this.replacementFingerprint = replacementFingerprint;
15238
- this.replacementKDFParams = replacementKDFParams;
15239
15284
  } else {
15240
15285
  this.version = null;
15241
15286
  this.hash = null;
15242
15287
  this.cipher = null;
15243
- this.flags = null;
15244
15288
  this.replacementFingerprint = null;
15245
- this.replacementKDFParams = null;
15246
15289
  }
15247
15290
  }
15248
15291
 
@@ -15252,44 +15295,41 @@ var openpgp = (function (exports) {
15252
15295
  * @returns {Number} Number of read bytes.
15253
15296
  */
15254
15297
  read(input) {
15298
+ const totalBytes = input[0];
15255
15299
  this.version = input[1];
15256
15300
  this.hash = input[2];
15257
15301
  this.cipher = input[3];
15258
15302
  let readBytes = 4;
15259
15303
 
15260
- if (this.version === 2) {
15261
- this.flags = input[readBytes++];
15262
- if (this.flags & enums.kdfFlags.replace_fingerprint) {
15263
- this.replacementFingerprint = input.slice(readBytes, readBytes + 20);
15264
- readBytes += 20;
15265
- }
15266
- if (this.flags & enums.kdfFlags.replace_kdf_params) {
15267
- const fieldLength = input[readBytes] + 1; // account for length
15268
- this.replacementKDFParams = input.slice(readBytes, readBytes + fieldLength);
15269
- readBytes += fieldLength;
15270
- }
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;
15271
15308
  }
15272
15309
  return readBytes;
15273
15310
  }
15274
15311
 
15275
15312
  /**
15276
15313
  * Write KDFParams to an Uint8Array
15314
+ * @param {Boolean} [forReplacementParams] - forwarding only: whether to serialize data to use for replacement params
15277
15315
  * @returns {Uint8Array} Array with the KDFParams value
15278
15316
  */
15279
- write() {
15280
- if (!this.version || this.version === 1) {
15317
+ write(forReplacementParams) {
15318
+ if (!this.version || this.version === 1 || forReplacementParams) {
15281
15319
  return new Uint8Array([3, 1, this.hash, this.cipher]);
15282
15320
  }
15283
15321
 
15284
- const v2Fields = util.concatUint8Array([
15285
- new Uint8Array([4, 2, this.hash, this.cipher, this.flags]),
15286
- this.replacementFingerprint || new Uint8Array(),
15287
- this.replacementKDFParams || new Uint8Array()
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
15288
15330
  ]);
15289
15331
 
15290
- // update length field
15291
- v2Fields[0] = v2Fields.length - 1;
15292
- return new Uint8Array(v2Fields);
15332
+ return forwardingFields;
15293
15333
  }
15294
15334
  }
15295
15335
 
@@ -15872,6 +15912,339 @@ var openpgp = (function (exports) {
15872
15912
 
15873
15913
  Object.assign(mod, crypto$1);
15874
15914
 
15915
+ const ARGON2_TYPE = 0x02; // id
15916
+ const ARGON2_VERSION = 0x13;
15917
+ const ARGON2_SALT_SIZE = 16;
15918
+
15919
+ class Argon2OutOfMemoryError extends Error {
15920
+ constructor(...params) {
15921
+ super(...params);
15922
+
15923
+ if (Error.captureStackTrace) {
15924
+ Error.captureStackTrace(this, Argon2OutOfMemoryError);
15925
+ }
15926
+
15927
+ this.name = 'Argon2OutOfMemoryError';
15928
+ }
15929
+ }
15930
+
15931
+ // cache argon wasm module
15932
+ let loadArgonWasmModule;
15933
+ let argon2Promise;
15934
+ // reload wasm module above this treshold, to deallocated used memory
15935
+ const ARGON2_WASM_MEMORY_THRESHOLD_RELOAD = 2 << 19;
15936
+
15937
+ class Argon2S2K {
15938
+ /**
15939
+ * @param {Object} [config] - Full configuration, defaults to openpgp.config
15940
+ */
15941
+ constructor(config$1 = config) {
15942
+ const { passes, parallelism, memoryExponent } = config$1.s2kArgon2Params;
15943
+
15944
+ this.type = 'argon2';
15945
+ /** @type {Uint8Array} 16 bytes of salt */
15946
+ this.salt = null;
15947
+ /** @type {Integer} number of passes */
15948
+ this.t = passes;
15949
+ /** @type {Integer} degree of parallelism (lanes) */
15950
+ this.p = parallelism;
15951
+ /** @type {Integer} exponent indicating memory size */
15952
+ this.encodedM = memoryExponent;
15953
+ }
15954
+
15955
+ generateSalt() {
15956
+ this.salt = mod.random.getRandomBytes(ARGON2_SALT_SIZE);
15957
+ }
15958
+
15959
+ /**
15960
+ * Parsing function for argon2 string-to-key specifier.
15961
+ * @param {Uint8Array} bytes - Payload of argon2 string-to-key specifier
15962
+ * @returns {Integer} Actual length of the object.
15963
+ */
15964
+ read(bytes) {
15965
+ let i = 0;
15966
+
15967
+ this.salt = bytes.subarray(i, i + 16);
15968
+ i += 16;
15969
+
15970
+ this.t = bytes[i++];
15971
+ this.p = bytes[i++];
15972
+ this.encodedM = bytes[i++]; // memory size exponent, one-octect
15973
+
15974
+ return i;
15975
+ }
15976
+
15977
+ /**
15978
+ * Serializes s2k information
15979
+ * @returns {Uint8Array} Binary representation of s2k.
15980
+ */
15981
+ write() {
15982
+ const arr = [
15983
+ new Uint8Array([enums.write(enums.s2k, this.type)]),
15984
+ this.salt,
15985
+ new Uint8Array([this.t, this.p, this.encodedM])
15986
+ ];
15987
+
15988
+ return util.concatUint8Array(arr);
15989
+ }
15990
+
15991
+ /**
15992
+ * Produces a key using the specified passphrase and the defined
15993
+ * hashAlgorithm
15994
+ * @param {String} passphrase - Passphrase containing user input
15995
+ * @returns {Promise<Uint8Array>} Produced key with a length corresponding to `keySize`
15996
+ * @throws {Argon2OutOfMemoryError|Errors}
15997
+ * @async
15998
+ */
15999
+ async produceKey(passphrase, keySize) {
16000
+ const decodedM = 2 << (this.encodedM - 1);
16001
+
16002
+ try {
16003
+ if (!argon2Promise) { // first load
16004
+ loadArgonWasmModule = loadArgonWasmModule || (await Promise.resolve().then(function () { return index; })).default;
16005
+ argon2Promise = loadArgonWasmModule();
16006
+ }
16007
+ // important to keep local ref to argon2 in case the module is reloaded by another instance
16008
+ const argon2 = await argon2Promise;
16009
+
16010
+ const passwordBytes = util.encodeUTF8(passphrase);
16011
+ const hash = argon2({
16012
+ version: ARGON2_VERSION,
16013
+ type: ARGON2_TYPE,
16014
+ password: passwordBytes,
16015
+ salt: this.salt,
16016
+ tagLength: keySize,
16017
+ memorySize: decodedM,
16018
+ parallelism: this.p,
16019
+ passes: this.t
16020
+ });
16021
+
16022
+ // a lot of memory was used, reload to deallocate
16023
+ if (decodedM > ARGON2_WASM_MEMORY_THRESHOLD_RELOAD) {
16024
+ // it will be awaited if needed at the next `produceKey` invocation
16025
+ argon2Promise = loadArgonWasmModule();
16026
+ }
16027
+ return hash;
16028
+ } catch (e) {
16029
+ if (e.message && (
16030
+ e.message.includes('Unable to grow instance memory') || // Chrome
16031
+ e.message.includes('failed to grow memory') || // Firefox
16032
+ e.message.includes('WebAssembly.Memory.grow') || // Safari
16033
+ e.message.includes('Out of memory') // Safari iOS
16034
+ )) {
16035
+ throw new Argon2OutOfMemoryError('Could not allocate required memory for Argon2');
16036
+ } else {
16037
+ throw e;
16038
+ }
16039
+ }
16040
+ }
16041
+ }
16042
+
16043
+ // GPG4Browsers - An OpenPGP implementation in javascript
16044
+
16045
+ class GenericS2K {
16046
+ /**
16047
+ * @param {Object} [config] - Full configuration, defaults to openpgp.config
16048
+ */
16049
+ constructor(s2kType, config$1 = config) {
16050
+ /**
16051
+ * Hash function identifier, or 0 for gnu-dummy keys
16052
+ * @type {module:enums.hash | 0}
16053
+ */
16054
+ this.algorithm = enums.hash.sha256;
16055
+ /**
16056
+ * enums.s2k identifier or 'gnu-dummy'
16057
+ * @type {String}
16058
+ */
16059
+ this.type = enums.read(enums.s2k, s2kType);
16060
+ /** @type {Integer} */
16061
+ this.c = config$1.s2kIterationCountByte;
16062
+ /** Eight bytes of salt in a binary string.
16063
+ * @type {Uint8Array}
16064
+ */
16065
+ this.salt = null;
16066
+ }
16067
+
16068
+ generateSalt() {
16069
+ switch (this.type) {
16070
+ case 'salted':
16071
+ case 'iterated':
16072
+ this.salt = mod.random.getRandomBytes(8);
16073
+ }
16074
+ }
16075
+
16076
+ getCount() {
16077
+ // Exponent bias, defined in RFC4880
16078
+ const expbias = 6;
16079
+
16080
+ return (16 + (this.c & 15)) << ((this.c >> 4) + expbias);
16081
+ }
16082
+
16083
+ /**
16084
+ * Parsing function for a string-to-key specifier ({@link https://tools.ietf.org/html/rfc4880#section-3.7|RFC 4880 3.7}).
16085
+ * @param {Uint8Array} bytes - Payload of string-to-key specifier
16086
+ * @returns {Integer} Actual length of the object.
16087
+ */
16088
+ read(bytes) {
16089
+ let i = 0;
16090
+ this.algorithm = bytes[i++];
16091
+
16092
+ switch (this.type) {
16093
+ case 'simple':
16094
+ break;
16095
+
16096
+ case 'salted':
16097
+ this.salt = bytes.subarray(i, i + 8);
16098
+ i += 8;
16099
+ break;
16100
+
16101
+ case 'iterated':
16102
+ this.salt = bytes.subarray(i, i + 8);
16103
+ i += 8;
16104
+
16105
+ // Octet 10: count, a one-octet, coded value
16106
+ this.c = bytes[i++];
16107
+ break;
16108
+ case 'gnu':
16109
+ if (util.uint8ArrayToString(bytes.subarray(i, i + 3)) === 'GNU') {
16110
+ i += 3; // GNU
16111
+ const gnuExtType = 1000 + bytes[i++];
16112
+ if (gnuExtType === 1001) {
16113
+ this.type = 'gnu-dummy';
16114
+ // GnuPG extension mode 1001 -- don't write secret key at all
16115
+ } else {
16116
+ throw new Error('Unknown s2k gnu protection mode.');
16117
+ }
16118
+ } else {
16119
+ throw new Error('Unknown s2k type.');
16120
+ }
16121
+ break;
16122
+
16123
+ default:
16124
+ throw new Error('Unknown s2k type.');
16125
+ }
16126
+
16127
+ return i;
16128
+ }
16129
+
16130
+ /**
16131
+ * Serializes s2k information
16132
+ * @returns {Uint8Array} Binary representation of s2k.
16133
+ */
16134
+ write() {
16135
+ if (this.type === 'gnu-dummy') {
16136
+ return new Uint8Array([101, 0, ...util.stringToUint8Array('GNU'), 1]);
16137
+ }
16138
+ const arr = [new Uint8Array([enums.write(enums.s2k, this.type), this.algorithm])];
16139
+
16140
+ switch (this.type) {
16141
+ case 'simple':
16142
+ break;
16143
+ case 'salted':
16144
+ arr.push(this.salt);
16145
+ break;
16146
+ case 'iterated':
16147
+ arr.push(this.salt);
16148
+ arr.push(new Uint8Array([this.c]));
16149
+ break;
16150
+ case 'gnu':
16151
+ throw new Error('GNU s2k type not supported.');
16152
+ default:
16153
+ throw new Error('Unknown s2k type.');
16154
+ }
16155
+
16156
+ return util.concatUint8Array(arr);
16157
+ }
16158
+
16159
+ /**
16160
+ * Produces a key using the specified passphrase and the defined
16161
+ * hashAlgorithm
16162
+ * @param {String} passphrase - Passphrase containing user input
16163
+ * @returns {Promise<Uint8Array>} Produced key with a length corresponding to.
16164
+ * hashAlgorithm hash length
16165
+ * @async
16166
+ */
16167
+ async produceKey(passphrase, numBytes) {
16168
+ passphrase = util.encodeUTF8(passphrase);
16169
+
16170
+ const arr = [];
16171
+ let rlength = 0;
16172
+
16173
+ let prefixlen = 0;
16174
+ while (rlength < numBytes) {
16175
+ let toHash;
16176
+ switch (this.type) {
16177
+ case 'simple':
16178
+ toHash = util.concatUint8Array([new Uint8Array(prefixlen), passphrase]);
16179
+ break;
16180
+ case 'salted':
16181
+ toHash = util.concatUint8Array([new Uint8Array(prefixlen), this.salt, passphrase]);
16182
+ break;
16183
+ case 'iterated': {
16184
+ const data = util.concatUint8Array([this.salt, passphrase]);
16185
+ let datalen = data.length;
16186
+ const count = Math.max(this.getCount(), datalen);
16187
+ toHash = new Uint8Array(prefixlen + count);
16188
+ toHash.set(data, prefixlen);
16189
+ for (let pos = prefixlen + datalen; pos < count; pos += datalen, datalen *= 2) {
16190
+ toHash.copyWithin(pos, prefixlen, pos);
16191
+ }
16192
+ break;
16193
+ }
16194
+ case 'gnu':
16195
+ throw new Error('GNU s2k type not supported.');
16196
+ default:
16197
+ throw new Error('Unknown s2k type.');
16198
+ }
16199
+ const result = await mod.hash.digest(this.algorithm, toHash);
16200
+ arr.push(result);
16201
+ rlength += result.length;
16202
+ prefixlen++;
16203
+ }
16204
+
16205
+ return util.concatUint8Array(arr).subarray(0, numBytes);
16206
+ }
16207
+ }
16208
+
16209
+ const allowedS2KTypesForEncryption = new Set([enums.s2k.argon2, enums.s2k.iterated]);
16210
+
16211
+ /**
16212
+ * Instantiate a new S2K instance of the given type
16213
+ * @param {module:enums.s2k} type
16214
+ * @oaram {Object} [config]
16215
+ * @returns {Object} New s2k object
16216
+ * @throws {Error} for unknown or unsupported types
16217
+ */
16218
+ function newS2KFromType(type, config$1 = config) {
16219
+ switch (type) {
16220
+ case enums.s2k.argon2:
16221
+ return new Argon2S2K(config$1);
16222
+ case enums.s2k.iterated:
16223
+ case enums.s2k.gnu:
16224
+ case enums.s2k.salted:
16225
+ case enums.s2k.simple:
16226
+ return new GenericS2K(type, config$1);
16227
+ default:
16228
+ throw new Error(`Unsupported S2K type ${type}`);
16229
+ }
16230
+ }
16231
+
16232
+ /**
16233
+ * Instantiate a new S2K instance based on the config settings
16234
+ * @oaram {Object} config
16235
+ * @returns {Object} New s2k object
16236
+ * @throws {Error} for unknown or unsupported types
16237
+ */
16238
+ function newS2KFromConfig(config) {
16239
+ const { s2kType } = config;
16240
+
16241
+ if (!allowedS2KTypesForEncryption.has(s2kType)) {
16242
+ throw new Error('The provided `config.s2kType` value is not allowed');
16243
+ }
16244
+
16245
+ return newS2KFromType(s2kType, config);
16246
+ }
16247
+
15875
16248
  var TYPED_OK = typeof Uint8Array !== "undefined" &&
15876
16249
  typeof Uint16Array !== "undefined" &&
15877
16250
  typeof Int32Array !== "undefined";
@@ -23926,6 +24299,9 @@ var openpgp = (function (exports) {
23926
24299
  * @async
23927
24300
  */
23928
24301
  async read(bytes, allowedPackets, config$1 = config) {
24302
+ if (config$1.additionalAllowedPackets.length) {
24303
+ allowedPackets = { ...allowedPackets, ...util.constructAllowedPackets(config$1.additionalAllowedPackets) };
24304
+ }
23929
24305
  this.stream = transformPair(bytes, async (readable, writable) => {
23930
24306
  const writer = getWriter(writable);
23931
24307
  try {
@@ -24693,166 +25069,6 @@ var openpgp = (function (exports) {
24693
25069
 
24694
25070
  // GPG4Browsers - An OpenPGP implementation in javascript
24695
25071
 
24696
- class S2K {
24697
- /**
24698
- * @param {Object} [config] - Full configuration, defaults to openpgp.config
24699
- */
24700
- constructor(config$1 = config) {
24701
- /**
24702
- * Hash function identifier, or 0 for gnu-dummy keys
24703
- * @type {module:enums.hash | 0}
24704
- */
24705
- this.algorithm = enums.hash.sha256;
24706
- /**
24707
- * enums.s2k identifier or 'gnu-dummy'
24708
- * @type {String}
24709
- */
24710
- this.type = 'iterated';
24711
- /** @type {Integer} */
24712
- this.c = config$1.s2kIterationCountByte;
24713
- /** Eight bytes of salt in a binary string.
24714
- * @type {Uint8Array}
24715
- */
24716
- this.salt = null;
24717
- }
24718
-
24719
- getCount() {
24720
- // Exponent bias, defined in RFC4880
24721
- const expbias = 6;
24722
-
24723
- return (16 + (this.c & 15)) << ((this.c >> 4) + expbias);
24724
- }
24725
-
24726
- /**
24727
- * Parsing function for a string-to-key specifier ({@link https://tools.ietf.org/html/rfc4880#section-3.7|RFC 4880 3.7}).
24728
- * @param {Uint8Array} bytes - Payload of string-to-key specifier
24729
- * @returns {Integer} Actual length of the object.
24730
- */
24731
- read(bytes) {
24732
- let i = 0;
24733
- this.type = enums.read(enums.s2k, bytes[i++]);
24734
- this.algorithm = bytes[i++];
24735
-
24736
- switch (this.type) {
24737
- case 'simple':
24738
- break;
24739
-
24740
- case 'salted':
24741
- this.salt = bytes.subarray(i, i + 8);
24742
- i += 8;
24743
- break;
24744
-
24745
- case 'iterated':
24746
- this.salt = bytes.subarray(i, i + 8);
24747
- i += 8;
24748
-
24749
- // Octet 10: count, a one-octet, coded value
24750
- this.c = bytes[i++];
24751
- break;
24752
-
24753
- case 'gnu':
24754
- if (util.uint8ArrayToString(bytes.subarray(i, i + 3)) === 'GNU') {
24755
- i += 3; // GNU
24756
- const gnuExtType = 1000 + bytes[i++];
24757
- if (gnuExtType === 1001) {
24758
- this.type = 'gnu-dummy';
24759
- // GnuPG extension mode 1001 -- don't write secret key at all
24760
- } else {
24761
- throw new Error('Unknown s2k gnu protection mode.');
24762
- }
24763
- } else {
24764
- throw new Error('Unknown s2k type.');
24765
- }
24766
- break;
24767
-
24768
- default:
24769
- throw new Error('Unknown s2k type.');
24770
- }
24771
-
24772
- return i;
24773
- }
24774
-
24775
- /**
24776
- * Serializes s2k information
24777
- * @returns {Uint8Array} Binary representation of s2k.
24778
- */
24779
- write() {
24780
- if (this.type === 'gnu-dummy') {
24781
- return new Uint8Array([101, 0, ...util.stringToUint8Array('GNU'), 1]);
24782
- }
24783
- const arr = [new Uint8Array([enums.write(enums.s2k, this.type), this.algorithm])];
24784
-
24785
- switch (this.type) {
24786
- case 'simple':
24787
- break;
24788
- case 'salted':
24789
- arr.push(this.salt);
24790
- break;
24791
- case 'iterated':
24792
- arr.push(this.salt);
24793
- arr.push(new Uint8Array([this.c]));
24794
- break;
24795
- case 'gnu':
24796
- throw new Error('GNU s2k type not supported.');
24797
- default:
24798
- throw new Error('Unknown s2k type.');
24799
- }
24800
-
24801
- return util.concatUint8Array(arr);
24802
- }
24803
-
24804
- /**
24805
- * Produces a key using the specified passphrase and the defined
24806
- * hashAlgorithm
24807
- * @param {String} passphrase - Passphrase containing user input
24808
- * @returns {Promise<Uint8Array>} Produced key with a length corresponding to.
24809
- * hashAlgorithm hash length
24810
- * @async
24811
- */
24812
- async produceKey(passphrase, numBytes) {
24813
- passphrase = util.encodeUTF8(passphrase);
24814
-
24815
- const arr = [];
24816
- let rlength = 0;
24817
-
24818
- let prefixlen = 0;
24819
- while (rlength < numBytes) {
24820
- let toHash;
24821
- switch (this.type) {
24822
- case 'simple':
24823
- toHash = util.concatUint8Array([new Uint8Array(prefixlen), passphrase]);
24824
- break;
24825
- case 'salted':
24826
- toHash = util.concatUint8Array([new Uint8Array(prefixlen), this.salt, passphrase]);
24827
- break;
24828
- case 'iterated': {
24829
- const data = util.concatUint8Array([this.salt, passphrase]);
24830
- let datalen = data.length;
24831
- const count = Math.max(this.getCount(), datalen);
24832
- toHash = new Uint8Array(prefixlen + count);
24833
- toHash.set(data, prefixlen);
24834
- for (let pos = prefixlen + datalen; pos < count; pos += datalen, datalen *= 2) {
24835
- toHash.copyWithin(pos, prefixlen, pos);
24836
- }
24837
- break;
24838
- }
24839
- case 'gnu':
24840
- throw new Error('GNU s2k type not supported.');
24841
- default:
24842
- throw new Error('Unknown s2k type.');
24843
- }
24844
- const result = await mod.hash.digest(this.algorithm, toHash);
24845
- arr.push(result);
24846
- rlength += result.length;
24847
- prefixlen++;
24848
- }
24849
-
24850
- return util.concatUint8Array(arr).subarray(0, numBytes);
24851
- }
24852
- }
24853
-
24854
- // GPG4Browsers - An OpenPGP implementation in javascript
24855
-
24856
25072
  /**
24857
25073
  * Symmetric-Key Encrypted Session Key Packets (Tag 3)
24858
25074
  *
@@ -24920,7 +25136,8 @@ var openpgp = (function (exports) {
24920
25136
  }
24921
25137
 
24922
25138
  // A string-to-key (S2K) specifier, length as defined above.
24923
- this.s2k = new S2K();
25139
+ const s2kType = bytes[offset++];
25140
+ this.s2k = newS2KFromType(s2kType);
24924
25141
  offset += this.s2k.read(bytes.subarray(offset, bytes.length));
24925
25142
 
24926
25143
  if (this.version === 5) {
@@ -25009,8 +25226,8 @@ var openpgp = (function (exports) {
25009
25226
 
25010
25227
  this.sessionKeyEncryptionAlgorithm = algo;
25011
25228
 
25012
- this.s2k = new S2K(config$1);
25013
- this.s2k.salt = mod.random.getRandomBytes(8);
25229
+ this.s2k = newS2KFromConfig(config$1);
25230
+ this.s2k.generateSalt();
25014
25231
 
25015
25232
  const { blockSize, keySize } = mod.getCipher(algo);
25016
25233
  const encryptionKey = await this.s2k.produceKey(passphrase, keySize);
@@ -25636,7 +25853,8 @@ var openpgp = (function (exports) {
25636
25853
  // - [Optional] If string-to-key usage octet was 255, 254, or 253, a
25637
25854
  // string-to-key specifier. The length of the string-to-key
25638
25855
  // specifier is implied by its type, as described above.
25639
- this.s2k = new S2K();
25856
+ const s2kType = bytes[i++];
25857
+ this.s2k = newS2KFromType(s2kType);
25640
25858
  i += this.s2k.read(bytes.subarray(i, bytes.length));
25641
25859
 
25642
25860
  if (this.s2k.type === 'gnu-dummy') {
@@ -25774,7 +25992,7 @@ var openpgp = (function (exports) {
25774
25992
  }
25775
25993
  this.isEncrypted = null;
25776
25994
  this.keyMaterial = null;
25777
- this.s2k = new S2K(config$1);
25995
+ this.s2k = newS2KFromType(enums.s2k.gnu, config$1);
25778
25996
  this.s2k.algorithm = 0;
25779
25997
  this.s2k.c = 0;
25780
25998
  this.s2k.type = 'gnu-dummy';
@@ -25805,8 +26023,8 @@ var openpgp = (function (exports) {
25805
26023
  throw new Error('A non-empty passphrase is required for key encryption.');
25806
26024
  }
25807
26025
 
25808
- this.s2k = new S2K(config$1);
25809
- this.s2k.salt = mod.random.getRandomBytes(8);
26026
+ this.s2k = newS2KFromConfig(config$1);
26027
+ this.s2k.generateSalt();
25810
26028
  const cleartext = mod.serializeParams(this.algorithm, this.privateParams);
25811
26029
  this.symmetric = enums.symmetric.aes256;
25812
26030
  const key = await produceEncryptionKey(this.s2k, passphrase, this.symmetric);
@@ -27637,7 +27855,8 @@ var openpgp = (function (exports) {
27637
27855
 
27638
27856
  return !signature.keyFlags ||
27639
27857
  (signature.keyFlags[0] & enums.keyFlags.encryptCommunication) !== 0 ||
27640
- (signature.keyFlags[0] & enums.keyFlags.encryptStorage) !== 0;
27858
+ (signature.keyFlags[0] & enums.keyFlags.encryptStorage) !== 0 ||
27859
+ (config.allowForwardedMessages && (signature.keyFlags[0] & enums.keyFlags.forwardedCommunication) !== 0);
27641
27860
  }
27642
27861
 
27643
27862
  /**
@@ -28585,7 +28804,7 @@ var openpgp = (function (exports) {
28585
28804
  throw exception || new Error('Could not find primary user');
28586
28805
  }
28587
28806
  await Promise.all(users.map(async function (a) {
28588
- return a.user.revoked || a.user.isRevoked(a.selfCertification, null, date, config$1);
28807
+ return a.selfCertification.revoked || a.user.isRevoked(a.selfCertification, null, date, config$1);
28589
28808
  }));
28590
28809
  // sort by primary user flag and signature creation time
28591
28810
  const primaryUser = users.sort(function(a, b) {
@@ -28808,7 +29027,8 @@ var openpgp = (function (exports) {
28808
29027
 
28809
29028
  results.push(...signatures.map(
28810
29029
  signature => ({
28811
- userID: user.userID.userID,
29030
+ userID: user.userID ? user.userID.userID : null,
29031
+ userAttribute: user.userAttribute,
28812
29032
  keyID: signature.keyID,
28813
29033
  valid: signature.valid
28814
29034
  }))
@@ -29684,6 +29904,9 @@ var openpgp = (function (exports) {
29684
29904
  decryptedSessionKeyPackets.push(skeskPacket);
29685
29905
  } catch (err) {
29686
29906
  util.printDebugError(err);
29907
+ if (err instanceof Argon2OutOfMemoryError) {
29908
+ exception = err;
29909
+ }
29687
29910
  }
29688
29911
  }));
29689
29912
  }));
@@ -43831,9 +44054,716 @@ var openpgp = (function (exports) {
43831
44054
  __moduleExports: elliptic_1
43832
44055
  });
43833
44056
 
44057
+ // Adapted from the reference implementation in RFC7693
44058
+ // Initial port to Javascript by https://github.com/dcposch and https://github.com/emilbayes
44059
+
44060
+ // Uint64 values are represented using two Uint32s, stored as little endian
44061
+ // NB: Uint32Arrays endianness depends on the underlying system, so for interoperability, conversions between Uint8Array and Uint32Arrays
44062
+ // need to be manually handled
44063
+
44064
+ // 64-bit unsigned addition (little endian, in place)
44065
+ // Sets a[i,i+1] += b[j,j+1]
44066
+ // `a` and `b` must be Uint32Array(2)
44067
+ function ADD64 (a, i, b, j) {
44068
+ a[i] += b[j];
44069
+ a[i+1] += b[j+1] + (a[i] < b[j]); // add carry
44070
+ }
44071
+
44072
+ // Increment 64-bit little-endian unsigned value by `c` (in place)
44073
+ // `a` must be Uint32Array(2)
44074
+ function INC64 (a, c) {
44075
+ a[0] += c;
44076
+ a[1] += (a[0] < c);
44077
+ }
44078
+
44079
+ // G Mixing function
44080
+ // The ROTRs are inlined for speed
44081
+ function G (v, m, a, b, c, d, ix, iy) {
44082
+ ADD64(v, a, v, b); // v[a,a+1] += v[b,b+1]
44083
+ ADD64(v, a, m, ix); // v[a, a+1] += x ... x0
44084
+
44085
+ // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated to the right by 32 bits
44086
+ let xor0 = v[d] ^ v[a];
44087
+ let xor1 = v[d + 1] ^ v[a + 1];
44088
+ v[d] = xor1;
44089
+ v[d + 1] = xor0;
44090
+
44091
+ ADD64(v, c, v, d);
44092
+
44093
+ // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 24 bits
44094
+ xor0 = v[b] ^ v[c];
44095
+ xor1 = v[b + 1] ^ v[c + 1];
44096
+ v[b] = (xor0 >>> 24) ^ (xor1 << 8);
44097
+ v[b + 1] = (xor1 >>> 24) ^ (xor0 << 8);
44098
+
44099
+ ADD64(v, a, v, b);
44100
+ ADD64(v, a, m, iy);
44101
+
44102
+ // v[d,d+1] = (v[d,d+1] xor v[a,a+1]) rotated right by 16 bits
44103
+ xor0 = v[d] ^ v[a];
44104
+ xor1 = v[d + 1] ^ v[a + 1];
44105
+ v[d] = (xor0 >>> 16) ^ (xor1 << 16);
44106
+ v[d + 1] = (xor1 >>> 16) ^ (xor0 << 16);
44107
+
44108
+ ADD64(v, c, v, d);
44109
+
44110
+ // v[b,b+1] = (v[b,b+1] xor v[c,c+1]) rotated right by 63 bits
44111
+ xor0 = v[b] ^ v[c];
44112
+ xor1 = v[b + 1] ^ v[c + 1];
44113
+ v[b] = (xor1 >>> 31) ^ (xor0 << 1);
44114
+ v[b + 1] = (xor0 >>> 31) ^ (xor1 << 1);
44115
+ }
44116
+
44117
+ // Initialization Vector
44118
+ const BLAKE2B_IV32 = new Uint32Array([
44119
+ 0xF3BCC908, 0x6A09E667, 0x84CAA73B, 0xBB67AE85,
44120
+ 0xFE94F82B, 0x3C6EF372, 0x5F1D36F1, 0xA54FF53A,
44121
+ 0xADE682D1, 0x510E527F, 0x2B3E6C1F, 0x9B05688C,
44122
+ 0xFB41BD6B, 0x1F83D9AB, 0x137E2179, 0x5BE0CD19
44123
+ ]);
44124
+
44125
+ // These are offsets into a Uint64 buffer.
44126
+ // Multiply them all by 2 to make them offsets into a Uint32 buffer
44127
+ const SIGMA = new Uint8Array([
44128
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
44129
+ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3,
44130
+ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4,
44131
+ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8,
44132
+ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13,
44133
+ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9,
44134
+ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11,
44135
+ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10,
44136
+ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5,
44137
+ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0,
44138
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
44139
+ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3
44140
+ ].map(x => x * 2));
44141
+
44142
+ // Compression function. 'last' flag indicates last block.
44143
+ // Note: we're representing 16 uint64s as 32 uint32s
44144
+ function compress(S, last) {
44145
+ const v = new Uint32Array(32);
44146
+ const m = new Uint32Array(S.b.buffer, S.b.byteOffset, 32);
44147
+
44148
+ // init work variables
44149
+ for (let i = 0; i < 16; i++) {
44150
+ v[i] = S.h[i];
44151
+ v[i + 16] = BLAKE2B_IV32[i];
44152
+ }
44153
+
44154
+ // low 64 bits of offset
44155
+ v[24] ^= S.t0[0];
44156
+ v[25] ^= S.t0[1];
44157
+ // high 64 bits not supported (`t1`), offset may not be higher than 2**53-1
44158
+
44159
+ // if last block
44160
+ const f0 = last ? 0xFFFFFFFF : 0;
44161
+ v[28] ^= f0;
44162
+ v[29] ^= f0;
44163
+
44164
+ // twelve rounds of mixing
44165
+ for (let i = 0; i < 12; i++) {
44166
+ // ROUND(r)
44167
+ const i16 = i << 4;
44168
+ G(v, m, 0, 8, 16, 24, SIGMA[i16 + 0], SIGMA[i16 + 1]);
44169
+ G(v, m, 2, 10, 18, 26, SIGMA[i16 + 2], SIGMA[i16 + 3]);
44170
+ G(v, m, 4, 12, 20, 28, SIGMA[i16 + 4], SIGMA[i16 + 5]);
44171
+ G(v, m, 6, 14, 22, 30, SIGMA[i16 + 6], SIGMA[i16 + 7]);
44172
+ G(v, m, 0, 10, 20, 30, SIGMA[i16 + 8], SIGMA[i16 + 9]);
44173
+ G(v, m, 2, 12, 22, 24, SIGMA[i16 + 10], SIGMA[i16 + 11]);
44174
+ G(v, m, 4, 14, 16, 26, SIGMA[i16 + 12], SIGMA[i16 + 13]);
44175
+ G(v, m, 6, 8, 18, 28, SIGMA[i16 + 14], SIGMA[i16 + 15]);
44176
+ }
44177
+
44178
+ for (let i = 0; i < 16; i++) {
44179
+ S.h[i] ^= v[i] ^ v[i + 16];
44180
+ }
44181
+ }
44182
+
44183
+ // Creates a BLAKE2b hashing context
44184
+ // Requires an output length between 1 and 64 bytes
44185
+ // Takes an optional Uint8Array key
44186
+ class Blake2b {
44187
+ constructor(outlen, key, salt, personal) {
44188
+ const params = new Uint8Array(64);
44189
+ // 0: outlen, keylen, fanout, depth
44190
+ // 4: leaf length, sequential mode
44191
+ // 8: node offset
44192
+ // 12: node offset
44193
+ // 16: node depth, inner length, rfu
44194
+ // 20: rfu
44195
+ // 24: rfu
44196
+ // 28: rfu
44197
+ // 32: salt
44198
+ // 36: salt
44199
+ // 40: salt
44200
+ // 44: salt
44201
+ // 48: personal
44202
+ // 52: personal
44203
+ // 56: personal
44204
+ // 60: personal
44205
+
44206
+ // init internal state
44207
+ this.S = {
44208
+ b: new Uint8Array(BLOCKBYTES),
44209
+ h: new Uint32Array(OUTBYTES_MAX / 4),
44210
+ t0: new Uint32Array(2), // input counter `t`, lower 64-bits only
44211
+ c: 0, // `fill`, pointer within buffer, up to `BLOCKBYTES`
44212
+ outlen // output length in bytes
44213
+ };
44214
+
44215
+ // init parameter block
44216
+ params[0] = outlen;
44217
+ if (key) params[1] = key.length;
44218
+ params[2] = 1; // fanout
44219
+ params[3] = 1; // depth
44220
+ if (salt) params.set(salt, 32);
44221
+ if (personal) params.set(personal, 48);
44222
+ const params32 = new Uint32Array(params.buffer, params.byteOffset, params.length / Uint32Array.BYTES_PER_ELEMENT);
44223
+
44224
+ // initialize hash state
44225
+ for (let i = 0; i < 16; i++) {
44226
+ this.S.h[i] = BLAKE2B_IV32[i] ^ params32[i];
44227
+ }
44228
+
44229
+ // key the hash, if applicable
44230
+ if (key) {
44231
+ const block = new Uint8Array(BLOCKBYTES);
44232
+ block.set(key);
44233
+ this.update(block);
44234
+ }
44235
+ }
44236
+
44237
+ // Updates a BLAKE2b streaming hash
44238
+ // Requires Uint8Array (byte array)
44239
+ update(input) {
44240
+ if (!(input instanceof Uint8Array)) throw new Error('Input must be Uint8Array or Buffer')
44241
+ // for (let i = 0; i < input.length; i++) {
44242
+ // if (this.S.c === BLOCKBYTES) { // buffer full
44243
+ // INC64(this.S.t0, this.S.c) // add counters
44244
+ // compress(this.S, false)
44245
+ // this.S.c = 0 // empty buffer
44246
+ // }
44247
+ // this.S.b[this.S.c++] = input[i]
44248
+ // }
44249
+ let i = 0;
44250
+ while(i < input.length) {
44251
+ if (this.S.c === BLOCKBYTES) { // buffer full
44252
+ INC64(this.S.t0, this.S.c); // add counters
44253
+ compress(this.S, false);
44254
+ this.S.c = 0; // empty buffer
44255
+ }
44256
+ let left = BLOCKBYTES - this.S.c;
44257
+ this.S.b.set(input.subarray(i, i + left), this.S.c); // end index can be out of bounds
44258
+ const fill = Math.min(left, input.length - i);
44259
+ this.S.c += fill;
44260
+ i += fill;
44261
+ }
44262
+ return this
44263
+ }
44264
+
44265
+ /**
44266
+ * Return a BLAKE2b hash, either filling the given Uint8Array or allocating a new one
44267
+ * @param {Uint8Array} [prealloc] - optional preallocated buffer
44268
+ * @returns {ArrayBuffer} message digest
44269
+ */
44270
+ digest(prealloc) {
44271
+ INC64(this.S.t0, this.S.c); // mark last block offset
44272
+
44273
+ // final block, padded
44274
+ this.S.b.fill(0, this.S.c);
44275
+ this.S.c = BLOCKBYTES;
44276
+ compress(this.S, true);
44277
+
44278
+ const out = prealloc || new Uint8Array(this.S.outlen);
44279
+ for (let i = 0; i < this.S.outlen; i++) {
44280
+ // must be loaded individually since default Uint32 endianness is platform dependant
44281
+ out[i] = this.S.h[i >> 2] >> (8 * (i & 3));
44282
+ }
44283
+ this.S.h = null; // prevent calling `update` after `digest`
44284
+ return out.buffer;
44285
+ }
44286
+ }
44287
+
44288
+
44289
+ function createHash(outlen, key, salt, personal) {
44290
+ if (outlen > OUTBYTES_MAX) throw new Error(`outlen must be at most ${OUTBYTES_MAX} (given: ${outlen})`)
44291
+ if (key) {
44292
+ if (!(key instanceof Uint8Array)) throw new Error('key must be Uint8Array or Buffer')
44293
+ if (key.length > KEYBYTES_MAX) throw new Error(`key size must be at most ${KEYBYTES_MAX} (given: ${key.length})`)
44294
+ }
44295
+ if (salt) {
44296
+ if (!(salt instanceof Uint8Array)) throw new Error('salt must be Uint8Array or Buffer')
44297
+ if (salt.length !== SALTBYTES) throw new Error(`salt must be exactly ${SALTBYTES} (given: ${salt.length}`)
44298
+ }
44299
+ if (personal) {
44300
+ if (!(personal instanceof Uint8Array)) throw new Error('personal must be Uint8Array or Buffer')
44301
+ if (personal.length !== PERSONALBYTES) throw new Error(`salt must be exactly ${PERSONALBYTES} (given: ${personal.length}`)
44302
+ }
44303
+
44304
+ return new Blake2b(outlen, key, salt, personal)
44305
+ }
44306
+
44307
+ const OUTBYTES_MAX = 64;
44308
+ const KEYBYTES_MAX = 64;
44309
+ const SALTBYTES = 16;
44310
+ const PERSONALBYTES = 16;
44311
+ const BLOCKBYTES = 128;
44312
+
44313
+ const TYPE$2 = 2; // Argon2id
44314
+ const VERSION$4 = 0x13;
44315
+ const TAGBYTES_MAX = 0xFFFFFFFF; // Math.pow(2, 32) - 1;
44316
+ const TAGBYTES_MIN = 4; // Math.pow(2, 32) - 1;
44317
+ const SALTBYTES_MAX = 0xFFFFFFFF; // Math.pow(2, 32) - 1;
44318
+ const SALTBYTES_MIN = 8;
44319
+ const passwordBYTES_MAX = 0xFFFFFFFF;// Math.pow(2, 32) - 1;
44320
+ const passwordBYTES_MIN = 8;
44321
+ const MEMBYTES_MAX = 0xFFFFFFFF;// Math.pow(2, 32) - 1;
44322
+ const ADBYTES_MAX = 0xFFFFFFFF; // Math.pow(2, 32) - 1; // associated data (optional)
44323
+ const SECRETBYTES_MAX = 32; // key (optional)
44324
+
44325
+ const ARGON2_BLOCK_SIZE = 1024;
44326
+ const ARGON2_PREHASH_DIGEST_LENGTH = 64;
44327
+
44328
+ const isLittleEndian$1 = new Uint8Array(new Uint16Array([0xabcd]).buffer)[0] === 0xcd;
44329
+
44330
+ // store n as a little-endian 32-bit Uint8Array inside buf (at buf[i:i+3])
44331
+ function LE32(buf, n, i) {
44332
+ buf[i+0] = n;
44333
+ buf[i+1] = n >> 8;
44334
+ buf[i+2] = n >> 16;
44335
+ buf[i+3] = n >> 24;
44336
+ return buf;
44337
+ }
44338
+
44339
+ /**
44340
+ * Store n as a 64-bit LE number in the given buffer (from buf[i] to buf[i+7])
44341
+ * @param {Uint8Array} buf
44342
+ * @param {Number} n
44343
+ * @param {Number} i
44344
+ */
44345
+ function LE64(buf, n, i) {
44346
+ if (n > Number.MAX_SAFE_INTEGER) throw new Error("LE64: large numbers unsupported");
44347
+ // ECMAScript standard has engines convert numbers to 32-bit integers for bitwise operations
44348
+ // shifting by 32 or more bits is not supported (https://stackoverflow.com/questions/6729122/javascript-bit-shift-number-wraps)
44349
+ // so we manually extract each byte
44350
+ let remainder = n;
44351
+ for (let offset = i; offset < i+7; offset++) { // last byte can be ignored as it would overflow MAX_SAFE_INTEGER
44352
+ buf[offset] = remainder; // implicit & 0xff
44353
+ remainder = (remainder - buf[offset]) / 256;
44354
+ }
44355
+ return buf;
44356
+ }
44357
+
44358
+ /**
44359
+ * Variable-Length Hash Function H'
44360
+ * @param {Number} outlen - T
44361
+ * @param {Uint8Array} X - value to hash
44362
+ * @param {Uint8Array} res - output buffer, of length `outlength` or larger
44363
+ */
44364
+ function H_(outlen, X, res) {
44365
+ const V = new Uint8Array(64); // no need to keep around all V_i
44366
+
44367
+ const V1_in = new Uint8Array(4 + X.length);
44368
+ LE32(V1_in, outlen, 0);
44369
+ V1_in.set(X, 4);
44370
+ if (outlen <= 64) {
44371
+ // H'^T(A) = H^T(LE32(T)||A)
44372
+ createHash(outlen).update(V1_in).digest(res);
44373
+ return res
44374
+ }
44375
+
44376
+ const r = Math.ceil(outlen / 32) - 2;
44377
+
44378
+ // Let V_i be a 64-byte block and W_i be its first 32 bytes.
44379
+ // V_1 = H^(64)(LE32(T)||A)
44380
+ // V_2 = H^(64)(V_1)
44381
+ // ...
44382
+ // V_r = H^(64)(V_{r-1})
44383
+ // V_{r+1} = H^(T-32*r)(V_{r})
44384
+ // H'^T(X) = W_1 || W_2 || ... || W_r || V_{r+1}
44385
+ for (let i = 0; i < r; i++) {
44386
+ createHash(64).update(i === 0 ? V1_in : V).digest(V);
44387
+ // store W_i in result buffer already
44388
+ res.set(V.subarray(0, 32), i*32);
44389
+ }
44390
+ // V_{r+1}
44391
+ const V_r1 = new Uint8Array(createHash(outlen - 32*r).update(V).digest());
44392
+ res.set(V_r1, r*32);
44393
+
44394
+ return res;
44395
+ }
44396
+
44397
+ // compute buf = xs ^ ys
44398
+ function XOR(wasmContext, buf, xs, ys) {
44399
+ wasmContext.fn.XOR(
44400
+ buf.byteOffset,
44401
+ xs.byteOffset,
44402
+ ys.byteOffset,
44403
+ );
44404
+ return buf
44405
+ }
44406
+
44407
+ /**
44408
+ * @param {Uint8Array} X (read-only)
44409
+ * @param {Uint8Array} Y (read-only)
44410
+ * @param {Uint8Array} R - output buffer
44411
+ * @returns
44412
+ */
44413
+ function G$1(wasmContext, X, Y, R) {
44414
+ wasmContext.fn.G(
44415
+ X.byteOffset,
44416
+ Y.byteOffset,
44417
+ R.byteOffset,
44418
+ wasmContext.refs.gZ.byteOffset
44419
+ );
44420
+ return R;
44421
+ }
44422
+
44423
+ function G2(wasmContext, X, Y, R) {
44424
+ wasmContext.fn.G2(
44425
+ X.byteOffset,
44426
+ Y.byteOffset,
44427
+ R.byteOffset,
44428
+ wasmContext.refs.gZ.byteOffset
44429
+ );
44430
+ return R;
44431
+ }
44432
+
44433
+ // Generator for data-independent J1, J2. Each `next()` invocation returns a new pair of values.
44434
+ function* makePRNG(wasmContext, pass, lane, slice, m_, totalPasses, segmentLength, segmentOffset) {
44435
+ // For each segment, we do the following. First, we compute the value Z as:
44436
+ // Z= ( LE64(r) || LE64(l) || LE64(sl) || LE64(m') || LE64(t) || LE64(y) )
44437
+ wasmContext.refs.prngTmp.fill(0);
44438
+ const Z = wasmContext.refs.prngTmp.subarray(0, 6 * 8);
44439
+ LE64(Z, pass, 0);
44440
+ LE64(Z, lane, 8);
44441
+ LE64(Z, slice, 16);
44442
+ LE64(Z, m_, 24);
44443
+ LE64(Z, totalPasses, 32);
44444
+ LE64(Z, TYPE$2, 40);
44445
+
44446
+ // Then we compute q/(128*SL) 1024-byte values
44447
+ // G( ZERO(1024),
44448
+ // G( ZERO(1024), Z || LE64(1) || ZERO(968) ) ),
44449
+ // ...,
44450
+ // G( ZERO(1024),
44451
+ // G( ZERO(1024), Z || LE64(q/(128*SL)) || ZERO(968) )),
44452
+ for(let i = 1; i <= segmentLength; i++) {
44453
+ // tmp.set(Z); // no need to re-copy
44454
+ LE64(wasmContext.refs.prngTmp, i, Z.length); // tmp.set(ZER0968) not necessary, memory already zeroed
44455
+ const g2 = G2(wasmContext, wasmContext.refs.ZERO1024, wasmContext.refs.prngTmp, wasmContext.refs.prngR );
44456
+
44457
+ // each invocation of G^2 outputs 1024 bytes that are to be partitioned into 8-bytes values, take as X1 || X2
44458
+ // NB: the first generated pair must be used for the first block of the segment, and so on.
44459
+ // Hence, if some blocks are skipped (e.g. during the first pass), the corresponding J1J2 are discarded based on the given segmentOffset.
44460
+ for(let k = i === 1 ? segmentOffset*8 : 0; k < g2.length; k += 8) {
44461
+ yield g2.subarray(k, k+8);
44462
+ }
44463
+ }
44464
+ return [];
44465
+ }
44466
+
44467
+ function validateParams$7({ type, version, tagLength, password, salt, ad, secret, parallelism, memorySize, passes }) {
44468
+ const assertLength = (name, value, min, max) => {
44469
+ if (value < min || value > max) { throw new Error(`${name} size should be between ${min} and ${max} bytes`); }
44470
+ };
44471
+
44472
+ if (type !== TYPE$2 || version !== VERSION$4) throw new Error('Unsupported type or version');
44473
+ assertLength('password', password, passwordBYTES_MIN, passwordBYTES_MAX);
44474
+ assertLength('salt', salt, SALTBYTES_MIN, SALTBYTES_MAX);
44475
+ assertLength('tag', tagLength, TAGBYTES_MIN, TAGBYTES_MAX);
44476
+ assertLength('memory', memorySize, 8*parallelism, MEMBYTES_MAX);
44477
+ // optional fields
44478
+ ad && assertLength('associated data', ad, 0, ADBYTES_MAX);
44479
+ secret && assertLength('secret', secret, 0, SECRETBYTES_MAX);
44480
+
44481
+ return { type, version, tagLength, password, salt, ad, secret, lanes: parallelism, memorySize, passes };
44482
+ }
44483
+
44484
+ const KB = 1024;
44485
+ const WASM_PAGE_SIZE = 64 * KB;
44486
+
44487
+ function argon2id(params, { memory, instance: wasmInstance }) {
44488
+ if (!isLittleEndian$1) throw new Error('BigEndian system not supported'); // optmisations assume LE system
44489
+
44490
+ const ctx = validateParams$7({ type: TYPE$2, version: VERSION$4, ...params });
44491
+
44492
+ const { G:wasmG, G2:wasmG2, xor:wasmXOR, getLZ:wasmLZ } = wasmInstance.exports;
44493
+ const wasmRefs = {};
44494
+ const wasmFn = {};
44495
+ wasmFn.G = wasmG;
44496
+ wasmFn.G2 = wasmG2;
44497
+ wasmFn.XOR = wasmXOR;
44498
+
44499
+ // The actual number of blocks is m', which is m rounded down to the nearest multiple of 4*p.
44500
+ const m_ = 4 * ctx.lanes * Math.floor(ctx.memorySize / (4 * ctx.lanes));
44501
+ const requiredMemory = m_ * ARGON2_BLOCK_SIZE + 10 * KB; // Additional KBs for utility references
44502
+ if (memory.buffer.byteLength < requiredMemory) {
44503
+ const missing = Math.ceil((requiredMemory - memory.buffer.byteLength) / WASM_PAGE_SIZE);
44504
+ // If enough memory is available, the `memory.buffer` is internally detached and the reference updated.
44505
+ // Otherwise, the operation fails, and the original memory can still be used.
44506
+ memory.grow(missing);
44507
+ }
44508
+
44509
+ let offset = 0;
44510
+ // Init wasm memory needed in other functions
44511
+ wasmRefs.gZ = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+= wasmRefs.gZ.length;
44512
+ wasmRefs.prngR = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+=wasmRefs.prngR.length;
44513
+ wasmRefs.prngTmp = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+=wasmRefs.prngTmp.length;
44514
+ wasmRefs.ZERO1024 = new Uint8Array(memory.buffer, offset, 1024); offset+=wasmRefs.ZERO1024.length;
44515
+ // Init wasm memory needed locally
44516
+ const lz = new Uint32Array(memory.buffer, offset, 2); offset+=lz.length * Uint32Array.BYTES_PER_ELEMENT;
44517
+ const wasmContext = { fn: wasmFn, refs: wasmRefs };
44518
+ const newBlock = new Uint8Array(memory.buffer, offset, ARGON2_BLOCK_SIZE); offset+=newBlock.length;
44519
+ const blockMemory = new Uint8Array(memory.buffer, offset, ctx.memorySize * ARGON2_BLOCK_SIZE);
44520
+ const allocatedMemory = new Uint8Array(memory.buffer, 0, offset);
44521
+
44522
+ // 1. Establish H_0
44523
+ const H0 = getH0(ctx);
44524
+
44525
+ // 2. Allocate the memory as m' 1024-byte blocks
44526
+ // For p lanes, the memory is organized in a matrix B[i][j] of blocks with p rows (lanes) and q = m' / p columns.
44527
+ const q = m_ / ctx.lanes;
44528
+ const B = new Array(ctx.lanes).fill(null).map(() => new Array(q));
44529
+ const initBlock = (i, j) => {
44530
+ B[i][j] = blockMemory.subarray(i*q*1024 + j*1024, (i*q*1024 + j*1024) + ARGON2_BLOCK_SIZE);
44531
+ return B[i][j];
44532
+ };
44533
+
44534
+ for (let i = 0; i < ctx.lanes; i++) {
44535
+ // const LEi = LE0; // since p = 1 for us
44536
+ const tmp = new Uint8Array(H0.length + 8);
44537
+ // 3. Compute B[i][0] for all i ranging from (and including) 0 to (not including) p
44538
+ // B[i][0] = H'^(1024)(H_0 || LE32(0) || LE32(i))
44539
+ tmp.set(H0); LE32(tmp, 0, H0.length); LE32(tmp, i, H0.length + 4);
44540
+ H_(ARGON2_BLOCK_SIZE, tmp, initBlock(i, 0));
44541
+ // 4. Compute B[i][1] for all i ranging from (and including) 0 to (not including) p
44542
+ // B[i][1] = H'^(1024)(H_0 || LE32(1) || LE32(i))
44543
+ LE32(tmp, 1, H0.length);
44544
+ H_(ARGON2_BLOCK_SIZE, tmp, initBlock(i, 1));
44545
+ }
44546
+
44547
+ // 5. Compute B[i][j] for all i ranging from (and including) 0 to (not including) p and for all j ranging from (and including) 2
44548
+ // to (not including) q. The computation MUST proceed slicewise (Section 3.4) : first, blocks from slice 0 are computed for all lanes
44549
+ // (in an arbitrary order of lanes), then blocks from slice 1 are computed, etc.
44550
+ const SL = 4; // vertical slices
44551
+ const segmentLength = q / SL;
44552
+ for (let pass = 0; pass < ctx.passes; pass++) {
44553
+ // The intersection of a slice and a lane is called a segment, which has a length of q/SL. Segments of the same slice can be computed in parallel
44554
+ for (let sl = 0; sl < SL; sl++) {
44555
+ const isDataIndependent = pass === 0 && sl <= 1;
44556
+ for (let i = 0; i < ctx.lanes; i++) { // lane
44557
+ // On the first slice of the first pass, blocks 0 and 1 are already filled
44558
+ let segmentOffset = sl === 0 && pass === 0 ? 2 : 0;
44559
+ // no need to generate all J1J2s, use iterator/generator that creates the value on the fly (to save memory)
44560
+ const PRNG = isDataIndependent ? makePRNG(wasmContext, pass, i, sl, m_, ctx.passes, segmentLength, segmentOffset) : null;
44561
+ for (segmentOffset; segmentOffset < segmentLength; segmentOffset++) {
44562
+ const j = sl * segmentLength + segmentOffset;
44563
+ const prevBlock = j > 0 ? B[i][j-1] : B[i][q-1]; // B[i][(j-1) mod q]
44564
+
44565
+ // we can assume the PRNG is never done
44566
+ const J1J2 = isDataIndependent ? PRNG.next().value : prevBlock; // .subarray(0, 8) not required since we only pass the byteOffset to wasm
44567
+ // The block indices l and z are determined for each i, j differently for Argon2d, Argon2i, and Argon2id.
44568
+ wasmLZ(lz.byteOffset, J1J2.byteOffset, i, ctx.lanes, pass, sl, segmentOffset, SL, segmentLength);
44569
+ const l = lz[0]; const z = lz[1];
44570
+ // for (let i = 0; i < p; i++ )
44571
+ // B[i][j] = G(B[i][j-1], B[l][z])
44572
+ // The block indices l and z are determined for each i, j differently for Argon2d, Argon2i, and Argon2id.
44573
+ if (pass === 0) initBlock(i, j);
44574
+ G$1(wasmContext, prevBlock, B[l][z], pass > 0 ? newBlock : B[i][j]);
44575
+
44576
+ // 6. If the number of passes t is larger than 1, we repeat step 5. However, blocks are computed differently as the old value is XORed with the new one
44577
+ if (pass > 0) XOR(wasmContext, B[i][j], newBlock, B[i][j]);
44578
+ }
44579
+ }
44580
+ }
44581
+ }
44582
+
44583
+ // 7. After t steps have been iterated, the final block C is computed as the XOR of the last column:
44584
+ // C = B[0][q-1] XOR B[1][q-1] XOR ... XOR B[p-1][q-1]
44585
+ const C = B[0][q-1];
44586
+ for(let i = 1; i < ctx.lanes; i++) {
44587
+ XOR(wasmContext, C, C, B[i][q-1]);
44588
+ }
44589
+
44590
+ const tag = H_(ctx.tagLength, C, new Uint8Array(ctx.tagLength));
44591
+ // clear memory since the module might be cached
44592
+ allocatedMemory.fill(0); // clear sensitive contents
44593
+ memory.grow(0); // allow deallocation
44594
+ // 8. The output tag is computed as H'^T(C).
44595
+ return tag;
44596
+
44597
+ }
44598
+
44599
+ function getH0(ctx) {
44600
+ const H = createHash(ARGON2_PREHASH_DIGEST_LENGTH);
44601
+ const ZERO32 = new Uint8Array(4);
44602
+ const params = new Uint8Array(24);
44603
+ LE32(params, ctx.lanes, 0);
44604
+ LE32(params, ctx.tagLength, 4);
44605
+ LE32(params, ctx.memorySize, 8);
44606
+ LE32(params, ctx.passes, 12);
44607
+ LE32(params, ctx.version, 16);
44608
+ LE32(params, ctx.type, 20);
44609
+
44610
+ const toHash = [params];
44611
+ if (ctx.password) {
44612
+ toHash.push(LE32(new Uint8Array(4), ctx.password.length, 0));
44613
+ toHash.push(ctx.password);
44614
+ } else {
44615
+ toHash.push(ZERO32); // context.password.length
44616
+ }
44617
+
44618
+ if (ctx.salt) {
44619
+ toHash.push(LE32(new Uint8Array(4), ctx.salt.length, 0));
44620
+ toHash.push(ctx.salt);
44621
+ } else {
44622
+ toHash.push(ZERO32); // context.salt.length
44623
+ }
44624
+
44625
+ if (ctx.secret) {
44626
+ toHash.push(LE32(new Uint8Array(4), ctx.secret.length, 0));
44627
+ toHash.push(ctx.secret);
44628
+ // todo clear secret?
44629
+ } else {
44630
+ toHash.push(ZERO32); // context.secret.length
44631
+ }
44632
+
44633
+ if (ctx.ad) {
44634
+ toHash.push(LE32(new Uint8Array(4), ctx.ad.length, 0));
44635
+ toHash.push(ctx.ad);
44636
+ } else {
44637
+ toHash.push(ZERO32); // context.ad.length
44638
+ }
44639
+ H.update(concatArrays(toHash));
44640
+
44641
+ const outputBuffer = H.digest();
44642
+ return new Uint8Array(outputBuffer);
44643
+ }
44644
+
44645
+ function concatArrays(arrays) {
44646
+ if (arrays.length === 1) return arrays[0];
44647
+
44648
+ let totalLength = 0;
44649
+ for (let i = 0; i < arrays.length; i++) {
44650
+ if (!(arrays[i] instanceof Uint8Array)) {
44651
+ throw new Error('concatArrays: Data must be in the form of a Uint8Array');
44652
+ }
44653
+
44654
+ totalLength += arrays[i].length;
44655
+ }
44656
+
44657
+ const result = new Uint8Array(totalLength);
44658
+ let pos = 0;
44659
+ arrays.forEach((element) => {
44660
+ result.set(element, pos);
44661
+ pos += element.length;
44662
+ });
44663
+
44664
+ return result;
44665
+ }
44666
+
44667
+ let isSIMDSupported;
44668
+ async function wasmLoader(memory, getSIMD, getNonSIMD) {
44669
+ const importObject = { env: { memory } };
44670
+ if (isSIMDSupported === undefined) {
44671
+ try {
44672
+ isSIMDSupported = true; // will be overwritten in the catch
44673
+ return await getSIMD(importObject);
44674
+ } catch(e) {
44675
+ isSIMDSupported = false;
44676
+ }
44677
+ }
44678
+
44679
+ const loader = isSIMDSupported ? getSIMD : getNonSIMD;
44680
+ return loader(importObject);
44681
+ }
44682
+
44683
+ async function setupWasm(getSIMD, getNonSIMD) {
44684
+ const memory = new WebAssembly.Memory({
44685
+ // in pages of 64KiB each
44686
+ // these values need to be compatible with those declared when building in `build-wasm`
44687
+ initial: 1040, // 65MB
44688
+ maximum: 65536, // 4GB
44689
+ });
44690
+ const wasmModule = await wasmLoader(memory, getSIMD, getNonSIMD);
44691
+
44692
+ /**
44693
+ * Argon2id hash function
44694
+ * @callback computeHash
44695
+ * @param {Object} params
44696
+ * @param {Uint8Array} params.password - password
44697
+ * @param {Uint8Array} params.salt - salt
44698
+ * @param {Integer} params.parallelism
44699
+ * @param {Integer} params.passes
44700
+ * @param {Integer} params.memorySize - in kibibytes
44701
+ * @param {Integer} params.tagLength - output tag length
44702
+ * @param {Uint8Array} [params.ad] - associated data (optional)
44703
+ * @param {Uint8Array} [params.secret] - secret data (optional)
44704
+ * @return {Uint8Array} argon2id hash
44705
+ */
44706
+ const computeHash = (params) => argon2id(params, { instance: wasmModule.instance, memory });
44707
+
44708
+ return computeHash;
44709
+ }
44710
+
44711
+ function _loadWasmModule (sync, filepath, src, imports) {
44712
+ function _instantiateOrCompile(source, imports, stream) {
44713
+ var instantiateFunc = stream ? WebAssembly.instantiateStreaming : WebAssembly.instantiate;
44714
+ var compileFunc = stream ? WebAssembly.compileStreaming : WebAssembly.compile;
44715
+
44716
+ if (imports) {
44717
+ return instantiateFunc(source, imports)
44718
+ } else {
44719
+ return compileFunc(source)
44720
+ }
44721
+ }
44722
+
44723
+
44724
+ var buf = null;
44725
+ if (filepath) {
44726
+
44727
+ return _instantiateOrCompile(fetch(filepath), imports, true);
44728
+
44729
+ }
44730
+
44731
+
44732
+ var raw = globalThis.atob(src);
44733
+ var rawLength = raw.length;
44734
+ buf = new Uint8Array(new ArrayBuffer(rawLength));
44735
+ for(var i = 0; i < rawLength; i++) {
44736
+ buf[i] = raw.charCodeAt(i);
44737
+ }
44738
+
44739
+
44740
+
44741
+ if(sync) {
44742
+ var mod = new WebAssembly.Module(buf);
44743
+ return imports ? new WebAssembly.Instance(mod, imports) : mod
44744
+ } else {
44745
+ return _instantiateOrCompile(buf, imports, false)
44746
+ }
44747
+ }
44748
+
44749
+ function wasmSIMD(imports){return _loadWasmModule(0, null, 'AGFzbQEAAAABKwdgBH9/f38AYAABf2AAAGADf39/AGAJf39/f39/f39/AX9gAX8AYAF/AX8CEwEDZW52Bm1lbW9yeQIBkAiAgAQDCgkCAwAABAEFBgEEBQFwAQICBgkBfwFBkIjAAgsHfQoDeG9yAAEBRwACAkcyAAMFZ2V0TFoABBlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQALX2luaXRpYWxpemUAABBfX2Vycm5vX2xvY2F0aW9uAAgJc3RhY2tTYXZlAAUMc3RhY2tSZXN0b3JlAAYKc3RhY2tBbGxvYwAHCQcBAEEBCwEACs0gCQMAAQtYAQJ/A0AgACAEQQR0IgNqIAIgA2r9AAQAIAEgA2r9AAQA/VH9CwQAIAAgA0EQciIDaiACIANq/QAEACABIANq/QAEAP1R/QsEACAEQQJqIgRBwABHDQALC7ceAgt7A38DQCADIBFBBHQiD2ogASAPav0ABAAgACAPav0ABAD9USIF/QsEACACIA9qIAX9CwQAIAMgD0EQciIPaiABIA9q/QAEACAAIA9q/QAEAP1RIgX9CwQAIAIgD2ogBf0LBAAgEUECaiIRQcAARw0ACwNAIAMgEEEHdGoiAEEQaiAA/QAEcCAA/QAEMCIFIAD9AAQQIgT9zgEgBSAF/Q0AAQIDCAkKCwABAgMICQoLIAQgBP0NAAECAw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kaGxwdHh/9CwSAByAAIAQgCP3OASAEIAT9DQABAgMICQoLAAECAwgJCgsgCCAI/Q0AAQIDCAkKCwABAgMICQoL/d4BQQH9ywH9zgEiBP0LBIAEIAAgBSAJ/c4BIAUgBf0NAAECAwgJCgsAAQIDCAkKCyAJIAn9DQABAgMICQoLAAECAwgJCgv93gFBAf3LAf3OASIJ/QsEgAUgACAEIAf9USIFQQH9ywEgBUE//c0B/VAiBSAJIAr9USIEQQH9ywEgBEE//c0B/VAiBCAE/Q0AAQIDBAUGBxAREhMUFRYX/Q0ICQoLDA0ODxgZGhscHR4f/QsEgAIgACAEIAUgBf0NAAECAwQFBgcQERITFBUWF/0NCAkKCwwNDg8YGRobHB0eH/0LBIADIBBBAWoiEEEIRw0AC0EAIRADQCACIBBBBHQiAGoiASAAIANq/QAEACAB/QAEAP1R/QsEACACIABBEHIiAWoiDyABIANq/QAEACAP/QAEAP1R/QsEACACIABBIHIiAWoiDyABIANq/QAEACAP/QAEAP1R/QsEACACIABBMHIiAGoiASAAIANq/QAEACAB/QAEAP1R/QsEACAQQQRqIhBBwABHDQALCxYAIAAgASACIAMQAiAAIAIgAiADEAILewIBfwF+IAIhCSABNQIAIQogBCAFcgRAIAEoAgQgA3AhCQsgACAJNgIAIAAgB0EBayAFIAQbIAhsIAZBAWtBAEF/IAYbIAIgCUYbaiIBIAVBAWogCGxBACAEG2ogAa0gCiAKfkIgiH5CIIinQX9zaiAHIAhscDYCBCAACwQAIwALBgAgACQACxAAIwAgAGtBcHEiACQAIAALBQBBgAgL', imports)}
44750
+
44751
+ function wasmNonSIMD(imports){return _loadWasmModule(0, null, 'AGFzbQEAAAABPwhgBH9/f38AYAABf2AAAGADf39/AGARf39/f39/f39/f39/f39/f38AYAl/f39/f39/f38Bf2ABfwBgAX8BfwITAQNlbnYGbWVtb3J5AgGQCICABAMLCgIDBAAABQEGBwEEBQFwAQICBgkBfwFBkIjAAgsHfQoDeG9yAAEBRwADAkcyAAQFZ2V0TFoABRlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQALX2luaXRpYWxpemUAABBfX2Vycm5vX2xvY2F0aW9uAAkJc3RhY2tTYXZlAAYMc3RhY2tSZXN0b3JlAAcKc3RhY2tBbGxvYwAICQcBAEEBCwEACssaCgMAAQtQAQJ/A0AgACAEQQN0IgNqIAIgA2opAwAgASADaikDAIU3AwAgACADQQhyIgNqIAIgA2opAwAgASADaikDAIU3AwAgBEECaiIEQYABRw0ACwveDwICfgF/IAAgAUEDdGoiEyATKQMAIhEgACAFQQN0aiIBKQMAIhJ8IBFCAYZC/v///x+DIBJC/////w+DfnwiETcDACAAIA1BA3RqIgUgESAFKQMAhUIgiSIRNwMAIAAgCUEDdGoiCSARIAkpAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAEgESABKQMAhUIoiSIRNwMAIBMgESATKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACAFIBEgBSkDAIVCMIkiETcDACAJIBEgCSkDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgASARIAEpAwCFQgGJNwMAIAAgAkEDdGoiDSANKQMAIhEgACAGQQN0aiICKQMAIhJ8IBFCAYZC/v///x+DIBJC/////w+DfnwiETcDACAAIA5BA3RqIgYgESAGKQMAhUIgiSIRNwMAIAAgCkEDdGoiCiARIAopAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAIgESACKQMAhUIoiSIRNwMAIA0gESANKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACAGIBEgBikDAIVCMIkiETcDACAKIBEgCikDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgAiARIAIpAwCFQgGJNwMAIAAgA0EDdGoiDiAOKQMAIhEgACAHQQN0aiIDKQMAIhJ8IBFCAYZC/v///x+DIBJC/////w+DfnwiETcDACAAIA9BA3RqIgcgESAHKQMAhUIgiSIRNwMAIAAgC0EDdGoiCyARIAspAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAMgESADKQMAhUIoiSIRNwMAIA4gESAOKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACAHIBEgBykDAIVCMIkiETcDACALIBEgCykDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgAyARIAMpAwCFQgGJNwMAIAAgBEEDdGoiDyAPKQMAIhEgACAIQQN0aiIEKQMAIhJ8IBFCAYZC/v///x+DIBJC/////w+DfnwiETcDACAAIBBBA3RqIgggESAIKQMAhUIgiSIRNwMAIAAgDEEDdGoiACARIAApAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAQgESAEKQMAhUIoiSIRNwMAIA8gESAPKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACAIIBEgCCkDAIVCMIkiETcDACAAIBEgACkDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgBCARIAQpAwCFQgGJNwMAIBMgEykDACIRIAIpAwAiEnwgEUIBhkL+////H4MgEkL/////D4N+fCIRNwMAIAggESAIKQMAhUIgiSIRNwMAIAsgESALKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACACIBEgAikDAIVCKIkiETcDACATIBEgEykDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgCCARIAgpAwCFQjCJIhE3AwAgCyARIAspAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAIgESACKQMAhUIBiTcDACANIA0pAwAiESADKQMAIhJ8IBFCAYZC/v///x+DIBJC/////w+DfnwiETcDACAFIBEgBSkDAIVCIIkiETcDACAAIBEgACkDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgAyARIAMpAwCFQiiJIhE3AwAgDSARIA0pAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAUgESAFKQMAhUIwiSIRNwMAIAAgESAAKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACADIBEgAykDAIVCAYk3AwAgDiAOKQMAIhEgBCkDACISfCARQgGGQv7///8fgyASQv////8Pg358IhE3AwAgBiARIAYpAwCFQiCJIhE3AwAgCSARIAkpAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAQgESAEKQMAhUIoiSIRNwMAIA4gESAOKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACAGIBEgBikDAIVCMIkiETcDACAJIBEgCSkDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgBCARIAQpAwCFQgGJNwMAIA8gDykDACIRIAEpAwAiEnwgEUIBhkL+////H4MgEkL/////D4N+fCIRNwMAIAcgESAHKQMAhUIgiSIRNwMAIAogESAKKQMAIhJ8IBFC/////w+DIBJCAYZC/v///x+DfnwiETcDACABIBEgASkDAIVCKIkiETcDACAPIBEgDykDACISfCARQv////8PgyASQgGGQv7///8fg358IhE3AwAgByARIAcpAwCFQjCJIhE3AwAgCiARIAopAwAiEnwgEUL/////D4MgEkIBhkL+////H4N+fCIRNwMAIAEgESABKQMAhUIBiTcDAAvdCAEPfwNAIAIgBUEDdCIGaiABIAZqKQMAIAAgBmopAwCFNwMAIAIgBkEIciIGaiABIAZqKQMAIAAgBmopAwCFNwMAIAVBAmoiBUGAAUcNAAsDQCADIARBA3QiAGogACACaikDADcDACADIARBAXIiAEEDdCIBaiABIAJqKQMANwMAIAMgBEECciIBQQN0IgVqIAIgBWopAwA3AwAgAyAEQQNyIgVBA3QiBmogAiAGaikDADcDACADIARBBHIiBkEDdCIHaiACIAdqKQMANwMAIAMgBEEFciIHQQN0IghqIAIgCGopAwA3AwAgAyAEQQZyIghBA3QiCWogAiAJaikDADcDACADIARBB3IiCUEDdCIKaiACIApqKQMANwMAIAMgBEEIciIKQQN0IgtqIAIgC2opAwA3AwAgAyAEQQlyIgtBA3QiDGogAiAMaikDADcDACADIARBCnIiDEEDdCINaiACIA1qKQMANwMAIAMgBEELciINQQN0Ig5qIAIgDmopAwA3AwAgAyAEQQxyIg5BA3QiD2og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BtqIAGtIAogCn5CIIh+QiCIp0F/c2ogByAIbHA2AgQgAAsEACMACwYAIAAkAAsQACMAIABrQXBxIgAkACAACwUAQYAICw==', imports)}
44752
+
44753
+ const loadWasm = async () => setupWasm(
44754
+ (instanceObject) => wasmSIMD(instanceObject),
44755
+ (instanceObject) => wasmNonSIMD(instanceObject),
44756
+ );
44757
+
44758
+ var index = /*#__PURE__*/Object.freeze({
44759
+ __proto__: null,
44760
+ 'default': loadWasm
44761
+ });
44762
+
43834
44763
  exports.AEADEncryptedDataPacket = AEADEncryptedDataPacket;
43835
44764
  exports.CleartextMessage = CleartextMessage;
43836
44765
  exports.CompressedDataPacket = CompressedDataPacket;
44766
+ exports.KDFParams = KDFParams;
43837
44767
  exports.LiteralDataPacket = LiteralDataPacket;
43838
44768
  exports.MarkerPacket = MarkerPacket;
43839
44769
  exports.Message = Message;