tkms 0.9.0-rc4 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/kms_lib.js CHANGED
@@ -18,48 +18,6 @@ function getStringFromWasm0(ptr, len) {
18
18
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
19
19
  }
20
20
 
21
- const heap = new Array(128).fill(undefined);
22
-
23
- heap.push(undefined, null, true, false);
24
-
25
- let heap_next = heap.length;
26
-
27
- function addHeapObject(obj) {
28
- if (heap_next === heap.length) heap.push(heap.length + 1);
29
- const idx = heap_next;
30
- heap_next = heap[idx];
31
-
32
- heap[idx] = obj;
33
- return idx;
34
- }
35
-
36
- function getObject(idx) { return heap[idx]; }
37
-
38
- function dropObject(idx) {
39
- if (idx < 132) return;
40
- heap[idx] = heap_next;
41
- heap_next = idx;
42
- }
43
-
44
- function takeObject(idx) {
45
- const ret = getObject(idx);
46
- dropObject(idx);
47
- return ret;
48
- }
49
-
50
- function isLikeNone(x) {
51
- return x === undefined || x === null;
52
- }
53
-
54
- let cachedDataViewMemory0 = null;
55
-
56
- function getDataViewMemory0() {
57
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
58
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
59
- }
60
- return cachedDataViewMemory0;
61
- }
62
-
63
21
  let WASM_VECTOR_LEN = 0;
64
22
 
65
23
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
@@ -116,6 +74,19 @@ function passStringToWasm0(arg, malloc, realloc) {
116
74
  return ptr;
117
75
  }
118
76
 
77
+ function isLikeNone(x) {
78
+ return x === undefined || x === null;
79
+ }
80
+
81
+ let cachedDataViewMemory0 = null;
82
+
83
+ function getDataViewMemory0() {
84
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
85
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
86
+ }
87
+ return cachedDataViewMemory0;
88
+ }
89
+
119
90
  function debugString(val) {
120
91
  // primitive types
121
92
  const type = typeof val;
@@ -181,10 +152,28 @@ function debugString(val) {
181
152
  return className;
182
153
  }
183
154
 
155
+ function _assertClass(instance, klass) {
156
+ if (!(instance instanceof klass)) {
157
+ throw new Error(`expected instance of ${klass.name}`);
158
+ }
159
+ return instance.ptr;
160
+ }
161
+
184
162
  function getArrayU8FromWasm0(ptr, len) {
185
163
  ptr = ptr >>> 0;
186
164
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
187
165
  }
166
+ /**
167
+ * @param {PublicSigKey} pk
168
+ * @returns {Uint8Array}
169
+ */
170
+ export function public_sig_key_to_u8vec(pk) {
171
+ _assertClass(pk, PublicSigKey);
172
+ const ret = wasm.public_sig_key_to_u8vec(pk.__wbg_ptr);
173
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
174
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
175
+ return v1;
176
+ }
188
177
 
189
178
  function passArray8ToWasm0(arg, malloc) {
190
179
  const ptr = malloc(arg.length * 1, 1) >>> 0;
@@ -193,144 +182,97 @@ function passArray8ToWasm0(arg, malloc) {
193
182
  return ptr;
194
183
  }
195
184
 
196
- function _assertClass(instance, klass) {
197
- if (!(instance instanceof klass)) {
198
- throw new Error(`expected instance of ${klass.name}`);
199
- }
200
- return instance.ptr;
185
+ function takeFromExternrefTable0(idx) {
186
+ const value = wasm.__wbindgen_export_2.get(idx);
187
+ wasm.__externref_table_dealloc(idx);
188
+ return value;
201
189
  }
202
190
  /**
203
- * @param {PublicSigKey} pk
204
- * @returns {Uint8Array}
205
- */
206
- export function public_sig_key_to_u8vec(pk) {
207
- try {
208
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
209
- _assertClass(pk, PublicSigKey);
210
- wasm.public_sig_key_to_u8vec(retptr, pk.__wbg_ptr);
211
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
212
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
213
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
214
- wasm.__wbindgen_free(r0, r1 * 1, 1);
215
- return v1;
216
- } finally {
217
- wasm.__wbindgen_add_to_stack_pointer(16);
218
- }
219
- }
220
-
221
- /**
222
- * @param {Uint8Array} v
223
- * @returns {PublicSigKey}
224
- */
191
+ * @param {Uint8Array} v
192
+ * @returns {PublicSigKey}
193
+ */
225
194
  export function u8vec_to_public_sig_key(v) {
226
- try {
227
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
228
- const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
229
- const len0 = WASM_VECTOR_LEN;
230
- wasm.u8vec_to_public_sig_key(retptr, ptr0, len0);
231
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
232
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
233
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
234
- if (r2) {
235
- throw takeObject(r1);
236
- }
237
- return PublicSigKey.__wrap(r0);
238
- } finally {
239
- wasm.__wbindgen_add_to_stack_pointer(16);
195
+ const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
196
+ const len0 = WASM_VECTOR_LEN;
197
+ const ret = wasm.u8vec_to_public_sig_key(ptr0, len0);
198
+ if (ret[2]) {
199
+ throw takeFromExternrefTable0(ret[1]);
240
200
  }
201
+ return PublicSigKey.__wrap(ret[0]);
241
202
  }
242
203
 
243
204
  /**
244
- * @param {PrivateSigKey} sk
245
- * @returns {Uint8Array}
246
- */
205
+ * @param {PrivateSigKey} sk
206
+ * @returns {Uint8Array}
207
+ */
247
208
  export function private_sig_key_to_u8vec(sk) {
248
- try {
249
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
250
- _assertClass(sk, PrivateSigKey);
251
- wasm.private_sig_key_to_u8vec(retptr, sk.__wbg_ptr);
252
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
253
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
254
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
255
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
256
- if (r3) {
257
- throw takeObject(r2);
258
- }
259
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
260
- wasm.__wbindgen_free(r0, r1 * 1, 1);
261
- return v1;
262
- } finally {
263
- wasm.__wbindgen_add_to_stack_pointer(16);
264
- }
209
+ _assertClass(sk, PrivateSigKey);
210
+ const ret = wasm.private_sig_key_to_u8vec(sk.__wbg_ptr);
211
+ if (ret[3]) {
212
+ throw takeFromExternrefTable0(ret[2]);
213
+ }
214
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
215
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
216
+ return v1;
265
217
  }
266
218
 
267
219
  /**
268
- * @param {Uint8Array} v
269
- * @returns {PrivateSigKey}
270
- */
220
+ * @param {Uint8Array} v
221
+ * @returns {PrivateSigKey}
222
+ */
271
223
  export function u8vec_to_private_sig_key(v) {
272
- try {
273
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
274
- const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
275
- const len0 = WASM_VECTOR_LEN;
276
- wasm.u8vec_to_private_sig_key(retptr, ptr0, len0);
277
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
278
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
279
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
280
- if (r2) {
281
- throw takeObject(r1);
282
- }
283
- return PrivateSigKey.__wrap(r0);
284
- } finally {
285
- wasm.__wbindgen_add_to_stack_pointer(16);
224
+ const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
225
+ const len0 = WASM_VECTOR_LEN;
226
+ const ret = wasm.u8vec_to_private_sig_key(ptr0, len0);
227
+ if (ret[2]) {
228
+ throw takeFromExternrefTable0(ret[1]);
286
229
  }
230
+ return PrivateSigKey.__wrap(ret[0]);
231
+ }
232
+
233
+ function addToExternrefTable0(obj) {
234
+ const idx = wasm.__externref_table_alloc();
235
+ wasm.__wbindgen_export_2.set(idx, obj);
236
+ return idx;
287
237
  }
288
238
 
289
239
  function passArrayJsValueToWasm0(array, malloc) {
290
240
  const ptr = malloc(array.length * 4, 4) >>> 0;
291
241
  const mem = getDataViewMemory0();
292
242
  for (let i = 0; i < array.length; i++) {
293
- mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
243
+ mem.setUint32(ptr + 4 * i, addToExternrefTable0(array[i]), true);
294
244
  }
295
245
  WASM_VECTOR_LEN = array.length;
296
246
  return ptr;
297
247
  }
298
248
  /**
299
- * Instantiate a new client.
300
- *
301
- * * `server_pks` - a list of KMS server signature public keys,
302
- * which can parsed using [u8vec_to_public_sig_key].
303
- *
304
- * * `client_address_hex` - the client (wallet) address in hex,
305
- * must be prefixed with "0x".
306
- *
307
- * * `param_choice` - the parameter choice, which can be either `"test"` or `"default"`.
308
- * The "default" parameter choice is selected if no matching string is found.
309
- * @param {(PublicSigKey)[]} server_pks
310
- * @param {string} client_address_hex
311
- * @param {string} param_choice
312
- * @returns {Client}
313
- */
314
- export function new_client(server_pks, client_address_hex, param_choice) {
315
- try {
316
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
317
- const ptr0 = passArrayJsValueToWasm0(server_pks, wasm.__wbindgen_malloc);
318
- const len0 = WASM_VECTOR_LEN;
319
- const ptr1 = passStringToWasm0(client_address_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
320
- const len1 = WASM_VECTOR_LEN;
321
- const ptr2 = passStringToWasm0(param_choice, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
322
- const len2 = WASM_VECTOR_LEN;
323
- wasm.new_client(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
324
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
325
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
326
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
327
- if (r2) {
328
- throw takeObject(r1);
329
- }
330
- return Client.__wrap(r0);
331
- } finally {
332
- wasm.__wbindgen_add_to_stack_pointer(16);
333
- }
249
+ * Instantiate a new client.
250
+ *
251
+ * * `server_addrs` - a list of KMS server EIP-55 addresses,
252
+ * must be prefixed with "0x".
253
+ *
254
+ * * `client_address_hex` - the client (wallet) address in hex,
255
+ * must be prefixed with "0x".
256
+ *
257
+ * * `param_choice` - the parameter choice, which can be either `"test"` or `"default"`.
258
+ * The "default" parameter choice is selected if no matching string is found.
259
+ * @param {(string)[]} server_addrs
260
+ * @param {string} client_address_hex
261
+ * @param {string} param_choice
262
+ * @returns {Client}
263
+ */
264
+ export function new_client(server_addrs, client_address_hex, param_choice) {
265
+ const ptr0 = passArrayJsValueToWasm0(server_addrs, wasm.__wbindgen_malloc);
266
+ const len0 = WASM_VECTOR_LEN;
267
+ const ptr1 = passStringToWasm0(client_address_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
268
+ const len1 = WASM_VECTOR_LEN;
269
+ const ptr2 = passStringToWasm0(param_choice, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
270
+ const len2 = WASM_VECTOR_LEN;
271
+ const ret = wasm.new_client(ptr0, len0, ptr1, len1, ptr2, len2);
272
+ if (ret[2]) {
273
+ throw takeFromExternrefTable0(ret[1]);
274
+ }
275
+ return Client.__wrap(ret[0]);
334
276
  }
335
277
 
336
278
  function getArrayJsValueFromWasm0(ptr, len) {
@@ -338,33 +280,27 @@ function getArrayJsValueFromWasm0(ptr, len) {
338
280
  const mem = getDataViewMemory0();
339
281
  const result = [];
340
282
  for (let i = ptr; i < ptr + 4 * len; i += 4) {
341
- result.push(takeObject(mem.getUint32(i, true)));
283
+ result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
342
284
  }
285
+ wasm.__externref_drop_slice(ptr, len);
343
286
  return result;
344
287
  }
345
288
  /**
346
- * @param {Client} client
347
- * @returns {(PublicSigKey)[]}
348
- */
349
- export function get_server_public_keys(client) {
350
- try {
351
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
352
- _assertClass(client, Client);
353
- wasm.get_server_public_keys(retptr, client.__wbg_ptr);
354
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
355
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
356
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
357
- wasm.__wbindgen_free(r0, r1 * 4, 4);
358
- return v1;
359
- } finally {
360
- wasm.__wbindgen_add_to_stack_pointer(16);
361
- }
289
+ * @param {Client} client
290
+ * @returns {(string)[]}
291
+ */
292
+ export function get_server_addrs(client) {
293
+ _assertClass(client, Client);
294
+ const ret = wasm.get_server_addrs(client.__wbg_ptr);
295
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
296
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
297
+ return v1;
362
298
  }
363
299
 
364
300
  /**
365
- * @param {Client} client
366
- * @returns {PrivateSigKey | undefined}
367
- */
301
+ * @param {Client} client
302
+ * @returns {PrivateSigKey | undefined}
303
+ */
368
304
  export function get_client_secret_key(client) {
369
305
  _assertClass(client, Client);
370
306
  const ret = wasm.get_client_secret_key(client.__wbg_ptr);
@@ -372,39 +308,35 @@ export function get_client_secret_key(client) {
372
308
  }
373
309
 
374
310
  /**
375
- * @param {Client} client
376
- * @returns {string}
377
- */
311
+ * @param {Client} client
312
+ * @returns {string}
313
+ */
378
314
  export function get_client_address(client) {
379
315
  let deferred1_0;
380
316
  let deferred1_1;
381
317
  try {
382
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
318
  _assertClass(client, Client);
384
- wasm.get_client_address(retptr, client.__wbg_ptr);
385
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
386
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
387
- deferred1_0 = r0;
388
- deferred1_1 = r1;
389
- return getStringFromWasm0(r0, r1);
319
+ const ret = wasm.get_client_address(client.__wbg_ptr);
320
+ deferred1_0 = ret[0];
321
+ deferred1_1 = ret[1];
322
+ return getStringFromWasm0(ret[0], ret[1]);
390
323
  } finally {
391
- wasm.__wbindgen_add_to_stack_pointer(16);
392
324
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
393
325
  }
394
326
  }
395
327
 
396
328
  /**
397
- * @returns {PrivateEncKey}
398
- */
329
+ * @returns {PrivateEncKey}
330
+ */
399
331
  export function cryptobox_keygen() {
400
332
  const ret = wasm.cryptobox_keygen();
401
333
  return PrivateEncKey.__wrap(ret);
402
334
  }
403
335
 
404
336
  /**
405
- * @param {PrivateEncKey} sk
406
- * @returns {PublicEncKey}
407
- */
337
+ * @param {PrivateEncKey} sk
338
+ * @returns {PublicEncKey}
339
+ */
408
340
  export function cryptobox_get_pk(sk) {
409
341
  _assertClass(sk, PrivateEncKey);
410
342
  const ret = wasm.cryptobox_get_pk(sk.__wbg_ptr);
@@ -412,103 +344,69 @@ export function cryptobox_get_pk(sk) {
412
344
  }
413
345
 
414
346
  /**
415
- * @param {PublicEncKey} pk
416
- * @returns {Uint8Array}
417
- */
347
+ * @param {PublicEncKey} pk
348
+ * @returns {Uint8Array}
349
+ */
418
350
  export function cryptobox_pk_to_u8vec(pk) {
419
- try {
420
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
421
- _assertClass(pk, PublicEncKey);
422
- wasm.cryptobox_pk_to_u8vec(retptr, pk.__wbg_ptr);
423
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
424
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
425
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
426
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
427
- if (r3) {
428
- throw takeObject(r2);
429
- }
430
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
431
- wasm.__wbindgen_free(r0, r1 * 1, 1);
432
- return v1;
433
- } finally {
434
- wasm.__wbindgen_add_to_stack_pointer(16);
435
- }
351
+ _assertClass(pk, PublicEncKey);
352
+ const ret = wasm.cryptobox_pk_to_u8vec(pk.__wbg_ptr);
353
+ if (ret[3]) {
354
+ throw takeFromExternrefTable0(ret[2]);
355
+ }
356
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
357
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
358
+ return v1;
436
359
  }
437
360
 
438
361
  /**
439
- * @param {PrivateEncKey} sk
440
- * @returns {Uint8Array}
441
- */
362
+ * @param {PrivateEncKey} sk
363
+ * @returns {Uint8Array}
364
+ */
442
365
  export function cryptobox_sk_to_u8vec(sk) {
443
- try {
444
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
445
- _assertClass(sk, PrivateEncKey);
446
- wasm.cryptobox_sk_to_u8vec(retptr, sk.__wbg_ptr);
447
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
448
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
449
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
450
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
451
- if (r3) {
452
- throw takeObject(r2);
453
- }
454
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
455
- wasm.__wbindgen_free(r0, r1 * 1, 1);
456
- return v1;
457
- } finally {
458
- wasm.__wbindgen_add_to_stack_pointer(16);
366
+ _assertClass(sk, PrivateEncKey);
367
+ const ret = wasm.cryptobox_sk_to_u8vec(sk.__wbg_ptr);
368
+ if (ret[3]) {
369
+ throw takeFromExternrefTable0(ret[2]);
459
370
  }
371
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
372
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
373
+ return v1;
460
374
  }
461
375
 
462
376
  /**
463
- * @param {Uint8Array} v
464
- * @returns {PublicEncKey}
465
- */
377
+ * @param {Uint8Array} v
378
+ * @returns {PublicEncKey}
379
+ */
466
380
  export function u8vec_to_cryptobox_pk(v) {
467
- try {
468
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
469
- const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
470
- const len0 = WASM_VECTOR_LEN;
471
- wasm.u8vec_to_cryptobox_pk(retptr, ptr0, len0);
472
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
473
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
474
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
475
- if (r2) {
476
- throw takeObject(r1);
477
- }
478
- return PublicEncKey.__wrap(r0);
479
- } finally {
480
- wasm.__wbindgen_add_to_stack_pointer(16);
381
+ const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
382
+ const len0 = WASM_VECTOR_LEN;
383
+ const ret = wasm.u8vec_to_cryptobox_pk(ptr0, len0);
384
+ if (ret[2]) {
385
+ throw takeFromExternrefTable0(ret[1]);
481
386
  }
387
+ return PublicEncKey.__wrap(ret[0]);
482
388
  }
483
389
 
484
390
  /**
485
- * @param {Uint8Array} v
486
- * @returns {PrivateEncKey}
487
- */
391
+ * @param {Uint8Array} v
392
+ * @returns {PrivateEncKey}
393
+ */
488
394
  export function u8vec_to_cryptobox_sk(v) {
489
- try {
490
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
491
- const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
492
- const len0 = WASM_VECTOR_LEN;
493
- wasm.u8vec_to_cryptobox_sk(retptr, ptr0, len0);
494
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
495
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
496
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
497
- if (r2) {
498
- throw takeObject(r1);
499
- }
500
- return PrivateEncKey.__wrap(r0);
501
- } finally {
502
- wasm.__wbindgen_add_to_stack_pointer(16);
395
+ const ptr0 = passArray8ToWasm0(v, wasm.__wbindgen_malloc);
396
+ const len0 = WASM_VECTOR_LEN;
397
+ const ret = wasm.u8vec_to_cryptobox_sk(ptr0, len0);
398
+ if (ret[2]) {
399
+ throw takeFromExternrefTable0(ret[1]);
503
400
  }
401
+ return PrivateEncKey.__wrap(ret[0]);
504
402
  }
505
403
 
506
404
  /**
507
- * @param {Uint8Array} msg
508
- * @param {PublicEncKey} their_pk
509
- * @param {PrivateEncKey} my_sk
510
- * @returns {CryptoBoxCt}
511
- */
405
+ * @param {Uint8Array} msg
406
+ * @param {PublicEncKey} their_pk
407
+ * @param {PrivateEncKey} my_sk
408
+ * @returns {CryptoBoxCt}
409
+ */
512
410
  export function cryptobox_encrypt(msg, their_pk, my_sk) {
513
411
  const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
514
412
  const len0 = WASM_VECTOR_LEN;
@@ -519,201 +417,180 @@ export function cryptobox_encrypt(msg, their_pk, my_sk) {
519
417
  }
520
418
 
521
419
  /**
522
- * @param {CryptoBoxCt} ct
523
- * @param {PrivateEncKey} my_sk
524
- * @param {PublicEncKey} their_pk
525
- * @returns {Uint8Array}
526
- */
420
+ * @param {CryptoBoxCt} ct
421
+ * @param {PrivateEncKey} my_sk
422
+ * @param {PublicEncKey} their_pk
423
+ * @returns {Uint8Array}
424
+ */
527
425
  export function cryptobox_decrypt(ct, my_sk, their_pk) {
528
- try {
529
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
530
- _assertClass(ct, CryptoBoxCt);
531
- _assertClass(my_sk, PrivateEncKey);
532
- _assertClass(their_pk, PublicEncKey);
533
- wasm.cryptobox_decrypt(retptr, ct.__wbg_ptr, my_sk.__wbg_ptr, their_pk.__wbg_ptr);
534
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
535
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
536
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
537
- wasm.__wbindgen_free(r0, r1 * 1, 1);
538
- return v1;
539
- } finally {
540
- wasm.__wbindgen_add_to_stack_pointer(16);
541
- }
426
+ _assertClass(ct, CryptoBoxCt);
427
+ _assertClass(my_sk, PrivateEncKey);
428
+ _assertClass(their_pk, PublicEncKey);
429
+ const ret = wasm.cryptobox_decrypt(ct.__wbg_ptr, my_sk.__wbg_ptr, their_pk.__wbg_ptr);
430
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
431
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
432
+ return v1;
542
433
  }
543
434
 
544
435
  /**
545
- * Process the reencryption response from JavaScript objects.
546
- * The result is a byte array representing a plaintext of any length.
547
- *
548
- * * `client` - client that wants to perform reencryption.
549
- *
550
- * * `request` - the initial reencryption request JS object.
551
- * It can be set to null if `verify` is false.
552
- * Otherwise the caller needs to give the following JS object.
553
- * Note that `client_address` and `eip712_verifying_contract` follow EIP-55.
554
- * ```
555
- * {
556
- * signature: '15a4f9a8eb61459cfba7d103d8f911fb04ce91ecf841b34c49c0d56a70b896d20cbc31986188f91efc3842b7df215cee8acb40178daedb8b63d0ba5d199bce121c',
557
- * client_address: '0x17853A630aAe15AED549B2B874de08B73C0F59c5',
558
- * enc_key: '2000000000000000df2fcacb774f03187f3802a27259f45c06d33cefa68d9c53426b15ad531aa822',
559
- * ciphertext_digest: '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358',
560
- * eip712_verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657'
561
- * }
562
- * ```
563
- *
564
- * * `eip712_domain` - the EIP-712 domain JS object.
565
- * It can be set to null if `verify` is false.
566
- * Otherwise the caller needs to give the following JS object.
567
- * Note that `salt` is optional and `verifying_contract` follows EIP-55,
568
- * additionally, `chain_id` is an array of u8.
569
- * ```
570
- * {
571
- * name: 'Authorization token',
572
- * version: '1',
573
- * chain_id: [
574
- * 70, 31, 0, 0, 0, 0, 0, 0, 0,
575
- * 0, 0, 0, 0, 0, 0, 0, 0, 0,
576
- * 0, 0, 0, 0, 0, 0, 0, 0, 0,
577
- * 0, 0, 0, 0, 0
578
- * ],
579
- * verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657',
580
- * salt: []
581
- * }
582
- * ```
583
- *
584
- * * `agg_resp` - the response JS object from the gateway.
585
- * It has two fields like so, both are hex encoded byte arrays.
586
- * ```
587
- * [
588
- * {
589
- * signature: '69e7e040cab157aa819015b321c012dccb1545ffefd325b359b492653f0347517e28e66c572cdc299e259024329859ff9fcb0096e1ce072af0b6e1ca1fe25ec6',
590
- * payload: '0100000029...'
591
- * }
592
- * ]
593
- * ```
594
- *
595
- * * `enc_pk` - The ephemeral public key.
596
- *
597
- * * `enc_sk` - The ephemeral secret key.
598
- *
599
- * * `verify` - Whether to perform signature verification for the response.
600
- * It is insecure if `verify = false`!
601
- * @param {Client} client
602
- * @param {any} request
603
- * @param {any} eip712_domain
604
- * @param {any} agg_resp
605
- * @param {PublicEncKey} enc_pk
606
- * @param {PrivateEncKey} enc_sk
607
- * @param {boolean} verify
608
- * @returns {Uint8Array}
609
- */
436
+ * Process the reencryption response from JavaScript objects.
437
+ * The returned result is a byte array representing a plaintext of any length,
438
+ * postprocessing is returned to turn it into an integer.
439
+ *
440
+ * * `client` - client that wants to perform reencryption.
441
+ *
442
+ * * `request` - the initial reencryption request JS object.
443
+ * It can be set to null if `verify` is false.
444
+ * Otherwise the caller needs to give the following JS object.
445
+ * Note that `client_address` and `eip712_verifying_contract` follow EIP-55.
446
+ * ```
447
+ * {
448
+ * signature: '15a4f9a8eb61459cfba7d103d8f911fb04ce91ecf841b34c49c0d56a70b896d20cbc31986188f91efc3842b7df215cee8acb40178daedb8b63d0ba5d199bce121c',
449
+ * client_address: '0x17853A630aAe15AED549B2B874de08B73C0F59c5',
450
+ * enc_key: '2000000000000000df2fcacb774f03187f3802a27259f45c06d33cefa68d9c53426b15ad531aa822',
451
+ * ciphertext_handle: '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358',
452
+ * eip712_verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657'
453
+ * }
454
+ * ```
455
+ *
456
+ * * `eip712_domain` - the EIP-712 domain JS object.
457
+ * It can be set to null if `verify` is false.
458
+ * Otherwise the caller needs to give the following JS object.
459
+ * Note that `salt` is optional and `verifying_contract` follows EIP-55,
460
+ * additionally, `chain_id` is an array of u8.
461
+ * ```
462
+ * {
463
+ * name: 'Authorization token',
464
+ * version: '1',
465
+ * chain_id: [
466
+ * 70, 31, 0, 0, 0, 0, 0, 0, 0,
467
+ * 0, 0, 0, 0, 0, 0, 0, 0, 0,
468
+ * 0, 0, 0, 0, 0, 0, 0, 0, 0,
469
+ * 0, 0, 0, 0, 0
470
+ * ],
471
+ * verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657',
472
+ * salt: []
473
+ * }
474
+ * ```
475
+ *
476
+ * * `agg_resp` - the response JS object from the gateway.
477
+ * It has two fields like so, both are hex encoded byte arrays.
478
+ * ```
479
+ * [
480
+ * {
481
+ * signature: '69e7e040cab157aa819015b321c012dccb1545ffefd325b359b492653f0347517e28e66c572cdc299e259024329859ff9fcb0096e1ce072af0b6e1ca1fe25ec6',
482
+ * payload: '0100000029...'
483
+ * }
484
+ * ]
485
+ * ```
486
+ *
487
+ * * `enc_pk` - The ephemeral public key.
488
+ *
489
+ * * `enc_sk` - The ephemeral secret key.
490
+ *
491
+ * * `verify` - Whether to perform signature verification for the response.
492
+ * It is insecure if `verify = false`!
493
+ * @param {Client} client
494
+ * @param {any} request
495
+ * @param {any} eip712_domain
496
+ * @param {any} agg_resp
497
+ * @param {PublicEncKey} enc_pk
498
+ * @param {PrivateEncKey} enc_sk
499
+ * @param {boolean} verify
500
+ * @returns {Uint8Array}
501
+ */
610
502
  export function process_reencryption_resp_from_js(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
611
- try {
612
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
613
- _assertClass(client, Client);
614
- _assertClass(enc_pk, PublicEncKey);
615
- _assertClass(enc_sk, PrivateEncKey);
616
- wasm.process_reencryption_resp_from_js(retptr, client.__wbg_ptr, addHeapObject(request), addHeapObject(eip712_domain), addHeapObject(agg_resp), enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
617
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
618
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
619
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
620
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
621
- if (r3) {
622
- throw takeObject(r2);
623
- }
624
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
625
- wasm.__wbindgen_free(r0, r1 * 1, 1);
626
- return v1;
627
- } finally {
628
- wasm.__wbindgen_add_to_stack_pointer(16);
629
- }
503
+ _assertClass(client, Client);
504
+ _assertClass(enc_pk, PublicEncKey);
505
+ _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);
507
+ if (ret[3]) {
508
+ throw takeFromExternrefTable0(ret[2]);
509
+ }
510
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
511
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
512
+ return v1;
630
513
  }
631
514
 
632
515
  /**
633
- * Process the reencryption response from Rust objects.
634
- * Consider using [process_reencryption_resp_from_js]
635
- * when using the JS API.
636
- * The result is a byte array representing a plaintext of any length.
637
- *
638
- * * `client` - client that wants to perform reencryption.
639
- *
640
- * * `request` - the initial reencryption request.
641
- * Must be given if `verify` is true.
642
- *
643
- * * `eip712_domain` - the EIP-712 domain.
644
- * Must be given if `verify` is true.
645
- *
646
- * * `agg_resp` - the vector of reencryption responses.
647
- *
648
- * * `enc_pk` - The ephemeral public key.
649
- *
650
- * * `enc_sk` - The ephemeral secret key.
651
- *
652
- * * `verify` - Whether to perform signature verification for the response.
653
- * It is insecure if `verify = false`!
654
- * @param {Client} client
655
- * @param {ParsedReencryptionRequest | undefined} request
656
- * @param {Eip712DomainMsg | undefined} eip712_domain
657
- * @param {(ReencryptionResponse)[]} agg_resp
658
- * @param {PublicEncKey} enc_pk
659
- * @param {PrivateEncKey} enc_sk
660
- * @param {boolean} verify
661
- * @returns {Uint8Array}
662
- */
516
+ * Process the reencryption response from Rust objects.
517
+ * Consider using [process_reencryption_resp_from_js]
518
+ * when using the JS API.
519
+ * The result is a byte array representing a plaintext of any length.
520
+ *
521
+ * * `client` - client that wants to perform reencryption.
522
+ *
523
+ * * `request` - the initial reencryption request.
524
+ * Must be given if `verify` is true.
525
+ *
526
+ * * `eip712_domain` - the EIP-712 domain.
527
+ * Must be given if `verify` is true.
528
+ *
529
+ * * `agg_resp` - the vector of reencryption responses.
530
+ *
531
+ * * `enc_pk` - The ephemeral public key.
532
+ *
533
+ * * `enc_sk` - The ephemeral secret key.
534
+ *
535
+ * * `verify` - Whether to perform signature verification for the response.
536
+ * It is insecure if `verify = false`!
537
+ * @param {Client} client
538
+ * @param {ParsedReencryptionRequest | undefined} request
539
+ * @param {Eip712DomainMsg | undefined} eip712_domain
540
+ * @param {(ReencryptionResponse)[]} agg_resp
541
+ * @param {PublicEncKey} enc_pk
542
+ * @param {PrivateEncKey} enc_sk
543
+ * @param {boolean} verify
544
+ * @returns {Uint8Array}
545
+ */
663
546
  export function process_reencryption_resp(client, request, eip712_domain, agg_resp, enc_pk, enc_sk, verify) {
664
- try {
665
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
666
- _assertClass(client, Client);
667
- let ptr0 = 0;
668
- if (!isLikeNone(request)) {
669
- _assertClass(request, ParsedReencryptionRequest);
670
- ptr0 = request.__destroy_into_raw();
671
- }
672
- let ptr1 = 0;
673
- if (!isLikeNone(eip712_domain)) {
674
- _assertClass(eip712_domain, Eip712DomainMsg);
675
- ptr1 = eip712_domain.__destroy_into_raw();
676
- }
677
- const ptr2 = passArrayJsValueToWasm0(agg_resp, wasm.__wbindgen_malloc);
678
- const len2 = WASM_VECTOR_LEN;
679
- _assertClass(enc_pk, PublicEncKey);
680
- _assertClass(enc_sk, PrivateEncKey);
681
- wasm.process_reencryption_resp(retptr, client.__wbg_ptr, ptr0, ptr1, ptr2, len2, enc_pk.__wbg_ptr, enc_sk.__wbg_ptr, verify);
682
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
683
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
684
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
685
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
686
- if (r3) {
687
- throw takeObject(r2);
688
- }
689
- var v4 = getArrayU8FromWasm0(r0, r1).slice();
690
- wasm.__wbindgen_free(r0, r1 * 1, 1);
691
- return v4;
692
- } finally {
693
- wasm.__wbindgen_add_to_stack_pointer(16);
694
- }
547
+ _assertClass(client, Client);
548
+ let ptr0 = 0;
549
+ if (!isLikeNone(request)) {
550
+ _assertClass(request, ParsedReencryptionRequest);
551
+ ptr0 = request.__destroy_into_raw();
552
+ }
553
+ let ptr1 = 0;
554
+ if (!isLikeNone(eip712_domain)) {
555
+ _assertClass(eip712_domain, Eip712DomainMsg);
556
+ ptr1 = eip712_domain.__destroy_into_raw();
557
+ }
558
+ const ptr2 = passArrayJsValueToWasm0(agg_resp, wasm.__wbindgen_malloc);
559
+ const len2 = WASM_VECTOR_LEN;
560
+ _assertClass(enc_pk, PublicEncKey);
561
+ _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);
563
+ if (ret[3]) {
564
+ throw takeFromExternrefTable0(ret[2]);
565
+ }
566
+ var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
567
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
568
+ return v4;
695
569
  }
696
570
 
697
571
  function handleError(f, args) {
698
572
  try {
699
573
  return f.apply(this, args);
700
574
  } catch (e) {
701
- wasm.__wbindgen_exn_store(addHeapObject(e));
575
+ const idx = addToExternrefTable0(e);
576
+ wasm.__wbindgen_exn_store(idx);
702
577
  }
703
578
  }
704
579
  /**
705
- * The plaintext types that can be encrypted in a fhevm ciphertext.
706
- */
580
+ * The plaintext types that can be encrypted in a fhevm ciphertext.
581
+ */
707
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", });
708
583
 
709
584
  const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
710
585
  ? { register: () => {}, unregister: () => {} }
711
586
  : new FinalizationRegistry(ptr => wasm.__wbg_client_free(ptr >>> 0, 1));
712
587
  /**
713
- * Simple client to interact with the KMS servers. This can be seen as a proof-of-concept
714
- * and reference code for validating the KMS. The logic supplied by the client will be
715
- * distributed across the aggregator/proxy and smart contracts.
716
- */
588
+ * Core Client
589
+ *
590
+ * Simple client to interact with the KMS servers. This can be seen as a proof-of-concept
591
+ * and reference code for validating the KMS. The logic supplied by the client will be
592
+ * distributed across the aggregator/proxy and smart contracts.
593
+ */
717
594
  export class Client {
718
595
 
719
596
  static __wrap(ptr) {
@@ -740,8 +617,7 @@ export class Client {
740
617
  const CryptoBoxCtFinalization = (typeof FinalizationRegistry === 'undefined')
741
618
  ? { register: () => {}, unregister: () => {} }
742
619
  : new FinalizationRegistry(ptr => wasm.__wbg_cryptoboxct_free(ptr >>> 0, 1));
743
- /**
744
- */
620
+
745
621
  export class CryptoBoxCt {
746
622
 
747
623
  static __wrap(ptr) {
@@ -769,10 +645,10 @@ const Eip712DomainMsgFinalization = (typeof FinalizationRegistry === 'undefined'
769
645
  ? { register: () => {}, unregister: () => {} }
770
646
  : new FinalizationRegistry(ptr => wasm.__wbg_eip712domainmsg_free(ptr >>> 0, 1));
771
647
  /**
772
- * <https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>
773
- * eventually chain_id, verifying_contract and salt will be parsed in to
774
- * solidity types
775
- */
648
+ * <https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>
649
+ * eventually chain_id, verifying_contract and salt will be parsed in to
650
+ * solidity types
651
+ */
776
652
  export class Eip712DomainMsg {
777
653
 
778
654
  static __wrap(ptr) {
@@ -795,132 +671,109 @@ export class Eip712DomainMsg {
795
671
  wasm.__wbg_eip712domainmsg_free(ptr, 0);
796
672
  }
797
673
  /**
798
- * @returns {string}
799
- */
674
+ * @returns {string}
675
+ */
800
676
  get name() {
801
677
  let deferred1_0;
802
678
  let deferred1_1;
803
679
  try {
804
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
805
- wasm.__wbg_get_eip712domainmsg_name(retptr, this.__wbg_ptr);
806
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
807
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
808
- deferred1_0 = r0;
809
- deferred1_1 = r1;
810
- return getStringFromWasm0(r0, r1);
680
+ const ret = wasm.__wbg_get_eip712domainmsg_name(this.__wbg_ptr);
681
+ deferred1_0 = ret[0];
682
+ deferred1_1 = ret[1];
683
+ return getStringFromWasm0(ret[0], ret[1]);
811
684
  } finally {
812
- wasm.__wbindgen_add_to_stack_pointer(16);
813
685
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
814
686
  }
815
687
  }
816
688
  /**
817
- * @param {string} arg0
818
- */
689
+ * @param {string} arg0
690
+ */
819
691
  set name(arg0) {
820
692
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
821
693
  const len0 = WASM_VECTOR_LEN;
822
694
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
823
695
  }
824
696
  /**
825
- * @returns {string}
826
- */
697
+ * @returns {string}
698
+ */
827
699
  get version() {
828
700
  let deferred1_0;
829
701
  let deferred1_1;
830
702
  try {
831
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
832
- wasm.__wbg_get_eip712domainmsg_version(retptr, this.__wbg_ptr);
833
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
834
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
835
- deferred1_0 = r0;
836
- deferred1_1 = r1;
837
- return getStringFromWasm0(r0, r1);
703
+ const ret = wasm.__wbg_get_eip712domainmsg_version(this.__wbg_ptr);
704
+ deferred1_0 = ret[0];
705
+ deferred1_1 = ret[1];
706
+ return getStringFromWasm0(ret[0], ret[1]);
838
707
  } finally {
839
- wasm.__wbindgen_add_to_stack_pointer(16);
840
708
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
841
709
  }
842
710
  }
843
711
  /**
844
- * @param {string} arg0
845
- */
712
+ * @param {string} arg0
713
+ */
846
714
  set version(arg0) {
847
715
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
848
716
  const len0 = WASM_VECTOR_LEN;
849
717
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
850
718
  }
851
719
  /**
852
- * @returns {Uint8Array}
853
- */
720
+ * @returns {Uint8Array}
721
+ */
854
722
  get chain_id() {
855
- try {
856
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
857
- wasm.__wbg_get_eip712domainmsg_chain_id(retptr, this.__wbg_ptr);
858
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
859
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
860
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
861
- wasm.__wbindgen_free(r0, r1 * 1, 1);
862
- return v1;
863
- } finally {
864
- wasm.__wbindgen_add_to_stack_pointer(16);
865
- }
723
+ const ret = wasm.__wbg_get_eip712domainmsg_chain_id(this.__wbg_ptr);
724
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
725
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
726
+ return v1;
866
727
  }
867
728
  /**
868
- * @param {Uint8Array} arg0
869
- */
729
+ * @param {Uint8Array} arg0
730
+ */
870
731
  set chain_id(arg0) {
871
732
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
872
733
  const len0 = WASM_VECTOR_LEN;
873
734
  wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
874
735
  }
875
736
  /**
876
- * @returns {string}
877
- */
737
+ * @returns {string}
738
+ */
878
739
  get verifying_contract() {
879
740
  let deferred1_0;
880
741
  let deferred1_1;
881
742
  try {
882
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
883
- wasm.__wbg_get_eip712domainmsg_verifying_contract(retptr, this.__wbg_ptr);
884
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
885
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
886
- deferred1_0 = r0;
887
- deferred1_1 = r1;
888
- return getStringFromWasm0(r0, r1);
743
+ const ret = wasm.__wbg_get_eip712domainmsg_verifying_contract(this.__wbg_ptr);
744
+ deferred1_0 = ret[0];
745
+ deferred1_1 = ret[1];
746
+ return getStringFromWasm0(ret[0], ret[1]);
889
747
  } finally {
890
- wasm.__wbindgen_add_to_stack_pointer(16);
891
748
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
892
749
  }
893
750
  }
894
751
  /**
895
- * @param {string} arg0
896
- */
752
+ * @param {string} arg0
753
+ */
897
754
  set verifying_contract(arg0) {
898
755
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
899
756
  const len0 = WASM_VECTOR_LEN;
900
757
  wasm.__wbg_set_eip712domainmsg_verifying_contract(this.__wbg_ptr, ptr0, len0);
901
758
  }
902
759
  /**
903
- * @returns {Uint8Array}
904
- */
760
+ * @returns {Uint8Array | undefined}
761
+ */
905
762
  get salt() {
906
- try {
907
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
908
- wasm.__wbg_get_eip712domainmsg_salt(retptr, this.__wbg_ptr);
909
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
910
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
911
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
912
- wasm.__wbindgen_free(r0, r1 * 1, 1);
913
- return v1;
914
- } finally {
915
- wasm.__wbindgen_add_to_stack_pointer(16);
763
+ const ret = wasm.__wbg_get_eip712domainmsg_salt(this.__wbg_ptr);
764
+ let v1;
765
+ if (ret[0] !== 0) {
766
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
767
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
916
768
  }
769
+ return v1;
917
770
  }
918
771
  /**
919
- * @param {Uint8Array} arg0
920
- */
772
+ * @param {Uint8Array | undefined} [arg0]
773
+ */
921
774
  set salt(arg0) {
922
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
923
- const len0 = WASM_VECTOR_LEN;
775
+ var ptr0 = isLikeNone(arg0) ? 0 : passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
776
+ var len0 = WASM_VECTOR_LEN;
924
777
  wasm.__wbg_set_eip712domainmsg_salt(this.__wbg_ptr, ptr0, len0);
925
778
  }
926
779
  }
@@ -929,8 +782,8 @@ const ParsedReencryptionRequestFinalization = (typeof FinalizationRegistry === '
929
782
  ? { register: () => {}, unregister: () => {} }
930
783
  : new FinalizationRegistry(ptr => wasm.__wbg_parsedreencryptionrequest_free(ptr >>> 0, 1));
931
784
  /**
932
- * Validity of this struct is not checked.
933
- */
785
+ * Validity of this struct is not checked.
786
+ */
934
787
  export class ParsedReencryptionRequest {
935
788
 
936
789
  __destroy_into_raw() {
@@ -946,55 +799,10 @@ export class ParsedReencryptionRequest {
946
799
  }
947
800
  }
948
801
 
949
- const PlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
950
- ? { register: () => {}, unregister: () => {} }
951
- : new FinalizationRegistry(ptr => wasm.__wbg_plaintext_free(ptr >>> 0, 1));
952
- /**
953
- */
954
- export class Plaintext {
955
-
956
- __destroy_into_raw() {
957
- const ptr = this.__wbg_ptr;
958
- this.__wbg_ptr = 0;
959
- PlaintextFinalization.unregister(this);
960
- return ptr;
961
- }
962
-
963
- free() {
964
- const ptr = this.__destroy_into_raw();
965
- wasm.__wbg_plaintext_free(ptr, 0);
966
- }
967
- /**
968
- * @returns {Uint8Array}
969
- */
970
- get bytes() {
971
- try {
972
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
973
- wasm.__wbg_get_plaintext_bytes(retptr, this.__wbg_ptr);
974
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
975
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
976
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
977
- wasm.__wbindgen_free(r0, r1 * 1, 1);
978
- return v1;
979
- } finally {
980
- wasm.__wbindgen_add_to_stack_pointer(16);
981
- }
982
- }
983
- /**
984
- * @param {Uint8Array} arg0
985
- */
986
- set bytes(arg0) {
987
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
988
- const len0 = WASM_VECTOR_LEN;
989
- wasm.__wbg_set_plaintext_bytes(this.__wbg_ptr, ptr0, len0);
990
- }
991
- }
992
-
993
802
  const PrivateEncKeyFinalization = (typeof FinalizationRegistry === 'undefined')
994
803
  ? { register: () => {}, unregister: () => {} }
995
804
  : new FinalizationRegistry(ptr => wasm.__wbg_privateenckey_free(ptr >>> 0, 1));
996
- /**
997
- */
805
+
998
806
  export class PrivateEncKey {
999
807
 
1000
808
  static __wrap(ptr) {
@@ -1021,8 +829,7 @@ export class PrivateEncKey {
1021
829
  const PrivateSigKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1022
830
  ? { register: () => {}, unregister: () => {} }
1023
831
  : new FinalizationRegistry(ptr => wasm.__wbg_privatesigkey_free(ptr >>> 0, 1));
1024
- /**
1025
- */
832
+
1026
833
  export class PrivateSigKey {
1027
834
 
1028
835
  static __wrap(ptr) {
@@ -1049,8 +856,7 @@ export class PrivateSigKey {
1049
856
  const PublicEncKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1050
857
  ? { register: () => {}, unregister: () => {} }
1051
858
  : new FinalizationRegistry(ptr => wasm.__wbg_publicenckey_free(ptr >>> 0, 1));
1052
- /**
1053
- */
859
+
1054
860
  export class PublicEncKey {
1055
861
 
1056
862
  static __wrap(ptr) {
@@ -1077,8 +883,7 @@ export class PublicEncKey {
1077
883
  const PublicSigKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1078
884
  ? { register: () => {}, unregister: () => {} }
1079
885
  : new FinalizationRegistry(ptr => wasm.__wbg_publicsigkey_free(ptr >>> 0, 1));
1080
- /**
1081
- */
886
+
1082
887
  export class PublicSigKey {
1083
888
 
1084
889
  static __wrap(ptr) {
@@ -1089,13 +894,6 @@ export class PublicSigKey {
1089
894
  return obj;
1090
895
  }
1091
896
 
1092
- static __unwrap(jsValue) {
1093
- if (!(jsValue instanceof PublicSigKey)) {
1094
- return 0;
1095
- }
1096
- return jsValue.__destroy_into_raw();
1097
- }
1098
-
1099
897
  __destroy_into_raw() {
1100
898
  const ptr = this.__wbg_ptr;
1101
899
  this.__wbg_ptr = 0;
@@ -1112,8 +910,7 @@ export class PublicSigKey {
1112
910
  const ReencryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
1113
911
  ? { register: () => {}, unregister: () => {} }
1114
912
  : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionrequest_free(ptr >>> 0, 1));
1115
- /**
1116
- */
913
+
1117
914
  export class ReencryptionRequest {
1118
915
 
1119
916
  __destroy_into_raw() {
@@ -1128,41 +925,34 @@ export class ReencryptionRequest {
1128
925
  wasm.__wbg_reencryptionrequest_free(ptr, 0);
1129
926
  }
1130
927
  /**
1131
- * Signature of the serialization of \[ReencryptionRequestPayload\].
1132
- * @returns {Uint8Array}
1133
- */
928
+ * Signature of the serialization of \[ReencryptionRequestPayload\].
929
+ * @returns {Uint8Array}
930
+ */
1134
931
  get signature() {
1135
- try {
1136
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1137
- wasm.__wbg_get_reencryptionrequest_signature(retptr, this.__wbg_ptr);
1138
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1139
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1140
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1141
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1142
- return v1;
1143
- } finally {
1144
- wasm.__wbindgen_add_to_stack_pointer(16);
1145
- }
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;
1146
936
  }
1147
937
  /**
1148
- * Signature of the serialization of \[ReencryptionRequestPayload\].
1149
- * @param {Uint8Array} arg0
1150
- */
938
+ * Signature of the serialization of \[ReencryptionRequestPayload\].
939
+ * @param {Uint8Array} arg0
940
+ */
1151
941
  set signature(arg0) {
1152
942
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1153
943
  const len0 = WASM_VECTOR_LEN;
1154
944
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1155
945
  }
1156
946
  /**
1157
- * @returns {ReencryptionRequestPayload | undefined}
1158
- */
947
+ * @returns {ReencryptionRequestPayload | undefined}
948
+ */
1159
949
  get payload() {
1160
950
  const ret = wasm.__wbg_get_reencryptionrequest_payload(this.__wbg_ptr);
1161
951
  return ret === 0 ? undefined : ReencryptionRequestPayload.__wrap(ret);
1162
952
  }
1163
953
  /**
1164
- * @param {ReencryptionRequestPayload | undefined} [arg0]
1165
- */
954
+ * @param {ReencryptionRequestPayload | undefined} [arg0]
955
+ */
1166
956
  set payload(arg0) {
1167
957
  let ptr0 = 0;
1168
958
  if (!isLikeNone(arg0)) {
@@ -1172,15 +962,15 @@ export class ReencryptionRequest {
1172
962
  wasm.__wbg_set_reencryptionrequest_payload(this.__wbg_ptr, ptr0);
1173
963
  }
1174
964
  /**
1175
- * @returns {Eip712DomainMsg | undefined}
1176
- */
965
+ * @returns {Eip712DomainMsg | undefined}
966
+ */
1177
967
  get domain() {
1178
968
  const ret = wasm.__wbg_get_reencryptionrequest_domain(this.__wbg_ptr);
1179
969
  return ret === 0 ? undefined : Eip712DomainMsg.__wrap(ret);
1180
970
  }
1181
971
  /**
1182
- * @param {Eip712DomainMsg | undefined} [arg0]
1183
- */
972
+ * @param {Eip712DomainMsg | undefined} [arg0]
973
+ */
1184
974
  set domain(arg0) {
1185
975
  let ptr0 = 0;
1186
976
  if (!isLikeNone(arg0)) {
@@ -1190,19 +980,19 @@ export class ReencryptionRequest {
1190
980
  wasm.__wbg_set_reencryptionrequest_domain(this.__wbg_ptr, ptr0);
1191
981
  }
1192
982
  /**
1193
- * The ID that identifies this request.
1194
- * Future queries for the result must use this request ID.
1195
- * @returns {RequestId | undefined}
1196
- */
983
+ * The ID that identifies this request.
984
+ * Future queries for the result must use this request ID.
985
+ * @returns {RequestId | undefined}
986
+ */
1197
987
  get request_id() {
1198
988
  const ret = wasm.__wbg_get_reencryptionrequest_request_id(this.__wbg_ptr);
1199
989
  return ret === 0 ? undefined : RequestId.__wrap(ret);
1200
990
  }
1201
991
  /**
1202
- * The ID that identifies this request.
1203
- * Future queries for the result must use this request ID.
1204
- * @param {RequestId | undefined} [arg0]
1205
- */
992
+ * The ID that identifies this request.
993
+ * Future queries for the result must use this request ID.
994
+ * @param {RequestId | undefined} [arg0]
995
+ */
1206
996
  set request_id(arg0) {
1207
997
  let ptr0 = 0;
1208
998
  if (!isLikeNone(arg0)) {
@@ -1216,8 +1006,7 @@ export class ReencryptionRequest {
1216
1006
  const ReencryptionRequestPayloadFinalization = (typeof FinalizationRegistry === 'undefined')
1217
1007
  ? { register: () => {}, unregister: () => {} }
1218
1008
  : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionrequestpayload_free(ptr >>> 0, 1));
1219
- /**
1220
- */
1009
+
1221
1010
  export class ReencryptionRequestPayload {
1222
1011
 
1223
1012
  static __wrap(ptr) {
@@ -1240,110 +1029,99 @@ export class ReencryptionRequestPayload {
1240
1029
  wasm.__wbg_reencryptionrequestpayload_free(ptr, 0);
1241
1030
  }
1242
1031
  /**
1243
- * Version of the request format.
1244
- * @returns {number}
1245
- */
1032
+ * Version of the request format.
1033
+ * @returns {number}
1034
+ */
1246
1035
  get version() {
1247
1036
  const ret = wasm.__wbg_get_reencryptionrequestpayload_version(this.__wbg_ptr);
1248
1037
  return ret >>> 0;
1249
1038
  }
1250
1039
  /**
1251
- * Version of the request format.
1252
- * @param {number} arg0
1253
- */
1040
+ * Version of the request format.
1041
+ * @param {number} arg0
1042
+ */
1254
1043
  set version(arg0) {
1255
1044
  wasm.__wbg_set_reencryptionrequestpayload_version(this.__wbg_ptr, arg0);
1256
1045
  }
1257
1046
  /**
1258
- * The client's (blockchain wallet) address,
1259
- * encoded using EIP-55.
1260
- * @returns {string}
1261
- */
1047
+ * The client's (blockchain wallet) address,
1048
+ * encoded using EIP-55.
1049
+ * @returns {string}
1050
+ */
1262
1051
  get client_address() {
1263
1052
  let deferred1_0;
1264
1053
  let deferred1_1;
1265
1054
  try {
1266
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1267
- wasm.__wbg_get_eip712domainmsg_name(retptr, this.__wbg_ptr);
1268
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1269
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1270
- deferred1_0 = r0;
1271
- deferred1_1 = r1;
1272
- return getStringFromWasm0(r0, r1);
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]);
1273
1059
  } finally {
1274
- wasm.__wbindgen_add_to_stack_pointer(16);
1275
1060
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1276
1061
  }
1277
1062
  }
1278
1063
  /**
1279
- * The client's (blockchain wallet) address,
1280
- * encoded using EIP-55.
1281
- * @param {string} arg0
1282
- */
1064
+ * The client's (blockchain wallet) address,
1065
+ * encoded using EIP-55.
1066
+ * @param {string} arg0
1067
+ */
1283
1068
  set client_address(arg0) {
1284
1069
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1285
1070
  const len0 = WASM_VECTOR_LEN;
1286
1071
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1287
1072
  }
1288
1073
  /**
1289
- * Encoding of the user's public encryption key for this request.
1290
- * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1291
- * Montgomery point.
1292
- * @returns {Uint8Array}
1293
- */
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.
1077
+ * @returns {Uint8Array}
1078
+ */
1294
1079
  get enc_key() {
1295
- try {
1296
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1297
- wasm.__wbg_get_reencryptionrequestpayload_enc_key(retptr, this.__wbg_ptr);
1298
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1299
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1300
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1301
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1302
- return v1;
1303
- } finally {
1304
- wasm.__wbindgen_add_to_stack_pointer(16);
1305
- }
1080
+ const ret = wasm.__wbg_get_reencryptionrequestpayload_enc_key(this.__wbg_ptr);
1081
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1082
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1083
+ return v1;
1306
1084
  }
1307
1085
  /**
1308
- * Encoding of the user's public encryption key for this request.
1309
- * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1310
- * Montgomery point.
1311
- * @param {Uint8Array} arg0
1312
- */
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.
1089
+ * @param {Uint8Array} arg0
1090
+ */
1313
1091
  set enc_key(arg0) {
1314
1092
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1315
1093
  const len0 = WASM_VECTOR_LEN;
1316
1094
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1317
1095
  }
1318
1096
  /**
1319
- * The type of plaintext encrypted.
1320
- * @returns {number}
1321
- */
1097
+ * The type of plaintext encrypted.
1098
+ * @returns {number}
1099
+ */
1322
1100
  get fhe_type() {
1323
1101
  const ret = wasm.__wbg_get_reencryptionrequestpayload_fhe_type(this.__wbg_ptr);
1324
1102
  return ret;
1325
1103
  }
1326
1104
  /**
1327
- * The type of plaintext encrypted.
1328
- * @param {number} arg0
1329
- */
1105
+ * The type of plaintext encrypted.
1106
+ * @param {number} arg0
1107
+ */
1330
1108
  set fhe_type(arg0) {
1331
1109
  wasm.__wbg_set_reencryptionrequestpayload_fhe_type(this.__wbg_ptr, arg0);
1332
1110
  }
1333
1111
  /**
1334
- * The key id to use for decryption. Will be the request_id used during key
1335
- * generation
1336
- * @returns {RequestId | undefined}
1337
- */
1112
+ * The key id to use for decryption. Will be the request_id used during key
1113
+ * generation
1114
+ * @returns {RequestId | undefined}
1115
+ */
1338
1116
  get key_id() {
1339
1117
  const ret = wasm.__wbg_get_reencryptionrequestpayload_key_id(this.__wbg_ptr);
1340
1118
  return ret === 0 ? undefined : RequestId.__wrap(ret);
1341
1119
  }
1342
1120
  /**
1343
- * The key id to use for decryption. Will be the request_id used during key
1344
- * generation
1345
- * @param {RequestId | undefined} [arg0]
1346
- */
1121
+ * The key id to use for decryption. Will be the request_id used during key
1122
+ * generation
1123
+ * @param {RequestId | undefined} [arg0]
1124
+ */
1347
1125
  set key_id(arg0) {
1348
1126
  let ptr0 = 0;
1349
1127
  if (!isLikeNone(arg0)) {
@@ -1353,61 +1131,47 @@ export class ReencryptionRequestPayload {
1353
1131
  wasm.__wbg_set_reencryptionrequestpayload_key_id(this.__wbg_ptr, ptr0);
1354
1132
  }
1355
1133
  /**
1356
- * The actual ciphertext to decrypt, taken directly from the fhevm.
1357
- * When creating the payload, this field may be empty,
1358
- * it is the responsibility of the gateway to fetch the
1359
- * ciphertext for the given digest below.
1360
- * @returns {Uint8Array | undefined}
1361
- */
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}
1139
+ */
1362
1140
  get ciphertext() {
1363
- try {
1364
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1365
- wasm.__wbg_get_reencryptionrequestpayload_ciphertext(retptr, this.__wbg_ptr);
1366
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1367
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1368
- let v1;
1369
- if (r0 !== 0) {
1370
- v1 = getArrayU8FromWasm0(r0, r1).slice();
1371
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1372
- }
1373
- return v1;
1374
- } finally {
1375
- wasm.__wbindgen_add_to_stack_pointer(16);
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);
1376
1146
  }
1147
+ return v1;
1377
1148
  }
1378
1149
  /**
1379
- * The actual ciphertext to decrypt, taken directly from the fhevm.
1380
- * When creating the payload, this field may be empty,
1381
- * it is the responsibility of the gateway to fetch the
1382
- * ciphertext for the given digest below.
1383
- * @param {Uint8Array | undefined} [arg0]
1384
- */
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]
1155
+ */
1385
1156
  set ciphertext(arg0) {
1386
1157
  var ptr0 = isLikeNone(arg0) ? 0 : passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1387
1158
  var len0 = WASM_VECTOR_LEN;
1388
- wasm.__wbg_set_reencryptionrequestpayload_ciphertext(this.__wbg_ptr, ptr0, len0);
1159
+ wasm.__wbg_set_eip712domainmsg_salt(this.__wbg_ptr, ptr0, len0);
1389
1160
  }
1390
1161
  /**
1391
- * The SHA3 digest of the ciphertext above.
1392
- * @returns {Uint8Array}
1393
- */
1162
+ * The SHA3 digest of the ciphertext above.
1163
+ * @returns {Uint8Array}
1164
+ */
1394
1165
  get ciphertext_digest() {
1395
- try {
1396
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1397
- wasm.__wbg_get_eip712domainmsg_chain_id(retptr, this.__wbg_ptr);
1398
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1399
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1400
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1401
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1402
- return v1;
1403
- } finally {
1404
- wasm.__wbindgen_add_to_stack_pointer(16);
1405
- }
1166
+ const ret = wasm.__wbg_get_reencryptionrequestpayload_ciphertext_digest(this.__wbg_ptr);
1167
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1168
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1169
+ return v1;
1406
1170
  }
1407
1171
  /**
1408
- * The SHA3 digest of the ciphertext above.
1409
- * @param {Uint8Array} arg0
1410
- */
1172
+ * The SHA3 digest of the ciphertext above.
1173
+ * @param {Uint8Array} arg0
1174
+ */
1411
1175
  set ciphertext_digest(arg0) {
1412
1176
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1413
1177
  const len0 = WASM_VECTOR_LEN;
@@ -1418,8 +1182,7 @@ export class ReencryptionRequestPayload {
1418
1182
  const ReencryptionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
1419
1183
  ? { register: () => {}, unregister: () => {} }
1420
1184
  : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionresponse_free(ptr >>> 0, 1));
1421
- /**
1422
- */
1185
+
1423
1186
  export class ReencryptionResponse {
1424
1187
 
1425
1188
  static __unwrap(jsValue) {
@@ -1441,41 +1204,34 @@ export class ReencryptionResponse {
1441
1204
  wasm.__wbg_reencryptionresponse_free(ptr, 0);
1442
1205
  }
1443
1206
  /**
1444
- * @returns {Uint8Array}
1445
- */
1207
+ * @returns {Uint8Array}
1208
+ */
1446
1209
  get signature() {
1447
- try {
1448
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1449
- wasm.__wbg_get_reencryptionrequest_signature(retptr, this.__wbg_ptr);
1450
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1451
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1452
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1453
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1454
- return v1;
1455
- } finally {
1456
- wasm.__wbindgen_add_to_stack_pointer(16);
1457
- }
1210
+ const ret = wasm.__wbg_get_reencryptionresponse_signature(this.__wbg_ptr);
1211
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1212
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1213
+ return v1;
1458
1214
  }
1459
1215
  /**
1460
- * @param {Uint8Array} arg0
1461
- */
1216
+ * @param {Uint8Array} arg0
1217
+ */
1462
1218
  set signature(arg0) {
1463
1219
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1464
1220
  const len0 = WASM_VECTOR_LEN;
1465
1221
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1466
1222
  }
1467
1223
  /**
1468
- * Signature of the serialization of \[ReencryptionResponsePayload\].
1469
- * @returns {ReencryptionResponsePayload | undefined}
1470
- */
1224
+ * Signature of the serialization of \[ReencryptionResponsePayload\].
1225
+ * @returns {ReencryptionResponsePayload | undefined}
1226
+ */
1471
1227
  get payload() {
1472
1228
  const ret = wasm.__wbg_get_reencryptionresponse_payload(this.__wbg_ptr);
1473
1229
  return ret === 0 ? undefined : ReencryptionResponsePayload.__wrap(ret);
1474
1230
  }
1475
1231
  /**
1476
- * Signature of the serialization of \[ReencryptionResponsePayload\].
1477
- * @param {ReencryptionResponsePayload | undefined} [arg0]
1478
- */
1232
+ * Signature of the serialization of \[ReencryptionResponsePayload\].
1233
+ * @param {ReencryptionResponsePayload | undefined} [arg0]
1234
+ */
1479
1235
  set payload(arg0) {
1480
1236
  let ptr0 = 0;
1481
1237
  if (!isLikeNone(arg0)) {
@@ -1489,8 +1245,7 @@ export class ReencryptionResponse {
1489
1245
  const ReencryptionResponsePayloadFinalization = (typeof FinalizationRegistry === 'undefined')
1490
1246
  ? { register: () => {}, unregister: () => {} }
1491
1247
  : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionresponsepayload_free(ptr >>> 0, 1));
1492
- /**
1493
- */
1248
+
1494
1249
  export class ReencryptionResponsePayload {
1495
1250
 
1496
1251
  static __wrap(ptr) {
@@ -1513,154 +1268,133 @@ export class ReencryptionResponsePayload {
1513
1268
  wasm.__wbg_reencryptionresponsepayload_free(ptr, 0);
1514
1269
  }
1515
1270
  /**
1516
- * Version of the response format.
1517
- * @returns {number}
1518
- */
1271
+ * Version of the response format.
1272
+ * @returns {number}
1273
+ */
1519
1274
  get version() {
1520
1275
  const ret = wasm.__wbg_get_reencryptionresponsepayload_version(this.__wbg_ptr);
1521
1276
  return ret >>> 0;
1522
1277
  }
1523
1278
  /**
1524
- * Version of the response format.
1525
- * @param {number} arg0
1526
- */
1279
+ * Version of the response format.
1280
+ * @param {number} arg0
1281
+ */
1527
1282
  set version(arg0) {
1528
1283
  wasm.__wbg_set_reencryptionresponsepayload_version(this.__wbg_ptr, arg0);
1529
1284
  }
1530
1285
  /**
1531
- * The server's signature verification key.
1532
- * Encoded using SEC1.
1533
- * Needed to validate the response, but MUST also be linked to a list of
1534
- * trusted keys.
1535
- * @returns {Uint8Array}
1536
- */
1286
+ * The server's signature verification key.
1287
+ * Encoded using SEC1.
1288
+ * Needed to validate the response, but MUST also be linked to a list of
1289
+ * trusted keys.
1290
+ * @returns {Uint8Array}
1291
+ */
1537
1292
  get verification_key() {
1538
- try {
1539
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1540
- wasm.__wbg_get_reencryptionrequest_signature(retptr, this.__wbg_ptr);
1541
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1542
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1543
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1544
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1545
- return v1;
1546
- } finally {
1547
- wasm.__wbindgen_add_to_stack_pointer(16);
1548
- }
1293
+ const ret = wasm.__wbg_get_reencryptionresponsepayload_verification_key(this.__wbg_ptr);
1294
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1295
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1296
+ return v1;
1549
1297
  }
1550
1298
  /**
1551
- * The server's signature verification key.
1552
- * Encoded using SEC1.
1553
- * Needed to validate the response, but MUST also be linked to a list of
1554
- * trusted keys.
1555
- * @param {Uint8Array} arg0
1556
- */
1299
+ * The server's signature verification key.
1300
+ * Encoded using SEC1.
1301
+ * Needed to validate the response, but MUST also be linked to a list of
1302
+ * trusted keys.
1303
+ * @param {Uint8Array} arg0
1304
+ */
1557
1305
  set verification_key(arg0) {
1558
1306
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1559
1307
  const len0 = WASM_VECTOR_LEN;
1560
1308
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1561
1309
  }
1562
1310
  /**
1563
- * The concatenation of two digests:
1564
- * (eip712_signing_hash(pk, domain) || ciphertext digest).
1565
- * This is needed to ensure the response corresponds to the request.
1566
- * @returns {Uint8Array}
1567
- */
1311
+ * The concatenation of two digests:
1312
+ * (eip712_signing_hash(pk, domain) || ciphertext digest).
1313
+ * This is needed to ensure the response corresponds to the request.
1314
+ * @returns {Uint8Array}
1315
+ */
1568
1316
  get digest() {
1569
- try {
1570
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1571
- wasm.__wbg_get_reencryptionrequestpayload_enc_key(retptr, this.__wbg_ptr);
1572
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1573
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1574
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1575
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1576
- return v1;
1577
- } finally {
1578
- wasm.__wbindgen_add_to_stack_pointer(16);
1579
- }
1317
+ const ret = wasm.__wbg_get_reencryptionresponsepayload_digest(this.__wbg_ptr);
1318
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1319
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1320
+ return v1;
1580
1321
  }
1581
1322
  /**
1582
- * The concatenation of two digests:
1583
- * (eip712_signing_hash(pk, domain) || ciphertext digest).
1584
- * This is needed to ensure the response corresponds to the request.
1585
- * @param {Uint8Array} arg0
1586
- */
1323
+ * The concatenation of two digests:
1324
+ * (eip712_signing_hash(pk, domain) || ciphertext digest).
1325
+ * This is needed to ensure the response corresponds to the request.
1326
+ * @param {Uint8Array} arg0
1327
+ */
1587
1328
  set digest(arg0) {
1588
1329
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1589
1330
  const len0 = WASM_VECTOR_LEN;
1590
1331
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1591
1332
  }
1592
1333
  /**
1593
- * The type of plaintext encrypted.
1594
- * @returns {number}
1595
- */
1334
+ * The type of plaintext encrypted.
1335
+ * @returns {number}
1336
+ */
1596
1337
  get fhe_type() {
1597
1338
  const ret = wasm.__wbg_get_reencryptionresponsepayload_fhe_type(this.__wbg_ptr);
1598
1339
  return ret;
1599
1340
  }
1600
1341
  /**
1601
- * The type of plaintext encrypted.
1602
- * @param {number} arg0
1603
- */
1342
+ * The type of plaintext encrypted.
1343
+ * @param {number} arg0
1344
+ */
1604
1345
  set fhe_type(arg0) {
1605
1346
  wasm.__wbg_set_reencryptionresponsepayload_fhe_type(this.__wbg_ptr, arg0);
1606
1347
  }
1607
1348
  /**
1608
- * The signcrypted payload, using a hybrid encryption approach in
1609
- * sign-then-encrypt.
1610
- * @returns {Uint8Array}
1611
- */
1349
+ * The signcrypted payload, using a hybrid encryption approach in
1350
+ * sign-then-encrypt.
1351
+ * @returns {Uint8Array}
1352
+ */
1612
1353
  get signcrypted_ciphertext() {
1613
- try {
1614
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1615
- wasm.__wbg_get_eip712domainmsg_chain_id(retptr, this.__wbg_ptr);
1616
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1617
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1618
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1619
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1620
- return v1;
1621
- } finally {
1622
- wasm.__wbindgen_add_to_stack_pointer(16);
1623
- }
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;
1624
1358
  }
1625
1359
  /**
1626
- * The signcrypted payload, using a hybrid encryption approach in
1627
- * sign-then-encrypt.
1628
- * @param {Uint8Array} arg0
1629
- */
1360
+ * The signcrypted payload, using a hybrid encryption approach in
1361
+ * sign-then-encrypt.
1362
+ * @param {Uint8Array} arg0
1363
+ */
1630
1364
  set signcrypted_ciphertext(arg0) {
1631
1365
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1632
1366
  const len0 = WASM_VECTOR_LEN;
1633
1367
  wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
1634
1368
  }
1635
1369
  /**
1636
- * The ID of the MPC party doing the reencryption. Used for polynomial
1637
- * reconstruction.
1638
- * @returns {number}
1639
- */
1370
+ * The ID of the MPC party doing the reencryption. Used for polynomial
1371
+ * reconstruction.
1372
+ * @returns {number}
1373
+ */
1640
1374
  get party_id() {
1641
1375
  const ret = wasm.__wbg_get_reencryptionresponsepayload_party_id(this.__wbg_ptr);
1642
1376
  return ret >>> 0;
1643
1377
  }
1644
1378
  /**
1645
- * The ID of the MPC party doing the reencryption. Used for polynomial
1646
- * reconstruction.
1647
- * @param {number} arg0
1648
- */
1379
+ * The ID of the MPC party doing the reencryption. Used for polynomial
1380
+ * reconstruction.
1381
+ * @param {number} arg0
1382
+ */
1649
1383
  set party_id(arg0) {
1650
1384
  wasm.__wbg_set_reencryptionresponsepayload_party_id(this.__wbg_ptr, arg0);
1651
1385
  }
1652
1386
  /**
1653
- * The degree of the sharing scheme used.
1654
- * @returns {number}
1655
- */
1387
+ * The degree of the sharing scheme used.
1388
+ * @returns {number}
1389
+ */
1656
1390
  get degree() {
1657
1391
  const ret = wasm.__wbg_get_reencryptionresponsepayload_degree(this.__wbg_ptr);
1658
1392
  return ret >>> 0;
1659
1393
  }
1660
1394
  /**
1661
- * The degree of the sharing scheme used.
1662
- * @param {number} arg0
1663
- */
1395
+ * The degree of the sharing scheme used.
1396
+ * @param {number} arg0
1397
+ */
1664
1398
  set degree(arg0) {
1665
1399
  wasm.__wbg_set_reencryptionresponsepayload_degree(this.__wbg_ptr, arg0);
1666
1400
  }
@@ -1670,9 +1404,9 @@ const RequestIdFinalization = (typeof FinalizationRegistry === 'undefined')
1670
1404
  ? { register: () => {}, unregister: () => {} }
1671
1405
  : new FinalizationRegistry(ptr => wasm.__wbg_requestid_free(ptr >>> 0, 1));
1672
1406
  /**
1673
- * Simple response to return an ID, to be used to retrieve the computed result
1674
- * later on.
1675
- */
1407
+ * Simple response to return an ID, to be used to retrieve the computed result
1408
+ * later on.
1409
+ */
1676
1410
  export class RequestId {
1677
1411
 
1678
1412
  static __wrap(ptr) {
@@ -1695,27 +1429,23 @@ export class RequestId {
1695
1429
  wasm.__wbg_requestid_free(ptr, 0);
1696
1430
  }
1697
1431
  /**
1698
- * @returns {string}
1699
- */
1432
+ * @returns {string}
1433
+ */
1700
1434
  get request_id() {
1701
1435
  let deferred1_0;
1702
1436
  let deferred1_1;
1703
1437
  try {
1704
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1705
- wasm.__wbg_get_eip712domainmsg_name(retptr, this.__wbg_ptr);
1706
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1707
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1708
- deferred1_0 = r0;
1709
- deferred1_1 = r1;
1710
- return getStringFromWasm0(r0, r1);
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]);
1711
1442
  } finally {
1712
- wasm.__wbindgen_add_to_stack_pointer(16);
1713
1443
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1714
1444
  }
1715
1445
  }
1716
1446
  /**
1717
- * @param {string} arg0
1718
- */
1447
+ * @param {string} arg0
1448
+ */
1719
1449
  set request_id(arg0) {
1720
1450
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1721
1451
  const len0 = WASM_VECTOR_LEN;
@@ -1731,7 +1461,7 @@ async function __wbg_load(module, imports) {
1731
1461
 
1732
1462
  } catch (e) {
1733
1463
  if (module.headers.get('Content-Type') != 'application/wasm') {
1734
- console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1464
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1735
1465
 
1736
1466
  } else {
1737
1467
  throw e;
@@ -1759,31 +1489,10 @@ function __wbg_get_imports() {
1759
1489
  imports.wbg = {};
1760
1490
  imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
1761
1491
  const ret = new Error(getStringFromWasm0(arg0, arg1));
1762
- return addHeapObject(ret);
1763
- };
1764
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1765
- takeObject(arg0);
1766
- };
1767
- imports.wbg.__wbg_publicsigkey_new = function(arg0) {
1768
- const ret = PublicSigKey.__wrap(arg0);
1769
- return addHeapObject(ret);
1770
- };
1771
- imports.wbg.__wbg_publicsigkey_unwrap = function(arg0) {
1772
- const ret = PublicSigKey.__unwrap(takeObject(arg0));
1773
1492
  return ret;
1774
1493
  };
1775
- imports.wbg.__wbg_reencryptionresponse_unwrap = function(arg0) {
1776
- const ret = ReencryptionResponse.__unwrap(takeObject(arg0));
1777
- return ret;
1778
- };
1779
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
1780
- const obj = getObject(arg1);
1781
- const ret = typeof(obj) === 'number' ? obj : undefined;
1782
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1783
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1784
- };
1785
1494
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
1786
- const obj = getObject(arg1);
1495
+ const obj = arg1;
1787
1496
  const ret = typeof(obj) === 'string' ? obj : undefined;
1788
1497
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1789
1498
  var len1 = WASM_VECTOR_LEN;
@@ -1791,60 +1500,66 @@ function __wbg_get_imports() {
1791
1500
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1792
1501
  };
1793
1502
  imports.wbg.__wbindgen_is_object = function(arg0) {
1794
- const val = getObject(arg0);
1503
+ const val = arg0;
1795
1504
  const ret = typeof(val) === 'object' && val !== null;
1796
1505
  return ret;
1797
1506
  };
1798
1507
  imports.wbg.__wbindgen_is_undefined = function(arg0) {
1799
- const ret = getObject(arg0) === undefined;
1508
+ const ret = arg0 === undefined;
1800
1509
  return ret;
1801
1510
  };
1802
1511
  imports.wbg.__wbindgen_in = function(arg0, arg1) {
1803
- const ret = getObject(arg0) in getObject(arg1);
1512
+ const ret = arg0 in arg1;
1804
1513
  return ret;
1805
1514
  };
1806
1515
  imports.wbg.__wbindgen_is_null = function(arg0) {
1807
- const ret = getObject(arg0) === null;
1516
+ const ret = arg0 === null;
1808
1517
  return ret;
1809
1518
  };
1519
+ imports.wbg.__wbg_reencryptionresponse_unwrap = function(arg0) {
1520
+ const ret = ReencryptionResponse.__unwrap(arg0);
1521
+ return ret;
1522
+ };
1523
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
1524
+ const obj = arg1;
1525
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1526
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1527
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1528
+ };
1810
1529
  imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
1811
- const ret = getObject(arg0) == getObject(arg1);
1530
+ const ret = arg0 == arg1;
1812
1531
  return ret;
1813
1532
  };
1814
1533
  imports.wbg.__wbindgen_boolean_get = function(arg0) {
1815
- const v = getObject(arg0);
1534
+ const v = arg0;
1816
1535
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1817
1536
  return ret;
1818
1537
  };
1819
1538
  imports.wbg.__wbindgen_as_number = function(arg0) {
1820
- const ret = +getObject(arg0);
1539
+ const ret = +arg0;
1821
1540
  return ret;
1822
1541
  };
1823
1542
  imports.wbg.__wbg_String_b9412f8799faab3e = function(arg0, arg1) {
1824
- const ret = String(getObject(arg1));
1543
+ const ret = String(arg1);
1825
1544
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1826
1545
  const len1 = WASM_VECTOR_LEN;
1827
1546
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1828
1547
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1829
1548
  };
1830
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
1831
- const ret = getObject(arg0);
1832
- return addHeapObject(ret);
1833
- };
1834
1549
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
1835
1550
  const ret = getStringFromWasm0(arg0, arg1);
1836
- return addHeapObject(ret);
1551
+ return ret;
1837
1552
  };
1838
1553
  imports.wbg.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
1839
- const ret = getObject(arg0)[getObject(arg1)];
1840
- return addHeapObject(ret);
1554
+ const ret = arg0[arg1];
1555
+ return ret;
1841
1556
  };
1842
1557
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
1843
1558
  const ret = new Error();
1844
- return addHeapObject(ret);
1559
+ return ret;
1845
1560
  };
1846
1561
  imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
1847
- const ret = getObject(arg1).stack;
1562
+ const ret = arg1.stack;
1848
1563
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1849
1564
  const len1 = WASM_VECTOR_LEN;
1850
1565
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
@@ -1862,160 +1577,160 @@ function __wbg_get_imports() {
1862
1577
  }
1863
1578
  };
1864
1579
  imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
1865
- const ret = getObject(arg0).crypto;
1866
- return addHeapObject(ret);
1580
+ const ret = arg0.crypto;
1581
+ return ret;
1867
1582
  };
1868
1583
  imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) {
1869
- const ret = getObject(arg0).process;
1870
- return addHeapObject(ret);
1584
+ const ret = arg0.process;
1585
+ return ret;
1871
1586
  };
1872
1587
  imports.wbg.__wbg_versions_f686565e586dd935 = function(arg0) {
1873
- const ret = getObject(arg0).versions;
1874
- return addHeapObject(ret);
1588
+ const ret = arg0.versions;
1589
+ return ret;
1875
1590
  };
1876
1591
  imports.wbg.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
1877
- const ret = getObject(arg0).node;
1878
- return addHeapObject(ret);
1592
+ const ret = arg0.node;
1593
+ return ret;
1879
1594
  };
1880
1595
  imports.wbg.__wbindgen_is_string = function(arg0) {
1881
- const ret = typeof(getObject(arg0)) === 'string';
1596
+ const ret = typeof(arg0) === 'string';
1882
1597
  return ret;
1883
1598
  };
1884
1599
  imports.wbg.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
1885
1600
  const ret = module.require;
1886
- return addHeapObject(ret);
1601
+ return ret;
1887
1602
  }, arguments) };
1888
1603
  imports.wbg.__wbindgen_is_function = function(arg0) {
1889
- const ret = typeof(getObject(arg0)) === 'function';
1604
+ const ret = typeof(arg0) === 'function';
1890
1605
  return ret;
1891
1606
  };
1892
1607
  imports.wbg.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
1893
- const ret = getObject(arg0).msCrypto;
1894
- return addHeapObject(ret);
1608
+ const ret = arg0.msCrypto;
1609
+ return ret;
1895
1610
  };
1896
1611
  imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
1897
- getObject(arg0).randomFillSync(takeObject(arg1));
1612
+ arg0.randomFillSync(arg1);
1898
1613
  }, arguments) };
1899
1614
  imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
1900
- getObject(arg0).getRandomValues(getObject(arg1));
1615
+ arg0.getRandomValues(arg1);
1901
1616
  }, arguments) };
1902
- imports.wbg.__wbg_get_3baa728f9d58d3f6 = function(arg0, arg1) {
1903
- const ret = getObject(arg0)[arg1 >>> 0];
1904
- return addHeapObject(ret);
1617
+ imports.wbg.__wbg_get_5419cf6b954aa11d = function(arg0, arg1) {
1618
+ const ret = arg0[arg1 >>> 0];
1619
+ return ret;
1905
1620
  };
1906
- imports.wbg.__wbg_length_ae22078168b726f5 = function(arg0) {
1907
- const ret = getObject(arg0).length;
1621
+ imports.wbg.__wbg_length_f217bbbf7e8e4df4 = function(arg0) {
1622
+ const ret = arg0.length;
1908
1623
  return ret;
1909
1624
  };
1910
- imports.wbg.__wbg_newnoargs_76313bd6ff35d0f2 = function(arg0, arg1) {
1625
+ imports.wbg.__wbg_newnoargs_1ede4bf2ebbaaf43 = function(arg0, arg1) {
1911
1626
  const ret = new Function(getStringFromWasm0(arg0, arg1));
1912
- return addHeapObject(ret);
1627
+ return ret;
1913
1628
  };
1914
- imports.wbg.__wbg_next_de3e9db4440638b2 = function(arg0) {
1915
- const ret = getObject(arg0).next;
1916
- return addHeapObject(ret);
1629
+ imports.wbg.__wbg_next_13b477da1eaa3897 = function(arg0) {
1630
+ const ret = arg0.next;
1631
+ return ret;
1917
1632
  };
1918
- imports.wbg.__wbg_next_f9cb570345655b9a = function() { return handleError(function (arg0) {
1919
- const ret = getObject(arg0).next();
1920
- return addHeapObject(ret);
1633
+ imports.wbg.__wbg_next_b06e115d1b01e10b = function() { return handleError(function (arg0) {
1634
+ const ret = arg0.next();
1635
+ return ret;
1921
1636
  }, arguments) };
1922
- imports.wbg.__wbg_done_bfda7aa8f252b39f = function(arg0) {
1923
- const ret = getObject(arg0).done;
1637
+ imports.wbg.__wbg_done_983b5ffcaec8c583 = function(arg0) {
1638
+ const ret = arg0.done;
1924
1639
  return ret;
1925
1640
  };
1926
- imports.wbg.__wbg_value_6d39332ab4788d86 = function(arg0) {
1927
- const ret = getObject(arg0).value;
1928
- return addHeapObject(ret);
1641
+ imports.wbg.__wbg_value_2ab8a198c834c26a = function(arg0) {
1642
+ const ret = arg0.value;
1643
+ return ret;
1929
1644
  };
1930
- imports.wbg.__wbg_iterator_888179a48810a9fe = function() {
1645
+ imports.wbg.__wbg_iterator_695d699a44d6234c = function() {
1931
1646
  const ret = Symbol.iterator;
1932
- return addHeapObject(ret);
1647
+ return ret;
1933
1648
  };
1934
- imports.wbg.__wbg_get_224d16597dbbfd96 = function() { return handleError(function (arg0, arg1) {
1935
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
1936
- return addHeapObject(ret);
1649
+ imports.wbg.__wbg_get_ef828680c64da212 = function() { return handleError(function (arg0, arg1) {
1650
+ const ret = Reflect.get(arg0, arg1);
1651
+ return ret;
1937
1652
  }, arguments) };
1938
- imports.wbg.__wbg_call_1084a111329e68ce = function() { return handleError(function (arg0, arg1) {
1939
- const ret = getObject(arg0).call(getObject(arg1));
1940
- return addHeapObject(ret);
1653
+ imports.wbg.__wbg_call_a9ef466721e824f2 = function() { return handleError(function (arg0, arg1) {
1654
+ const ret = arg0.call(arg1);
1655
+ return ret;
1941
1656
  }, arguments) };
1942
- imports.wbg.__wbg_self_3093d5d1f7bcb682 = function() { return handleError(function () {
1657
+ imports.wbg.__wbg_self_bf91bf94d9e04084 = function() { return handleError(function () {
1943
1658
  const ret = self.self;
1944
- return addHeapObject(ret);
1659
+ return ret;
1945
1660
  }, arguments) };
1946
- imports.wbg.__wbg_window_3bcfc4d31bc012f8 = function() { return handleError(function () {
1661
+ imports.wbg.__wbg_window_52dd9f07d03fd5f8 = function() { return handleError(function () {
1947
1662
  const ret = window.window;
1948
- return addHeapObject(ret);
1663
+ return ret;
1949
1664
  }, arguments) };
1950
- imports.wbg.__wbg_globalThis_86b222e13bdf32ed = function() { return handleError(function () {
1665
+ imports.wbg.__wbg_globalThis_05c129bf37fcf1be = function() { return handleError(function () {
1951
1666
  const ret = globalThis.globalThis;
1952
- return addHeapObject(ret);
1667
+ return ret;
1953
1668
  }, arguments) };
1954
- imports.wbg.__wbg_global_e5a3fe56f8be9485 = function() { return handleError(function () {
1669
+ imports.wbg.__wbg_global_3eca19bb09e9c484 = function() { return handleError(function () {
1955
1670
  const ret = global.global;
1956
- return addHeapObject(ret);
1671
+ return ret;
1957
1672
  }, arguments) };
1958
- imports.wbg.__wbg_isArray_8364a5371e9737d8 = function(arg0) {
1959
- const ret = Array.isArray(getObject(arg0));
1673
+ imports.wbg.__wbg_isArray_6f3b47f09adb61b5 = function(arg0) {
1674
+ const ret = Array.isArray(arg0);
1960
1675
  return ret;
1961
1676
  };
1962
- imports.wbg.__wbg_instanceof_ArrayBuffer_61dfc3198373c902 = function(arg0) {
1677
+ imports.wbg.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) {
1963
1678
  let result;
1964
1679
  try {
1965
- result = getObject(arg0) instanceof ArrayBuffer;
1680
+ result = arg0 instanceof ArrayBuffer;
1966
1681
  } catch (_) {
1967
1682
  result = false;
1968
1683
  }
1969
1684
  const ret = result;
1970
1685
  return ret;
1971
1686
  };
1972
- imports.wbg.__wbg_call_89af060b4e1523f2 = function() { return handleError(function (arg0, arg1, arg2) {
1973
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1974
- return addHeapObject(ret);
1687
+ imports.wbg.__wbg_call_3bfa248576352471 = function() { return handleError(function (arg0, arg1, arg2) {
1688
+ const ret = arg0.call(arg1, arg2);
1689
+ return ret;
1975
1690
  }, arguments) };
1976
- imports.wbg.__wbg_isSafeInteger_7f1ed56200d90674 = function(arg0) {
1977
- const ret = Number.isSafeInteger(getObject(arg0));
1691
+ imports.wbg.__wbg_isSafeInteger_b9dff570f01a9100 = function(arg0) {
1692
+ const ret = Number.isSafeInteger(arg0);
1978
1693
  return ret;
1979
1694
  };
1980
- imports.wbg.__wbg_buffer_b7b08af79b0b0974 = function(arg0) {
1981
- const ret = getObject(arg0).buffer;
1982
- return addHeapObject(ret);
1695
+ imports.wbg.__wbg_buffer_ccaed51a635d8a2d = function(arg0) {
1696
+ const ret = arg0.buffer;
1697
+ return ret;
1983
1698
  };
1984
- imports.wbg.__wbg_newwithbyteoffsetandlength_8a2cb9ca96b27ec9 = function(arg0, arg1, arg2) {
1985
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
1986
- return addHeapObject(ret);
1699
+ imports.wbg.__wbg_newwithbyteoffsetandlength_7e3eb787208af730 = function(arg0, arg1, arg2) {
1700
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
1701
+ return ret;
1987
1702
  };
1988
- imports.wbg.__wbg_new_ea1883e1e5e86686 = function(arg0) {
1989
- const ret = new Uint8Array(getObject(arg0));
1990
- return addHeapObject(ret);
1703
+ imports.wbg.__wbg_new_fec2611eb9180f95 = function(arg0) {
1704
+ const ret = new Uint8Array(arg0);
1705
+ return ret;
1991
1706
  };
1992
- imports.wbg.__wbg_set_d1e79e2388520f18 = function(arg0, arg1, arg2) {
1993
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1707
+ imports.wbg.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) {
1708
+ arg0.set(arg1, arg2 >>> 0);
1994
1709
  };
1995
- imports.wbg.__wbg_length_8339fcf5d8ecd12e = function(arg0) {
1996
- const ret = getObject(arg0).length;
1710
+ imports.wbg.__wbg_length_9254c4bd3b9f23c4 = function(arg0) {
1711
+ const ret = arg0.length;
1997
1712
  return ret;
1998
1713
  };
1999
- imports.wbg.__wbg_instanceof_Uint8Array_247a91427532499e = function(arg0) {
1714
+ imports.wbg.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) {
2000
1715
  let result;
2001
1716
  try {
2002
- result = getObject(arg0) instanceof Uint8Array;
1717
+ result = arg0 instanceof Uint8Array;
2003
1718
  } catch (_) {
2004
1719
  result = false;
2005
1720
  }
2006
1721
  const ret = result;
2007
1722
  return ret;
2008
1723
  };
2009
- imports.wbg.__wbg_newwithlength_ec548f448387c968 = function(arg0) {
1724
+ imports.wbg.__wbg_newwithlength_76462a666eca145f = function(arg0) {
2010
1725
  const ret = new Uint8Array(arg0 >>> 0);
2011
- return addHeapObject(ret);
1726
+ return ret;
2012
1727
  };
2013
- imports.wbg.__wbg_subarray_7c2e3576afe181d1 = function(arg0, arg1, arg2) {
2014
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
2015
- return addHeapObject(ret);
1728
+ imports.wbg.__wbg_subarray_975a06f9dbd16995 = function(arg0, arg1, arg2) {
1729
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1730
+ return ret;
2016
1731
  };
2017
1732
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
2018
- const ret = debugString(getObject(arg1));
1733
+ const ret = debugString(arg1);
2019
1734
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2020
1735
  const len1 = WASM_VECTOR_LEN;
2021
1736
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
@@ -2026,7 +1741,17 @@ function __wbg_get_imports() {
2026
1741
  };
2027
1742
  imports.wbg.__wbindgen_memory = function() {
2028
1743
  const ret = wasm.memory;
2029
- return addHeapObject(ret);
1744
+ return ret;
1745
+ };
1746
+ imports.wbg.__wbindgen_init_externref_table = function() {
1747
+ const table = wasm.__wbindgen_export_2;
1748
+ const offset = table.grow(4);
1749
+ table.set(0, undefined);
1750
+ table.set(offset + 0, undefined);
1751
+ table.set(offset + 1, null);
1752
+ table.set(offset + 2, true);
1753
+ table.set(offset + 3, false);
1754
+ ;
2030
1755
  };
2031
1756
 
2032
1757
  return imports;
@@ -2043,7 +1768,7 @@ function __wbg_finalize_init(instance, module) {
2043
1768
  cachedUint8ArrayMemory0 = null;
2044
1769
 
2045
1770
 
2046
-
1771
+ wasm.__wbindgen_start();
2047
1772
  return wasm;
2048
1773
  }
2049
1774
 
@@ -2051,10 +1776,13 @@ function initSync(module) {
2051
1776
  if (wasm !== undefined) return wasm;
2052
1777
 
2053
1778
 
2054
- if (typeof module !== 'undefined' && Object.getPrototypeOf(module) === Object.prototype)
2055
- ({module} = module)
2056
- else
2057
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1779
+ if (typeof module !== 'undefined') {
1780
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1781
+ ({module} = module)
1782
+ } else {
1783
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1784
+ }
1785
+ }
2058
1786
 
2059
1787
  const imports = __wbg_get_imports();
2060
1788
 
@@ -2073,10 +1801,13 @@ async function __wbg_init(module_or_path) {
2073
1801
  if (wasm !== undefined) return wasm;
2074
1802
 
2075
1803
 
2076
- if (typeof module_or_path !== 'undefined' && Object.getPrototypeOf(module_or_path) === Object.prototype)
2077
- ({module_or_path} = module_or_path)
2078
- else
2079
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1804
+ if (typeof module_or_path !== 'undefined') {
1805
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1806
+ ({module_or_path} = module_or_path)
1807
+ } else {
1808
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1809
+ }
1810
+ }
2080
1811
 
2081
1812
  if (typeof module_or_path === 'undefined') {
2082
1813
  module_or_path = new URL('kms_lib_bg.wasm', import.meta.url);