tkms 0.10.0-rc1 → 0.11.0-rc13

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
@@ -1,8 +1,6 @@
1
1
  let wasm;
2
2
 
3
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
-
5
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
3
+ let WASM_VECTOR_LEN = 0;
6
4
 
7
5
  let cachedUint8ArrayMemory0 = null;
8
6
 
@@ -13,26 +11,6 @@ function getUint8ArrayMemory0() {
13
11
  return cachedUint8ArrayMemory0;
14
12
  }
15
13
 
16
- function getStringFromWasm0(ptr, len) {
17
- ptr = ptr >>> 0;
18
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
19
- }
20
-
21
- function isLikeNone(x) {
22
- return x === undefined || x === null;
23
- }
24
-
25
- let cachedDataViewMemory0 = null;
26
-
27
- function getDataViewMemory0() {
28
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
29
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
30
- }
31
- return cachedDataViewMemory0;
32
- }
33
-
34
- let WASM_VECTOR_LEN = 0;
35
-
36
14
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
37
15
 
38
16
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -87,6 +65,43 @@ function passStringToWasm0(arg, malloc, realloc) {
87
65
  return ptr;
88
66
  }
89
67
 
68
+ let cachedDataViewMemory0 = null;
69
+
70
+ function getDataViewMemory0() {
71
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
72
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
73
+ }
74
+ return cachedDataViewMemory0;
75
+ }
76
+
77
+ function addToExternrefTable0(obj) {
78
+ const idx = wasm.__externref_table_alloc();
79
+ wasm.__wbindgen_export_4.set(idx, obj);
80
+ return idx;
81
+ }
82
+
83
+ function handleError(f, args) {
84
+ try {
85
+ return f.apply(this, args);
86
+ } catch (e) {
87
+ const idx = addToExternrefTable0(e);
88
+ wasm.__wbindgen_exn_store(idx);
89
+ }
90
+ }
91
+
92
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
93
+
94
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
95
+
96
+ function getStringFromWasm0(ptr, len) {
97
+ ptr = ptr >>> 0;
98
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
99
+ }
100
+
101
+ function isLikeNone(x) {
102
+ return x === undefined || x === null;
103
+ }
104
+
90
105
  function debugString(val) {
91
106
  // primitive types
92
107
  const type = typeof val;
@@ -128,7 +143,7 @@ function debugString(val) {
128
143
  // Test for built-in
129
144
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
130
145
  let className;
131
- if (builtInMatches.length > 1) {
146
+ if (builtInMatches && builtInMatches.length > 1) {
132
147
  className = builtInMatches[1];
133
148
  } else {
134
149
  // Failed to match the standard '[object ClassName]'
@@ -152,23 +167,15 @@ function debugString(val) {
152
167
  return className;
153
168
  }
154
169
 
155
- function getArrayU8FromWasm0(ptr, len) {
156
- ptr = ptr >>> 0;
157
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
158
- }
159
-
160
- function passArray8ToWasm0(arg, malloc) {
161
- const ptr = malloc(arg.length * 1, 1) >>> 0;
162
- getUint8ArrayMemory0().set(arg, ptr / 1);
163
- WASM_VECTOR_LEN = arg.length;
164
- return ptr;
165
- }
166
-
167
170
  function _assertClass(instance, klass) {
168
171
  if (!(instance instanceof klass)) {
169
172
  throw new Error(`expected instance of ${klass.name}`);
170
173
  }
171
- return instance.ptr;
174
+ }
175
+
176
+ function getArrayU8FromWasm0(ptr, len) {
177
+ ptr = ptr >>> 0;
178
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
172
179
  }
173
180
  /**
174
181
  * @param {PublicSigKey} pk
@@ -182,8 +189,15 @@ export function public_sig_key_to_u8vec(pk) {
182
189
  return v1;
183
190
  }
184
191
 
192
+ function passArray8ToWasm0(arg, malloc) {
193
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
194
+ getUint8ArrayMemory0().set(arg, ptr / 1);
195
+ WASM_VECTOR_LEN = arg.length;
196
+ return ptr;
197
+ }
198
+
185
199
  function takeFromExternrefTable0(idx) {
186
- const value = wasm.__wbindgen_export_2.get(idx);
200
+ const value = wasm.__wbindgen_export_4.get(idx);
187
201
  wasm.__externref_table_dealloc(idx);
188
202
  return value;
189
203
  }
@@ -230,17 +244,11 @@ export function u8vec_to_private_sig_key(v) {
230
244
  return PrivateSigKey.__wrap(ret[0]);
231
245
  }
232
246
 
233
- function addToExternrefTable0(obj) {
234
- const idx = wasm.__externref_table_alloc();
235
- wasm.__wbindgen_export_2.set(idx, obj);
236
- return idx;
237
- }
238
-
239
247
  function passArrayJsValueToWasm0(array, malloc) {
240
248
  const ptr = malloc(array.length * 4, 4) >>> 0;
241
- const mem = getDataViewMemory0();
242
249
  for (let i = 0; i < array.length; i++) {
243
- mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true);
250
+ const add = addToExternrefTable0(array[i]);
251
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
244
252
  }
245
253
  WASM_VECTOR_LEN = array.length;
246
254
  return ptr;
@@ -254,19 +262,19 @@ function passArrayJsValueToWasm0(array, malloc) {
254
262
  * * `client_address_hex` - the client (wallet) address in hex,
255
263
  * must be prefixed with "0x".
256
264
  *
257
- * * `param_choice` - the parameter choice, which can be either `"test"` or `"default"`.
265
+ * * `fhe_parameter` - the parameter choice, which can be either `"test"` or `"default"`.
258
266
  * The "default" parameter choice is selected if no matching string is found.
259
- * @param {(string)[]} server_addrs
267
+ * @param {string[]} server_addrs
260
268
  * @param {string} client_address_hex
261
- * @param {string} param_choice
269
+ * @param {string} fhe_parameter
262
270
  * @returns {Client}
263
271
  */
264
- export function new_client(server_addrs, client_address_hex, param_choice) {
272
+ export function new_client(server_addrs, client_address_hex, fhe_parameter) {
265
273
  const ptr0 = passArrayJsValueToWasm0(server_addrs, wasm.__wbindgen_malloc);
266
274
  const len0 = WASM_VECTOR_LEN;
267
275
  const ptr1 = passStringToWasm0(client_address_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
268
276
  const len1 = WASM_VECTOR_LEN;
269
- const ptr2 = passStringToWasm0(param_choice, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
277
+ const ptr2 = passStringToWasm0(fhe_parameter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
270
278
  const len2 = WASM_VECTOR_LEN;
271
279
  const ret = wasm.new_client(ptr0, len0, ptr1, len1, ptr2, len2);
272
280
  if (ret[2]) {
@@ -280,14 +288,14 @@ function getArrayJsValueFromWasm0(ptr, len) {
280
288
  const mem = getDataViewMemory0();
281
289
  const result = [];
282
290
  for (let i = ptr; i < ptr + 4 * len; i += 4) {
283
- result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
291
+ result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
284
292
  }
285
293
  wasm.__externref_drop_slice(ptr, len);
286
294
  return result;
287
295
  }
288
296
  /**
289
297
  * @param {Client} client
290
- * @returns {(string)[]}
298
+ * @returns {string[]}
291
299
  */
292
300
  export function get_server_addrs(client) {
293
301
  _assertClass(client, Client);
@@ -433,22 +441,23 @@ export function cryptobox_decrypt(ct, my_sk, their_pk) {
433
441
  }
434
442
 
435
443
  /**
436
- * Process the reencryption response from JavaScript objects.
444
+ * Process the user_decryption response from JavaScript objects.
437
445
  * The returned result is a byte array representing a plaintext of any length,
438
446
  * postprocessing is returned to turn it into an integer.
439
447
  *
440
- * * `client` - client that wants to perform reencryption.
448
+ * * `client` - client that wants to perform user_decryption.
441
449
  *
442
- * * `request` - the initial reencryption request JS object.
450
+ * * `request` - the initial user_decryption request JS object.
443
451
  * It can be set to null if `verify` is false.
444
452
  * Otherwise the caller needs to give the following JS object.
445
453
  * Note that `client_address` and `eip712_verifying_contract` follow EIP-55.
454
+ * The signature field is not needed.
446
455
  * ```
447
456
  * {
448
- * signature: '15a4f9a8eb61459cfba7d103d8f911fb04ce91ecf841b34c49c0d56a70b896d20cbc31986188f91efc3842b7df215cee8acb40178daedb8b63d0ba5d199bce121c',
457
+ * signature: undefined,
449
458
  * client_address: '0x17853A630aAe15AED549B2B874de08B73C0F59c5',
450
459
  * enc_key: '2000000000000000df2fcacb774f03187f3802a27259f45c06d33cefa68d9c53426b15ad531aa822',
451
- * ciphertext_handle: '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358',
460
+ * ciphertext_handles: [ '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358' ]
452
461
  * eip712_verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657'
453
462
  * }
454
463
  * ```
@@ -497,36 +506,36 @@ export function cryptobox_decrypt(ct, my_sk, their_pk) {
497
506
  * @param {PublicEncKey} enc_pk
498
507
  * @param {PrivateEncKey} enc_sk
499
508
  * @param {boolean} verify
500
- * @returns {Uint8Array}
509
+ * @returns {TypedPlaintext[]}
501
510
  */
502
- export function process_reencryption_resp_from_js(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
511
+ export function process_user_decryption_resp_from_js(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
503
512
  _assertClass(client, Client);
504
513
  _assertClass(enc_pk, PublicEncKey);
505
514
  _assertClass(enc_sk, PrivateEncKey);
506
- 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);
515
+ 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);
507
516
  if (ret[3]) {
508
517
  throw takeFromExternrefTable0(ret[2]);
509
518
  }
510
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
511
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
519
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
520
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
512
521
  return v1;
513
522
  }
514
523
 
515
524
  /**
516
- * Process the reencryption response from Rust objects.
517
- * Consider using [process_reencryption_resp_from_js]
525
+ * Process the user_decryption response from Rust objects.
526
+ * Consider using [process_user_decryption_resp_from_js]
518
527
  * when using the JS API.
519
528
  * The result is a byte array representing a plaintext of any length.
520
529
  *
521
- * * `client` - client that wants to perform reencryption.
530
+ * * `client` - client that wants to perform user_decryption.
522
531
  *
523
- * * `request` - the initial reencryption request.
532
+ * * `request` - the initial user_decryption request.
524
533
  * Must be given if `verify` is true.
525
534
  *
526
535
  * * `eip712_domain` - the EIP-712 domain.
527
536
  * Must be given if `verify` is true.
528
537
  *
529
- * * `agg_resp` - the vector of reencryption responses.
538
+ * * `agg_resp` - the vector of user_decryption responses.
530
539
  *
531
540
  * * `enc_pk` - The ephemeral public key.
532
541
  *
@@ -535,19 +544,19 @@ export function process_reencryption_resp_from_js(client, request, eip712_domain
535
544
  * * `verify` - Whether to perform signature verification for the response.
536
545
  * It is insecure if `verify = false`!
537
546
  * @param {Client} client
538
- * @param {ParsedReencryptionRequest | undefined} request
539
- * @param {Eip712DomainMsg | undefined} eip712_domain
540
- * @param {(ReencryptionResponse)[]} agg_resp
547
+ * @param {ParsedUserDecryptionRequest | null | undefined} request
548
+ * @param {Eip712DomainMsg | null | undefined} eip712_domain
549
+ * @param {UserDecryptionResponse[]} agg_resp
541
550
  * @param {PublicEncKey} enc_pk
542
551
  * @param {PrivateEncKey} enc_sk
543
552
  * @param {boolean} verify
544
- * @returns {Uint8Array}
553
+ * @returns {TypedPlaintext[]}
545
554
  */
546
- export function process_reencryption_resp(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
555
+ export function process_user_decryption_resp(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
547
556
  _assertClass(client, Client);
548
557
  let ptr0 = 0;
549
558
  if (!isLikeNone(request)) {
550
- _assertClass(request, ParsedReencryptionRequest);
559
+ _assertClass(request, ParsedUserDecryptionRequest);
551
560
  ptr0 = request.__destroy_into_raw();
552
561
  }
553
562
  let ptr1 = 0;
@@ -559,27 +568,33 @@ export function process_reencryption_resp(client, request, eip712_domain, agg_re
559
568
  const len2 = WASM_VECTOR_LEN;
560
569
  _assertClass(enc_pk, PublicEncKey);
561
570
  _assertClass(enc_sk, PrivateEncKey);
562
- const ret = wasm.process_reencryption_resp(client.__wbg_ptr, ptr0, ptr1, ptr2, len2, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
571
+ const ret = wasm.process_user_decryption_resp(client.__wbg_ptr, ptr0, ptr1, ptr2, len2, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
563
572
  if (ret[3]) {
564
573
  throw takeFromExternrefTable0(ret[2]);
565
574
  }
566
- var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
567
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
575
+ var v4 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
576
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
568
577
  return v4;
569
578
  }
570
579
 
571
- function handleError(f, args) {
572
- try {
573
- return f.apply(this, args);
574
- } catch (e) {
575
- const idx = addToExternrefTable0(e);
576
- wasm.__wbindgen_exn_store(idx);
580
+ const CiphertextHandleFinalization = (typeof FinalizationRegistry === 'undefined')
581
+ ? { register: () => {}, unregister: () => {} }
582
+ : new FinalizationRegistry(ptr => wasm.__wbg_ciphertexthandle_free(ptr >>> 0, 1));
583
+
584
+ export class CiphertextHandle {
585
+
586
+ __destroy_into_raw() {
587
+ const ptr = this.__wbg_ptr;
588
+ this.__wbg_ptr = 0;
589
+ CiphertextHandleFinalization.unregister(this);
590
+ return ptr;
591
+ }
592
+
593
+ free() {
594
+ const ptr = this.__destroy_into_raw();
595
+ wasm.__wbg_ciphertexthandle_free(ptr, 0);
577
596
  }
578
597
  }
579
- /**
580
- * The plaintext types that can be encrypted in a fhevm ciphertext.
581
- */
582
- export const 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", });
583
598
 
584
599
  const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
585
600
  ? { register: () => {}, unregister: () => {} }
@@ -769,7 +784,7 @@ export class Eip712DomainMsg {
769
784
  return v1;
770
785
  }
771
786
  /**
772
- * @param {Uint8Array | undefined} [arg0]
787
+ * @param {Uint8Array | null} [arg0]
773
788
  */
774
789
  set salt(arg0) {
775
790
  var ptr0 = isLikeNone(arg0) ? 0 : passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
@@ -778,24 +793,24 @@ export class Eip712DomainMsg {
778
793
  }
779
794
  }
780
795
 
781
- const ParsedReencryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
796
+ const ParsedUserDecryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
782
797
  ? { register: () => {}, unregister: () => {} }
783
- : new FinalizationRegistry(ptr => wasm.__wbg_parsedreencryptionrequest_free(ptr >>> 0, 1));
798
+ : new FinalizationRegistry(ptr => wasm.__wbg_parseduserdecryptionrequest_free(ptr >>> 0, 1));
784
799
  /**
785
800
  * Validity of this struct is not checked.
786
801
  */
787
- export class ParsedReencryptionRequest {
802
+ export class ParsedUserDecryptionRequest {
788
803
 
789
804
  __destroy_into_raw() {
790
805
  const ptr = this.__wbg_ptr;
791
806
  this.__wbg_ptr = 0;
792
- ParsedReencryptionRequestFinalization.unregister(this);
807
+ ParsedUserDecryptionRequestFinalization.unregister(this);
793
808
  return ptr;
794
809
  }
795
810
 
796
811
  free() {
797
812
  const ptr = this.__destroy_into_raw();
798
- wasm.__wbg_parsedreencryptionrequest_free(ptr, 0);
813
+ wasm.__wbg_parseduserdecryptionrequest_free(ptr, 0);
799
814
  }
800
815
  }
801
816
 
@@ -907,220 +922,407 @@ export class PublicSigKey {
907
922
  }
908
923
  }
909
924
 
910
- const ReencryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
925
+ const RequestIdFinalization = (typeof FinalizationRegistry === 'undefined')
911
926
  ? { register: () => {}, unregister: () => {} }
912
- : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionrequest_free(ptr >>> 0, 1));
927
+ : new FinalizationRegistry(ptr => wasm.__wbg_requestid_free(ptr >>> 0, 1));
928
+ /**
929
+ * Simple response to return a 32 Byte / 256 Bit ID, to be used to retrieve the
930
+ * computed result later on. This string does NOT contain a `0x` prefix.
931
+ */
932
+ export class RequestId {
913
933
 
914
- export class ReencryptionRequest {
934
+ static __wrap(ptr) {
935
+ ptr = ptr >>> 0;
936
+ const obj = Object.create(RequestId.prototype);
937
+ obj.__wbg_ptr = ptr;
938
+ RequestIdFinalization.register(obj, obj.__wbg_ptr, obj);
939
+ return obj;
940
+ }
915
941
 
916
942
  __destroy_into_raw() {
917
943
  const ptr = this.__wbg_ptr;
918
944
  this.__wbg_ptr = 0;
919
- ReencryptionRequestFinalization.unregister(this);
945
+ RequestIdFinalization.unregister(this);
920
946
  return ptr;
921
947
  }
922
948
 
923
949
  free() {
924
950
  const ptr = this.__destroy_into_raw();
925
- wasm.__wbg_reencryptionrequest_free(ptr, 0);
926
- }
927
- /**
928
- * Signature of the serialization of \[ReencryptionRequestPayload\].
929
- * @returns {Uint8Array}
930
- */
931
- get signature() {
932
- const ret = wasm.__wbg_get_reencryptionrequest_signature(this.__wbg_ptr);
933
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
934
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
935
- return v1;
936
- }
937
- /**
938
- * Signature of the serialization of \[ReencryptionRequestPayload\].
939
- * @param {Uint8Array} arg0
940
- */
941
- set signature(arg0) {
942
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
943
- const len0 = WASM_VECTOR_LEN;
944
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
945
- }
946
- /**
947
- * @returns {ReencryptionRequestPayload | undefined}
948
- */
949
- get payload() {
950
- const ret = wasm.__wbg_get_reencryptionrequest_payload(this.__wbg_ptr);
951
- return ret === 0 ? undefined : ReencryptionRequestPayload.__wrap(ret);
952
- }
953
- /**
954
- * @param {ReencryptionRequestPayload | undefined} [arg0]
955
- */
956
- set payload(arg0) {
957
- let ptr0 = 0;
958
- if (!isLikeNone(arg0)) {
959
- _assertClass(arg0, ReencryptionRequestPayload);
960
- ptr0 = arg0.__destroy_into_raw();
961
- }
962
- wasm.__wbg_set_reencryptionrequest_payload(this.__wbg_ptr, ptr0);
963
- }
964
- /**
965
- * @returns {Eip712DomainMsg | undefined}
966
- */
967
- get domain() {
968
- const ret = wasm.__wbg_get_reencryptionrequest_domain(this.__wbg_ptr);
969
- return ret === 0 ? undefined : Eip712DomainMsg.__wrap(ret);
970
- }
971
- /**
972
- * @param {Eip712DomainMsg | undefined} [arg0]
973
- */
974
- set domain(arg0) {
975
- let ptr0 = 0;
976
- if (!isLikeNone(arg0)) {
977
- _assertClass(arg0, Eip712DomainMsg);
978
- ptr0 = arg0.__destroy_into_raw();
979
- }
980
- wasm.__wbg_set_reencryptionrequest_domain(this.__wbg_ptr, ptr0);
951
+ wasm.__wbg_requestid_free(ptr, 0);
981
952
  }
982
953
  /**
983
- * The ID that identifies this request.
984
- * Future queries for the result must use this request ID.
985
- * @returns {RequestId | undefined}
954
+ * @returns {string}
986
955
  */
987
956
  get request_id() {
988
- const ret = wasm.__wbg_get_reencryptionrequest_request_id(this.__wbg_ptr);
989
- return ret === 0 ? undefined : RequestId.__wrap(ret);
957
+ let deferred1_0;
958
+ let deferred1_1;
959
+ try {
960
+ const ret = wasm.__wbg_get_requestid_request_id(this.__wbg_ptr);
961
+ deferred1_0 = ret[0];
962
+ deferred1_1 = ret[1];
963
+ return getStringFromWasm0(ret[0], ret[1]);
964
+ } finally {
965
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
966
+ }
990
967
  }
991
968
  /**
992
- * The ID that identifies this request.
993
- * Future queries for the result must use this request ID.
994
- * @param {RequestId | undefined} [arg0]
969
+ * @param {string} arg0
995
970
  */
996
971
  set request_id(arg0) {
997
- let ptr0 = 0;
998
- if (!isLikeNone(arg0)) {
999
- _assertClass(arg0, RequestId);
1000
- ptr0 = arg0.__destroy_into_raw();
1001
- }
1002
- wasm.__wbg_set_reencryptionrequest_request_id(this.__wbg_ptr, ptr0);
972
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
973
+ const len0 = WASM_VECTOR_LEN;
974
+ wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1003
975
  }
1004
976
  }
1005
977
 
1006
- const ReencryptionRequestPayloadFinalization = (typeof FinalizationRegistry === 'undefined')
978
+ const TypedCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
1007
979
  ? { register: () => {}, unregister: () => {} }
1008
- : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionrequestpayload_free(ptr >>> 0, 1));
980
+ : new FinalizationRegistry(ptr => wasm.__wbg_typedciphertext_free(ptr >>> 0, 1));
1009
981
 
1010
- export class ReencryptionRequestPayload {
982
+ export class TypedCiphertext {
1011
983
 
1012
984
  static __wrap(ptr) {
1013
985
  ptr = ptr >>> 0;
1014
- const obj = Object.create(ReencryptionRequestPayload.prototype);
986
+ const obj = Object.create(TypedCiphertext.prototype);
1015
987
  obj.__wbg_ptr = ptr;
1016
- ReencryptionRequestPayloadFinalization.register(obj, obj.__wbg_ptr, obj);
988
+ TypedCiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
1017
989
  return obj;
1018
990
  }
1019
991
 
992
+ static __unwrap(jsValue) {
993
+ if (!(jsValue instanceof TypedCiphertext)) {
994
+ return 0;
995
+ }
996
+ return jsValue.__destroy_into_raw();
997
+ }
998
+
1020
999
  __destroy_into_raw() {
1021
1000
  const ptr = this.__wbg_ptr;
1022
1001
  this.__wbg_ptr = 0;
1023
- ReencryptionRequestPayloadFinalization.unregister(this);
1002
+ TypedCiphertextFinalization.unregister(this);
1024
1003
  return ptr;
1025
1004
  }
1026
1005
 
1027
1006
  free() {
1028
1007
  const ptr = this.__destroy_into_raw();
1029
- wasm.__wbg_reencryptionrequestpayload_free(ptr, 0);
1008
+ wasm.__wbg_typedciphertext_free(ptr, 0);
1030
1009
  }
1031
1010
  /**
1032
- * Version of the request format.
1033
- * @returns {number}
1011
+ * The actual ciphertext to decrypt, taken directly from fhevm.
1012
+ * @returns {Uint8Array}
1034
1013
  */
1035
- get version() {
1036
- const ret = wasm.__wbg_get_reencryptionrequestpayload_version(this.__wbg_ptr);
1037
- return ret >>> 0;
1014
+ get ciphertext() {
1015
+ const ret = wasm.__wbg_get_typedciphertext_ciphertext(this.__wbg_ptr);
1016
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1017
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1018
+ return v1;
1038
1019
  }
1039
1020
  /**
1040
- * Version of the request format.
1041
- * @param {number} arg0
1021
+ * The actual ciphertext to decrypt, taken directly from fhevm.
1022
+ * @param {Uint8Array} arg0
1042
1023
  */
1043
- set version(arg0) {
1044
- wasm.__wbg_set_reencryptionrequestpayload_version(this.__wbg_ptr, arg0);
1024
+ set ciphertext(arg0) {
1025
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1026
+ const len0 = WASM_VECTOR_LEN;
1027
+ wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1045
1028
  }
1046
1029
  /**
1047
- * The client's (blockchain wallet) address,
1048
- * encoded using EIP-55.
1049
- * @returns {string}
1030
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1031
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1032
+ * @returns {number}
1050
1033
  */
1051
- get client_address() {
1052
- let deferred1_0;
1053
- let deferred1_1;
1054
- try {
1055
- const ret = wasm.__wbg_get_reencryptionrequestpayload_client_address(this.__wbg_ptr);
1056
- deferred1_0 = ret[0];
1057
- deferred1_1 = ret[1];
1058
- return getStringFromWasm0(ret[0], ret[1]);
1059
- } finally {
1060
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1061
- }
1034
+ get fhe_type() {
1035
+ const ret = wasm.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr);
1036
+ return ret;
1062
1037
  }
1063
1038
  /**
1064
- * The client's (blockchain wallet) address,
1065
- * encoded using EIP-55.
1066
- * @param {string} arg0
1039
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1040
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1041
+ * @param {number} arg0
1067
1042
  */
1068
- set client_address(arg0) {
1069
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1070
- const len0 = WASM_VECTOR_LEN;
1071
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1043
+ set fhe_type(arg0) {
1044
+ wasm.__wbg_set_typedciphertext_fhe_type(this.__wbg_ptr, arg0);
1072
1045
  }
1073
1046
  /**
1074
- * Encoding of the user's public encryption key for this request.
1075
- * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1076
- * Montgomery point.
1047
+ * The external handle of the ciphertext (the handle used in the copro).
1077
1048
  * @returns {Uint8Array}
1078
1049
  */
1079
- get enc_key() {
1080
- const ret = wasm.__wbg_get_reencryptionrequestpayload_enc_key(this.__wbg_ptr);
1050
+ get external_handle() {
1051
+ const ret = wasm.__wbg_get_typedciphertext_external_handle(this.__wbg_ptr);
1081
1052
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1082
1053
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1083
1054
  return v1;
1084
1055
  }
1085
1056
  /**
1086
- * Encoding of the user's public encryption key for this request.
1087
- * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1088
- * Montgomery point.
1057
+ * The external handle of the ciphertext (the handle used in the copro).
1089
1058
  * @param {Uint8Array} arg0
1090
1059
  */
1091
- set enc_key(arg0) {
1060
+ set external_handle(arg0) {
1092
1061
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1093
1062
  const len0 = WASM_VECTOR_LEN;
1094
1063
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1095
1064
  }
1096
1065
  /**
1097
- * The type of plaintext encrypted.
1066
+ * The ciphertext format, see CiphertextFormat documentation for details.
1067
+ * CiphertextFormat::default() is used if unspecified.
1098
1068
  * @returns {number}
1099
1069
  */
1100
- get fhe_type() {
1101
- const ret = wasm.__wbg_get_reencryptionrequestpayload_fhe_type(this.__wbg_ptr);
1070
+ get ciphertext_format() {
1071
+ const ret = wasm.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr);
1102
1072
  return ret;
1103
1073
  }
1104
1074
  /**
1105
- * The type of plaintext encrypted.
1075
+ * The ciphertext format, see CiphertextFormat documentation for details.
1076
+ * CiphertextFormat::default() is used if unspecified.
1106
1077
  * @param {number} arg0
1107
1078
  */
1108
- set fhe_type(arg0) {
1109
- wasm.__wbg_set_reencryptionrequestpayload_fhe_type(this.__wbg_ptr, arg0);
1079
+ set ciphertext_format(arg0) {
1080
+ wasm.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr, arg0);
1110
1081
  }
1111
- /**
1112
- * The key id to use for decryption. Will be the request_id used during key
1113
- * generation
1114
- * @returns {RequestId | undefined}
1115
- */
1116
- get key_id() {
1117
- const ret = wasm.__wbg_get_reencryptionrequestpayload_key_id(this.__wbg_ptr);
1082
+ }
1083
+
1084
+ const TypedPlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
1085
+ ? { register: () => {}, unregister: () => {} }
1086
+ : new FinalizationRegistry(ptr => wasm.__wbg_typedplaintext_free(ptr >>> 0, 1));
1087
+
1088
+ export class TypedPlaintext {
1089
+
1090
+ static __wrap(ptr) {
1091
+ ptr = ptr >>> 0;
1092
+ const obj = Object.create(TypedPlaintext.prototype);
1093
+ obj.__wbg_ptr = ptr;
1094
+ TypedPlaintextFinalization.register(obj, obj.__wbg_ptr, obj);
1095
+ return obj;
1096
+ }
1097
+
1098
+ __destroy_into_raw() {
1099
+ const ptr = this.__wbg_ptr;
1100
+ this.__wbg_ptr = 0;
1101
+ TypedPlaintextFinalization.unregister(this);
1102
+ return ptr;
1103
+ }
1104
+
1105
+ free() {
1106
+ const ptr = this.__destroy_into_raw();
1107
+ wasm.__wbg_typedplaintext_free(ptr, 0);
1108
+ }
1109
+ /**
1110
+ * The actual plaintext in bytes.
1111
+ * @returns {Uint8Array}
1112
+ */
1113
+ get bytes() {
1114
+ const ret = wasm.__wbg_get_typedplaintext_bytes(this.__wbg_ptr);
1115
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1116
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1117
+ return v1;
1118
+ }
1119
+ /**
1120
+ * The actual plaintext in bytes.
1121
+ * @param {Uint8Array} arg0
1122
+ */
1123
+ set bytes(arg0) {
1124
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1125
+ const len0 = WASM_VECTOR_LEN;
1126
+ wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1127
+ }
1128
+ /**
1129
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1130
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1131
+ * @returns {number}
1132
+ */
1133
+ get fhe_type() {
1134
+ const ret = wasm.__wbg_get_typedplaintext_fhe_type(this.__wbg_ptr);
1135
+ return ret;
1136
+ }
1137
+ /**
1138
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1139
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1140
+ * @param {number} arg0
1141
+ */
1142
+ set fhe_type(arg0) {
1143
+ wasm.__wbg_set_typedplaintext_fhe_type(this.__wbg_ptr, arg0);
1144
+ }
1145
+ }
1146
+
1147
+ const TypedSigncryptedCiphertextFinalization = (typeof FinalizationRegistry === 'undefined')
1148
+ ? { register: () => {}, unregister: () => {} }
1149
+ : new FinalizationRegistry(ptr => wasm.__wbg_typedsigncryptedciphertext_free(ptr >>> 0, 1));
1150
+
1151
+ export class TypedSigncryptedCiphertext {
1152
+
1153
+ static __wrap(ptr) {
1154
+ ptr = ptr >>> 0;
1155
+ const obj = Object.create(TypedSigncryptedCiphertext.prototype);
1156
+ obj.__wbg_ptr = ptr;
1157
+ TypedSigncryptedCiphertextFinalization.register(obj, obj.__wbg_ptr, obj);
1158
+ return obj;
1159
+ }
1160
+
1161
+ static __unwrap(jsValue) {
1162
+ if (!(jsValue instanceof TypedSigncryptedCiphertext)) {
1163
+ return 0;
1164
+ }
1165
+ return jsValue.__destroy_into_raw();
1166
+ }
1167
+
1168
+ __destroy_into_raw() {
1169
+ const ptr = this.__wbg_ptr;
1170
+ this.__wbg_ptr = 0;
1171
+ TypedSigncryptedCiphertextFinalization.unregister(this);
1172
+ return ptr;
1173
+ }
1174
+
1175
+ free() {
1176
+ const ptr = this.__destroy_into_raw();
1177
+ wasm.__wbg_typedsigncryptedciphertext_free(ptr, 0);
1178
+ }
1179
+ /**
1180
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1181
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1182
+ * @returns {number}
1183
+ */
1184
+ get fhe_type() {
1185
+ const ret = wasm.__wbg_get_typedciphertext_fhe_type(this.__wbg_ptr);
1186
+ return ret;
1187
+ }
1188
+ /**
1189
+ * The type of plaintext encrypted. The type should match FheType from tfhe-rs:
1190
+ * <https://github.com/zama-ai/tfhe-rs/blob/main/tfhe/src/high_level_api/mod.rs>
1191
+ * @param {number} arg0
1192
+ */
1193
+ set fhe_type(arg0) {
1194
+ wasm.__wbg_set_typedciphertext_fhe_type(this.__wbg_ptr, arg0);
1195
+ }
1196
+ /**
1197
+ * The signcrypted payload, using a hybrid encryption approach in
1198
+ * sign-then-encrypt.
1199
+ * @returns {Uint8Array}
1200
+ */
1201
+ get signcrypted_ciphertext() {
1202
+ const ret = wasm.__wbg_get_typedsigncryptedciphertext_signcrypted_ciphertext(this.__wbg_ptr);
1203
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1204
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1205
+ return v1;
1206
+ }
1207
+ /**
1208
+ * The signcrypted payload, using a hybrid encryption approach in
1209
+ * sign-then-encrypt.
1210
+ * @param {Uint8Array} arg0
1211
+ */
1212
+ set signcrypted_ciphertext(arg0) {
1213
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1214
+ const len0 = WASM_VECTOR_LEN;
1215
+ wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1216
+ }
1217
+ /**
1218
+ * The external handles that were originally in the request.
1219
+ * @returns {Uint8Array}
1220
+ */
1221
+ get external_handle() {
1222
+ const ret = wasm.__wbg_get_typedsigncryptedciphertext_external_handle(this.__wbg_ptr);
1223
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1224
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1225
+ return v1;
1226
+ }
1227
+ /**
1228
+ * The external handles that were originally in the request.
1229
+ * @param {Uint8Array} arg0
1230
+ */
1231
+ set external_handle(arg0) {
1232
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1233
+ const len0 = WASM_VECTOR_LEN;
1234
+ wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1235
+ }
1236
+ /**
1237
+ * The packing factor determines whether the decrypted plaintext
1238
+ * has a different way of packing compared to what is specified in the plaintext modulus.
1239
+ * @returns {number}
1240
+ */
1241
+ get packing_factor() {
1242
+ const ret = wasm.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr);
1243
+ return ret >>> 0;
1244
+ }
1245
+ /**
1246
+ * The packing factor determines whether the decrypted plaintext
1247
+ * has a different way of packing compared to what is specified in the plaintext modulus.
1248
+ * @param {number} arg0
1249
+ */
1250
+ set packing_factor(arg0) {
1251
+ wasm.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr, arg0);
1252
+ }
1253
+ }
1254
+
1255
+ const UserDecryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
1256
+ ? { register: () => {}, unregister: () => {} }
1257
+ : new FinalizationRegistry(ptr => wasm.__wbg_userdecryptionrequest_free(ptr >>> 0, 1));
1258
+
1259
+ export class UserDecryptionRequest {
1260
+
1261
+ __destroy_into_raw() {
1262
+ const ptr = this.__wbg_ptr;
1263
+ this.__wbg_ptr = 0;
1264
+ UserDecryptionRequestFinalization.unregister(this);
1265
+ return ptr;
1266
+ }
1267
+
1268
+ free() {
1269
+ const ptr = this.__destroy_into_raw();
1270
+ wasm.__wbg_userdecryptionrequest_free(ptr, 0);
1271
+ }
1272
+ /**
1273
+ * The 32 Byte / 256 Bit ID of the user decryption request, without `0x`
1274
+ * prefix. Future queries for the result must use this request ID.
1275
+ * @returns {RequestId | undefined}
1276
+ */
1277
+ get request_id() {
1278
+ const ret = wasm.__wbg_get_userdecryptionrequest_request_id(this.__wbg_ptr);
1279
+ return ret === 0 ? undefined : RequestId.__wrap(ret);
1280
+ }
1281
+ /**
1282
+ * The 32 Byte / 256 Bit ID of the user decryption request, without `0x`
1283
+ * prefix. Future queries for the result must use this request ID.
1284
+ * @param {RequestId | null} [arg0]
1285
+ */
1286
+ set request_id(arg0) {
1287
+ let ptr0 = 0;
1288
+ if (!isLikeNone(arg0)) {
1289
+ _assertClass(arg0, RequestId);
1290
+ ptr0 = arg0.__destroy_into_raw();
1291
+ }
1292
+ wasm.__wbg_set_userdecryptionrequest_request_id(this.__wbg_ptr, ptr0);
1293
+ }
1294
+ /**
1295
+ * The list of ciphertexts to decrypt for the user.
1296
+ * @returns {TypedCiphertext[]}
1297
+ */
1298
+ get typed_ciphertexts() {
1299
+ const ret = wasm.__wbg_get_userdecryptionrequest_typed_ciphertexts(this.__wbg_ptr);
1300
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1301
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1302
+ return v1;
1303
+ }
1304
+ /**
1305
+ * The list of ciphertexts to decrypt for the user.
1306
+ * @param {TypedCiphertext[]} arg0
1307
+ */
1308
+ set typed_ciphertexts(arg0) {
1309
+ const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
1310
+ const len0 = WASM_VECTOR_LEN;
1311
+ wasm.__wbg_set_userdecryptionrequest_typed_ciphertexts(this.__wbg_ptr, ptr0, len0);
1312
+ }
1313
+ /**
1314
+ * The 32 Byte / 256 Bit key id to use for decryption. This is the request_id
1315
+ * used for key generation
1316
+ * @returns {RequestId | undefined}
1317
+ */
1318
+ get key_id() {
1319
+ const ret = wasm.__wbg_get_userdecryptionrequest_key_id(this.__wbg_ptr);
1118
1320
  return ret === 0 ? undefined : RequestId.__wrap(ret);
1119
1321
  }
1120
1322
  /**
1121
- * The key id to use for decryption. Will be the request_id used during key
1122
- * generation
1123
- * @param {RequestId | undefined} [arg0]
1323
+ * The 32 Byte / 256 Bit key id to use for decryption. This is the request_id
1324
+ * used for key generation
1325
+ * @param {RequestId | null} [arg0]
1124
1326
  */
1125
1327
  set key_id(arg0) {
1126
1328
  let ptr0 = 0;
@@ -1128,65 +1330,86 @@ export class ReencryptionRequestPayload {
1128
1330
  _assertClass(arg0, RequestId);
1129
1331
  ptr0 = arg0.__destroy_into_raw();
1130
1332
  }
1131
- wasm.__wbg_set_reencryptionrequestpayload_key_id(this.__wbg_ptr, ptr0);
1333
+ wasm.__wbg_set_userdecryptionrequest_key_id(this.__wbg_ptr, ptr0);
1132
1334
  }
1133
1335
  /**
1134
- * The actual ciphertext to decrypt, taken directly from the fhevm.
1135
- * When creating the payload, this field may be empty,
1136
- * it is the responsibility of the gateway to fetch the
1137
- * ciphertext for the given digest below.
1138
- * @returns {Uint8Array | undefined}
1336
+ * The client's (blockchain wallet) address,
1337
+ * encoded using EIP-55.
1338
+ * @returns {string}
1139
1339
  */
1140
- get ciphertext() {
1141
- const ret = wasm.__wbg_get_reencryptionrequestpayload_ciphertext(this.__wbg_ptr);
1142
- let v1;
1143
- if (ret[0] !== 0) {
1144
- v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1145
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1340
+ get client_address() {
1341
+ let deferred1_0;
1342
+ let deferred1_1;
1343
+ try {
1344
+ const ret = wasm.__wbg_get_userdecryptionrequest_client_address(this.__wbg_ptr);
1345
+ deferred1_0 = ret[0];
1346
+ deferred1_1 = ret[1];
1347
+ return getStringFromWasm0(ret[0], ret[1]);
1348
+ } finally {
1349
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1146
1350
  }
1147
- return v1;
1148
1351
  }
1149
1352
  /**
1150
- * The actual ciphertext to decrypt, taken directly from the fhevm.
1151
- * When creating the payload, this field may be empty,
1152
- * it is the responsibility of the gateway to fetch the
1153
- * ciphertext for the given digest below.
1154
- * @param {Uint8Array | undefined} [arg0]
1353
+ * The client's (blockchain wallet) address,
1354
+ * encoded using EIP-55.
1355
+ * @param {string} arg0
1155
1356
  */
1156
- set ciphertext(arg0) {
1157
- var ptr0 = isLikeNone(arg0) ? 0 : passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1158
- var len0 = WASM_VECTOR_LEN;
1159
- wasm.__wbg_set_eip712domainmsg_salt(this.__wbg_ptr, ptr0, len0);
1357
+ set client_address(arg0) {
1358
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1359
+ const len0 = WASM_VECTOR_LEN;
1360
+ wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1160
1361
  }
1161
1362
  /**
1162
- * The SHA3 digest of the ciphertext above.
1363
+ * Encoding of the user's public encryption key for this request.
1364
+ * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1365
+ * Montgomery point.
1163
1366
  * @returns {Uint8Array}
1164
1367
  */
1165
- get ciphertext_digest() {
1166
- const ret = wasm.__wbg_get_reencryptionrequestpayload_ciphertext_digest(this.__wbg_ptr);
1368
+ get enc_key() {
1369
+ const ret = wasm.__wbg_get_userdecryptionrequest_enc_key(this.__wbg_ptr);
1167
1370
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1168
1371
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1169
1372
  return v1;
1170
1373
  }
1171
1374
  /**
1172
- * The SHA3 digest of the ciphertext above.
1375
+ * Encoding of the user's public encryption key for this request.
1376
+ * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1377
+ * Montgomery point.
1173
1378
  * @param {Uint8Array} arg0
1174
1379
  */
1175
- set ciphertext_digest(arg0) {
1380
+ set enc_key(arg0) {
1176
1381
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1177
1382
  const len0 = WASM_VECTOR_LEN;
1178
1383
  wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
1179
1384
  }
1385
+ /**
1386
+ * @returns {Eip712DomainMsg | undefined}
1387
+ */
1388
+ get domain() {
1389
+ const ret = wasm.__wbg_get_userdecryptionrequest_domain(this.__wbg_ptr);
1390
+ return ret === 0 ? undefined : Eip712DomainMsg.__wrap(ret);
1391
+ }
1392
+ /**
1393
+ * @param {Eip712DomainMsg | null} [arg0]
1394
+ */
1395
+ set domain(arg0) {
1396
+ let ptr0 = 0;
1397
+ if (!isLikeNone(arg0)) {
1398
+ _assertClass(arg0, Eip712DomainMsg);
1399
+ ptr0 = arg0.__destroy_into_raw();
1400
+ }
1401
+ wasm.__wbg_set_userdecryptionrequest_domain(this.__wbg_ptr, ptr0);
1402
+ }
1180
1403
  }
1181
1404
 
1182
- const ReencryptionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
1405
+ const UserDecryptionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
1183
1406
  ? { register: () => {}, unregister: () => {} }
1184
- : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionresponse_free(ptr >>> 0, 1));
1407
+ : new FinalizationRegistry(ptr => wasm.__wbg_userdecryptionresponse_free(ptr >>> 0, 1));
1185
1408
 
1186
- export class ReencryptionResponse {
1409
+ export class UserDecryptionResponse {
1187
1410
 
1188
1411
  static __unwrap(jsValue) {
1189
- if (!(jsValue instanceof ReencryptionResponse)) {
1412
+ if (!(jsValue instanceof UserDecryptionResponse)) {
1190
1413
  return 0;
1191
1414
  }
1192
1415
  return jsValue.__destroy_into_raw();
@@ -1195,19 +1418,19 @@ export class ReencryptionResponse {
1195
1418
  __destroy_into_raw() {
1196
1419
  const ptr = this.__wbg_ptr;
1197
1420
  this.__wbg_ptr = 0;
1198
- ReencryptionResponseFinalization.unregister(this);
1421
+ UserDecryptionResponseFinalization.unregister(this);
1199
1422
  return ptr;
1200
1423
  }
1201
1424
 
1202
1425
  free() {
1203
1426
  const ptr = this.__destroy_into_raw();
1204
- wasm.__wbg_reencryptionresponse_free(ptr, 0);
1427
+ wasm.__wbg_userdecryptionresponse_free(ptr, 0);
1205
1428
  }
1206
1429
  /**
1207
1430
  * @returns {Uint8Array}
1208
1431
  */
1209
1432
  get signature() {
1210
- const ret = wasm.__wbg_get_reencryptionresponse_signature(this.__wbg_ptr);
1433
+ const ret = wasm.__wbg_get_userdecryptionresponse_signature(this.__wbg_ptr);
1211
1434
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1212
1435
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1213
1436
  return v1;
@@ -1221,83 +1444,97 @@ export class ReencryptionResponse {
1221
1444
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1222
1445
  }
1223
1446
  /**
1224
- * Signature of the serialization of \[ReencryptionResponsePayload\].
1225
- * @returns {ReencryptionResponsePayload | undefined}
1447
+ * This is the external signature created from the Eip712 domain
1448
+ * on the structure, where userDecryptedShare is bincode::serialize(&payload)
1449
+ * struct UserDecryptResponseVerification {
1450
+ * bytes publicKey;
1451
+ * uint256\[\] ctHandles;
1452
+ * bytes userDecryptedShare;
1453
+ * }
1454
+ * @returns {Uint8Array}
1455
+ */
1456
+ get external_signature() {
1457
+ const ret = wasm.__wbg_get_userdecryptionresponse_external_signature(this.__wbg_ptr);
1458
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1459
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1460
+ return v1;
1461
+ }
1462
+ /**
1463
+ * This is the external signature created from the Eip712 domain
1464
+ * on the structure, where userDecryptedShare is bincode::serialize(&payload)
1465
+ * struct UserDecryptResponseVerification {
1466
+ * bytes publicKey;
1467
+ * uint256\[\] ctHandles;
1468
+ * bytes userDecryptedShare;
1469
+ * }
1470
+ * @param {Uint8Array} arg0
1471
+ */
1472
+ set external_signature(arg0) {
1473
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1474
+ const len0 = WASM_VECTOR_LEN;
1475
+ wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1476
+ }
1477
+ /**
1478
+ * The actual \[UserDecryptionResponsePayload\].
1479
+ * @returns {UserDecryptionResponsePayload | undefined}
1226
1480
  */
1227
1481
  get payload() {
1228
- const ret = wasm.__wbg_get_reencryptionresponse_payload(this.__wbg_ptr);
1229
- return ret === 0 ? undefined : ReencryptionResponsePayload.__wrap(ret);
1482
+ const ret = wasm.__wbg_get_userdecryptionresponse_payload(this.__wbg_ptr);
1483
+ return ret === 0 ? undefined : UserDecryptionResponsePayload.__wrap(ret);
1230
1484
  }
1231
1485
  /**
1232
- * Signature of the serialization of \[ReencryptionResponsePayload\].
1233
- * @param {ReencryptionResponsePayload | undefined} [arg0]
1486
+ * The actual \[UserDecryptionResponsePayload\].
1487
+ * @param {UserDecryptionResponsePayload | null} [arg0]
1234
1488
  */
1235
1489
  set payload(arg0) {
1236
1490
  let ptr0 = 0;
1237
1491
  if (!isLikeNone(arg0)) {
1238
- _assertClass(arg0, ReencryptionResponsePayload);
1492
+ _assertClass(arg0, UserDecryptionResponsePayload);
1239
1493
  ptr0 = arg0.__destroy_into_raw();
1240
1494
  }
1241
- wasm.__wbg_set_reencryptionresponse_payload(this.__wbg_ptr, ptr0);
1495
+ wasm.__wbg_set_userdecryptionresponse_payload(this.__wbg_ptr, ptr0);
1242
1496
  }
1243
1497
  }
1244
1498
 
1245
- const ReencryptionResponsePayloadFinalization = (typeof FinalizationRegistry === 'undefined')
1499
+ const UserDecryptionResponsePayloadFinalization = (typeof FinalizationRegistry === 'undefined')
1246
1500
  ? { register: () => {}, unregister: () => {} }
1247
- : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionresponsepayload_free(ptr >>> 0, 1));
1501
+ : new FinalizationRegistry(ptr => wasm.__wbg_userdecryptionresponsepayload_free(ptr >>> 0, 1));
1248
1502
 
1249
- export class ReencryptionResponsePayload {
1503
+ export class UserDecryptionResponsePayload {
1250
1504
 
1251
1505
  static __wrap(ptr) {
1252
1506
  ptr = ptr >>> 0;
1253
- const obj = Object.create(ReencryptionResponsePayload.prototype);
1507
+ const obj = Object.create(UserDecryptionResponsePayload.prototype);
1254
1508
  obj.__wbg_ptr = ptr;
1255
- ReencryptionResponsePayloadFinalization.register(obj, obj.__wbg_ptr, obj);
1509
+ UserDecryptionResponsePayloadFinalization.register(obj, obj.__wbg_ptr, obj);
1256
1510
  return obj;
1257
1511
  }
1258
1512
 
1259
1513
  __destroy_into_raw() {
1260
1514
  const ptr = this.__wbg_ptr;
1261
1515
  this.__wbg_ptr = 0;
1262
- ReencryptionResponsePayloadFinalization.unregister(this);
1516
+ UserDecryptionResponsePayloadFinalization.unregister(this);
1263
1517
  return ptr;
1264
1518
  }
1265
1519
 
1266
1520
  free() {
1267
1521
  const ptr = this.__destroy_into_raw();
1268
- wasm.__wbg_reencryptionresponsepayload_free(ptr, 0);
1269
- }
1270
- /**
1271
- * Version of the response format.
1272
- * @returns {number}
1273
- */
1274
- get version() {
1275
- const ret = wasm.__wbg_get_reencryptionresponsepayload_version(this.__wbg_ptr);
1276
- return ret >>> 0;
1277
- }
1278
- /**
1279
- * Version of the response format.
1280
- * @param {number} arg0
1281
- */
1282
- set version(arg0) {
1283
- wasm.__wbg_set_reencryptionresponsepayload_version(this.__wbg_ptr, arg0);
1522
+ wasm.__wbg_userdecryptionresponsepayload_free(ptr, 0);
1284
1523
  }
1285
1524
  /**
1286
- * The server's signature verification key.
1287
- * Encoded using SEC1.
1525
+ * The server's signature verification key, Encoded using SEC1.
1288
1526
  * Needed to validate the response, but MUST also be linked to a list of
1289
1527
  * trusted keys.
1290
1528
  * @returns {Uint8Array}
1291
1529
  */
1292
1530
  get verification_key() {
1293
- const ret = wasm.__wbg_get_reencryptionresponsepayload_verification_key(this.__wbg_ptr);
1531
+ const ret = wasm.__wbg_get_userdecryptionresponsepayload_verification_key(this.__wbg_ptr);
1294
1532
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1295
1533
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1296
1534
  return v1;
1297
1535
  }
1298
1536
  /**
1299
- * The server's signature verification key.
1300
- * Encoded using SEC1.
1537
+ * The server's signature verification key, Encoded using SEC1.
1301
1538
  * Needed to validate the response, but MUST also be linked to a list of
1302
1539
  * trusted keys.
1303
1540
  * @param {Uint8Array} arg0
@@ -1308,21 +1545,21 @@ export class ReencryptionResponsePayload {
1308
1545
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1309
1546
  }
1310
1547
  /**
1311
- * The concatenation of two digests:
1312
- * (eip712_signing_hash(pk, domain) || ciphertext digest).
1313
1548
  * This is needed to ensure the response corresponds to the request.
1549
+ * It is the digest of UserDecryptionLinker hashed using EIP712
1550
+ * under the given domain in the request.
1314
1551
  * @returns {Uint8Array}
1315
1552
  */
1316
1553
  get digest() {
1317
- const ret = wasm.__wbg_get_reencryptionresponsepayload_digest(this.__wbg_ptr);
1554
+ const ret = wasm.__wbg_get_userdecryptionresponsepayload_digest(this.__wbg_ptr);
1318
1555
  var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1319
1556
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1320
1557
  return v1;
1321
1558
  }
1322
1559
  /**
1323
- * The concatenation of two digests:
1324
- * (eip712_signing_hash(pk, domain) || ciphertext digest).
1325
1560
  * This is needed to ensure the response corresponds to the request.
1561
+ * It is the digest of UserDecryptionLinker hashed using EIP712
1562
+ * under the given domain in the request.
1326
1563
  * @param {Uint8Array} arg0
1327
1564
  */
1328
1565
  set digest(arg0) {
@@ -1331,64 +1568,51 @@ export class ReencryptionResponsePayload {
1331
1568
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1332
1569
  }
1333
1570
  /**
1334
- * The type of plaintext encrypted.
1335
- * @returns {number}
1571
+ * The resulting signcrypted ciphertexts, each ciphertext
1572
+ * must be decrypted and then reconstructed with the other shares
1573
+ * to produce the final plaintext.
1574
+ * @returns {TypedSigncryptedCiphertext[]}
1336
1575
  */
1337
- get fhe_type() {
1338
- const ret = wasm.__wbg_get_reencryptionresponsepayload_fhe_type(this.__wbg_ptr);
1339
- return ret;
1576
+ get signcrypted_ciphertexts() {
1577
+ const ret = wasm.__wbg_get_userdecryptionresponsepayload_signcrypted_ciphertexts(this.__wbg_ptr);
1578
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1579
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1580
+ return v1;
1340
1581
  }
1341
1582
  /**
1342
- * The type of plaintext encrypted.
1343
- * @param {number} arg0
1583
+ * The resulting signcrypted ciphertexts, each ciphertext
1584
+ * must be decrypted and then reconstructed with the other shares
1585
+ * to produce the final plaintext.
1586
+ * @param {TypedSigncryptedCiphertext[]} arg0
1344
1587
  */
1345
- set fhe_type(arg0) {
1346
- wasm.__wbg_set_reencryptionresponsepayload_fhe_type(this.__wbg_ptr, arg0);
1588
+ set signcrypted_ciphertexts(arg0) {
1589
+ const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
1590
+ const len0 = WASM_VECTOR_LEN;
1591
+ wasm.__wbg_set_userdecryptionresponsepayload_signcrypted_ciphertexts(this.__wbg_ptr, ptr0, len0);
1347
1592
  }
1348
1593
  /**
1349
- * The signcrypted payload, using a hybrid encryption approach in
1350
- * sign-then-encrypt.
1351
- * @returns {Uint8Array}
1352
- */
1353
- get signcrypted_ciphertext() {
1354
- const ret = wasm.__wbg_get_reencryptionresponsepayload_signcrypted_ciphertext(this.__wbg_ptr);
1355
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1356
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1357
- return v1;
1358
- }
1359
- /**
1360
- * The signcrypted payload, using a hybrid encryption approach in
1361
- * sign-then-encrypt.
1362
- * @param {Uint8Array} arg0
1363
- */
1364
- set signcrypted_ciphertext(arg0) {
1365
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1366
- const len0 = WASM_VECTOR_LEN;
1367
- wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
1368
- }
1369
- /**
1370
- * The ID of the MPC party doing the reencryption. Used for polynomial
1371
- * reconstruction.
1372
- * @returns {number}
1594
+ * The ID of the MPC party doing the user decryption. Used for polynomial
1595
+ * reconstruction.
1596
+ * @returns {number}
1373
1597
  */
1374
1598
  get party_id() {
1375
- const ret = wasm.__wbg_get_reencryptionresponsepayload_party_id(this.__wbg_ptr);
1599
+ const ret = wasm.__wbg_get_userdecryptionresponsepayload_party_id(this.__wbg_ptr);
1376
1600
  return ret >>> 0;
1377
1601
  }
1378
1602
  /**
1379
- * The ID of the MPC party doing the reencryption. Used for polynomial
1603
+ * The ID of the MPC party doing the user decryption. Used for polynomial
1380
1604
  * reconstruction.
1381
1605
  * @param {number} arg0
1382
1606
  */
1383
1607
  set party_id(arg0) {
1384
- wasm.__wbg_set_reencryptionresponsepayload_party_id(this.__wbg_ptr, arg0);
1608
+ wasm.__wbg_set_userdecryptionresponsepayload_party_id(this.__wbg_ptr, arg0);
1385
1609
  }
1386
1610
  /**
1387
1611
  * The degree of the sharing scheme used.
1388
1612
  * @returns {number}
1389
1613
  */
1390
1614
  get degree() {
1391
- const ret = wasm.__wbg_get_reencryptionresponsepayload_degree(this.__wbg_ptr);
1615
+ const ret = wasm.__wbg_get_userdecryptionresponsepayload_degree(this.__wbg_ptr);
1392
1616
  return ret >>> 0;
1393
1617
  }
1394
1618
  /**
@@ -1396,60 +1620,7 @@ export class ReencryptionResponsePayload {
1396
1620
  * @param {number} arg0
1397
1621
  */
1398
1622
  set degree(arg0) {
1399
- wasm.__wbg_set_reencryptionresponsepayload_degree(this.__wbg_ptr, arg0);
1400
- }
1401
- }
1402
-
1403
- const RequestIdFinalization = (typeof FinalizationRegistry === 'undefined')
1404
- ? { register: () => {}, unregister: () => {} }
1405
- : new FinalizationRegistry(ptr => wasm.__wbg_requestid_free(ptr >>> 0, 1));
1406
- /**
1407
- * Simple response to return an ID, to be used to retrieve the computed result
1408
- * later on.
1409
- */
1410
- export class RequestId {
1411
-
1412
- static __wrap(ptr) {
1413
- ptr = ptr >>> 0;
1414
- const obj = Object.create(RequestId.prototype);
1415
- obj.__wbg_ptr = ptr;
1416
- RequestIdFinalization.register(obj, obj.__wbg_ptr, obj);
1417
- return obj;
1418
- }
1419
-
1420
- __destroy_into_raw() {
1421
- const ptr = this.__wbg_ptr;
1422
- this.__wbg_ptr = 0;
1423
- RequestIdFinalization.unregister(this);
1424
- return ptr;
1425
- }
1426
-
1427
- free() {
1428
- const ptr = this.__destroy_into_raw();
1429
- wasm.__wbg_requestid_free(ptr, 0);
1430
- }
1431
- /**
1432
- * @returns {string}
1433
- */
1434
- get request_id() {
1435
- let deferred1_0;
1436
- let deferred1_1;
1437
- try {
1438
- const ret = wasm.__wbg_get_requestid_request_id(this.__wbg_ptr);
1439
- deferred1_0 = ret[0];
1440
- deferred1_1 = ret[1];
1441
- return getStringFromWasm0(ret[0], ret[1]);
1442
- } finally {
1443
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1444
- }
1445
- }
1446
- /**
1447
- * @param {string} arg0
1448
- */
1449
- set request_id(arg0) {
1450
- const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1451
- const len0 = WASM_VECTOR_LEN;
1452
- wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1623
+ wasm.__wbg_set_userdecryptionresponsepayload_degree(this.__wbg_ptr, arg0);
1453
1624
  }
1454
1625
  }
1455
1626
 
@@ -1487,85 +1658,34 @@ async function __wbg_load(module, imports) {
1487
1658
  function __wbg_get_imports() {
1488
1659
  const imports = {};
1489
1660
  imports.wbg = {};
1490
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
1491
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1492
- return ret;
1493
- };
1494
- imports.wbg.__wbg_reencryptionresponse_unwrap = function(arg0) {
1495
- const ret = ReencryptionResponse.__unwrap(arg0);
1496
- return ret;
1497
- };
1498
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
1499
- const obj = arg1;
1500
- const ret = typeof(obj) === 'number' ? obj : undefined;
1501
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1502
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1503
- };
1504
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
1505
- const obj = arg1;
1506
- const ret = typeof(obj) === 'string' ? obj : undefined;
1507
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1508
- var len1 = WASM_VECTOR_LEN;
1509
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1510
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1511
- };
1512
- imports.wbg.__wbindgen_is_object = function(arg0) {
1513
- const val = arg0;
1514
- const ret = typeof(val) === 'object' && val !== null;
1515
- return ret;
1516
- };
1517
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
1518
- const ret = arg0 === undefined;
1519
- return ret;
1520
- };
1521
- imports.wbg.__wbindgen_in = function(arg0, arg1) {
1522
- const ret = arg0 in arg1;
1523
- return ret;
1524
- };
1525
- imports.wbg.__wbindgen_is_null = function(arg0) {
1526
- const ret = arg0 === null;
1527
- return ret;
1528
- };
1529
- imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
1530
- const ret = arg0 == arg1;
1531
- return ret;
1532
- };
1533
- imports.wbg.__wbindgen_boolean_get = function(arg0) {
1534
- const v = arg0;
1535
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1536
- return ret;
1537
- };
1538
- imports.wbg.__wbindgen_as_number = function(arg0) {
1539
- const ret = +arg0;
1540
- return ret;
1541
- };
1542
- imports.wbg.__wbg_String_b9412f8799faab3e = function(arg0, arg1) {
1661
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1543
1662
  const ret = String(arg1);
1544
1663
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1545
1664
  const len1 = WASM_VECTOR_LEN;
1546
1665
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1547
1666
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1548
1667
  };
1549
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
1550
- const ret = getStringFromWasm0(arg0, arg1);
1668
+ imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
1669
+ const ret = arg0.buffer;
1551
1670
  return ret;
1552
1671
  };
1553
- imports.wbg.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
1554
- const ret = arg0[arg1];
1672
+ imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
1673
+ const ret = arg0.call(arg1);
1555
1674
  return ret;
1556
- };
1557
- imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
1558
- const ret = new Error();
1675
+ }, arguments) };
1676
+ imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
1677
+ const ret = arg0.call(arg1, arg2);
1678
+ return ret;
1679
+ }, arguments) };
1680
+ imports.wbg.__wbg_crypto_ed58b8e10a292839 = function(arg0) {
1681
+ const ret = arg0.crypto;
1559
1682
  return ret;
1560
1683
  };
1561
- imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
1562
- const ret = arg1.stack;
1563
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1564
- const len1 = WASM_VECTOR_LEN;
1565
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1566
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1684
+ imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
1685
+ const ret = arg0.done;
1686
+ return ret;
1567
1687
  };
1568
- imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
1688
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
1569
1689
  let deferred0_0;
1570
1690
  let deferred0_1;
1571
1691
  try {
@@ -1576,157 +1696,177 @@ function __wbg_get_imports() {
1576
1696
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1577
1697
  }
1578
1698
  };
1579
- imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
1580
- const ret = arg0.crypto;
1699
+ imports.wbg.__wbg_getRandomValues_bcb4912f16000dc4 = function() { return handleError(function (arg0, arg1) {
1700
+ arg0.getRandomValues(arg1);
1701
+ }, arguments) };
1702
+ imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
1703
+ const ret = Reflect.get(arg0, arg1);
1581
1704
  return ret;
1582
- };
1583
- imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) {
1584
- const ret = arg0.process;
1705
+ }, arguments) };
1706
+ imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
1707
+ const ret = arg0[arg1 >>> 0];
1585
1708
  return ret;
1586
1709
  };
1587
- imports.wbg.__wbg_versions_f686565e586dd935 = function(arg0) {
1588
- const ret = arg0.versions;
1710
+ imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
1711
+ const ret = arg0[arg1];
1589
1712
  return ret;
1590
1713
  };
1591
- imports.wbg.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
1592
- const ret = arg0.node;
1714
+ imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
1715
+ let result;
1716
+ try {
1717
+ result = arg0 instanceof ArrayBuffer;
1718
+ } catch (_) {
1719
+ result = false;
1720
+ }
1721
+ const ret = result;
1593
1722
  return ret;
1594
1723
  };
1595
- imports.wbg.__wbindgen_is_string = function(arg0) {
1596
- const ret = typeof(arg0) === 'string';
1724
+ imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
1725
+ let result;
1726
+ try {
1727
+ result = arg0 instanceof Uint8Array;
1728
+ } catch (_) {
1729
+ result = false;
1730
+ }
1731
+ const ret = result;
1597
1732
  return ret;
1598
1733
  };
1599
- imports.wbg.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
1600
- const ret = module.require;
1601
- return ret;
1602
- }, arguments) };
1603
- imports.wbg.__wbindgen_is_function = function(arg0) {
1604
- const ret = typeof(arg0) === 'function';
1734
+ imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
1735
+ const ret = Array.isArray(arg0);
1605
1736
  return ret;
1606
1737
  };
1607
- imports.wbg.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
1608
- const ret = arg0.msCrypto;
1738
+ imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
1739
+ const ret = Number.isSafeInteger(arg0);
1609
1740
  return ret;
1610
1741
  };
1611
- imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
1612
- arg0.randomFillSync(arg1);
1613
- }, arguments) };
1614
- imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
1615
- arg0.getRandomValues(arg1);
1616
- }, arguments) };
1617
- imports.wbg.__wbg_get_5419cf6b954aa11d = function(arg0, arg1) {
1618
- const ret = arg0[arg1 >>> 0];
1742
+ imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
1743
+ const ret = Symbol.iterator;
1619
1744
  return ret;
1620
1745
  };
1621
- imports.wbg.__wbg_length_f217bbbf7e8e4df4 = function(arg0) {
1746
+ imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
1622
1747
  const ret = arg0.length;
1623
1748
  return ret;
1624
1749
  };
1625
- imports.wbg.__wbg_newnoargs_1ede4bf2ebbaaf43 = function(arg0, arg1) {
1626
- const ret = new Function(getStringFromWasm0(arg0, arg1));
1750
+ imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
1751
+ const ret = arg0.length;
1627
1752
  return ret;
1628
1753
  };
1629
- imports.wbg.__wbg_next_13b477da1eaa3897 = function(arg0) {
1630
- const ret = arg0.next;
1754
+ imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
1755
+ const ret = arg0.msCrypto;
1631
1756
  return ret;
1632
1757
  };
1633
- imports.wbg.__wbg_next_b06e115d1b01e10b = function() { return handleError(function (arg0) {
1634
- const ret = arg0.next();
1758
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
1759
+ const ret = new Error();
1635
1760
  return ret;
1636
- }, arguments) };
1637
- imports.wbg.__wbg_done_983b5ffcaec8c583 = function(arg0) {
1638
- const ret = arg0.done;
1761
+ };
1762
+ imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
1763
+ const ret = new Uint8Array(arg0);
1639
1764
  return ret;
1640
1765
  };
1641
- imports.wbg.__wbg_value_2ab8a198c834c26a = function(arg0) {
1642
- const ret = arg0.value;
1766
+ imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
1767
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
1643
1768
  return ret;
1644
1769
  };
1645
- imports.wbg.__wbg_iterator_695d699a44d6234c = function() {
1646
- const ret = Symbol.iterator;
1770
+ imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
1771
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
1647
1772
  return ret;
1648
1773
  };
1649
- imports.wbg.__wbg_get_ef828680c64da212 = function() { return handleError(function (arg0, arg1) {
1650
- const ret = Reflect.get(arg0, arg1);
1774
+ imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function(arg0) {
1775
+ const ret = new Uint8Array(arg0 >>> 0);
1651
1776
  return ret;
1652
- }, arguments) };
1653
- imports.wbg.__wbg_call_a9ef466721e824f2 = function() { return handleError(function (arg0, arg1) {
1654
- const ret = arg0.call(arg1);
1777
+ };
1778
+ imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
1779
+ const ret = arg0.next;
1655
1780
  return ret;
1656
- }, arguments) };
1657
- imports.wbg.__wbg_self_bf91bf94d9e04084 = function() { return handleError(function () {
1658
- const ret = self.self;
1781
+ };
1782
+ imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
1783
+ const ret = arg0.next();
1659
1784
  return ret;
1660
1785
  }, arguments) };
1661
- imports.wbg.__wbg_window_52dd9f07d03fd5f8 = function() { return handleError(function () {
1662
- const ret = window.window;
1786
+ imports.wbg.__wbg_node_02999533c4ea02e3 = function(arg0) {
1787
+ const ret = arg0.node;
1663
1788
  return ret;
1664
- }, arguments) };
1665
- imports.wbg.__wbg_globalThis_05c129bf37fcf1be = function() { return handleError(function () {
1666
- const ret = globalThis.globalThis;
1789
+ };
1790
+ imports.wbg.__wbg_process_5c1d670bc53614b8 = function(arg0) {
1791
+ const ret = arg0.process;
1667
1792
  return ret;
1793
+ };
1794
+ imports.wbg.__wbg_randomFillSync_ab2cfe79ebbf2740 = function() { return handleError(function (arg0, arg1) {
1795
+ arg0.randomFillSync(arg1);
1668
1796
  }, arguments) };
1669
- imports.wbg.__wbg_global_3eca19bb09e9c484 = function() { return handleError(function () {
1670
- const ret = global.global;
1797
+ imports.wbg.__wbg_require_79b1e9274cde3c87 = function() { return handleError(function () {
1798
+ const ret = module.require;
1671
1799
  return ret;
1672
1800
  }, arguments) };
1673
- imports.wbg.__wbg_isArray_6f3b47f09adb61b5 = function(arg0) {
1674
- const ret = Array.isArray(arg0);
1675
- return ret;
1801
+ imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
1802
+ arg0.set(arg1, arg2 >>> 0);
1676
1803
  };
1677
- imports.wbg.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) {
1678
- let result;
1679
- try {
1680
- result = arg0 instanceof ArrayBuffer;
1681
- } catch (_) {
1682
- result = false;
1683
- }
1684
- const ret = result;
1804
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1805
+ const ret = arg1.stack;
1806
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1807
+ const len1 = WASM_VECTOR_LEN;
1808
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1809
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1810
+ };
1811
+ imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
1812
+ const ret = typeof global === 'undefined' ? null : global;
1813
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1814
+ };
1815
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
1816
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1817
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1818
+ };
1819
+ imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
1820
+ const ret = typeof self === 'undefined' ? null : self;
1821
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1822
+ };
1823
+ imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
1824
+ const ret = typeof window === 'undefined' ? null : window;
1825
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1826
+ };
1827
+ imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) {
1828
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1685
1829
  return ret;
1686
1830
  };
1687
- imports.wbg.__wbg_call_3bfa248576352471 = function() { return handleError(function (arg0, arg1, arg2) {
1688
- const ret = arg0.call(arg1, arg2);
1831
+ imports.wbg.__wbg_typedciphertext_new = function(arg0) {
1832
+ const ret = TypedCiphertext.__wrap(arg0);
1689
1833
  return ret;
1690
- }, arguments) };
1691
- imports.wbg.__wbg_isSafeInteger_b9dff570f01a9100 = function(arg0) {
1692
- const ret = Number.isSafeInteger(arg0);
1834
+ };
1835
+ imports.wbg.__wbg_typedciphertext_unwrap = function(arg0) {
1836
+ const ret = TypedCiphertext.__unwrap(arg0);
1693
1837
  return ret;
1694
1838
  };
1695
- imports.wbg.__wbg_buffer_ccaed51a635d8a2d = function(arg0) {
1696
- const ret = arg0.buffer;
1839
+ imports.wbg.__wbg_typedplaintext_new = function(arg0) {
1840
+ const ret = TypedPlaintext.__wrap(arg0);
1697
1841
  return ret;
1698
1842
  };
1699
- imports.wbg.__wbg_newwithbyteoffsetandlength_7e3eb787208af730 = function(arg0, arg1, arg2) {
1700
- const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
1843
+ imports.wbg.__wbg_typedsigncryptedciphertext_new = function(arg0) {
1844
+ const ret = TypedSigncryptedCiphertext.__wrap(arg0);
1701
1845
  return ret;
1702
1846
  };
1703
- imports.wbg.__wbg_new_fec2611eb9180f95 = function(arg0) {
1704
- const ret = new Uint8Array(arg0);
1847
+ imports.wbg.__wbg_typedsigncryptedciphertext_unwrap = function(arg0) {
1848
+ const ret = TypedSigncryptedCiphertext.__unwrap(arg0);
1705
1849
  return ret;
1706
1850
  };
1707
- imports.wbg.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) {
1708
- arg0.set(arg1, arg2 >>> 0);
1851
+ imports.wbg.__wbg_userdecryptionresponse_unwrap = function(arg0) {
1852
+ const ret = UserDecryptionResponse.__unwrap(arg0);
1853
+ return ret;
1709
1854
  };
1710
- imports.wbg.__wbg_length_9254c4bd3b9f23c4 = function(arg0) {
1711
- const ret = arg0.length;
1855
+ imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
1856
+ const ret = arg0.value;
1712
1857
  return ret;
1713
1858
  };
1714
- imports.wbg.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) {
1715
- let result;
1716
- try {
1717
- result = arg0 instanceof Uint8Array;
1718
- } catch (_) {
1719
- result = false;
1720
- }
1721
- const ret = result;
1859
+ imports.wbg.__wbg_versions_c71aa1626a93e0a1 = function(arg0) {
1860
+ const ret = arg0.versions;
1722
1861
  return ret;
1723
1862
  };
1724
- imports.wbg.__wbg_newwithlength_76462a666eca145f = function(arg0) {
1725
- const ret = new Uint8Array(arg0 >>> 0);
1863
+ imports.wbg.__wbindgen_as_number = function(arg0) {
1864
+ const ret = +arg0;
1726
1865
  return ret;
1727
1866
  };
1728
- imports.wbg.__wbg_subarray_975a06f9dbd16995 = function(arg0, arg1, arg2) {
1729
- const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1867
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
1868
+ const v = arg0;
1869
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1730
1870
  return ret;
1731
1871
  };
1732
1872
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
@@ -1736,15 +1876,16 @@ function __wbg_get_imports() {
1736
1876
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1737
1877
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1738
1878
  };
1739
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
1740
- throw new Error(getStringFromWasm0(arg0, arg1));
1879
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
1880
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1881
+ return ret;
1741
1882
  };
1742
- imports.wbg.__wbindgen_memory = function() {
1743
- const ret = wasm.memory;
1883
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
1884
+ const ret = arg0 in arg1;
1744
1885
  return ret;
1745
1886
  };
1746
1887
  imports.wbg.__wbindgen_init_externref_table = function() {
1747
- const table = wasm.__wbindgen_export_2;
1888
+ const table = wasm.__wbindgen_export_4;
1748
1889
  const offset = table.grow(4);
1749
1890
  table.set(0, undefined);
1750
1891
  table.set(offset + 0, undefined);
@@ -1753,6 +1894,56 @@ function __wbg_get_imports() {
1753
1894
  table.set(offset + 3, false);
1754
1895
  ;
1755
1896
  };
1897
+ imports.wbg.__wbindgen_is_function = function(arg0) {
1898
+ const ret = typeof(arg0) === 'function';
1899
+ return ret;
1900
+ };
1901
+ imports.wbg.__wbindgen_is_null = function(arg0) {
1902
+ const ret = arg0 === null;
1903
+ return ret;
1904
+ };
1905
+ imports.wbg.__wbindgen_is_object = function(arg0) {
1906
+ const val = arg0;
1907
+ const ret = typeof(val) === 'object' && val !== null;
1908
+ return ret;
1909
+ };
1910
+ imports.wbg.__wbindgen_is_string = function(arg0) {
1911
+ const ret = typeof(arg0) === 'string';
1912
+ return ret;
1913
+ };
1914
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
1915
+ const ret = arg0 === undefined;
1916
+ return ret;
1917
+ };
1918
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
1919
+ const ret = arg0 == arg1;
1920
+ return ret;
1921
+ };
1922
+ imports.wbg.__wbindgen_memory = function() {
1923
+ const ret = wasm.memory;
1924
+ return ret;
1925
+ };
1926
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
1927
+ const obj = arg1;
1928
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1929
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1930
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1931
+ };
1932
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
1933
+ const obj = arg1;
1934
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1935
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1936
+ var len1 = WASM_VECTOR_LEN;
1937
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1938
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1939
+ };
1940
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
1941
+ const ret = getStringFromWasm0(arg0, arg1);
1942
+ return ret;
1943
+ };
1944
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
1945
+ throw new Error(getStringFromWasm0(arg0, arg1));
1946
+ };
1756
1947
 
1757
1948
  return imports;
1758
1949
  }