node-tkms 0.9.1-rc3 → 0.11.0-22

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/kms_lib.js CHANGED
@@ -2,11 +2,9 @@
2
2
  let imports = {};
3
3
  imports['__wbindgen_placeholder__'] = module.exports;
4
4
  let wasm;
5
- const { TextDecoder, TextEncoder } = require(`util`);
5
+ const { TextEncoder, TextDecoder } = require(`util`);
6
6
 
7
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
8
-
9
- cachedTextDecoder.decode();
7
+ let WASM_VECTOR_LEN = 0;
10
8
 
11
9
  let cachedUint8ArrayMemory0 = null;
12
10
 
@@ -17,13 +15,6 @@ function getUint8ArrayMemory0() {
17
15
  return cachedUint8ArrayMemory0;
18
16
  }
19
17
 
20
- function getStringFromWasm0(ptr, len) {
21
- ptr = ptr >>> 0;
22
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
23
- }
24
-
25
- let WASM_VECTOR_LEN = 0;
26
-
27
18
  let cachedTextEncoder = new TextEncoder('utf-8');
28
19
 
29
20
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -78,10 +69,6 @@ function passStringToWasm0(arg, malloc, realloc) {
78
69
  return ptr;
79
70
  }
80
71
 
81
- function isLikeNone(x) {
82
- return x === undefined || x === null;
83
- }
84
-
85
72
  let cachedDataViewMemory0 = null;
86
73
 
87
74
  function getDataViewMemory0() {
@@ -91,6 +78,34 @@ function getDataViewMemory0() {
91
78
  return cachedDataViewMemory0;
92
79
  }
93
80
 
81
+ function addToExternrefTable0(obj) {
82
+ const idx = wasm.__externref_table_alloc();
83
+ wasm.__wbindgen_export_4.set(idx, obj);
84
+ return idx;
85
+ }
86
+
87
+ function handleError(f, args) {
88
+ try {
89
+ return f.apply(this, args);
90
+ } catch (e) {
91
+ const idx = addToExternrefTable0(e);
92
+ wasm.__wbindgen_exn_store(idx);
93
+ }
94
+ }
95
+
96
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
97
+
98
+ cachedTextDecoder.decode();
99
+
100
+ function getStringFromWasm0(ptr, len) {
101
+ ptr = ptr >>> 0;
102
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
103
+ }
104
+
105
+ function isLikeNone(x) {
106
+ return x === undefined || x === null;
107
+ }
108
+
94
109
  function debugString(val) {
95
110
  // primitive types
96
111
  const type = typeof val;
@@ -132,7 +147,7 @@ function debugString(val) {
132
147
  // Test for built-in
133
148
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
134
149
  let className;
135
- if (builtInMatches.length > 1) {
150
+ if (builtInMatches && builtInMatches.length > 1) {
136
151
  className = builtInMatches[1];
137
152
  } else {
138
153
  // Failed to match the standard '[object ClassName]'
@@ -155,12 +170,26 @@ function debugString(val) {
155
170
  // TODO we could test for more things here, like `Set`s and `Map`s.
156
171
  return className;
157
172
  }
173
+ /**
174
+ * @returns {number}
175
+ */
176
+ module.exports.ml_kem_pke_pk_len = function() {
177
+ const ret = wasm.ml_kem_pke_pk_len();
178
+ return ret >>> 0;
179
+ };
180
+
181
+ /**
182
+ * @returns {number}
183
+ */
184
+ module.exports.ml_kem_pke_sk_len = function() {
185
+ const ret = wasm.ml_kem_pke_sk_len();
186
+ return ret >>> 0;
187
+ };
158
188
 
159
189
  function _assertClass(instance, klass) {
160
190
  if (!(instance instanceof klass)) {
161
191
  throw new Error(`expected instance of ${klass.name}`);
162
192
  }
163
- return instance.ptr;
164
193
  }
165
194
 
166
195
  function getArrayU8FromWasm0(ptr, len) {
@@ -187,7 +216,7 @@ function passArray8ToWasm0(arg, malloc) {
187
216
  }
188
217
 
189
218
  function takeFromExternrefTable0(idx) {
190
- const value = wasm.__wbindgen_export_2.get(idx);
219
+ const value = wasm.__wbindgen_export_4.get(idx);
191
220
  wasm.__externref_table_dealloc(idx);
192
221
  return value;
193
222
  }
@@ -234,17 +263,28 @@ module.exports.u8vec_to_private_sig_key = function(v) {
234
263
  return PrivateSigKey.__wrap(ret[0]);
235
264
  };
236
265
 
237
- function addToExternrefTable0(obj) {
238
- const idx = wasm.__externref_table_alloc();
239
- wasm.__wbindgen_export_2.set(idx, obj);
240
- return idx;
241
- }
266
+ /**
267
+ * Create a new [ServerIdAddr] structure that holds an ID and an address
268
+ * which must be a valid EIP-55 address, notably prefixed with "0x".
269
+ * @param {number} id
270
+ * @param {string} addr
271
+ * @returns {ServerIdAddr}
272
+ */
273
+ module.exports.new_server_id_addr = function(id, addr) {
274
+ const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
275
+ const len0 = WASM_VECTOR_LEN;
276
+ const ret = wasm.new_server_id_addr(id, ptr0, len0);
277
+ if (ret[2]) {
278
+ throw takeFromExternrefTable0(ret[1]);
279
+ }
280
+ return ServerIdAddr.__wrap(ret[0]);
281
+ };
242
282
 
243
283
  function passArrayJsValueToWasm0(array, malloc) {
244
284
  const ptr = malloc(array.length * 4, 4) >>> 0;
245
- const mem = getDataViewMemory0();
246
285
  for (let i = 0; i < array.length; i++) {
247
- mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true);
286
+ const add = addToExternrefTable0(array[i]);
287
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
248
288
  }
249
289
  WASM_VECTOR_LEN = array.length;
250
290
  return ptr;
@@ -252,25 +292,25 @@ function passArrayJsValueToWasm0(array, malloc) {
252
292
  /**
253
293
  * Instantiate a new client.
254
294
  *
255
- * * `server_addrs` - a list of KMS server EIP-55 addresses,
256
- * must be prefixed with "0x".
295
+ * * `server_addrs` - a list of KMS server ID with EIP-55 addresses,
296
+ * the elements in the list can be created using [new_server_id_addr].
257
297
  *
258
298
  * * `client_address_hex` - the client (wallet) address in hex,
259
299
  * must be prefixed with "0x".
260
300
  *
261
- * * `param_choice` - the parameter choice, which can be either `"test"` or `"default"`.
301
+ * * `fhe_parameter` - the parameter choice, which can be either `"test"` or `"default"`.
262
302
  * The "default" parameter choice is selected if no matching string is found.
263
- * @param {(string)[]} server_addrs
303
+ * @param {ServerIdAddr[]} server_addrs
264
304
  * @param {string} client_address_hex
265
- * @param {string} param_choice
305
+ * @param {string} fhe_parameter
266
306
  * @returns {Client}
267
307
  */
268
- module.exports.new_client = function(server_addrs, client_address_hex, param_choice) {
308
+ module.exports.new_client = function(server_addrs, client_address_hex, fhe_parameter) {
269
309
  const ptr0 = passArrayJsValueToWasm0(server_addrs, wasm.__wbindgen_malloc);
270
310
  const len0 = WASM_VECTOR_LEN;
271
311
  const ptr1 = passStringToWasm0(client_address_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
272
312
  const len1 = WASM_VECTOR_LEN;
273
- const ptr2 = passStringToWasm0(param_choice, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
313
+ const ptr2 = passStringToWasm0(fhe_parameter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
274
314
  const len2 = WASM_VECTOR_LEN;
275
315
  const ret = wasm.new_client(ptr0, len0, ptr1, len1, ptr2, len2);
276
316
  if (ret[2]) {
@@ -284,14 +324,14 @@ function getArrayJsValueFromWasm0(ptr, len) {
284
324
  const mem = getDataViewMemory0();
285
325
  const result = [];
286
326
  for (let i = ptr; i < ptr + 4 * len; i += 4) {
287
- result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
327
+ result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
288
328
  }
289
329
  wasm.__externref_drop_slice(ptr, len);
290
330
  return result;
291
331
  }
292
332
  /**
293
333
  * @param {Client} client
294
- * @returns {(string)[]}
334
+ * @returns {ServerIdAddr[]}
295
335
  */
296
336
  module.exports.get_server_addrs = function(client) {
297
337
  _assertClass(client, Client);
@@ -330,30 +370,30 @@ module.exports.get_client_address = function(client) {
330
370
  };
331
371
 
332
372
  /**
333
- * @returns {PrivateEncKey}
373
+ * @returns {PrivateEncKeyMlKem512}
334
374
  */
335
- module.exports.cryptobox_keygen = function() {
336
- const ret = wasm.cryptobox_keygen();
337
- return PrivateEncKey.__wrap(ret);
375
+ module.exports.ml_kem_pke_keygen = function() {
376
+ const ret = wasm.ml_kem_pke_keygen();
377
+ return PrivateEncKeyMlKem512.__wrap(ret);
338
378
  };
339
379
 
340
380
  /**
341
- * @param {PrivateEncKey} sk
342
- * @returns {PublicEncKey}
381
+ * @param {PrivateEncKeyMlKem512} sk
382
+ * @returns {PublicEncKeyMlKem512}
343
383
  */
344
- module.exports.cryptobox_get_pk = function(sk) {
345
- _assertClass(sk, PrivateEncKey);
346
- const ret = wasm.cryptobox_get_pk(sk.__wbg_ptr);
347
- return PublicEncKey.__wrap(ret);
384
+ module.exports.ml_kem_pke_get_pk = function(sk) {
385
+ _assertClass(sk, PrivateEncKeyMlKem512);
386
+ const ret = wasm.ml_kem_pke_get_pk(sk.__wbg_ptr);
387
+ return PublicEncKeyMlKem512.__wrap(ret);
348
388
  };
349
389
 
350
390
  /**
351
- * @param {PublicEncKey} pk
391
+ * @param {PublicEncKeyMlKem512} pk
352
392
  * @returns {Uint8Array}
353
393
  */
354
- module.exports.cryptobox_pk_to_u8vec = function(pk) {
355
- _assertClass(pk, PublicEncKey);
356
- const ret = wasm.cryptobox_pk_to_u8vec(pk.__wbg_ptr);
394
+ module.exports.ml_kem_pke_pk_to_u8vec = function(pk) {
395
+ _assertClass(pk, PublicEncKeyMlKem512);
396
+ const ret = wasm.ml_kem_pke_pk_to_u8vec(pk.__wbg_ptr);
357
397
  if (ret[3]) {
358
398
  throw takeFromExternrefTable0(ret[2]);
359
399
  }
@@ -363,12 +403,12 @@ module.exports.cryptobox_pk_to_u8vec = function(pk) {
363
403
  };
364
404
 
365
405
  /**
366
- * @param {PrivateEncKey} sk
406
+ * @param {PrivateEncKeyMlKem512} sk
367
407
  * @returns {Uint8Array}
368
408
  */
369
- module.exports.cryptobox_sk_to_u8vec = function(sk) {
370
- _assertClass(sk, PrivateEncKey);
371
- const ret = wasm.cryptobox_sk_to_u8vec(sk.__wbg_ptr);
409
+ module.exports.ml_kem_pke_sk_to_u8vec = function(sk) {
410
+ _assertClass(sk, PrivateEncKeyMlKem512);
411
+ const ret = wasm.ml_kem_pke_sk_to_u8vec(sk.__wbg_ptr);
372
412
  if (ret[3]) {
373
413
  throw takeFromExternrefTable0(ret[2]);
374
414
  }
@@ -379,80 +419,85 @@ module.exports.cryptobox_sk_to_u8vec = function(sk) {
379
419
 
380
420
  /**
381
421
  * @param {Uint8Array} v
382
- * @returns {PublicEncKey}
422
+ * @returns {PublicEncKeyMlKem512}
383
423
  */
384
- module.exports.u8vec_to_cryptobox_pk = function(v) {
424
+ module.exports.u8vec_to_ml_kem_pke_pk = function(v) {
385
425
  const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
386
426
  const len0 = WASM_VECTOR_LEN;
387
- const ret = wasm.u8vec_to_cryptobox_pk(ptr0, len0);
427
+ const ret = wasm.u8vec_to_ml_kem_pke_pk(ptr0, len0);
388
428
  if (ret[2]) {
389
429
  throw takeFromExternrefTable0(ret[1]);
390
430
  }
391
- return PublicEncKey.__wrap(ret[0]);
431
+ return PublicEncKeyMlKem512.__wrap(ret[0]);
392
432
  };
393
433
 
394
434
  /**
395
435
  * @param {Uint8Array} v
396
- * @returns {PrivateEncKey}
436
+ * @returns {PrivateEncKeyMlKem512}
397
437
  */
398
- module.exports.u8vec_to_cryptobox_sk = function(v) {
438
+ module.exports.u8vec_to_ml_kem_pke_sk = function(v) {
399
439
  const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
400
440
  const len0 = WASM_VECTOR_LEN;
401
- const ret = wasm.u8vec_to_cryptobox_sk(ptr0, len0);
441
+ const ret = wasm.u8vec_to_ml_kem_pke_sk(ptr0, len0);
402
442
  if (ret[2]) {
403
443
  throw takeFromExternrefTable0(ret[1]);
404
444
  }
405
- return PrivateEncKey.__wrap(ret[0]);
445
+ return PrivateEncKeyMlKem512.__wrap(ret[0]);
406
446
  };
407
447
 
408
448
  /**
449
+ * This function is *not* used by relayer-sdk because the encryption
450
+ * happens on the KMS side. It's just here for completeness and tests.
409
451
  * @param {Uint8Array} msg
410
- * @param {PublicEncKey} their_pk
411
- * @param {PrivateEncKey} my_sk
412
- * @returns {CryptoBoxCt}
452
+ * @param {PublicEncKeyMlKem512} their_pk
453
+ * @returns {Uint8Array}
413
454
  */
414
- module.exports.cryptobox_encrypt = function(msg, their_pk, my_sk) {
455
+ module.exports.ml_kem_pke_encrypt = function(msg, their_pk) {
415
456
  const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
416
457
  const len0 = WASM_VECTOR_LEN;
417
- _assertClass(their_pk, PublicEncKey);
418
- _assertClass(my_sk, PrivateEncKey);
419
- const ret = wasm.cryptobox_encrypt(ptr0, len0, their_pk.__wbg_ptr, my_sk.__wbg_ptr);
420
- return CryptoBoxCt.__wrap(ret);
458
+ _assertClass(their_pk, PublicEncKeyMlKem512);
459
+ const ret = wasm.ml_kem_pke_encrypt(ptr0, len0, their_pk.__wbg_ptr);
460
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
461
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
462
+ return v2;
421
463
  };
422
464
 
423
465
  /**
424
- * @param {CryptoBoxCt} ct
425
- * @param {PrivateEncKey} my_sk
426
- * @param {PublicEncKey} their_pk
466
+ * This function is *not* used by relayer-sdk because the decryption
467
+ * is handled by [process_user_decryption_resp].
468
+ * It's just here for completeness and tests.
469
+ * @param {Uint8Array} ct
470
+ * @param {PrivateEncKeyMlKem512} my_sk
427
471
  * @returns {Uint8Array}
428
472
  */
429
- module.exports.cryptobox_decrypt = function(ct, my_sk, their_pk) {
430
- _assertClass(ct, CryptoBoxCt);
431
- _assertClass(my_sk, PrivateEncKey);
432
- _assertClass(their_pk, PublicEncKey);
433
- const ret = wasm.cryptobox_decrypt(ct.__wbg_ptr, my_sk.__wbg_ptr, their_pk.__wbg_ptr);
434
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
473
+ module.exports.ml_kem_pke_decrypt = function(ct, my_sk) {
474
+ const ptr0 = passArray8ToWasm0(ct, wasm.__wbindgen_malloc);
475
+ const len0 = WASM_VECTOR_LEN;
476
+ _assertClass(my_sk, PrivateEncKeyMlKem512);
477
+ const ret = wasm.ml_kem_pke_decrypt(ptr0, len0, my_sk.__wbg_ptr);
478
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
435
479
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
436
- return v1;
480
+ return v2;
437
481
  };
438
482
 
439
483
  /**
440
- * Process the reencryption response from JavaScript objects.
484
+ * Process the user_decryption response from JavaScript objects.
441
485
  * The returned result is a byte array representing a plaintext of any length,
442
486
  * postprocessing is returned to turn it into an integer.
443
487
  *
444
- * * `client` - client that wants to perform reencryption.
488
+ * * `client` - client that wants to perform user_decryption.
445
489
  *
446
- * * `request` - the initial reencryption request JS object.
490
+ * * `request` - the initial user_decryption request JS object.
447
491
  * It can be set to null if `verify` is false.
448
492
  * Otherwise the caller needs to give the following JS object.
449
493
  * Note that `client_address` and `eip712_verifying_contract` follow EIP-55.
494
+ * The signature field is not needed.
450
495
  * ```
451
496
  * {
452
- * signature: '15a4f9a8eb61459cfba7d103d8f911fb04ce91ecf841b34c49c0d56a70b896d20cbc31986188f91efc3842b7df215cee8acb40178daedb8b63d0ba5d199bce121c',
497
+ * signature: undefined,
453
498
  * client_address: '0x17853A630aAe15AED549B2B874de08B73C0F59c5',
454
499
  * enc_key: '2000000000000000df2fcacb774f03187f3802a27259f45c06d33cefa68d9c53426b15ad531aa822',
455
- * ciphertext_handle: '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358',
500
+ * ciphertext_handles: [ '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358' ]
456
501
  * eip712_verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657'
457
502
  * }
458
503
  * ```
@@ -498,39 +543,39 @@ module.exports.cryptobox_decrypt = function(ct, my_sk, their_pk) {
498
543
  * @param {any} request
499
544
  * @param {any} eip712_domain
500
545
  * @param {any} agg_resp
501
- * @param {PublicEncKey} enc_pk
502
- * @param {PrivateEncKey} enc_sk
546
+ * @param {PublicEncKeyMlKem512} enc_pk
547
+ * @param {PrivateEncKeyMlKem512} enc_sk
503
548
  * @param {boolean} verify
504
- * @returns {Uint8Array}
549
+ * @returns {TypedPlaintext[]}
505
550
  */
506
- module.exports.process_reencryption_resp_from_js = function(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
551
+ module.exports.process_user_decryption_resp_from_js = function(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
507
552
  _assertClass(client, Client);
508
- _assertClass(enc_pk, PublicEncKey);
509
- _assertClass(enc_sk, PrivateEncKey);
510
- const ret = wasm.process_reencryption_resp_from_js(client.__wbg_ptr, request, eip712_domain, agg_resp, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
553
+ _assertClass(enc_pk, PublicEncKeyMlKem512);
554
+ _assertClass(enc_sk, PrivateEncKeyMlKem512);
555
+ const ret = wasm.process_user_decryption_resp_from_js(client.__wbg_ptr, request, eip712_domain, agg_resp, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
511
556
  if (ret[3]) {
512
557
  throw takeFromExternrefTable0(ret[2]);
513
558
  }
514
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
515
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
559
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
560
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
516
561
  return v1;
517
562
  };
518
563
 
519
564
  /**
520
- * Process the reencryption response from Rust objects.
521
- * Consider using [process_reencryption_resp_from_js]
565
+ * Process the user_decryption response from Rust objects.
566
+ * Consider using [process_user_decryption_resp_from_js]
522
567
  * when using the JS API.
523
568
  * The result is a byte array representing a plaintext of any length.
524
569
  *
525
- * * `client` - client that wants to perform reencryption.
570
+ * * `client` - client that wants to perform user_decryption.
526
571
  *
527
- * * `request` - the initial reencryption request.
572
+ * * `request` - the initial user_decryption request.
528
573
  * Must be given if `verify` is true.
529
574
  *
530
575
  * * `eip712_domain` - the EIP-712 domain.
531
576
  * Must be given if `verify` is true.
532
577
  *
533
- * * `agg_resp` - the vector of reencryption responses.
578
+ * * `agg_resp` - the vector of user_decryption responses.
534
579
  *
535
580
  * * `enc_pk` - The ephemeral public key.
536
581
  *
@@ -539,19 +584,19 @@ module.exports.process_reencryption_resp_from_js = function(client, request, eip
539
584
  * * `verify` - Whether to perform signature verification for the response.
540
585
  * It is insecure if `verify = false`!
541
586
  * @param {Client} client
542
- * @param {ParsedReencryptionRequest | undefined} request
543
- * @param {Eip712DomainMsg | undefined} eip712_domain
544
- * @param {(ReencryptionResponse)[]} agg_resp
545
- * @param {PublicEncKey} enc_pk
546
- * @param {PrivateEncKey} enc_sk
587
+ * @param {ParsedUserDecryptionRequest | null | undefined} request
588
+ * @param {Eip712DomainMsg | null | undefined} eip712_domain
589
+ * @param {UserDecryptionResponse[]} agg_resp
590
+ * @param {PublicEncKeyMlKem512} enc_pk
591
+ * @param {PrivateEncKeyMlKem512} enc_sk
547
592
  * @param {boolean} verify
548
- * @returns {Uint8Array}
593
+ * @returns {TypedPlaintext[]}
549
594
  */
550
- module.exports.process_reencryption_resp = function(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
595
+ module.exports.process_user_decryption_resp = function(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
551
596
  _assertClass(client, Client);
552
597
  let ptr0 = 0;
553
598
  if (!isLikeNone(request)) {
554
- _assertClass(request, ParsedReencryptionRequest);
599
+ _assertClass(request, ParsedUserDecryptionRequest);
555
600
  ptr0 = request.__destroy_into_raw();
556
601
  }
557
602
  let ptr1 = 0;
@@ -561,29 +606,36 @@ module.exports.process_reencryption_resp = function(client, request, eip712_doma
561
606
  }
562
607
  const ptr2 = passArrayJsValueToWasm0(agg_resp, wasm.__wbindgen_malloc);
563
608
  const len2 = WASM_VECTOR_LEN;
564
- _assertClass(enc_pk, PublicEncKey);
565
- _assertClass(enc_sk, PrivateEncKey);
566
- const ret = wasm.process_reencryption_resp(client.__wbg_ptr, ptr0, ptr1, ptr2, len2, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
609
+ _assertClass(enc_pk, PublicEncKeyMlKem512);
610
+ _assertClass(enc_sk, PrivateEncKeyMlKem512);
611
+ const ret = wasm.process_user_decryption_resp(client.__wbg_ptr, ptr0, ptr1, ptr2, len2, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
567
612
  if (ret[3]) {
568
613
  throw takeFromExternrefTable0(ret[2]);
569
614
  }
570
- var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
571
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
615
+ var v4 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
616
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
572
617
  return v4;
573
618
  };
574
619
 
575
- function handleError(f, args) {
576
- try {
577
- return f.apply(this, args);
578
- } catch (e) {
579
- const idx = addToExternrefTable0(e);
580
- wasm.__wbindgen_exn_store(idx);
620
+ const CiphertextHandleFinalization = (typeof FinalizationRegistry === 'undefined')
621
+ ? { register: () => {}, unregister: () => {} }
622
+ : new FinalizationRegistry(ptr => wasm.__wbg_ciphertexthandle_free(ptr >>> 0, 1));
623
+
624
+ class CiphertextHandle {
625
+
626
+ __destroy_into_raw() {
627
+ const ptr = this.__wbg_ptr;
628
+ this.__wbg_ptr = 0;
629
+ CiphertextHandleFinalization.unregister(this);
630
+ return ptr;
631
+ }
632
+
633
+ free() {
634
+ const ptr = this.__destroy_into_raw();
635
+ wasm.__wbg_ciphertexthandle_free(ptr, 0);
581
636
  }
582
637
  }
583
- /**
584
- * The plaintext types that can be encrypted in a fhevm ciphertext.
585
- */
586
- module.exports.FheType = Object.freeze({ Ebool:0,"0":"Ebool",Euint4:1,"1":"Euint4",Euint8:2,"2":"Euint8",Euint16:3,"3":"Euint16",Euint32:4,"4":"Euint32",Euint64:5,"5":"Euint64",Euint128:6,"6":"Euint128",Euint160:7,"7":"Euint160",Euint256:8,"8":"Euint256",Euint512:9,"9":"Euint512",Euint1024:10,"10":"Euint1024",Euint2048:11,"11":"Euint2048", });
638
+ module.exports.CiphertextHandle = CiphertextHandle;
587
639
 
588
640
  const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
589
641
  ? { register: () => {}, unregister: () => {} }
@@ -619,41 +671,13 @@ class Client {
619
671
  }
620
672
  module.exports.Client = Client;
621
673
 
622
- const CryptoBoxCtFinalization = (typeof FinalizationRegistry === 'undefined')
623
- ? { register: () => {}, unregister: () => {} }
624
- : new FinalizationRegistry(ptr => wasm.__wbg_cryptoboxct_free(ptr >>> 0, 1));
625
-
626
- class CryptoBoxCt {
627
-
628
- static __wrap(ptr) {
629
- ptr = ptr >>> 0;
630
- const obj = Object.create(CryptoBoxCt.prototype);
631
- obj.__wbg_ptr = ptr;
632
- CryptoBoxCtFinalization.register(obj, obj.__wbg_ptr, obj);
633
- return obj;
634
- }
635
-
636
- __destroy_into_raw() {
637
- const ptr = this.__wbg_ptr;
638
- this.__wbg_ptr = 0;
639
- CryptoBoxCtFinalization.unregister(this);
640
- return ptr;
641
- }
642
-
643
- free() {
644
- const ptr = this.__destroy_into_raw();
645
- wasm.__wbg_cryptoboxct_free(ptr, 0);
646
- }
647
- }
648
- module.exports.CryptoBoxCt = CryptoBoxCt;
649
-
650
674
  const Eip712DomainMsgFinalization = (typeof FinalizationRegistry === 'undefined')
651
675
  ? { register: () => {}, unregister: () => {} }
652
676
  : new FinalizationRegistry(ptr => wasm.__wbg_eip712domainmsg_free(ptr >>> 0, 1));
653
677
  /**
654
- * <https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>
655
- * eventually chain_id, verifying_contract and salt will be parsed in to
656
- * solidity types
678
+ * Eip712 domain information.
679
+ * Any constraints specified in the [standard](<https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>) _must_ be fulfilled.
680
+ * Furthermore, be aware that all parameters will eventually be parsed into Solidity types.
657
681
  */
658
682
  class Eip712DomainMsg {
659
683
 
@@ -775,7 +799,7 @@ class Eip712DomainMsg {
775
799
  return v1;
776
800
  }
777
801
  /**
778
- * @param {Uint8Array | undefined} [arg0]
802
+ * @param {Uint8Array | null} [arg0]
779
803
  */
780
804
  set salt(arg0) {
781
805
  var ptr0 = isLikeNone(arg0) ? 0 : passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
@@ -785,55 +809,55 @@ class Eip712DomainMsg {
785
809
  }
786
810
  module.exports.Eip712DomainMsg = Eip712DomainMsg;
787
811
 
788
- const ParsedReencryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
812
+ const ParsedUserDecryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
789
813
  ? { register: () => {}, unregister: () => {} }
790
- : new FinalizationRegistry(ptr => wasm.__wbg_parsedreencryptionrequest_free(ptr >>> 0, 1));
814
+ : new FinalizationRegistry(ptr => wasm.__wbg_parseduserdecryptionrequest_free(ptr >>> 0, 1));
791
815
  /**
792
816
  * Validity of this struct is not checked.
793
817
  */
794
- class ParsedReencryptionRequest {
818
+ class ParsedUserDecryptionRequest {
795
819
 
796
820
  __destroy_into_raw() {
797
821
  const ptr = this.__wbg_ptr;
798
822
  this.__wbg_ptr = 0;
799
- ParsedReencryptionRequestFinalization.unregister(this);
823
+ ParsedUserDecryptionRequestFinalization.unregister(this);
800
824
  return ptr;
801
825
  }
802
826
 
803
827
  free() {
804
828
  const ptr = this.__destroy_into_raw();
805
- wasm.__wbg_parsedreencryptionrequest_free(ptr, 0);
829
+ wasm.__wbg_parseduserdecryptionrequest_free(ptr, 0);
806
830
  }
807
831
  }
808
- module.exports.ParsedReencryptionRequest = ParsedReencryptionRequest;
832
+ module.exports.ParsedUserDecryptionRequest = ParsedUserDecryptionRequest;
809
833
 
810
- const PrivateEncKeyFinalization = (typeof FinalizationRegistry === 'undefined')
834
+ const PrivateEncKeyMlKem512Finalization = (typeof FinalizationRegistry === 'undefined')
811
835
  ? { register: () => {}, unregister: () => {} }
812
- : new FinalizationRegistry(ptr => wasm.__wbg_privateenckey_free(ptr >>> 0, 1));
836
+ : new FinalizationRegistry(ptr => wasm.__wbg_privateenckeymlkem512_free(ptr >>> 0, 1));
813
837
 
814
- class PrivateEncKey {
838
+ class PrivateEncKeyMlKem512 {
815
839
 
816
840
  static __wrap(ptr) {
817
841
  ptr = ptr >>> 0;
818
- const obj = Object.create(PrivateEncKey.prototype);
842
+ const obj = Object.create(PrivateEncKeyMlKem512.prototype);
819
843
  obj.__wbg_ptr = ptr;
820
- PrivateEncKeyFinalization.register(obj, obj.__wbg_ptr, obj);
844
+ PrivateEncKeyMlKem512Finalization.register(obj, obj.__wbg_ptr, obj);
821
845
  return obj;
822
846
  }
823
847
 
824
848
  __destroy_into_raw() {
825
849
  const ptr = this.__wbg_ptr;
826
850
  this.__wbg_ptr = 0;
827
- PrivateEncKeyFinalization.unregister(this);
851
+ PrivateEncKeyMlKem512Finalization.unregister(this);
828
852
  return ptr;
829
853
  }
830
854
 
831
855
  free() {
832
856
  const ptr = this.__destroy_into_raw();
833
- wasm.__wbg_privateenckey_free(ptr, 0);
857
+ wasm.__wbg_privateenckeymlkem512_free(ptr, 0);
834
858
  }
835
859
  }
836
- module.exports.PrivateEncKey = PrivateEncKey;
860
+ module.exports.PrivateEncKeyMlKem512 = PrivateEncKeyMlKem512;
837
861
 
838
862
  const PrivateSigKeyFinalization = (typeof FinalizationRegistry === 'undefined')
839
863
  ? { register: () => {}, unregister: () => {} }
@@ -863,33 +887,33 @@ class PrivateSigKey {
863
887
  }
864
888
  module.exports.PrivateSigKey = PrivateSigKey;
865
889
 
866
- const PublicEncKeyFinalization = (typeof FinalizationRegistry === 'undefined')
890
+ const PublicEncKeyMlKem512Finalization = (typeof FinalizationRegistry === 'undefined')
867
891
  ? { register: () => {}, unregister: () => {} }
868
- : new FinalizationRegistry(ptr => wasm.__wbg_publicenckey_free(ptr >>> 0, 1));
892
+ : new FinalizationRegistry(ptr => wasm.__wbg_publicenckeymlkem512_free(ptr >>> 0, 1));
869
893
 
870
- class PublicEncKey {
894
+ class PublicEncKeyMlKem512 {
871
895
 
872
896
  static __wrap(ptr) {
873
897
  ptr = ptr >>> 0;
874
- const obj = Object.create(PublicEncKey.prototype);
898
+ const obj = Object.create(PublicEncKeyMlKem512.prototype);
875
899
  obj.__wbg_ptr = ptr;
876
- PublicEncKeyFinalization.register(obj, obj.__wbg_ptr, obj);
900
+ PublicEncKeyMlKem512Finalization.register(obj, obj.__wbg_ptr, obj);
877
901
  return obj;
878
902
  }
879
903
 
880
904
  __destroy_into_raw() {
881
905
  const ptr = this.__wbg_ptr;
882
906
  this.__wbg_ptr = 0;
883
- PublicEncKeyFinalization.unregister(this);
907
+ PublicEncKeyMlKem512Finalization.unregister(this);
884
908
  return ptr;
885
909
  }
886
910
 
887
911
  free() {
888
912
  const ptr = this.__destroy_into_raw();
889
- wasm.__wbg_publicenckey_free(ptr, 0);
913
+ wasm.__wbg_publicenckeymlkem512_free(ptr, 0);
890
914
  }
891
915
  }
892
- module.exports.PublicEncKey = PublicEncKey;
916
+ module.exports.PublicEncKeyMlKem512 = PublicEncKeyMlKem512;
893
917
 
894
918
  const PublicSigKeyFinalization = (typeof FinalizationRegistry === 'undefined')
895
919
  ? { register: () => {}, unregister: () => {} }
@@ -919,221 +943,447 @@ class PublicSigKey {
919
943
  }
920
944
  module.exports.PublicSigKey = PublicSigKey;
921
945
 
922
- const ReencryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
946
+ const RequestIdFinalization = (typeof FinalizationRegistry === 'undefined')
923
947
  ? { register: () => {}, unregister: () => {} }
924
- : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionrequest_free(ptr >>> 0, 1));
948
+ : new FinalizationRegistry(ptr => wasm.__wbg_requestid_free(ptr >>> 0, 1));
949
+ /**
950
+ * / A unique 32 Byte / 256 Bit ID, to be used to identify a request and
951
+ * / for retrieving the computed result later on.
952
+ * / Must be encoded in lower-case hex. The string must NOT contain a `0x` prefix.
953
+ */
954
+ class RequestId {
925
955
 
926
- class ReencryptionRequest {
956
+ static __wrap(ptr) {
957
+ ptr = ptr >>> 0;
958
+ const obj = Object.create(RequestId.prototype);
959
+ obj.__wbg_ptr = ptr;
960
+ RequestIdFinalization.register(obj, obj.__wbg_ptr, obj);
961
+ return obj;
962
+ }
927
963
 
928
964
  __destroy_into_raw() {
929
965
  const ptr = this.__wbg_ptr;
930
966
  this.__wbg_ptr = 0;
931
- ReencryptionRequestFinalization.unregister(this);
967
+ RequestIdFinalization.unregister(this);
932
968
  return ptr;
933
969
  }
934
970
 
935
971
  free() {
936
972
  const ptr = this.__destroy_into_raw();
937
- wasm.__wbg_reencryptionrequest_free(ptr, 0);
973
+ wasm.__wbg_requestid_free(ptr, 0);
938
974
  }
939
975
  /**
940
- * Signature of the serialization of \[ReencryptionRequestPayload\].
941
- * @returns {Uint8Array}
976
+ * @returns {string}
942
977
  */
943
- get signature() {
944
- const ret = wasm.__wbg_get_reencryptionrequest_signature(this.__wbg_ptr);
945
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
946
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
947
- return v1;
978
+ get request_id() {
979
+ let deferred1_0;
980
+ let deferred1_1;
981
+ try {
982
+ const ret = wasm.__wbg_get_requestid_request_id(this.__wbg_ptr);
983
+ deferred1_0 = ret[0];
984
+ deferred1_1 = ret[1];
985
+ return getStringFromWasm0(ret[0], ret[1]);
986
+ } finally {
987
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
988
+ }
948
989
  }
949
990
  /**
950
- * Signature of the serialization of \[ReencryptionRequestPayload\].
951
- * @param {Uint8Array} arg0
991
+ * @param {string} arg0
952
992
  */
953
- set signature(arg0) {
954
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
993
+ set request_id(arg0) {
994
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
955
995
  const len0 = WASM_VECTOR_LEN;
956
996
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
957
997
  }
958
- /**
959
- * @returns {ReencryptionRequestPayload | undefined}
960
- */
961
- get payload() {
962
- const ret = wasm.__wbg_get_reencryptionrequest_payload(this.__wbg_ptr);
963
- return ret === 0 ? undefined : ReencryptionRequestPayload.__wrap(ret);
964
- }
965
- /**
966
- * @param {ReencryptionRequestPayload | undefined} [arg0]
967
- */
968
- set payload(arg0) {
969
- let ptr0 = 0;
970
- if (!isLikeNone(arg0)) {
971
- _assertClass(arg0, ReencryptionRequestPayload);
972
- ptr0 = arg0.__destroy_into_raw();
973
- }
974
- wasm.__wbg_set_reencryptionrequest_payload(this.__wbg_ptr, ptr0);
975
- }
976
- /**
977
- * @returns {Eip712DomainMsg | undefined}
978
- */
979
- get domain() {
980
- const ret = wasm.__wbg_get_reencryptionrequest_domain(this.__wbg_ptr);
981
- return ret === 0 ? undefined : Eip712DomainMsg.__wrap(ret);
998
+ }
999
+ module.exports.RequestId = RequestId;
1000
+
1001
+ const ServerIdAddrFinalization = (typeof FinalizationRegistry === 'undefined')
1002
+ ? { register: () => {}, unregister: () => {} }
1003
+ : new FinalizationRegistry(ptr => wasm.__wbg_serveridaddr_free(ptr >>> 0, 1));
1004
+
1005
+ class ServerIdAddr {
1006
+
1007
+ static __wrap(ptr) {
1008
+ ptr = ptr >>> 0;
1009
+ const obj = Object.create(ServerIdAddr.prototype);
1010
+ obj.__wbg_ptr = ptr;
1011
+ ServerIdAddrFinalization.register(obj, obj.__wbg_ptr, obj);
1012
+ return obj;
982
1013
  }
983
- /**
984
- * @param {Eip712DomainMsg | undefined} [arg0]
985
- */
986
- set domain(arg0) {
987
- let ptr0 = 0;
988
- if (!isLikeNone(arg0)) {
989
- _assertClass(arg0, Eip712DomainMsg);
990
- ptr0 = arg0.__destroy_into_raw();
1014
+
1015
+ static __unwrap(jsValue) {
1016
+ if (!(jsValue instanceof ServerIdAddr)) {
1017
+ return 0;
991
1018
  }
992
- wasm.__wbg_set_reencryptionrequest_domain(this.__wbg_ptr, ptr0);
1019
+ return jsValue.__destroy_into_raw();
993
1020
  }
994
- /**
995
- * The ID that identifies this request.
996
- * Future queries for the result must use this request ID.
997
- * @returns {RequestId | undefined}
998
- */
999
- get request_id() {
1000
- const ret = wasm.__wbg_get_reencryptionrequest_request_id(this.__wbg_ptr);
1001
- return ret === 0 ? undefined : RequestId.__wrap(ret);
1021
+
1022
+ __destroy_into_raw() {
1023
+ const ptr = this.__wbg_ptr;
1024
+ this.__wbg_ptr = 0;
1025
+ ServerIdAddrFinalization.unregister(this);
1026
+ return ptr;
1002
1027
  }
1003
- /**
1004
- * The ID that identifies this request.
1005
- * Future queries for the result must use this request ID.
1006
- * @param {RequestId | undefined} [arg0]
1007
- */
1008
- set request_id(arg0) {
1009
- let ptr0 = 0;
1010
- if (!isLikeNone(arg0)) {
1011
- _assertClass(arg0, RequestId);
1012
- ptr0 = arg0.__destroy_into_raw();
1013
- }
1014
- wasm.__wbg_set_reencryptionrequest_request_id(this.__wbg_ptr, ptr0);
1028
+
1029
+ free() {
1030
+ const ptr = this.__destroy_into_raw();
1031
+ wasm.__wbg_serveridaddr_free(ptr, 0);
1015
1032
  }
1016
1033
  }
1017
- module.exports.ReencryptionRequest = ReencryptionRequest;
1034
+ module.exports.ServerIdAddr = ServerIdAddr;
1018
1035
 
1019
- const ReencryptionRequestPayloadFinalization = (typeof FinalizationRegistry === 'undefined')
1036
+ const TypedCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
1020
1037
  ? { register: () => {}, unregister: () => {} }
1021
- : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionrequestpayload_free(ptr >>> 0, 1));
1038
+ : new FinalizationRegistry(ptr => wasm.__wbg_typedciphertext_free(ptr >>> 0, 1));
1022
1039
 
1023
- class ReencryptionRequestPayload {
1040
+ class TypedCiphertext {
1024
1041
 
1025
1042
  static __wrap(ptr) {
1026
1043
  ptr = ptr >>> 0;
1027
- const obj = Object.create(ReencryptionRequestPayload.prototype);
1044
+ const obj = Object.create(TypedCiphertext.prototype);
1028
1045
  obj.__wbg_ptr = ptr;
1029
- ReencryptionRequestPayloadFinalization.register(obj, obj.__wbg_ptr, obj);
1046
+ TypedCiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
1030
1047
  return obj;
1031
1048
  }
1032
1049
 
1050
+ static __unwrap(jsValue) {
1051
+ if (!(jsValue instanceof TypedCiphertext)) {
1052
+ return 0;
1053
+ }
1054
+ return jsValue.__destroy_into_raw();
1055
+ }
1056
+
1033
1057
  __destroy_into_raw() {
1034
1058
  const ptr = this.__wbg_ptr;
1035
1059
  this.__wbg_ptr = 0;
1036
- ReencryptionRequestPayloadFinalization.unregister(this);
1060
+ TypedCiphertextFinalization.unregister(this);
1037
1061
  return ptr;
1038
1062
  }
1039
1063
 
1040
1064
  free() {
1041
1065
  const ptr = this.__destroy_into_raw();
1042
- wasm.__wbg_reencryptionrequestpayload_free(ptr, 0);
1066
+ wasm.__wbg_typedciphertext_free(ptr, 0);
1043
1067
  }
1044
1068
  /**
1045
- * Version of the request format.
1046
- * @returns {number}
1069
+ * The actual ciphertext to decrypt, taken directly from fhevm.
1070
+ * @returns {Uint8Array}
1047
1071
  */
1048
- get version() {
1049
- const ret = wasm.__wbg_get_reencryptionrequestpayload_version(this.__wbg_ptr);
1050
- return ret >>> 0;
1072
+ get ciphertext() {
1073
+ const ret = wasm.__wbg_get_typedciphertext_ciphertext(this.__wbg_ptr);
1074
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1075
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1076
+ return v1;
1051
1077
  }
1052
1078
  /**
1053
- * Version of the request format.
1054
- * @param {number} arg0
1079
+ * The actual ciphertext to decrypt, taken directly from fhevm.
1080
+ * @param {Uint8Array} arg0
1055
1081
  */
1056
- set version(arg0) {
1057
- wasm.__wbg_set_reencryptionrequestpayload_version(this.__wbg_ptr, arg0);
1082
+ set ciphertext(arg0) {
1083
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1084
+ const len0 = WASM_VECTOR_LEN;
1085
+ wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1058
1086
  }
1059
1087
  /**
1060
- * The client's (blockchain wallet) address,
1061
- * encoded using EIP-55.
1062
- * @returns {string}
1088
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1089
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1090
+ * @returns {number}
1063
1091
  */
1064
- get client_address() {
1065
- let deferred1_0;
1066
- let deferred1_1;
1067
- try {
1068
- const ret = wasm.__wbg_get_reencryptionrequestpayload_client_address(this.__wbg_ptr);
1069
- deferred1_0 = ret[0];
1070
- deferred1_1 = ret[1];
1071
- return getStringFromWasm0(ret[0], ret[1]);
1072
- } finally {
1073
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1074
- }
1092
+ get fhe_type() {
1093
+ const ret = wasm.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr);
1094
+ return ret;
1075
1095
  }
1076
1096
  /**
1077
- * The client's (blockchain wallet) address,
1078
- * encoded using EIP-55.
1079
- * @param {string} arg0
1097
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1098
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1099
+ * @param {number} arg0
1080
1100
  */
1081
- set client_address(arg0) {
1082
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1083
- const len0 = WASM_VECTOR_LEN;
1084
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1101
+ set fhe_type(arg0) {
1102
+ wasm.__wbg_set_typedciphertext_fhe_type(this.__wbg_ptr, arg0);
1085
1103
  }
1086
1104
  /**
1087
- * Encoding of the user's public encryption key for this request.
1088
- * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1089
- * Montgomery point.
1105
+ * The external handle of the ciphertext (the handle used in the copro).
1090
1106
  * @returns {Uint8Array}
1091
1107
  */
1092
- get enc_key() {
1093
- const ret = wasm.__wbg_get_reencryptionrequestpayload_enc_key(this.__wbg_ptr);
1108
+ get external_handle() {
1109
+ const ret = wasm.__wbg_get_typedciphertext_external_handle(this.__wbg_ptr);
1094
1110
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1095
1111
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1096
1112
  return v1;
1097
1113
  }
1098
1114
  /**
1099
- * Encoding of the user's public encryption key for this request.
1100
- * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1101
- * Montgomery point.
1115
+ * The external handle of the ciphertext (the handle used in the copro).
1102
1116
  * @param {Uint8Array} arg0
1103
1117
  */
1104
- set enc_key(arg0) {
1118
+ set external_handle(arg0) {
1105
1119
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1106
1120
  const len0 = WASM_VECTOR_LEN;
1107
1121
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1108
1122
  }
1109
1123
  /**
1110
- * The type of plaintext encrypted.
1124
+ * The ciphertext format, see CiphertextFormat documentation for details.
1125
+ * CiphertextFormat::default() is used if unspecified.
1126
+ * @returns {number}
1127
+ */
1128
+ get ciphertext_format() {
1129
+ const ret = wasm.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr);
1130
+ return ret;
1131
+ }
1132
+ /**
1133
+ * The ciphertext format, see CiphertextFormat documentation for details.
1134
+ * CiphertextFormat::default() is used if unspecified.
1135
+ * @param {number} arg0
1136
+ */
1137
+ set ciphertext_format(arg0) {
1138
+ wasm.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr, arg0);
1139
+ }
1140
+ }
1141
+ module.exports.TypedCiphertext = TypedCiphertext;
1142
+
1143
+ const TypedPlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
1144
+ ? { register: () => {}, unregister: () => {} }
1145
+ : new FinalizationRegistry(ptr => wasm.__wbg_typedplaintext_free(ptr >>> 0, 1));
1146
+
1147
+ class TypedPlaintext {
1148
+
1149
+ static __wrap(ptr) {
1150
+ ptr = ptr >>> 0;
1151
+ const obj = Object.create(TypedPlaintext.prototype);
1152
+ obj.__wbg_ptr = ptr;
1153
+ TypedPlaintextFinalization.register(obj, obj.__wbg_ptr, obj);
1154
+ return obj;
1155
+ }
1156
+
1157
+ __destroy_into_raw() {
1158
+ const ptr = this.__wbg_ptr;
1159
+ this.__wbg_ptr = 0;
1160
+ TypedPlaintextFinalization.unregister(this);
1161
+ return ptr;
1162
+ }
1163
+
1164
+ free() {
1165
+ const ptr = this.__destroy_into_raw();
1166
+ wasm.__wbg_typedplaintext_free(ptr, 0);
1167
+ }
1168
+ /**
1169
+ * The actual plaintext in bytes.
1170
+ * @returns {Uint8Array}
1171
+ */
1172
+ get bytes() {
1173
+ const ret = wasm.__wbg_get_typedplaintext_bytes(this.__wbg_ptr);
1174
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1175
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1176
+ return v1;
1177
+ }
1178
+ /**
1179
+ * The actual plaintext in bytes.
1180
+ * @param {Uint8Array} arg0
1181
+ */
1182
+ set bytes(arg0) {
1183
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1184
+ const len0 = WASM_VECTOR_LEN;
1185
+ wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1186
+ }
1187
+ /**
1188
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1189
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1190
+ * @returns {number}
1191
+ */
1192
+ get fhe_type() {
1193
+ const ret = wasm.__wbg_get_typedplaintext_fhe_type(this.__wbg_ptr);
1194
+ return ret;
1195
+ }
1196
+ /**
1197
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1198
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1199
+ * @param {number} arg0
1200
+ */
1201
+ set fhe_type(arg0) {
1202
+ wasm.__wbg_set_typedplaintext_fhe_type(this.__wbg_ptr, arg0);
1203
+ }
1204
+ }
1205
+ module.exports.TypedPlaintext = TypedPlaintext;
1206
+
1207
+ const TypedSigncryptedCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
1208
+ ? { register: () => {}, unregister: () => {} }
1209
+ : new FinalizationRegistry(ptr => wasm.__wbg_typedsigncryptedciphertext_free(ptr >>> 0, 1));
1210
+
1211
+ class TypedSigncryptedCiphertext {
1212
+
1213
+ static __wrap(ptr) {
1214
+ ptr = ptr >>> 0;
1215
+ const obj = Object.create(TypedSigncryptedCiphertext.prototype);
1216
+ obj.__wbg_ptr = ptr;
1217
+ TypedSigncryptedCiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
1218
+ return obj;
1219
+ }
1220
+
1221
+ static __unwrap(jsValue) {
1222
+ if (!(jsValue instanceof TypedSigncryptedCiphertext)) {
1223
+ return 0;
1224
+ }
1225
+ return jsValue.__destroy_into_raw();
1226
+ }
1227
+
1228
+ __destroy_into_raw() {
1229
+ const ptr = this.__wbg_ptr;
1230
+ this.__wbg_ptr = 0;
1231
+ TypedSigncryptedCiphertextFinalization.unregister(this);
1232
+ return ptr;
1233
+ }
1234
+
1235
+ free() {
1236
+ const ptr = this.__destroy_into_raw();
1237
+ wasm.__wbg_typedsigncryptedciphertext_free(ptr, 0);
1238
+ }
1239
+ /**
1240
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1241
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1111
1242
  * @returns {number}
1112
1243
  */
1113
1244
  get fhe_type() {
1114
- const ret = wasm.__wbg_get_reencryptionrequestpayload_fhe_type(this.__wbg_ptr);
1245
+ const ret = wasm.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr);
1115
1246
  return ret;
1116
1247
  }
1117
1248
  /**
1118
- * The type of plaintext encrypted.
1249
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1250
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1119
1251
  * @param {number} arg0
1120
1252
  */
1121
1253
  set fhe_type(arg0) {
1122
- wasm.__wbg_set_reencryptionrequestpayload_fhe_type(this.__wbg_ptr, arg0);
1254
+ wasm.__wbg_set_typedciphertext_fhe_type(this.__wbg_ptr, arg0);
1255
+ }
1256
+ /**
1257
+ * The signcrypted payload, using a hybrid encryption approach in
1258
+ * sign-then-encrypt.
1259
+ * @returns {Uint8Array}
1260
+ */
1261
+ get signcrypted_ciphertext() {
1262
+ const ret = wasm.__wbg_get_typedsigncryptedciphertext_signcrypted_ciphertext(this.__wbg_ptr);
1263
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1264
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1265
+ return v1;
1266
+ }
1267
+ /**
1268
+ * The signcrypted payload, using a hybrid encryption approach in
1269
+ * sign-then-encrypt.
1270
+ * @param {Uint8Array} arg0
1271
+ */
1272
+ set signcrypted_ciphertext(arg0) {
1273
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1274
+ const len0 = WASM_VECTOR_LEN;
1275
+ wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1276
+ }
1277
+ /**
1278
+ * The external handles that were originally in the request.
1279
+ * @returns {Uint8Array}
1280
+ */
1281
+ get external_handle() {
1282
+ const ret = wasm.__wbg_get_typedsigncryptedciphertext_external_handle(this.__wbg_ptr);
1283
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1284
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1285
+ return v1;
1286
+ }
1287
+ /**
1288
+ * The external handles that were originally in the request.
1289
+ * @param {Uint8Array} arg0
1290
+ */
1291
+ set external_handle(arg0) {
1292
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1293
+ const len0 = WASM_VECTOR_LEN;
1294
+ wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1295
+ }
1296
+ /**
1297
+ * The packing factor determines whether the decrypted plaintext
1298
+ * has a different way of packing compared to what is specified in the plaintext modulus.
1299
+ * @returns {number}
1300
+ */
1301
+ get packing_factor() {
1302
+ const ret = wasm.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr);
1303
+ return ret >>> 0;
1304
+ }
1305
+ /**
1306
+ * The packing factor determines whether the decrypted plaintext
1307
+ * has a different way of packing compared to what is specified in the plaintext modulus.
1308
+ * @param {number} arg0
1309
+ */
1310
+ set packing_factor(arg0) {
1311
+ wasm.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr, arg0);
1312
+ }
1313
+ }
1314
+ module.exports.TypedSigncryptedCiphertext = TypedSigncryptedCiphertext;
1315
+
1316
+ const UserDecryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
1317
+ ? { register: () => {}, unregister: () => {} }
1318
+ : new FinalizationRegistry(ptr => wasm.__wbg_userdecryptionrequest_free(ptr >>> 0, 1));
1319
+
1320
+ class UserDecryptionRequest {
1321
+
1322
+ __destroy_into_raw() {
1323
+ const ptr = this.__wbg_ptr;
1324
+ this.__wbg_ptr = 0;
1325
+ UserDecryptionRequestFinalization.unregister(this);
1326
+ return ptr;
1327
+ }
1328
+
1329
+ free() {
1330
+ const ptr = this.__destroy_into_raw();
1331
+ wasm.__wbg_userdecryptionrequest_free(ptr, 0);
1332
+ }
1333
+ /**
1334
+ * The 32 Byte / 256 Bit ID of the user decryption request, without `0x`
1335
+ * prefix. Future queries for the result must use this request ID.
1336
+ * @returns {RequestId | undefined}
1337
+ */
1338
+ get request_id() {
1339
+ const ret = wasm.__wbg_get_userdecryptionrequest_request_id(this.__wbg_ptr);
1340
+ return ret === 0 ? undefined : RequestId.__wrap(ret);
1341
+ }
1342
+ /**
1343
+ * The 32 Byte / 256 Bit ID of the user decryption request, without `0x`
1344
+ * prefix. Future queries for the result must use this request ID.
1345
+ * @param {RequestId | null} [arg0]
1346
+ */
1347
+ set request_id(arg0) {
1348
+ let ptr0 = 0;
1349
+ if (!isLikeNone(arg0)) {
1350
+ _assertClass(arg0, RequestId);
1351
+ ptr0 = arg0.__destroy_into_raw();
1352
+ }
1353
+ wasm.__wbg_set_userdecryptionrequest_request_id(this.__wbg_ptr, ptr0);
1354
+ }
1355
+ /**
1356
+ * The list of ciphertexts to decrypt for the user.
1357
+ * @returns {TypedCiphertext[]}
1358
+ */
1359
+ get typed_ciphertexts() {
1360
+ const ret = wasm.__wbg_get_userdecryptionrequest_typed_ciphertexts(this.__wbg_ptr);
1361
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1362
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1363
+ return v1;
1364
+ }
1365
+ /**
1366
+ * The list of ciphertexts to decrypt for the user.
1367
+ * @param {TypedCiphertext[]} arg0
1368
+ */
1369
+ set typed_ciphertexts(arg0) {
1370
+ const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
1371
+ const len0 = WASM_VECTOR_LEN;
1372
+ wasm.__wbg_set_userdecryptionrequest_typed_ciphertexts(this.__wbg_ptr, ptr0, len0);
1123
1373
  }
1124
1374
  /**
1125
- * The key id to use for decryption. Will be the request_id used during key
1126
- * generation
1375
+ * The 32 Byte / 256 Bit key id to use for decryption. This is the request_id
1376
+ * used for key generation
1127
1377
  * @returns {RequestId | undefined}
1128
1378
  */
1129
1379
  get key_id() {
1130
- const ret = wasm.__wbg_get_reencryptionrequestpayload_key_id(this.__wbg_ptr);
1380
+ const ret = wasm.__wbg_get_userdecryptionrequest_key_id(this.__wbg_ptr);
1131
1381
  return ret === 0 ? undefined : RequestId.__wrap(ret);
1132
1382
  }
1133
1383
  /**
1134
- * The key id to use for decryption. Will be the request_id used during key
1135
- * generation
1136
- * @param {RequestId | undefined} [arg0]
1384
+ * The 32 Byte / 256 Bit key id to use for decryption. This is the request_id
1385
+ * used for key generation
1386
+ * @param {RequestId | null} [arg0]
1137
1387
  */
1138
1388
  set key_id(arg0) {
1139
1389
  let ptr0 = 0;
@@ -1141,66 +1391,85 @@ class ReencryptionRequestPayload {
1141
1391
  _assertClass(arg0, RequestId);
1142
1392
  ptr0 = arg0.__destroy_into_raw();
1143
1393
  }
1144
- wasm.__wbg_set_reencryptionrequestpayload_key_id(this.__wbg_ptr, ptr0);
1394
+ wasm.__wbg_set_userdecryptionrequest_key_id(this.__wbg_ptr, ptr0);
1145
1395
  }
1146
1396
  /**
1147
- * The actual ciphertext to decrypt, taken directly from the fhevm.
1148
- * When creating the payload, this field may be empty,
1149
- * it is the responsibility of the gateway to fetch the
1150
- * ciphertext for the given digest below.
1151
- * @returns {Uint8Array | undefined}
1397
+ * The client's (blockchain wallet) address, encoded using EIP-55. I.e. including `0x`.
1398
+ * @returns {string}
1152
1399
  */
1153
- get ciphertext() {
1154
- const ret = wasm.__wbg_get_reencryptionrequestpayload_ciphertext(this.__wbg_ptr);
1155
- let v1;
1156
- if (ret[0] !== 0) {
1157
- v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1158
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1400
+ get client_address() {
1401
+ let deferred1_0;
1402
+ let deferred1_1;
1403
+ try {
1404
+ const ret = wasm.__wbg_get_userdecryptionrequest_client_address(this.__wbg_ptr);
1405
+ deferred1_0 = ret[0];
1406
+ deferred1_1 = ret[1];
1407
+ return getStringFromWasm0(ret[0], ret[1]);
1408
+ } finally {
1409
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1159
1410
  }
1160
- return v1;
1161
1411
  }
1162
1412
  /**
1163
- * The actual ciphertext to decrypt, taken directly from the fhevm.
1164
- * When creating the payload, this field may be empty,
1165
- * it is the responsibility of the gateway to fetch the
1166
- * ciphertext for the given digest below.
1167
- * @param {Uint8Array | undefined} [arg0]
1413
+ * The client's (blockchain wallet) address, encoded using EIP-55. I.e. including `0x`.
1414
+ * @param {string} arg0
1168
1415
  */
1169
- set ciphertext(arg0) {
1170
- var ptr0 = isLikeNone(arg0) ? 0 : passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1171
- var len0 = WASM_VECTOR_LEN;
1172
- wasm.__wbg_set_eip712domainmsg_salt(this.__wbg_ptr, ptr0, len0);
1416
+ set client_address(arg0) {
1417
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1418
+ const len0 = WASM_VECTOR_LEN;
1419
+ wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1173
1420
  }
1174
1421
  /**
1175
- * The SHA3 digest of the ciphertext above.
1422
+ * Encoding of the user's public encryption key for this request.
1423
+ * This must be a bincode (v.1) encoded ML-KEM 512 key.
1176
1424
  * @returns {Uint8Array}
1177
1425
  */
1178
- get ciphertext_digest() {
1179
- const ret = wasm.__wbg_get_reencryptionrequestpayload_ciphertext_digest(this.__wbg_ptr);
1426
+ get enc_key() {
1427
+ const ret = wasm.__wbg_get_userdecryptionrequest_enc_key(this.__wbg_ptr);
1180
1428
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1181
1429
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1182
1430
  return v1;
1183
1431
  }
1184
1432
  /**
1185
- * The SHA3 digest of the ciphertext above.
1433
+ * Encoding of the user's public encryption key for this request.
1434
+ * This must be a bincode (v.1) encoded ML-KEM 512 key.
1186
1435
  * @param {Uint8Array} arg0
1187
1436
  */
1188
- set ciphertext_digest(arg0) {
1437
+ set enc_key(arg0) {
1189
1438
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1190
1439
  const len0 = WASM_VECTOR_LEN;
1191
1440
  wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
1192
1441
  }
1442
+ /**
1443
+ * The user's EIP712 domain. This MUST be present. Furthermore, the `verifying_contract` MUST be set and be distinct from `client_address`.
1444
+ * @returns {Eip712DomainMsg | undefined}
1445
+ */
1446
+ get domain() {
1447
+ const ret = wasm.__wbg_get_userdecryptionrequest_domain(this.__wbg_ptr);
1448
+ return ret === 0 ? undefined : Eip712DomainMsg.__wrap(ret);
1449
+ }
1450
+ /**
1451
+ * The user's EIP712 domain. This MUST be present. Furthermore, the `verifying_contract` MUST be set and be distinct from `client_address`.
1452
+ * @param {Eip712DomainMsg | null} [arg0]
1453
+ */
1454
+ set domain(arg0) {
1455
+ let ptr0 = 0;
1456
+ if (!isLikeNone(arg0)) {
1457
+ _assertClass(arg0, Eip712DomainMsg);
1458
+ ptr0 = arg0.__destroy_into_raw();
1459
+ }
1460
+ wasm.__wbg_set_userdecryptionrequest_domain(this.__wbg_ptr, ptr0);
1461
+ }
1193
1462
  }
1194
- module.exports.ReencryptionRequestPayload = ReencryptionRequestPayload;
1463
+ module.exports.UserDecryptionRequest = UserDecryptionRequest;
1195
1464
 
1196
- const ReencryptionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
1465
+ const UserDecryptionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
1197
1466
  ? { register: () => {}, unregister: () => {} }
1198
- : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionresponse_free(ptr >>> 0, 1));
1467
+ : new FinalizationRegistry(ptr => wasm.__wbg_userdecryptionresponse_free(ptr >>> 0, 1));
1199
1468
 
1200
- class ReencryptionResponse {
1469
+ class UserDecryptionResponse {
1201
1470
 
1202
1471
  static __unwrap(jsValue) {
1203
- if (!(jsValue instanceof ReencryptionResponse)) {
1472
+ if (!(jsValue instanceof UserDecryptionResponse)) {
1204
1473
  return 0;
1205
1474
  }
1206
1475
  return jsValue.__destroy_into_raw();
@@ -1209,19 +1478,19 @@ class ReencryptionResponse {
1209
1478
  __destroy_into_raw() {
1210
1479
  const ptr = this.__wbg_ptr;
1211
1480
  this.__wbg_ptr = 0;
1212
- ReencryptionResponseFinalization.unregister(this);
1481
+ UserDecryptionResponseFinalization.unregister(this);
1213
1482
  return ptr;
1214
1483
  }
1215
1484
 
1216
1485
  free() {
1217
1486
  const ptr = this.__destroy_into_raw();
1218
- wasm.__wbg_reencryptionresponse_free(ptr, 0);
1487
+ wasm.__wbg_userdecryptionresponse_free(ptr, 0);
1219
1488
  }
1220
1489
  /**
1221
1490
  * @returns {Uint8Array}
1222
1491
  */
1223
1492
  get signature() {
1224
- const ret = wasm.__wbg_get_reencryptionresponse_signature(this.__wbg_ptr);
1493
+ const ret = wasm.__wbg_get_userdecryptionresponse_signature(this.__wbg_ptr);
1225
1494
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1226
1495
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1227
1496
  return v1;
@@ -1235,84 +1504,98 @@ class ReencryptionResponse {
1235
1504
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1236
1505
  }
1237
1506
  /**
1238
- * Signature of the serialization of \[ReencryptionResponsePayload\].
1239
- * @returns {ReencryptionResponsePayload | undefined}
1507
+ * This is the external signature created from the Eip712 domain
1508
+ * on the structure, where userDecryptedShare is bc2wrap::serialize(&payload)
1509
+ * struct UserDecryptResponseVerification {
1510
+ * bytes publicKey;
1511
+ * uint256\[\] ctHandles;
1512
+ * bytes userDecryptedShare;
1513
+ * }
1514
+ * @returns {Uint8Array}
1515
+ */
1516
+ get external_signature() {
1517
+ const ret = wasm.__wbg_get_userdecryptionresponse_external_signature(this.__wbg_ptr);
1518
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1519
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1520
+ return v1;
1521
+ }
1522
+ /**
1523
+ * This is the external signature created from the Eip712 domain
1524
+ * on the structure, where userDecryptedShare is bc2wrap::serialize(&payload)
1525
+ * struct UserDecryptResponseVerification {
1526
+ * bytes publicKey;
1527
+ * uint256\[\] ctHandles;
1528
+ * bytes userDecryptedShare;
1529
+ * }
1530
+ * @param {Uint8Array} arg0
1531
+ */
1532
+ set external_signature(arg0) {
1533
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1534
+ const len0 = WASM_VECTOR_LEN;
1535
+ wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1536
+ }
1537
+ /**
1538
+ * The actual \[UserDecryptionResponsePayload\].
1539
+ * @returns {UserDecryptionResponsePayload | undefined}
1240
1540
  */
1241
1541
  get payload() {
1242
- const ret = wasm.__wbg_get_reencryptionresponse_payload(this.__wbg_ptr);
1243
- return ret === 0 ? undefined : ReencryptionResponsePayload.__wrap(ret);
1542
+ const ret = wasm.__wbg_get_userdecryptionresponse_payload(this.__wbg_ptr);
1543
+ return ret === 0 ? undefined : UserDecryptionResponsePayload.__wrap(ret);
1244
1544
  }
1245
1545
  /**
1246
- * Signature of the serialization of \[ReencryptionResponsePayload\].
1247
- * @param {ReencryptionResponsePayload | undefined} [arg0]
1546
+ * The actual \[UserDecryptionResponsePayload\].
1547
+ * @param {UserDecryptionResponsePayload | null} [arg0]
1248
1548
  */
1249
1549
  set payload(arg0) {
1250
1550
  let ptr0 = 0;
1251
1551
  if (!isLikeNone(arg0)) {
1252
- _assertClass(arg0, ReencryptionResponsePayload);
1552
+ _assertClass(arg0, UserDecryptionResponsePayload);
1253
1553
  ptr0 = arg0.__destroy_into_raw();
1254
1554
  }
1255
- wasm.__wbg_set_reencryptionresponse_payload(this.__wbg_ptr, ptr0);
1555
+ wasm.__wbg_set_userdecryptionresponse_payload(this.__wbg_ptr, ptr0);
1256
1556
  }
1257
1557
  }
1258
- module.exports.ReencryptionResponse = ReencryptionResponse;
1558
+ module.exports.UserDecryptionResponse = UserDecryptionResponse;
1259
1559
 
1260
- const ReencryptionResponsePayloadFinalization = (typeof FinalizationRegistry === 'undefined')
1560
+ const UserDecryptionResponsePayloadFinalization = (typeof FinalizationRegistry === 'undefined')
1261
1561
  ? { register: () => {}, unregister: () => {} }
1262
- : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionresponsepayload_free(ptr >>> 0, 1));
1562
+ : new FinalizationRegistry(ptr => wasm.__wbg_userdecryptionresponsepayload_free(ptr >>> 0, 1));
1263
1563
 
1264
- class ReencryptionResponsePayload {
1564
+ class UserDecryptionResponsePayload {
1265
1565
 
1266
1566
  static __wrap(ptr) {
1267
1567
  ptr = ptr >>> 0;
1268
- const obj = Object.create(ReencryptionResponsePayload.prototype);
1568
+ const obj = Object.create(UserDecryptionResponsePayload.prototype);
1269
1569
  obj.__wbg_ptr = ptr;
1270
- ReencryptionResponsePayloadFinalization.register(obj, obj.__wbg_ptr, obj);
1570
+ UserDecryptionResponsePayloadFinalization.register(obj, obj.__wbg_ptr, obj);
1271
1571
  return obj;
1272
1572
  }
1273
1573
 
1274
1574
  __destroy_into_raw() {
1275
1575
  const ptr = this.__wbg_ptr;
1276
1576
  this.__wbg_ptr = 0;
1277
- ReencryptionResponsePayloadFinalization.unregister(this);
1577
+ UserDecryptionResponsePayloadFinalization.unregister(this);
1278
1578
  return ptr;
1279
1579
  }
1280
1580
 
1281
1581
  free() {
1282
1582
  const ptr = this.__destroy_into_raw();
1283
- wasm.__wbg_reencryptionresponsepayload_free(ptr, 0);
1284
- }
1285
- /**
1286
- * Version of the response format.
1287
- * @returns {number}
1288
- */
1289
- get version() {
1290
- const ret = wasm.__wbg_get_reencryptionresponsepayload_version(this.__wbg_ptr);
1291
- return ret >>> 0;
1292
- }
1293
- /**
1294
- * Version of the response format.
1295
- * @param {number} arg0
1296
- */
1297
- set version(arg0) {
1298
- wasm.__wbg_set_reencryptionresponsepayload_version(this.__wbg_ptr, arg0);
1583
+ wasm.__wbg_userdecryptionresponsepayload_free(ptr, 0);
1299
1584
  }
1300
1585
  /**
1301
- * The server's signature verification key.
1302
- * Encoded using SEC1.
1586
+ * The server's signature verification key, Encoded using SEC1.
1303
1587
  * Needed to validate the response, but MUST also be linked to a list of
1304
1588
  * trusted keys.
1305
1589
  * @returns {Uint8Array}
1306
1590
  */
1307
1591
  get verification_key() {
1308
- const ret = wasm.__wbg_get_reencryptionresponsepayload_verification_key(this.__wbg_ptr);
1592
+ const ret = wasm.__wbg_get_userdecryptionresponsepayload_verification_key(this.__wbg_ptr);
1309
1593
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1310
1594
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1311
1595
  return v1;
1312
1596
  }
1313
1597
  /**
1314
- * The server's signature verification key.
1315
- * Encoded using SEC1.
1598
+ * The server's signature verification key, Encoded using SEC1.
1316
1599
  * Needed to validate the response, but MUST also be linked to a list of
1317
1600
  * trusted keys.
1318
1601
  * @param {Uint8Array} arg0
@@ -1323,21 +1606,21 @@ class ReencryptionResponsePayload {
1323
1606
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1324
1607
  }
1325
1608
  /**
1326
- * The concatenation of two digests:
1327
- * (eip712_signing_hash(pk, domain) || ciphertext digest).
1328
1609
  * This is needed to ensure the response corresponds to the request.
1610
+ * It is the digest of UserDecryptionLinker hashed using EIP712
1611
+ * under the given domain in the request.
1329
1612
  * @returns {Uint8Array}
1330
1613
  */
1331
1614
  get digest() {
1332
- const ret = wasm.__wbg_get_reencryptionresponsepayload_digest(this.__wbg_ptr);
1615
+ const ret = wasm.__wbg_get_userdecryptionresponsepayload_digest(this.__wbg_ptr);
1333
1616
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1334
1617
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1335
1618
  return v1;
1336
1619
  }
1337
1620
  /**
1338
- * The concatenation of two digests:
1339
- * (eip712_signing_hash(pk, domain) || ciphertext digest).
1340
1621
  * This is needed to ensure the response corresponds to the request.
1622
+ * It is the digest of UserDecryptionLinker hashed using EIP712
1623
+ * under the given domain in the request.
1341
1624
  * @param {Uint8Array} arg0
1342
1625
  */
1343
1626
  set digest(arg0) {
@@ -1346,64 +1629,51 @@ class ReencryptionResponsePayload {
1346
1629
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1347
1630
  }
1348
1631
  /**
1349
- * The type of plaintext encrypted.
1350
- * @returns {number}
1351
- */
1352
- get fhe_type() {
1353
- const ret = wasm.__wbg_get_reencryptionresponsepayload_fhe_type(this.__wbg_ptr);
1354
- return ret;
1355
- }
1356
- /**
1357
- * The type of plaintext encrypted.
1358
- * @param {number} arg0
1359
- */
1360
- set fhe_type(arg0) {
1361
- wasm.__wbg_set_reencryptionresponsepayload_fhe_type(this.__wbg_ptr, arg0);
1362
- }
1363
- /**
1364
- * The signcrypted payload, using a hybrid encryption approach in
1365
- * sign-then-encrypt.
1366
- * @returns {Uint8Array}
1632
+ * The resulting signcrypted ciphertexts, each ciphertext
1633
+ * must be decrypted and then reconstructed with the other shares
1634
+ * to produce the final plaintext.
1635
+ * @returns {TypedSigncryptedCiphertext[]}
1367
1636
  */
1368
- get signcrypted_ciphertext() {
1369
- const ret = wasm.__wbg_get_reencryptionresponsepayload_signcrypted_ciphertext(this.__wbg_ptr);
1370
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1371
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1637
+ get signcrypted_ciphertexts() {
1638
+ const ret = wasm.__wbg_get_userdecryptionresponsepayload_signcrypted_ciphertexts(this.__wbg_ptr);
1639
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1640
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1372
1641
  return v1;
1373
1642
  }
1374
1643
  /**
1375
- * The signcrypted payload, using a hybrid encryption approach in
1376
- * sign-then-encrypt.
1377
- * @param {Uint8Array} arg0
1644
+ * The resulting signcrypted ciphertexts, each ciphertext
1645
+ * must be decrypted and then reconstructed with the other shares
1646
+ * to produce the final plaintext.
1647
+ * @param {TypedSigncryptedCiphertext[]} arg0
1378
1648
  */
1379
- set signcrypted_ciphertext(arg0) {
1380
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1649
+ set signcrypted_ciphertexts(arg0) {
1650
+ const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
1381
1651
  const len0 = WASM_VECTOR_LEN;
1382
- wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
1652
+ wasm.__wbg_set_userdecryptionresponsepayload_signcrypted_ciphertexts(this.__wbg_ptr, ptr0, len0);
1383
1653
  }
1384
1654
  /**
1385
- * The ID of the MPC party doing the reencryption. Used for polynomial
1655
+ * The ID of the MPC party doing the user decryption. Used for polynomial
1386
1656
  * reconstruction.
1387
1657
  * @returns {number}
1388
1658
  */
1389
1659
  get party_id() {
1390
- const ret = wasm.__wbg_get_reencryptionresponsepayload_party_id(this.__wbg_ptr);
1660
+ const ret = wasm.__wbg_get_userdecryptionresponsepayload_party_id(this.__wbg_ptr);
1391
1661
  return ret >>> 0;
1392
1662
  }
1393
1663
  /**
1394
- * The ID of the MPC party doing the reencryption. Used for polynomial
1664
+ * The ID of the MPC party doing the user decryption. Used for polynomial
1395
1665
  * reconstruction.
1396
1666
  * @param {number} arg0
1397
1667
  */
1398
1668
  set party_id(arg0) {
1399
- wasm.__wbg_set_reencryptionresponsepayload_party_id(this.__wbg_ptr, arg0);
1669
+ wasm.__wbg_set_userdecryptionresponsepayload_party_id(this.__wbg_ptr, arg0);
1400
1670
  }
1401
1671
  /**
1402
1672
  * The degree of the sharing scheme used.
1403
1673
  * @returns {number}
1404
1674
  */
1405
1675
  get degree() {
1406
- const ret = wasm.__wbg_get_reencryptionresponsepayload_degree(this.__wbg_ptr);
1676
+ const ret = wasm.__wbg_get_userdecryptionresponsepayload_degree(this.__wbg_ptr);
1407
1677
  return ret >>> 0;
1408
1678
  }
1409
1679
  /**
@@ -1411,357 +1681,276 @@ class ReencryptionResponsePayload {
1411
1681
  * @param {number} arg0
1412
1682
  */
1413
1683
  set degree(arg0) {
1414
- wasm.__wbg_set_reencryptionresponsepayload_degree(this.__wbg_ptr, arg0);
1684
+ wasm.__wbg_set_userdecryptionresponsepayload_degree(this.__wbg_ptr, arg0);
1415
1685
  }
1416
1686
  }
1417
- module.exports.ReencryptionResponsePayload = ReencryptionResponsePayload;
1687
+ module.exports.UserDecryptionResponsePayload = UserDecryptionResponsePayload;
1418
1688
 
1419
- const RequestIdFinalization = (typeof FinalizationRegistry === 'undefined')
1420
- ? { register: () => {}, unregister: () => {} }
1421
- : new FinalizationRegistry(ptr => wasm.__wbg_requestid_free(ptr >>> 0, 1));
1422
- /**
1423
- * Simple response to return an ID, to be used to retrieve the computed result
1424
- * later on.
1425
- */
1426
- class RequestId {
1427
-
1428
- static __wrap(ptr) {
1429
- ptr = ptr >>> 0;
1430
- const obj = Object.create(RequestId.prototype);
1431
- obj.__wbg_ptr = ptr;
1432
- RequestIdFinalization.register(obj, obj.__wbg_ptr, obj);
1433
- return obj;
1434
- }
1435
-
1436
- __destroy_into_raw() {
1437
- const ptr = this.__wbg_ptr;
1438
- this.__wbg_ptr = 0;
1439
- RequestIdFinalization.unregister(this);
1440
- return ptr;
1441
- }
1442
-
1443
- free() {
1444
- const ptr = this.__destroy_into_raw();
1445
- wasm.__wbg_requestid_free(ptr, 0);
1446
- }
1447
- /**
1448
- * @returns {string}
1449
- */
1450
- get request_id() {
1451
- let deferred1_0;
1452
- let deferred1_1;
1453
- try {
1454
- const ret = wasm.__wbg_get_requestid_request_id(this.__wbg_ptr);
1455
- deferred1_0 = ret[0];
1456
- deferred1_1 = ret[1];
1457
- return getStringFromWasm0(ret[0], ret[1]);
1458
- } finally {
1459
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1460
- }
1461
- }
1462
- /**
1463
- * @param {string} arg0
1464
- */
1465
- set request_id(arg0) {
1466
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1467
- const len0 = WASM_VECTOR_LEN;
1468
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1469
- }
1470
- }
1471
- module.exports.RequestId = RequestId;
1472
-
1473
- module.exports.__wbindgen_error_new = function(arg0, arg1) {
1474
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1475
- return ret;
1476
- };
1477
-
1478
- module.exports.__wbindgen_string_get = function(arg0, arg1) {
1479
- const obj = arg1;
1480
- const ret = typeof(obj) === 'string' ? obj : undefined;
1481
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1482
- var len1 = WASM_VECTOR_LEN;
1689
+ module.exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1690
+ const ret = String(arg1);
1691
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1692
+ const len1 = WASM_VECTOR_LEN;
1483
1693
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1484
1694
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1485
1695
  };
1486
1696
 
1487
- module.exports.__wbindgen_is_object = function(arg0) {
1488
- const val = arg0;
1489
- const ret = typeof(val) === 'object' && val !== null;
1697
+ module.exports.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
1698
+ const ret = arg0.buffer;
1490
1699
  return ret;
1491
1700
  };
1492
1701
 
1493
- module.exports.__wbindgen_is_undefined = function(arg0) {
1494
- const ret = arg0 === undefined;
1702
+ module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
1703
+ const ret = arg0.call(arg1);
1495
1704
  return ret;
1496
- };
1705
+ }, arguments) };
1497
1706
 
1498
- module.exports.__wbindgen_in = function(arg0, arg1) {
1499
- const ret = arg0 in arg1;
1707
+ module.exports.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
1708
+ const ret = arg0.call(arg1, arg2);
1500
1709
  return ret;
1501
- };
1710
+ }, arguments) };
1502
1711
 
1503
- module.exports.__wbindgen_is_null = function(arg0) {
1504
- const ret = arg0 === null;
1712
+ module.exports.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
1713
+ const ret = arg0.crypto;
1505
1714
  return ret;
1506
1715
  };
1507
1716
 
1508
- module.exports.__wbg_reencryptionresponse_unwrap = function(arg0) {
1509
- const ret = ReencryptionResponse.__unwrap(arg0);
1717
+ module.exports.__wbg_done_769e5ede4b31c67b = function(arg0) {
1718
+ const ret = arg0.done;
1510
1719
  return ret;
1511
1720
  };
1512
1721
 
1513
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
1514
- const obj = arg1;
1515
- const ret = typeof(obj) === 'number' ? obj : undefined;
1516
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1517
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1518
- };
1519
-
1520
- module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
1521
- const ret = arg0 == arg1;
1522
- return ret;
1722
+ module.exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
1723
+ let deferred0_0;
1724
+ let deferred0_1;
1725
+ try {
1726
+ deferred0_0 = arg0;
1727
+ deferred0_1 = arg1;
1728
+ console.error(getStringFromWasm0(arg0, arg1));
1729
+ } finally {
1730
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1731
+ }
1523
1732
  };
1524
1733
 
1525
- module.exports.__wbindgen_boolean_get = function(arg0) {
1526
- const v = arg0;
1527
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1528
- return ret;
1529
- };
1734
+ module.exports.__wbg_getRandomValues_bcb4912f16000dc4 = function() { return handleError(function (arg0, arg1) {
1735
+ arg0.getRandomValues(arg1);
1736
+ }, arguments) };
1530
1737
 
1531
- module.exports.__wbindgen_as_number = function(arg0) {
1532
- const ret = +arg0;
1738
+ module.exports.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
1739
+ const ret = Reflect.get(arg0, arg1);
1533
1740
  return ret;
1534
- };
1535
-
1536
- module.exports.__wbg_String_b9412f8799faab3e = function(arg0, arg1) {
1537
- const ret = String(arg1);
1538
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1539
- const len1 = WASM_VECTOR_LEN;
1540
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1541
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1542
- };
1741
+ }, arguments) };
1543
1742
 
1544
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
1545
- const ret = getStringFromWasm0(arg0, arg1);
1743
+ module.exports.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
1744
+ const ret = arg0[arg1 >>> 0];
1546
1745
  return ret;
1547
1746
  };
1548
1747
 
1549
- module.exports.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
1748
+ module.exports.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
1550
1749
  const ret = arg0[arg1];
1551
1750
  return ret;
1552
1751
  };
1553
1752
 
1554
- module.exports.__wbg_new_abda76e883ba8a5f = function() {
1555
- const ret = new Error();
1753
+ module.exports.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
1754
+ let result;
1755
+ try {
1756
+ result = arg0 instanceof ArrayBuffer;
1757
+ } catch (_) {
1758
+ result = false;
1759
+ }
1760
+ const ret = result;
1556
1761
  return ret;
1557
1762
  };
1558
1763
 
1559
- module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
1560
- const ret = arg1.stack;
1561
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1562
- const len1 = WASM_VECTOR_LEN;
1563
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1564
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1565
- };
1566
-
1567
- module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
1568
- let deferred0_0;
1569
- let deferred0_1;
1764
+ module.exports.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
1765
+ let result;
1570
1766
  try {
1571
- deferred0_0 = arg0;
1572
- deferred0_1 = arg1;
1573
- console.error(getStringFromWasm0(arg0, arg1));
1574
- } finally {
1575
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1767
+ result = arg0 instanceof Uint8Array;
1768
+ } catch (_) {
1769
+ result = false;
1576
1770
  }
1771
+ const ret = result;
1772
+ return ret;
1577
1773
  };
1578
1774
 
1579
- module.exports.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
1580
- const ret = arg0.crypto;
1775
+ module.exports.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
1776
+ const ret = Array.isArray(arg0);
1581
1777
  return ret;
1582
1778
  };
1583
1779
 
1584
- module.exports.__wbg_process_4a72847cc503995b = function(arg0) {
1585
- const ret = arg0.process;
1780
+ module.exports.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
1781
+ const ret = Number.isSafeInteger(arg0);
1586
1782
  return ret;
1587
1783
  };
1588
1784
 
1589
- module.exports.__wbg_versions_f686565e586dd935 = function(arg0) {
1590
- const ret = arg0.versions;
1785
+ module.exports.__wbg_iterator_9a24c88df860dc65 = function() {
1786
+ const ret = Symbol.iterator;
1591
1787
  return ret;
1592
1788
  };
1593
1789
 
1594
- module.exports.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
1595
- const ret = arg0.node;
1790
+ module.exports.__wbg_length_a446193dc22c12f8 = function(arg0) {
1791
+ const ret = arg0.length;
1596
1792
  return ret;
1597
1793
  };
1598
1794
 
1599
- module.exports.__wbindgen_is_string = function(arg0) {
1600
- const ret = typeof(arg0) === 'string';
1795
+ module.exports.__wbg_length_e2d2a49132c1b256 = function(arg0) {
1796
+ const ret = arg0.length;
1601
1797
  return ret;
1602
1798
  };
1603
1799
 
1604
- module.exports.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
1605
- const ret = module.require;
1800
+ module.exports.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
1801
+ const ret = arg0.msCrypto;
1606
1802
  return ret;
1607
- }, arguments) };
1803
+ };
1608
1804
 
1609
- module.exports.__wbindgen_is_function = function(arg0) {
1610
- const ret = typeof(arg0) === 'function';
1805
+ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
1806
+ const ret = new Error();
1611
1807
  return ret;
1612
1808
  };
1613
1809
 
1614
- module.exports.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
1615
- const ret = arg0.msCrypto;
1810
+ module.exports.__wbg_new_a12002a7f91c75be = function(arg0) {
1811
+ const ret = new Uint8Array(arg0);
1616
1812
  return ret;
1617
1813
  };
1618
1814
 
1619
- module.exports.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
1620
- arg0.randomFillSync(arg1);
1621
- }, arguments) };
1622
-
1623
- module.exports.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
1624
- arg0.getRandomValues(arg1);
1625
- }, arguments) };
1626
-
1627
- module.exports.__wbg_get_5419cf6b954aa11d = function(arg0, arg1) {
1628
- const ret = arg0[arg1 >>> 0];
1815
+ module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
1816
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
1629
1817
  return ret;
1630
1818
  };
1631
1819
 
1632
- module.exports.__wbg_length_f217bbbf7e8e4df4 = function(arg0) {
1633
- const ret = arg0.length;
1820
+ module.exports.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
1821
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
1634
1822
  return ret;
1635
1823
  };
1636
1824
 
1637
- module.exports.__wbg_newnoargs_1ede4bf2ebbaaf43 = function(arg0, arg1) {
1638
- const ret = new Function(getStringFromWasm0(arg0, arg1));
1825
+ module.exports.__wbg_newwithlength_a381634e90c276d4 = function(arg0) {
1826
+ const ret = new Uint8Array(arg0 >>> 0);
1639
1827
  return ret;
1640
1828
  };
1641
1829
 
1642
- module.exports.__wbg_next_13b477da1eaa3897 = function(arg0) {
1830
+ module.exports.__wbg_next_25feadfc0913fea9 = function(arg0) {
1643
1831
  const ret = arg0.next;
1644
1832
  return ret;
1645
1833
  };
1646
1834
 
1647
- module.exports.__wbg_next_b06e115d1b01e10b = function() { return handleError(function (arg0) {
1835
+ module.exports.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
1648
1836
  const ret = arg0.next();
1649
1837
  return ret;
1650
1838
  }, arguments) };
1651
1839
 
1652
- module.exports.__wbg_done_983b5ffcaec8c583 = function(arg0) {
1653
- const ret = arg0.done;
1654
- return ret;
1655
- };
1656
-
1657
- module.exports.__wbg_value_2ab8a198c834c26a = function(arg0) {
1658
- const ret = arg0.value;
1840
+ module.exports.__wbg_node_02999533c4ea02e3 = function(arg0) {
1841
+ const ret = arg0.node;
1659
1842
  return ret;
1660
1843
  };
1661
1844
 
1662
- module.exports.__wbg_iterator_695d699a44d6234c = function() {
1663
- const ret = Symbol.iterator;
1845
+ module.exports.__wbg_process_5c1d670bc53614b8 = function(arg0) {
1846
+ const ret = arg0.process;
1664
1847
  return ret;
1665
1848
  };
1666
1849
 
1667
- module.exports.__wbg_get_ef828680c64da212 = function() { return handleError(function (arg0, arg1) {
1668
- const ret = Reflect.get(arg0, arg1);
1669
- return ret;
1850
+ module.exports.__wbg_randomFillSync_ab2cfe79ebbf2740 = function() { return handleError(function (arg0, arg1) {
1851
+ arg0.randomFillSync(arg1);
1670
1852
  }, arguments) };
1671
1853
 
1672
- module.exports.__wbg_call_a9ef466721e824f2 = function() { return handleError(function (arg0, arg1) {
1673
- const ret = arg0.call(arg1);
1854
+ module.exports.__wbg_require_79b1e9274cde3c87 = function() { return handleError(function () {
1855
+ const ret = module.require;
1674
1856
  return ret;
1675
1857
  }, arguments) };
1676
1858
 
1677
- module.exports.__wbg_self_bf91bf94d9e04084 = function() { return handleError(function () {
1678
- const ret = self.self;
1859
+ module.exports.__wbg_serveridaddr_new = function(arg0) {
1860
+ const ret = ServerIdAddr.__wrap(arg0);
1679
1861
  return ret;
1680
- }, arguments) };
1862
+ };
1681
1863
 
1682
- module.exports.__wbg_window_52dd9f07d03fd5f8 = function() { return handleError(function () {
1683
- const ret = window.window;
1864
+ module.exports.__wbg_serveridaddr_unwrap = function(arg0) {
1865
+ const ret = ServerIdAddr.__unwrap(arg0);
1684
1866
  return ret;
1685
- }, arguments) };
1867
+ };
1686
1868
 
1687
- module.exports.__wbg_globalThis_05c129bf37fcf1be = function() { return handleError(function () {
1688
- const ret = globalThis.globalThis;
1689
- return ret;
1690
- }, arguments) };
1869
+ module.exports.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
1870
+ arg0.set(arg1, arg2 >>> 0);
1871
+ };
1691
1872
 
1692
- module.exports.__wbg_global_3eca19bb09e9c484 = function() { return handleError(function () {
1693
- const ret = global.global;
1694
- return ret;
1695
- }, arguments) };
1873
+ module.exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1874
+ const ret = arg1.stack;
1875
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1876
+ const len1 = WASM_VECTOR_LEN;
1877
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1878
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1879
+ };
1696
1880
 
1697
- module.exports.__wbg_isArray_6f3b47f09adb61b5 = function(arg0) {
1698
- const ret = Array.isArray(arg0);
1699
- return ret;
1881
+ module.exports.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
1882
+ const ret = typeof global === 'undefined' ? null : global;
1883
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1700
1884
  };
1701
1885
 
1702
- module.exports.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) {
1703
- let result;
1704
- try {
1705
- result = arg0 instanceof ArrayBuffer;
1706
- } catch (_) {
1707
- result = false;
1708
- }
1709
- const ret = result;
1886
+ module.exports.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
1887
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1888
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1889
+ };
1890
+
1891
+ module.exports.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
1892
+ const ret = typeof self === 'undefined' ? null : self;
1893
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1894
+ };
1895
+
1896
+ module.exports.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
1897
+ const ret = typeof window === 'undefined' ? null : window;
1898
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1899
+ };
1900
+
1901
+ module.exports.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) {
1902
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1710
1903
  return ret;
1711
1904
  };
1712
1905
 
1713
- module.exports.__wbg_call_3bfa248576352471 = function() { return handleError(function (arg0, arg1, arg2) {
1714
- const ret = arg0.call(arg1, arg2);
1906
+ module.exports.__wbg_typedciphertext_new = function(arg0) {
1907
+ const ret = TypedCiphertext.__wrap(arg0);
1715
1908
  return ret;
1716
- }, arguments) };
1909
+ };
1717
1910
 
1718
- module.exports.__wbg_isSafeInteger_b9dff570f01a9100 = function(arg0) {
1719
- const ret = Number.isSafeInteger(arg0);
1911
+ module.exports.__wbg_typedciphertext_unwrap = function(arg0) {
1912
+ const ret = TypedCiphertext.__unwrap(arg0);
1720
1913
  return ret;
1721
1914
  };
1722
1915
 
1723
- module.exports.__wbg_buffer_ccaed51a635d8a2d = function(arg0) {
1724
- const ret = arg0.buffer;
1916
+ module.exports.__wbg_typedplaintext_new = function(arg0) {
1917
+ const ret = TypedPlaintext.__wrap(arg0);
1725
1918
  return ret;
1726
1919
  };
1727
1920
 
1728
- module.exports.__wbg_newwithbyteoffsetandlength_7e3eb787208af730 = function(arg0, arg1, arg2) {
1729
- const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
1921
+ module.exports.__wbg_typedsigncryptedciphertext_new = function(arg0) {
1922
+ const ret = TypedSigncryptedCiphertext.__wrap(arg0);
1730
1923
  return ret;
1731
1924
  };
1732
1925
 
1733
- module.exports.__wbg_new_fec2611eb9180f95 = function(arg0) {
1734
- const ret = new Uint8Array(arg0);
1926
+ module.exports.__wbg_typedsigncryptedciphertext_unwrap = function(arg0) {
1927
+ const ret = TypedSigncryptedCiphertext.__unwrap(arg0);
1735
1928
  return ret;
1736
1929
  };
1737
1930
 
1738
- module.exports.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) {
1739
- arg0.set(arg1, arg2 >>> 0);
1931
+ module.exports.__wbg_userdecryptionresponse_unwrap = function(arg0) {
1932
+ const ret = UserDecryptionResponse.__unwrap(arg0);
1933
+ return ret;
1740
1934
  };
1741
1935
 
1742
- module.exports.__wbg_length_9254c4bd3b9f23c4 = function(arg0) {
1743
- const ret = arg0.length;
1936
+ module.exports.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
1937
+ const ret = arg0.value;
1744
1938
  return ret;
1745
1939
  };
1746
1940
 
1747
- module.exports.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) {
1748
- let result;
1749
- try {
1750
- result = arg0 instanceof Uint8Array;
1751
- } catch (_) {
1752
- result = false;
1753
- }
1754
- const ret = result;
1941
+ module.exports.__wbg_versions_c71aa1626a93e0a1 = function(arg0) {
1942
+ const ret = arg0.versions;
1755
1943
  return ret;
1756
1944
  };
1757
1945
 
1758
- module.exports.__wbg_newwithlength_76462a666eca145f = function(arg0) {
1759
- const ret = new Uint8Array(arg0 >>> 0);
1946
+ module.exports.__wbindgen_as_number = function(arg0) {
1947
+ const ret = +arg0;
1760
1948
  return ret;
1761
1949
  };
1762
1950
 
1763
- module.exports.__wbg_subarray_975a06f9dbd16995 = function(arg0, arg1, arg2) {
1764
- const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1951
+ module.exports.__wbindgen_boolean_get = function(arg0) {
1952
+ const v = arg0;
1953
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1765
1954
  return ret;
1766
1955
  };
1767
1956
 
@@ -1773,17 +1962,18 @@ module.exports.__wbindgen_debug_string = function(arg0, arg1) {
1773
1962
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1774
1963
  };
1775
1964
 
1776
- module.exports.__wbindgen_throw = function(arg0, arg1) {
1777
- throw new Error(getStringFromWasm0(arg0, arg1));
1965
+ module.exports.__wbindgen_error_new = function(arg0, arg1) {
1966
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1967
+ return ret;
1778
1968
  };
1779
1969
 
1780
- module.exports.__wbindgen_memory = function() {
1781
- const ret = wasm.memory;
1970
+ module.exports.__wbindgen_in = function(arg0, arg1) {
1971
+ const ret = arg0 in arg1;
1782
1972
  return ret;
1783
1973
  };
1784
1974
 
1785
1975
  module.exports.__wbindgen_init_externref_table = function() {
1786
- const table = wasm.__wbindgen_export_2;
1976
+ const table = wasm.__wbindgen_export_4;
1787
1977
  const offset = table.grow(4);
1788
1978
  table.set(0, undefined);
1789
1979
  table.set(offset + 0, undefined);
@@ -1793,6 +1983,67 @@ module.exports.__wbindgen_init_externref_table = function() {
1793
1983
  ;
1794
1984
  };
1795
1985
 
1986
+ module.exports.__wbindgen_is_function = function(arg0) {
1987
+ const ret = typeof(arg0) === 'function';
1988
+ return ret;
1989
+ };
1990
+
1991
+ module.exports.__wbindgen_is_null = function(arg0) {
1992
+ const ret = arg0 === null;
1993
+ return ret;
1994
+ };
1995
+
1996
+ module.exports.__wbindgen_is_object = function(arg0) {
1997
+ const val = arg0;
1998
+ const ret = typeof(val) === 'object' && val !== null;
1999
+ return ret;
2000
+ };
2001
+
2002
+ module.exports.__wbindgen_is_string = function(arg0) {
2003
+ const ret = typeof(arg0) === 'string';
2004
+ return ret;
2005
+ };
2006
+
2007
+ module.exports.__wbindgen_is_undefined = function(arg0) {
2008
+ const ret = arg0 === undefined;
2009
+ return ret;
2010
+ };
2011
+
2012
+ module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
2013
+ const ret = arg0 == arg1;
2014
+ return ret;
2015
+ };
2016
+
2017
+ module.exports.__wbindgen_memory = function() {
2018
+ const ret = wasm.memory;
2019
+ return ret;
2020
+ };
2021
+
2022
+ module.exports.__wbindgen_number_get = function(arg0, arg1) {
2023
+ const obj = arg1;
2024
+ const ret = typeof(obj) === 'number' ? obj : undefined;
2025
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2026
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2027
+ };
2028
+
2029
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
2030
+ const obj = arg1;
2031
+ const ret = typeof(obj) === 'string' ? obj : undefined;
2032
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2033
+ var len1 = WASM_VECTOR_LEN;
2034
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2035
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2036
+ };
2037
+
2038
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
2039
+ const ret = getStringFromWasm0(arg0, arg1);
2040
+ return ret;
2041
+ };
2042
+
2043
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
2044
+ throw new Error(getStringFromWasm0(arg0, arg1));
2045
+ };
2046
+
1796
2047
  const path = require('path').join(__dirname, 'kms_lib_bg.wasm');
1797
2048
  const bytes = require('fs').readFileSync(path);
1798
2049