node-tkms 0.9.0-rc11 → 0.9.0-rc21

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