node-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
@@ -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;
@@ -185,10 +156,28 @@ function debugString(val) {
185
156
  return className;
186
157
  }
187
158
 
159
+ function _assertClass(instance, klass) {
160
+ if (!(instance instanceof klass)) {
161
+ throw new Error(`expected instance of ${klass.name}`);
162
+ }
163
+ return instance.ptr;
164
+ }
165
+
188
166
  function getArrayU8FromWasm0(ptr, len) {
189
167
  ptr = ptr >>> 0;
190
168
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
191
169
  }
170
+ /**
171
+ * @param {PublicSigKey} pk
172
+ * @returns {Uint8Array}
173
+ */
174
+ module.exports.public_sig_key_to_u8vec = function(pk) {
175
+ _assertClass(pk, PublicSigKey);
176
+ const ret = wasm.public_sig_key_to_u8vec(pk.__wbg_ptr);
177
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
178
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
179
+ return v1;
180
+ };
192
181
 
193
182
  function passArray8ToWasm0(arg, malloc) {
194
183
  const ptr = malloc(arg.length * 1, 1) >>> 0;
@@ -197,144 +186,97 @@ function passArray8ToWasm0(arg, malloc) {
197
186
  return ptr;
198
187
  }
199
188
 
200
- function _assertClass(instance, klass) {
201
- if (!(instance instanceof klass)) {
202
- throw new Error(`expected instance of ${klass.name}`);
203
- }
204
- return instance.ptr;
189
+ function takeFromExternrefTable0(idx) {
190
+ const value = wasm.__wbindgen_export_2.get(idx);
191
+ wasm.__externref_table_dealloc(idx);
192
+ return value;
205
193
  }
206
194
  /**
207
- * @param {PublicSigKey} pk
208
- * @returns {Uint8Array}
209
- */
210
- 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
- }
223
- };
224
-
225
- /**
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 {(PublicSigKey)[]} server_pks
314
- * @param {string} client_address_hex
315
- * @param {string} param_choice
316
- * @returns {Client}
317
- */
318
- module.exports.new_client = function(server_pks, client_address_hex, param_choice) {
319
- try {
320
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
321
- const ptr0 = passArrayJsValueToWasm0(server_pks, 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);
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
+ */
268
+ module.exports.new_client = function(server_addrs, client_address_hex, param_choice) {
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 {(PublicSigKey)[]}
352
- */
353
- module.exports.get_server_public_keys = function(client) {
354
- try {
355
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
356
- _assertClass(client, Client);
357
- wasm.get_server_public_keys(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
- }
293
+ * @param {Client} client
294
+ * @returns {(string)[]}
295
+ */
296
+ module.exports.get_server_addrs = function(client) {
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,180 @@ 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();
556
+ }
557
+ let ptr1 = 0;
558
+ if (!isLikeNone(eip712_domain)) {
559
+ _assertClass(eip712_domain, Eip712DomainMsg);
560
+ ptr1 = eip712_domain.__destroy_into_raw();
698
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
+ * Core Client
593
+ *
594
+ * Simple client to interact with the KMS servers. This can be seen as a proof-of-concept
595
+ * and reference code for validating the KMS. The logic supplied by the client will be
596
+ * distributed across the aggregator/proxy and smart contracts.
597
+ */
721
598
  class Client {
722
599
 
723
600
  static __wrap(ptr) {
@@ -745,8 +622,7 @@ module.exports.Client = Client;
745
622
  const CryptoBoxCtFinalization = (typeof FinalizationRegistry === 'undefined')
746
623
  ? { register: () => {}, unregister: () => {} }
747
624
  : new FinalizationRegistry(ptr => wasm.__wbg_cryptoboxct_free(ptr >>> 0, 1));
748
- /**
749
- */
625
+
750
626
  class CryptoBoxCt {
751
627
 
752
628
  static __wrap(ptr) {
@@ -775,10 +651,10 @@ const Eip712DomainMsgFinalization = (typeof FinalizationRegistry === 'undefined'
775
651
  ? { register: () => {}, unregister: () => {} }
776
652
  : new FinalizationRegistry(ptr => wasm.__wbg_eip712domainmsg_free(ptr >>> 0, 1));
777
653
  /**
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
- */
654
+ * <https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator>
655
+ * eventually chain_id, verifying_contract and salt will be parsed in to
656
+ * solidity types
657
+ */
782
658
  class Eip712DomainMsg {
783
659
 
784
660
  static __wrap(ptr) {
@@ -801,132 +677,109 @@ class Eip712DomainMsg {
801
677
  wasm.__wbg_eip712domainmsg_free(ptr, 0);
802
678
  }
803
679
  /**
804
- * @returns {string}
805
- */
680
+ * @returns {string}
681
+ */
806
682
  get name() {
807
683
  let deferred1_0;
808
684
  let deferred1_1;
809
685
  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);
686
+ const ret = wasm.__wbg_get_eip712domainmsg_name(this.__wbg_ptr);
687
+ deferred1_0 = ret[0];
688
+ deferred1_1 = ret[1];
689
+ return getStringFromWasm0(ret[0], ret[1]);
817
690
  } finally {
818
- wasm.__wbindgen_add_to_stack_pointer(16);
819
691
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
820
692
  }
821
693
  }
822
694
  /**
823
- * @param {string} arg0
824
- */
695
+ * @param {string} arg0
696
+ */
825
697
  set name(arg0) {
826
698
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
827
699
  const len0 = WASM_VECTOR_LEN;
828
700
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
829
701
  }
830
702
  /**
831
- * @returns {string}
832
- */
703
+ * @returns {string}
704
+ */
833
705
  get version() {
834
706
  let deferred1_0;
835
707
  let deferred1_1;
836
708
  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);
709
+ const ret = wasm.__wbg_get_eip712domainmsg_version(this.__wbg_ptr);
710
+ deferred1_0 = ret[0];
711
+ deferred1_1 = ret[1];
712
+ return getStringFromWasm0(ret[0], ret[1]);
844
713
  } finally {
845
- wasm.__wbindgen_add_to_stack_pointer(16);
846
714
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
847
715
  }
848
716
  }
849
717
  /**
850
- * @param {string} arg0
851
- */
718
+ * @param {string} arg0
719
+ */
852
720
  set version(arg0) {
853
721
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
854
722
  const len0 = WASM_VECTOR_LEN;
855
723
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
856
724
  }
857
725
  /**
858
- * @returns {Uint8Array}
859
- */
726
+ * @returns {Uint8Array}
727
+ */
860
728
  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
- }
729
+ const ret = wasm.__wbg_get_eip712domainmsg_chain_id(this.__wbg_ptr);
730
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
731
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
732
+ return v1;
872
733
  }
873
734
  /**
874
- * @param {Uint8Array} arg0
875
- */
735
+ * @param {Uint8Array} arg0
736
+ */
876
737
  set chain_id(arg0) {
877
738
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
878
739
  const len0 = WASM_VECTOR_LEN;
879
740
  wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
880
741
  }
881
742
  /**
882
- * @returns {string}
883
- */
743
+ * @returns {string}
744
+ */
884
745
  get verifying_contract() {
885
746
  let deferred1_0;
886
747
  let deferred1_1;
887
748
  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);
749
+ const ret = wasm.__wbg_get_eip712domainmsg_verifying_contract(this.__wbg_ptr);
750
+ deferred1_0 = ret[0];
751
+ deferred1_1 = ret[1];
752
+ return getStringFromWasm0(ret[0], ret[1]);
895
753
  } finally {
896
- wasm.__wbindgen_add_to_stack_pointer(16);
897
754
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
898
755
  }
899
756
  }
900
757
  /**
901
- * @param {string} arg0
902
- */
758
+ * @param {string} arg0
759
+ */
903
760
  set verifying_contract(arg0) {
904
761
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
905
762
  const len0 = WASM_VECTOR_LEN;
906
763
  wasm.__wbg_set_eip712domainmsg_verifying_contract(this.__wbg_ptr, ptr0, len0);
907
764
  }
908
765
  /**
909
- * @returns {Uint8Array}
910
- */
766
+ * @returns {Uint8Array | undefined}
767
+ */
911
768
  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);
769
+ const ret = wasm.__wbg_get_eip712domainmsg_salt(this.__wbg_ptr);
770
+ let v1;
771
+ if (ret[0] !== 0) {
772
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
773
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
922
774
  }
775
+ return v1;
923
776
  }
924
777
  /**
925
- * @param {Uint8Array} arg0
926
- */
778
+ * @param {Uint8Array | undefined} [arg0]
779
+ */
927
780
  set salt(arg0) {
928
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
929
- const len0 = WASM_VECTOR_LEN;
781
+ var ptr0 = isLikeNone(arg0) ? 0 : passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
782
+ var len0 = WASM_VECTOR_LEN;
930
783
  wasm.__wbg_set_eip712domainmsg_salt(this.__wbg_ptr, ptr0, len0);
931
784
  }
932
785
  }
@@ -936,8 +789,8 @@ const ParsedReencryptionRequestFinalization = (typeof FinalizationRegistry === '
936
789
  ? { register: () => {}, unregister: () => {} }
937
790
  : new FinalizationRegistry(ptr => wasm.__wbg_parsedreencryptionrequest_free(ptr >>> 0, 1));
938
791
  /**
939
- * Validity of this struct is not checked.
940
- */
792
+ * Validity of this struct is not checked.
793
+ */
941
794
  class ParsedReencryptionRequest {
942
795
 
943
796
  __destroy_into_raw() {
@@ -954,56 +807,10 @@ class ParsedReencryptionRequest {
954
807
  }
955
808
  module.exports.ParsedReencryptionRequest = ParsedReencryptionRequest;
956
809
 
957
- const PlaintextFinalization = (typeof FinalizationRegistry === 'undefined')
958
- ? { register: () => {}, unregister: () => {} }
959
- : new FinalizationRegistry(ptr => wasm.__wbg_plaintext_free(ptr >>> 0, 1));
960
- /**
961
- */
962
- class Plaintext {
963
-
964
- __destroy_into_raw() {
965
- const ptr = this.__wbg_ptr;
966
- this.__wbg_ptr = 0;
967
- PlaintextFinalization.unregister(this);
968
- return ptr;
969
- }
970
-
971
- free() {
972
- const ptr = this.__destroy_into_raw();
973
- wasm.__wbg_plaintext_free(ptr, 0);
974
- }
975
- /**
976
- * @returns {Uint8Array}
977
- */
978
- 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
- }
990
- }
991
- /**
992
- * @param {Uint8Array} arg0
993
- */
994
- set bytes(arg0) {
995
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
996
- const len0 = WASM_VECTOR_LEN;
997
- wasm.__wbg_set_plaintext_bytes(this.__wbg_ptr, ptr0, len0);
998
- }
999
- }
1000
- module.exports.Plaintext = Plaintext;
1001
-
1002
810
  const PrivateEncKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1003
811
  ? { register: () => {}, unregister: () => {} }
1004
812
  : new FinalizationRegistry(ptr => wasm.__wbg_privateenckey_free(ptr >>> 0, 1));
1005
- /**
1006
- */
813
+
1007
814
  class PrivateEncKey {
1008
815
 
1009
816
  static __wrap(ptr) {
@@ -1031,8 +838,7 @@ module.exports.PrivateEncKey = PrivateEncKey;
1031
838
  const PrivateSigKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1032
839
  ? { register: () => {}, unregister: () => {} }
1033
840
  : new FinalizationRegistry(ptr => wasm.__wbg_privatesigkey_free(ptr >>> 0, 1));
1034
- /**
1035
- */
841
+
1036
842
  class PrivateSigKey {
1037
843
 
1038
844
  static __wrap(ptr) {
@@ -1060,8 +866,7 @@ module.exports.PrivateSigKey = PrivateSigKey;
1060
866
  const PublicEncKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1061
867
  ? { register: () => {}, unregister: () => {} }
1062
868
  : new FinalizationRegistry(ptr => wasm.__wbg_publicenckey_free(ptr >>> 0, 1));
1063
- /**
1064
- */
869
+
1065
870
  class PublicEncKey {
1066
871
 
1067
872
  static __wrap(ptr) {
@@ -1089,8 +894,7 @@ module.exports.PublicEncKey = PublicEncKey;
1089
894
  const PublicSigKeyFinalization = (typeof FinalizationRegistry === 'undefined')
1090
895
  ? { register: () => {}, unregister: () => {} }
1091
896
  : new FinalizationRegistry(ptr => wasm.__wbg_publicsigkey_free(ptr >>> 0, 1));
1092
- /**
1093
- */
897
+
1094
898
  class PublicSigKey {
1095
899
 
1096
900
  static __wrap(ptr) {
@@ -1101,13 +905,6 @@ class PublicSigKey {
1101
905
  return obj;
1102
906
  }
1103
907
 
1104
- static __unwrap(jsValue) {
1105
- if (!(jsValue instanceof PublicSigKey)) {
1106
- return 0;
1107
- }
1108
- return jsValue.__destroy_into_raw();
1109
- }
1110
-
1111
908
  __destroy_into_raw() {
1112
909
  const ptr = this.__wbg_ptr;
1113
910
  this.__wbg_ptr = 0;
@@ -1125,8 +922,7 @@ module.exports.PublicSigKey = PublicSigKey;
1125
922
  const ReencryptionRequestFinalization = (typeof FinalizationRegistry === 'undefined')
1126
923
  ? { register: () => {}, unregister: () => {} }
1127
924
  : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionrequest_free(ptr >>> 0, 1));
1128
- /**
1129
- */
925
+
1130
926
  class ReencryptionRequest {
1131
927
 
1132
928
  __destroy_into_raw() {
@@ -1141,41 +937,34 @@ class ReencryptionRequest {
1141
937
  wasm.__wbg_reencryptionrequest_free(ptr, 0);
1142
938
  }
1143
939
  /**
1144
- * Signature of the serialization of \[ReencryptionRequestPayload\].
1145
- * @returns {Uint8Array}
1146
- */
940
+ * Signature of the serialization of \[ReencryptionRequestPayload\].
941
+ * @returns {Uint8Array}
942
+ */
1147
943
  get signature() {
1148
- try {
1149
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1150
- wasm.__wbg_get_reencryptionrequest_signature(retptr, this.__wbg_ptr);
1151
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1152
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1153
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1154
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1155
- return v1;
1156
- } finally {
1157
- wasm.__wbindgen_add_to_stack_pointer(16);
1158
- }
944
+ const ret = wasm.__wbg_get_reencryptionrequest_signature(this.__wbg_ptr);
945
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
946
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
947
+ return v1;
1159
948
  }
1160
949
  /**
1161
- * Signature of the serialization of \[ReencryptionRequestPayload\].
1162
- * @param {Uint8Array} arg0
1163
- */
950
+ * Signature of the serialization of \[ReencryptionRequestPayload\].
951
+ * @param {Uint8Array} arg0
952
+ */
1164
953
  set signature(arg0) {
1165
954
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1166
955
  const len0 = WASM_VECTOR_LEN;
1167
956
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1168
957
  }
1169
958
  /**
1170
- * @returns {ReencryptionRequestPayload | undefined}
1171
- */
959
+ * @returns {ReencryptionRequestPayload | undefined}
960
+ */
1172
961
  get payload() {
1173
962
  const ret = wasm.__wbg_get_reencryptionrequest_payload(this.__wbg_ptr);
1174
963
  return ret === 0 ? undefined : ReencryptionRequestPayload.__wrap(ret);
1175
964
  }
1176
965
  /**
1177
- * @param {ReencryptionRequestPayload | undefined} [arg0]
1178
- */
966
+ * @param {ReencryptionRequestPayload | undefined} [arg0]
967
+ */
1179
968
  set payload(arg0) {
1180
969
  let ptr0 = 0;
1181
970
  if (!isLikeNone(arg0)) {
@@ -1185,15 +974,15 @@ class ReencryptionRequest {
1185
974
  wasm.__wbg_set_reencryptionrequest_payload(this.__wbg_ptr, ptr0);
1186
975
  }
1187
976
  /**
1188
- * @returns {Eip712DomainMsg | undefined}
1189
- */
977
+ * @returns {Eip712DomainMsg | undefined}
978
+ */
1190
979
  get domain() {
1191
980
  const ret = wasm.__wbg_get_reencryptionrequest_domain(this.__wbg_ptr);
1192
981
  return ret === 0 ? undefined : Eip712DomainMsg.__wrap(ret);
1193
982
  }
1194
983
  /**
1195
- * @param {Eip712DomainMsg | undefined} [arg0]
1196
- */
984
+ * @param {Eip712DomainMsg | undefined} [arg0]
985
+ */
1197
986
  set domain(arg0) {
1198
987
  let ptr0 = 0;
1199
988
  if (!isLikeNone(arg0)) {
@@ -1203,19 +992,19 @@ class ReencryptionRequest {
1203
992
  wasm.__wbg_set_reencryptionrequest_domain(this.__wbg_ptr, ptr0);
1204
993
  }
1205
994
  /**
1206
- * The ID that identifies this request.
1207
- * Future queries for the result must use this request ID.
1208
- * @returns {RequestId | undefined}
1209
- */
995
+ * The ID that identifies this request.
996
+ * Future queries for the result must use this request ID.
997
+ * @returns {RequestId | undefined}
998
+ */
1210
999
  get request_id() {
1211
1000
  const ret = wasm.__wbg_get_reencryptionrequest_request_id(this.__wbg_ptr);
1212
1001
  return ret === 0 ? undefined : RequestId.__wrap(ret);
1213
1002
  }
1214
1003
  /**
1215
- * The ID that identifies this request.
1216
- * Future queries for the result must use this request ID.
1217
- * @param {RequestId | undefined} [arg0]
1218
- */
1004
+ * The ID that identifies this request.
1005
+ * Future queries for the result must use this request ID.
1006
+ * @param {RequestId | undefined} [arg0]
1007
+ */
1219
1008
  set request_id(arg0) {
1220
1009
  let ptr0 = 0;
1221
1010
  if (!isLikeNone(arg0)) {
@@ -1230,8 +1019,7 @@ module.exports.ReencryptionRequest = ReencryptionRequest;
1230
1019
  const ReencryptionRequestPayloadFinalization = (typeof FinalizationRegistry === 'undefined')
1231
1020
  ? { register: () => {}, unregister: () => {} }
1232
1021
  : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionrequestpayload_free(ptr >>> 0, 1));
1233
- /**
1234
- */
1022
+
1235
1023
  class ReencryptionRequestPayload {
1236
1024
 
1237
1025
  static __wrap(ptr) {
@@ -1254,110 +1042,99 @@ class ReencryptionRequestPayload {
1254
1042
  wasm.__wbg_reencryptionrequestpayload_free(ptr, 0);
1255
1043
  }
1256
1044
  /**
1257
- * Version of the request format.
1258
- * @returns {number}
1259
- */
1045
+ * Version of the request format.
1046
+ * @returns {number}
1047
+ */
1260
1048
  get version() {
1261
1049
  const ret = wasm.__wbg_get_reencryptionrequestpayload_version(this.__wbg_ptr);
1262
1050
  return ret >>> 0;
1263
1051
  }
1264
1052
  /**
1265
- * Version of the request format.
1266
- * @param {number} arg0
1267
- */
1053
+ * Version of the request format.
1054
+ * @param {number} arg0
1055
+ */
1268
1056
  set version(arg0) {
1269
1057
  wasm.__wbg_set_reencryptionrequestpayload_version(this.__wbg_ptr, arg0);
1270
1058
  }
1271
1059
  /**
1272
- * The client's (blockchain wallet) address,
1273
- * encoded using EIP-55.
1274
- * @returns {string}
1275
- */
1060
+ * The client's (blockchain wallet) address,
1061
+ * encoded using EIP-55.
1062
+ * @returns {string}
1063
+ */
1276
1064
  get client_address() {
1277
1065
  let deferred1_0;
1278
1066
  let deferred1_1;
1279
1067
  try {
1280
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1281
- wasm.__wbg_get_eip712domainmsg_name(retptr, this.__wbg_ptr);
1282
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1283
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1284
- deferred1_0 = r0;
1285
- deferred1_1 = r1;
1286
- return getStringFromWasm0(r0, r1);
1068
+ const ret = wasm.__wbg_get_reencryptionrequestpayload_client_address(this.__wbg_ptr);
1069
+ deferred1_0 = ret[0];
1070
+ deferred1_1 = ret[1];
1071
+ return getStringFromWasm0(ret[0], ret[1]);
1287
1072
  } finally {
1288
- wasm.__wbindgen_add_to_stack_pointer(16);
1289
1073
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1290
1074
  }
1291
1075
  }
1292
1076
  /**
1293
- * The client's (blockchain wallet) address,
1294
- * encoded using EIP-55.
1295
- * @param {string} arg0
1296
- */
1077
+ * The client's (blockchain wallet) address,
1078
+ * encoded using EIP-55.
1079
+ * @param {string} arg0
1080
+ */
1297
1081
  set client_address(arg0) {
1298
1082
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1299
1083
  const len0 = WASM_VECTOR_LEN;
1300
1084
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1301
1085
  }
1302
1086
  /**
1303
- * Encoding of the user's public encryption key for this request.
1304
- * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1305
- * Montgomery point.
1306
- * @returns {Uint8Array}
1307
- */
1087
+ * Encoding of the user's public encryption key for this request.
1088
+ * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1089
+ * Montgomery point.
1090
+ * @returns {Uint8Array}
1091
+ */
1308
1092
  get enc_key() {
1309
- try {
1310
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1311
- wasm.__wbg_get_reencryptionrequestpayload_enc_key(retptr, this.__wbg_ptr);
1312
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1313
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1314
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1315
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1316
- return v1;
1317
- } finally {
1318
- wasm.__wbindgen_add_to_stack_pointer(16);
1319
- }
1093
+ const ret = wasm.__wbg_get_reencryptionrequestpayload_enc_key(this.__wbg_ptr);
1094
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1095
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1096
+ return v1;
1320
1097
  }
1321
1098
  /**
1322
- * Encoding of the user's public encryption key for this request.
1323
- * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1324
- * Montgomery point.
1325
- * @param {Uint8Array} arg0
1326
- */
1099
+ * Encoding of the user's public encryption key for this request.
1100
+ * Encoding using the default encoding of libsodium, i.e. the 32 bytes of a
1101
+ * Montgomery point.
1102
+ * @param {Uint8Array} arg0
1103
+ */
1327
1104
  set enc_key(arg0) {
1328
1105
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1329
1106
  const len0 = WASM_VECTOR_LEN;
1330
1107
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1331
1108
  }
1332
1109
  /**
1333
- * The type of plaintext encrypted.
1334
- * @returns {number}
1335
- */
1110
+ * The type of plaintext encrypted.
1111
+ * @returns {number}
1112
+ */
1336
1113
  get fhe_type() {
1337
1114
  const ret = wasm.__wbg_get_reencryptionrequestpayload_fhe_type(this.__wbg_ptr);
1338
1115
  return ret;
1339
1116
  }
1340
1117
  /**
1341
- * The type of plaintext encrypted.
1342
- * @param {number} arg0
1343
- */
1118
+ * The type of plaintext encrypted.
1119
+ * @param {number} arg0
1120
+ */
1344
1121
  set fhe_type(arg0) {
1345
1122
  wasm.__wbg_set_reencryptionrequestpayload_fhe_type(this.__wbg_ptr, arg0);
1346
1123
  }
1347
1124
  /**
1348
- * The key id to use for decryption. Will be the request_id used during key
1349
- * generation
1350
- * @returns {RequestId | undefined}
1351
- */
1125
+ * The key id to use for decryption. Will be the request_id used during key
1126
+ * generation
1127
+ * @returns {RequestId | undefined}
1128
+ */
1352
1129
  get key_id() {
1353
1130
  const ret = wasm.__wbg_get_reencryptionrequestpayload_key_id(this.__wbg_ptr);
1354
1131
  return ret === 0 ? undefined : RequestId.__wrap(ret);
1355
1132
  }
1356
1133
  /**
1357
- * The key id to use for decryption. Will be the request_id used during key
1358
- * generation
1359
- * @param {RequestId | undefined} [arg0]
1360
- */
1134
+ * The key id to use for decryption. Will be the request_id used during key
1135
+ * generation
1136
+ * @param {RequestId | undefined} [arg0]
1137
+ */
1361
1138
  set key_id(arg0) {
1362
1139
  let ptr0 = 0;
1363
1140
  if (!isLikeNone(arg0)) {
@@ -1367,61 +1144,47 @@ class ReencryptionRequestPayload {
1367
1144
  wasm.__wbg_set_reencryptionrequestpayload_key_id(this.__wbg_ptr, ptr0);
1368
1145
  }
1369
1146
  /**
1370
- * The actual ciphertext to decrypt, taken directly from the fhevm.
1371
- * When creating the payload, this field may be empty,
1372
- * it is the responsibility of the gateway to fetch the
1373
- * ciphertext for the given digest below.
1374
- * @returns {Uint8Array | undefined}
1375
- */
1147
+ * The actual ciphertext to decrypt, taken directly from the fhevm.
1148
+ * When creating the payload, this field may be empty,
1149
+ * it is the responsibility of the gateway to fetch the
1150
+ * ciphertext for the given digest below.
1151
+ * @returns {Uint8Array | undefined}
1152
+ */
1376
1153
  get ciphertext() {
1377
- try {
1378
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1379
- wasm.__wbg_get_reencryptionrequestpayload_ciphertext(retptr, this.__wbg_ptr);
1380
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1381
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1382
- let v1;
1383
- if (r0 !== 0) {
1384
- v1 = getArrayU8FromWasm0(r0, r1).slice();
1385
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1386
- }
1387
- return v1;
1388
- } finally {
1389
- wasm.__wbindgen_add_to_stack_pointer(16);
1154
+ const ret = wasm.__wbg_get_reencryptionrequestpayload_ciphertext(this.__wbg_ptr);
1155
+ let v1;
1156
+ if (ret[0] !== 0) {
1157
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1158
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1390
1159
  }
1160
+ return v1;
1391
1161
  }
1392
1162
  /**
1393
- * The actual ciphertext to decrypt, taken directly from the fhevm.
1394
- * When creating the payload, this field may be empty,
1395
- * it is the responsibility of the gateway to fetch the
1396
- * ciphertext for the given digest below.
1397
- * @param {Uint8Array | undefined} [arg0]
1398
- */
1163
+ * The actual ciphertext to decrypt, taken directly from the fhevm.
1164
+ * When creating the payload, this field may be empty,
1165
+ * it is the responsibility of the gateway to fetch the
1166
+ * ciphertext for the given digest below.
1167
+ * @param {Uint8Array | undefined} [arg0]
1168
+ */
1399
1169
  set ciphertext(arg0) {
1400
1170
  var ptr0 = isLikeNone(arg0) ? 0 : passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1401
1171
  var len0 = WASM_VECTOR_LEN;
1402
- wasm.__wbg_set_reencryptionrequestpayload_ciphertext(this.__wbg_ptr, ptr0, len0);
1172
+ wasm.__wbg_set_eip712domainmsg_salt(this.__wbg_ptr, ptr0, len0);
1403
1173
  }
1404
1174
  /**
1405
- * The SHA3 digest of the ciphertext above.
1406
- * @returns {Uint8Array}
1407
- */
1175
+ * The SHA3 digest of the ciphertext above.
1176
+ * @returns {Uint8Array}
1177
+ */
1408
1178
  get ciphertext_digest() {
1409
- try {
1410
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1411
- wasm.__wbg_get_eip712domainmsg_chain_id(retptr, this.__wbg_ptr);
1412
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1413
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1414
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1415
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1416
- return v1;
1417
- } finally {
1418
- wasm.__wbindgen_add_to_stack_pointer(16);
1419
- }
1179
+ const ret = wasm.__wbg_get_reencryptionrequestpayload_ciphertext_digest(this.__wbg_ptr);
1180
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1181
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1182
+ return v1;
1420
1183
  }
1421
1184
  /**
1422
- * The SHA3 digest of the ciphertext above.
1423
- * @param {Uint8Array} arg0
1424
- */
1185
+ * The SHA3 digest of the ciphertext above.
1186
+ * @param {Uint8Array} arg0
1187
+ */
1425
1188
  set ciphertext_digest(arg0) {
1426
1189
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1427
1190
  const len0 = WASM_VECTOR_LEN;
@@ -1433,8 +1196,7 @@ module.exports.ReencryptionRequestPayload = ReencryptionRequestPayload;
1433
1196
  const ReencryptionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
1434
1197
  ? { register: () => {}, unregister: () => {} }
1435
1198
  : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionresponse_free(ptr >>> 0, 1));
1436
- /**
1437
- */
1199
+
1438
1200
  class ReencryptionResponse {
1439
1201
 
1440
1202
  static __unwrap(jsValue) {
@@ -1456,41 +1218,34 @@ class ReencryptionResponse {
1456
1218
  wasm.__wbg_reencryptionresponse_free(ptr, 0);
1457
1219
  }
1458
1220
  /**
1459
- * @returns {Uint8Array}
1460
- */
1221
+ * @returns {Uint8Array}
1222
+ */
1461
1223
  get signature() {
1462
- try {
1463
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1464
- wasm.__wbg_get_reencryptionrequest_signature(retptr, this.__wbg_ptr);
1465
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1466
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1467
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1468
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1469
- return v1;
1470
- } finally {
1471
- wasm.__wbindgen_add_to_stack_pointer(16);
1472
- }
1224
+ const ret = wasm.__wbg_get_reencryptionresponse_signature(this.__wbg_ptr);
1225
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1226
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1227
+ return v1;
1473
1228
  }
1474
1229
  /**
1475
- * @param {Uint8Array} arg0
1476
- */
1230
+ * @param {Uint8Array} arg0
1231
+ */
1477
1232
  set signature(arg0) {
1478
1233
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1479
1234
  const len0 = WASM_VECTOR_LEN;
1480
1235
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1481
1236
  }
1482
1237
  /**
1483
- * Signature of the serialization of \[ReencryptionResponsePayload\].
1484
- * @returns {ReencryptionResponsePayload | undefined}
1485
- */
1238
+ * Signature of the serialization of \[ReencryptionResponsePayload\].
1239
+ * @returns {ReencryptionResponsePayload | undefined}
1240
+ */
1486
1241
  get payload() {
1487
1242
  const ret = wasm.__wbg_get_reencryptionresponse_payload(this.__wbg_ptr);
1488
1243
  return ret === 0 ? undefined : ReencryptionResponsePayload.__wrap(ret);
1489
1244
  }
1490
1245
  /**
1491
- * Signature of the serialization of \[ReencryptionResponsePayload\].
1492
- * @param {ReencryptionResponsePayload | undefined} [arg0]
1493
- */
1246
+ * Signature of the serialization of \[ReencryptionResponsePayload\].
1247
+ * @param {ReencryptionResponsePayload | undefined} [arg0]
1248
+ */
1494
1249
  set payload(arg0) {
1495
1250
  let ptr0 = 0;
1496
1251
  if (!isLikeNone(arg0)) {
@@ -1505,8 +1260,7 @@ module.exports.ReencryptionResponse = ReencryptionResponse;
1505
1260
  const ReencryptionResponsePayloadFinalization = (typeof FinalizationRegistry === 'undefined')
1506
1261
  ? { register: () => {}, unregister: () => {} }
1507
1262
  : new FinalizationRegistry(ptr => wasm.__wbg_reencryptionresponsepayload_free(ptr >>> 0, 1));
1508
- /**
1509
- */
1263
+
1510
1264
  class ReencryptionResponsePayload {
1511
1265
 
1512
1266
  static __wrap(ptr) {
@@ -1529,154 +1283,133 @@ class ReencryptionResponsePayload {
1529
1283
  wasm.__wbg_reencryptionresponsepayload_free(ptr, 0);
1530
1284
  }
1531
1285
  /**
1532
- * Version of the response format.
1533
- * @returns {number}
1534
- */
1286
+ * Version of the response format.
1287
+ * @returns {number}
1288
+ */
1535
1289
  get version() {
1536
1290
  const ret = wasm.__wbg_get_reencryptionresponsepayload_version(this.__wbg_ptr);
1537
1291
  return ret >>> 0;
1538
1292
  }
1539
1293
  /**
1540
- * Version of the response format.
1541
- * @param {number} arg0
1542
- */
1294
+ * Version of the response format.
1295
+ * @param {number} arg0
1296
+ */
1543
1297
  set version(arg0) {
1544
1298
  wasm.__wbg_set_reencryptionresponsepayload_version(this.__wbg_ptr, arg0);
1545
1299
  }
1546
1300
  /**
1547
- * The server's signature verification key.
1548
- * Encoded using SEC1.
1549
- * Needed to validate the response, but MUST also be linked to a list of
1550
- * trusted keys.
1551
- * @returns {Uint8Array}
1552
- */
1301
+ * The server's signature verification key.
1302
+ * Encoded using SEC1.
1303
+ * Needed to validate the response, but MUST also be linked to a list of
1304
+ * trusted keys.
1305
+ * @returns {Uint8Array}
1306
+ */
1553
1307
  get verification_key() {
1554
- try {
1555
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1556
- wasm.__wbg_get_reencryptionrequest_signature(retptr, this.__wbg_ptr);
1557
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1558
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1559
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1560
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1561
- return v1;
1562
- } finally {
1563
- wasm.__wbindgen_add_to_stack_pointer(16);
1564
- }
1308
+ const ret = wasm.__wbg_get_reencryptionresponsepayload_verification_key(this.__wbg_ptr);
1309
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1310
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1311
+ return v1;
1565
1312
  }
1566
1313
  /**
1567
- * The server's signature verification key.
1568
- * Encoded using SEC1.
1569
- * Needed to validate the response, but MUST also be linked to a list of
1570
- * trusted keys.
1571
- * @param {Uint8Array} arg0
1572
- */
1314
+ * The server's signature verification key.
1315
+ * Encoded using SEC1.
1316
+ * Needed to validate the response, but MUST also be linked to a list of
1317
+ * trusted keys.
1318
+ * @param {Uint8Array} arg0
1319
+ */
1573
1320
  set verification_key(arg0) {
1574
1321
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1575
1322
  const len0 = WASM_VECTOR_LEN;
1576
1323
  wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
1577
1324
  }
1578
1325
  /**
1579
- * The concatenation of two digests:
1580
- * (eip712_signing_hash(pk, domain) || ciphertext digest).
1581
- * This is needed to ensure the response corresponds to the request.
1582
- * @returns {Uint8Array}
1583
- */
1326
+ * The concatenation of two digests:
1327
+ * (eip712_signing_hash(pk, domain) || ciphertext digest).
1328
+ * This is needed to ensure the response corresponds to the request.
1329
+ * @returns {Uint8Array}
1330
+ */
1584
1331
  get digest() {
1585
- try {
1586
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1587
- wasm.__wbg_get_reencryptionrequestpayload_enc_key(retptr, this.__wbg_ptr);
1588
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1589
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1590
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1591
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1592
- return v1;
1593
- } finally {
1594
- wasm.__wbindgen_add_to_stack_pointer(16);
1595
- }
1332
+ const ret = wasm.__wbg_get_reencryptionresponsepayload_digest(this.__wbg_ptr);
1333
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1334
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1335
+ return v1;
1596
1336
  }
1597
1337
  /**
1598
- * The concatenation of two digests:
1599
- * (eip712_signing_hash(pk, domain) || ciphertext digest).
1600
- * This is needed to ensure the response corresponds to the request.
1601
- * @param {Uint8Array} arg0
1602
- */
1338
+ * The concatenation of two digests:
1339
+ * (eip712_signing_hash(pk, domain) || ciphertext digest).
1340
+ * This is needed to ensure the response corresponds to the request.
1341
+ * @param {Uint8Array} arg0
1342
+ */
1603
1343
  set digest(arg0) {
1604
1344
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1605
1345
  const len0 = WASM_VECTOR_LEN;
1606
1346
  wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
1607
1347
  }
1608
1348
  /**
1609
- * The type of plaintext encrypted.
1610
- * @returns {number}
1611
- */
1349
+ * The type of plaintext encrypted.
1350
+ * @returns {number}
1351
+ */
1612
1352
  get fhe_type() {
1613
1353
  const ret = wasm.__wbg_get_reencryptionresponsepayload_fhe_type(this.__wbg_ptr);
1614
1354
  return ret;
1615
1355
  }
1616
1356
  /**
1617
- * The type of plaintext encrypted.
1618
- * @param {number} arg0
1619
- */
1357
+ * The type of plaintext encrypted.
1358
+ * @param {number} arg0
1359
+ */
1620
1360
  set fhe_type(arg0) {
1621
1361
  wasm.__wbg_set_reencryptionresponsepayload_fhe_type(this.__wbg_ptr, arg0);
1622
1362
  }
1623
1363
  /**
1624
- * The signcrypted payload, using a hybrid encryption approach in
1625
- * sign-then-encrypt.
1626
- * @returns {Uint8Array}
1627
- */
1364
+ * The signcrypted payload, using a hybrid encryption approach in
1365
+ * sign-then-encrypt.
1366
+ * @returns {Uint8Array}
1367
+ */
1628
1368
  get signcrypted_ciphertext() {
1629
- try {
1630
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1631
- wasm.__wbg_get_eip712domainmsg_chain_id(retptr, this.__wbg_ptr);
1632
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1633
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1634
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1635
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1636
- return v1;
1637
- } finally {
1638
- wasm.__wbindgen_add_to_stack_pointer(16);
1639
- }
1369
+ const ret = wasm.__wbg_get_reencryptionresponsepayload_signcrypted_ciphertext(this.__wbg_ptr);
1370
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1371
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1372
+ return v1;
1640
1373
  }
1641
1374
  /**
1642
- * The signcrypted payload, using a hybrid encryption approach in
1643
- * sign-then-encrypt.
1644
- * @param {Uint8Array} arg0
1645
- */
1375
+ * The signcrypted payload, using a hybrid encryption approach in
1376
+ * sign-then-encrypt.
1377
+ * @param {Uint8Array} arg0
1378
+ */
1646
1379
  set signcrypted_ciphertext(arg0) {
1647
1380
  const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
1648
1381
  const len0 = WASM_VECTOR_LEN;
1649
1382
  wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
1650
1383
  }
1651
1384
  /**
1652
- * The ID of the MPC party doing the reencryption. Used for polynomial
1653
- * reconstruction.
1654
- * @returns {number}
1655
- */
1385
+ * The ID of the MPC party doing the reencryption. Used for polynomial
1386
+ * reconstruction.
1387
+ * @returns {number}
1388
+ */
1656
1389
  get party_id() {
1657
1390
  const ret = wasm.__wbg_get_reencryptionresponsepayload_party_id(this.__wbg_ptr);
1658
1391
  return ret >>> 0;
1659
1392
  }
1660
1393
  /**
1661
- * The ID of the MPC party doing the reencryption. Used for polynomial
1662
- * reconstruction.
1663
- * @param {number} arg0
1664
- */
1394
+ * The ID of the MPC party doing the reencryption. Used for polynomial
1395
+ * reconstruction.
1396
+ * @param {number} arg0
1397
+ */
1665
1398
  set party_id(arg0) {
1666
1399
  wasm.__wbg_set_reencryptionresponsepayload_party_id(this.__wbg_ptr, arg0);
1667
1400
  }
1668
1401
  /**
1669
- * The degree of the sharing scheme used.
1670
- * @returns {number}
1671
- */
1402
+ * The degree of the sharing scheme used.
1403
+ * @returns {number}
1404
+ */
1672
1405
  get degree() {
1673
1406
  const ret = wasm.__wbg_get_reencryptionresponsepayload_degree(this.__wbg_ptr);
1674
1407
  return ret >>> 0;
1675
1408
  }
1676
1409
  /**
1677
- * The degree of the sharing scheme used.
1678
- * @param {number} arg0
1679
- */
1410
+ * The degree of the sharing scheme used.
1411
+ * @param {number} arg0
1412
+ */
1680
1413
  set degree(arg0) {
1681
1414
  wasm.__wbg_set_reencryptionresponsepayload_degree(this.__wbg_ptr, arg0);
1682
1415
  }
@@ -1687,9 +1420,9 @@ const RequestIdFinalization = (typeof FinalizationRegistry === 'undefined')
1687
1420
  ? { register: () => {}, unregister: () => {} }
1688
1421
  : new FinalizationRegistry(ptr => wasm.__wbg_requestid_free(ptr >>> 0, 1));
1689
1422
  /**
1690
- * Simple response to return an ID, to be used to retrieve the computed result
1691
- * later on.
1692
- */
1423
+ * Simple response to return an ID, to be used to retrieve the computed result
1424
+ * later on.
1425
+ */
1693
1426
  class RequestId {
1694
1427
 
1695
1428
  static __wrap(ptr) {
@@ -1712,27 +1445,23 @@ class RequestId {
1712
1445
  wasm.__wbg_requestid_free(ptr, 0);
1713
1446
  }
1714
1447
  /**
1715
- * @returns {string}
1716
- */
1448
+ * @returns {string}
1449
+ */
1717
1450
  get request_id() {
1718
1451
  let deferred1_0;
1719
1452
  let deferred1_1;
1720
1453
  try {
1721
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1722
- wasm.__wbg_get_eip712domainmsg_name(retptr, this.__wbg_ptr);
1723
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1724
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1725
- deferred1_0 = r0;
1726
- deferred1_1 = r1;
1727
- return getStringFromWasm0(r0, r1);
1454
+ const ret = wasm.__wbg_get_requestid_request_id(this.__wbg_ptr);
1455
+ deferred1_0 = ret[0];
1456
+ deferred1_1 = ret[1];
1457
+ return getStringFromWasm0(ret[0], ret[1]);
1728
1458
  } finally {
1729
- wasm.__wbindgen_add_to_stack_pointer(16);
1730
1459
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1731
1460
  }
1732
1461
  }
1733
1462
  /**
1734
- * @param {string} arg0
1735
- */
1463
+ * @param {string} arg0
1464
+ */
1736
1465
  set request_id(arg0) {
1737
1466
  const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1738
1467
  const len0 = WASM_VECTOR_LEN;
@@ -1743,37 +1472,11 @@ module.exports.RequestId = RequestId;
1743
1472
 
1744
1473
  module.exports.__wbindgen_error_new = function(arg0, arg1) {
1745
1474
  const ret = new Error(getStringFromWasm0(arg0, arg1));
1746
- return addHeapObject(ret);
1747
- };
1748
-
1749
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
1750
- takeObject(arg0);
1751
- };
1752
-
1753
- module.exports.__wbg_publicsigkey_new = function(arg0) {
1754
- const ret = PublicSigKey.__wrap(arg0);
1755
- return addHeapObject(ret);
1756
- };
1757
-
1758
- module.exports.__wbg_publicsigkey_unwrap = function(arg0) {
1759
- const ret = PublicSigKey.__unwrap(takeObject(arg0));
1760
1475
  return ret;
1761
1476
  };
1762
1477
 
1763
- module.exports.__wbg_reencryptionresponse_unwrap = function(arg0) {
1764
- const ret = ReencryptionResponse.__unwrap(takeObject(arg0));
1765
- return ret;
1766
- };
1767
-
1768
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
1769
- const obj = getObject(arg1);
1770
- const ret = typeof(obj) === 'number' ? obj : undefined;
1771
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1772
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1773
- };
1774
-
1775
1478
  module.exports.__wbindgen_string_get = function(arg0, arg1) {
1776
- const obj = getObject(arg1);
1479
+ const obj = arg1;
1777
1480
  const ret = typeof(obj) === 'string' ? obj : undefined;
1778
1481
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1779
1482
  var len1 = WASM_VECTOR_LEN;
@@ -1782,72 +1485,79 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
1782
1485
  };
1783
1486
 
1784
1487
  module.exports.__wbindgen_is_object = function(arg0) {
1785
- const val = getObject(arg0);
1488
+ const val = arg0;
1786
1489
  const ret = typeof(val) === 'object' && val !== null;
1787
1490
  return ret;
1788
1491
  };
1789
1492
 
1790
1493
  module.exports.__wbindgen_is_undefined = function(arg0) {
1791
- const ret = getObject(arg0) === undefined;
1494
+ const ret = arg0 === undefined;
1792
1495
  return ret;
1793
1496
  };
1794
1497
 
1795
1498
  module.exports.__wbindgen_in = function(arg0, arg1) {
1796
- const ret = getObject(arg0) in getObject(arg1);
1499
+ const ret = arg0 in arg1;
1797
1500
  return ret;
1798
1501
  };
1799
1502
 
1800
1503
  module.exports.__wbindgen_is_null = function(arg0) {
1801
- const ret = getObject(arg0) === null;
1504
+ const ret = arg0 === null;
1802
1505
  return ret;
1803
1506
  };
1804
1507
 
1508
+ module.exports.__wbg_reencryptionresponse_unwrap = function(arg0) {
1509
+ const ret = ReencryptionResponse.__unwrap(arg0);
1510
+ return ret;
1511
+ };
1512
+
1513
+ module.exports.__wbindgen_number_get = function(arg0, arg1) {
1514
+ const obj = arg1;
1515
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1516
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1517
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1518
+ };
1519
+
1805
1520
  module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
1806
- const ret = getObject(arg0) == getObject(arg1);
1521
+ const ret = arg0 == arg1;
1807
1522
  return ret;
1808
1523
  };
1809
1524
 
1810
1525
  module.exports.__wbindgen_boolean_get = function(arg0) {
1811
- const v = getObject(arg0);
1526
+ const v = arg0;
1812
1527
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
1813
1528
  return ret;
1814
1529
  };
1815
1530
 
1816
1531
  module.exports.__wbindgen_as_number = function(arg0) {
1817
- const ret = +getObject(arg0);
1532
+ const ret = +arg0;
1818
1533
  return ret;
1819
1534
  };
1820
1535
 
1821
1536
  module.exports.__wbg_String_b9412f8799faab3e = function(arg0, arg1) {
1822
- const ret = String(getObject(arg1));
1537
+ const ret = String(arg1);
1823
1538
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1824
1539
  const len1 = WASM_VECTOR_LEN;
1825
1540
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1826
1541
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1827
1542
  };
1828
1543
 
1829
- module.exports.__wbindgen_object_clone_ref = function(arg0) {
1830
- const ret = getObject(arg0);
1831
- return addHeapObject(ret);
1832
- };
1833
-
1834
1544
  module.exports.__wbindgen_string_new = function(arg0, arg1) {
1835
1545
  const ret = getStringFromWasm0(arg0, arg1);
1836
- return addHeapObject(ret);
1546
+ return ret;
1837
1547
  };
1838
1548
 
1839
1549
  module.exports.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
1840
- const ret = getObject(arg0)[getObject(arg1)];
1841
- return addHeapObject(ret);
1550
+ const ret = arg0[arg1];
1551
+ return ret;
1842
1552
  };
1843
1553
 
1844
1554
  module.exports.__wbg_new_abda76e883ba8a5f = function() {
1845
1555
  const ret = new Error();
1846
- return addHeapObject(ret);
1556
+ return ret;
1847
1557
  };
1848
1558
 
1849
1559
  module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
1850
- const ret = getObject(arg1).stack;
1560
+ const ret = arg1.stack;
1851
1561
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1852
1562
  const len1 = WASM_VECTOR_LEN;
1853
1563
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
@@ -1867,132 +1577,132 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
1867
1577
  };
1868
1578
 
1869
1579
  module.exports.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
1870
- const ret = getObject(arg0).crypto;
1871
- return addHeapObject(ret);
1580
+ const ret = arg0.crypto;
1581
+ return ret;
1872
1582
  };
1873
1583
 
1874
1584
  module.exports.__wbg_process_4a72847cc503995b = function(arg0) {
1875
- const ret = getObject(arg0).process;
1876
- return addHeapObject(ret);
1585
+ const ret = arg0.process;
1586
+ return ret;
1877
1587
  };
1878
1588
 
1879
1589
  module.exports.__wbg_versions_f686565e586dd935 = function(arg0) {
1880
- const ret = getObject(arg0).versions;
1881
- return addHeapObject(ret);
1590
+ const ret = arg0.versions;
1591
+ return ret;
1882
1592
  };
1883
1593
 
1884
1594
  module.exports.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
1885
- const ret = getObject(arg0).node;
1886
- return addHeapObject(ret);
1595
+ const ret = arg0.node;
1596
+ return ret;
1887
1597
  };
1888
1598
 
1889
1599
  module.exports.__wbindgen_is_string = function(arg0) {
1890
- const ret = typeof(getObject(arg0)) === 'string';
1600
+ const ret = typeof(arg0) === 'string';
1891
1601
  return ret;
1892
1602
  };
1893
1603
 
1894
1604
  module.exports.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
1895
1605
  const ret = module.require;
1896
- return addHeapObject(ret);
1606
+ return ret;
1897
1607
  }, arguments) };
1898
1608
 
1899
1609
  module.exports.__wbindgen_is_function = function(arg0) {
1900
- const ret = typeof(getObject(arg0)) === 'function';
1610
+ const ret = typeof(arg0) === 'function';
1901
1611
  return ret;
1902
1612
  };
1903
1613
 
1904
1614
  module.exports.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
1905
- const ret = getObject(arg0).msCrypto;
1906
- return addHeapObject(ret);
1615
+ const ret = arg0.msCrypto;
1616
+ return ret;
1907
1617
  };
1908
1618
 
1909
1619
  module.exports.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
1910
- getObject(arg0).randomFillSync(takeObject(arg1));
1620
+ arg0.randomFillSync(arg1);
1911
1621
  }, arguments) };
1912
1622
 
1913
1623
  module.exports.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
1914
- getObject(arg0).getRandomValues(getObject(arg1));
1624
+ arg0.getRandomValues(arg1);
1915
1625
  }, arguments) };
1916
1626
 
1917
- module.exports.__wbg_get_3baa728f9d58d3f6 = function(arg0, arg1) {
1918
- const ret = getObject(arg0)[arg1 >>> 0];
1919
- return addHeapObject(ret);
1627
+ module.exports.__wbg_get_5419cf6b954aa11d = function(arg0, arg1) {
1628
+ const ret = arg0[arg1 >>> 0];
1629
+ return ret;
1920
1630
  };
1921
1631
 
1922
- module.exports.__wbg_length_ae22078168b726f5 = function(arg0) {
1923
- const ret = getObject(arg0).length;
1632
+ module.exports.__wbg_length_f217bbbf7e8e4df4 = function(arg0) {
1633
+ const ret = arg0.length;
1924
1634
  return ret;
1925
1635
  };
1926
1636
 
1927
- module.exports.__wbg_newnoargs_76313bd6ff35d0f2 = function(arg0, arg1) {
1637
+ module.exports.__wbg_newnoargs_1ede4bf2ebbaaf43 = function(arg0, arg1) {
1928
1638
  const ret = new Function(getStringFromWasm0(arg0, arg1));
1929
- return addHeapObject(ret);
1639
+ return ret;
1930
1640
  };
1931
1641
 
1932
- module.exports.__wbg_next_de3e9db4440638b2 = function(arg0) {
1933
- const ret = getObject(arg0).next;
1934
- return addHeapObject(ret);
1642
+ module.exports.__wbg_next_13b477da1eaa3897 = function(arg0) {
1643
+ const ret = arg0.next;
1644
+ return ret;
1935
1645
  };
1936
1646
 
1937
- module.exports.__wbg_next_f9cb570345655b9a = function() { return handleError(function (arg0) {
1938
- const ret = getObject(arg0).next();
1939
- return addHeapObject(ret);
1647
+ module.exports.__wbg_next_b06e115d1b01e10b = function() { return handleError(function (arg0) {
1648
+ const ret = arg0.next();
1649
+ return ret;
1940
1650
  }, arguments) };
1941
1651
 
1942
- module.exports.__wbg_done_bfda7aa8f252b39f = function(arg0) {
1943
- const ret = getObject(arg0).done;
1652
+ module.exports.__wbg_done_983b5ffcaec8c583 = function(arg0) {
1653
+ const ret = arg0.done;
1944
1654
  return ret;
1945
1655
  };
1946
1656
 
1947
- module.exports.__wbg_value_6d39332ab4788d86 = function(arg0) {
1948
- const ret = getObject(arg0).value;
1949
- return addHeapObject(ret);
1657
+ module.exports.__wbg_value_2ab8a198c834c26a = function(arg0) {
1658
+ const ret = arg0.value;
1659
+ return ret;
1950
1660
  };
1951
1661
 
1952
- module.exports.__wbg_iterator_888179a48810a9fe = function() {
1662
+ module.exports.__wbg_iterator_695d699a44d6234c = function() {
1953
1663
  const ret = Symbol.iterator;
1954
- return addHeapObject(ret);
1664
+ return ret;
1955
1665
  };
1956
1666
 
1957
- module.exports.__wbg_get_224d16597dbbfd96 = function() { return handleError(function (arg0, arg1) {
1958
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
1959
- return addHeapObject(ret);
1667
+ module.exports.__wbg_get_ef828680c64da212 = function() { return handleError(function (arg0, arg1) {
1668
+ const ret = Reflect.get(arg0, arg1);
1669
+ return ret;
1960
1670
  }, arguments) };
1961
1671
 
1962
- module.exports.__wbg_call_1084a111329e68ce = function() { return handleError(function (arg0, arg1) {
1963
- const ret = getObject(arg0).call(getObject(arg1));
1964
- return addHeapObject(ret);
1672
+ module.exports.__wbg_call_a9ef466721e824f2 = function() { return handleError(function (arg0, arg1) {
1673
+ const ret = arg0.call(arg1);
1674
+ return ret;
1965
1675
  }, arguments) };
1966
1676
 
1967
- module.exports.__wbg_self_3093d5d1f7bcb682 = function() { return handleError(function () {
1677
+ module.exports.__wbg_self_bf91bf94d9e04084 = function() { return handleError(function () {
1968
1678
  const ret = self.self;
1969
- return addHeapObject(ret);
1679
+ return ret;
1970
1680
  }, arguments) };
1971
1681
 
1972
- module.exports.__wbg_window_3bcfc4d31bc012f8 = function() { return handleError(function () {
1682
+ module.exports.__wbg_window_52dd9f07d03fd5f8 = function() { return handleError(function () {
1973
1683
  const ret = window.window;
1974
- return addHeapObject(ret);
1684
+ return ret;
1975
1685
  }, arguments) };
1976
1686
 
1977
- module.exports.__wbg_globalThis_86b222e13bdf32ed = function() { return handleError(function () {
1687
+ module.exports.__wbg_globalThis_05c129bf37fcf1be = function() { return handleError(function () {
1978
1688
  const ret = globalThis.globalThis;
1979
- return addHeapObject(ret);
1689
+ return ret;
1980
1690
  }, arguments) };
1981
1691
 
1982
- module.exports.__wbg_global_e5a3fe56f8be9485 = function() { return handleError(function () {
1692
+ module.exports.__wbg_global_3eca19bb09e9c484 = function() { return handleError(function () {
1983
1693
  const ret = global.global;
1984
- return addHeapObject(ret);
1694
+ return ret;
1985
1695
  }, arguments) };
1986
1696
 
1987
- module.exports.__wbg_isArray_8364a5371e9737d8 = function(arg0) {
1988
- const ret = Array.isArray(getObject(arg0));
1697
+ module.exports.__wbg_isArray_6f3b47f09adb61b5 = function(arg0) {
1698
+ const ret = Array.isArray(arg0);
1989
1699
  return ret;
1990
1700
  };
1991
1701
 
1992
- module.exports.__wbg_instanceof_ArrayBuffer_61dfc3198373c902 = function(arg0) {
1702
+ module.exports.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) {
1993
1703
  let result;
1994
1704
  try {
1995
- result = getObject(arg0) instanceof ArrayBuffer;
1705
+ result = arg0 instanceof ArrayBuffer;
1996
1706
  } catch (_) {
1997
1707
  result = false;
1998
1708
  }
@@ -2000,44 +1710,44 @@ module.exports.__wbg_instanceof_ArrayBuffer_61dfc3198373c902 = function(arg0) {
2000
1710
  return ret;
2001
1711
  };
2002
1712
 
2003
- module.exports.__wbg_call_89af060b4e1523f2 = function() { return handleError(function (arg0, arg1, arg2) {
2004
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2005
- return addHeapObject(ret);
1713
+ module.exports.__wbg_call_3bfa248576352471 = function() { return handleError(function (arg0, arg1, arg2) {
1714
+ const ret = arg0.call(arg1, arg2);
1715
+ return ret;
2006
1716
  }, arguments) };
2007
1717
 
2008
- module.exports.__wbg_isSafeInteger_7f1ed56200d90674 = function(arg0) {
2009
- const ret = Number.isSafeInteger(getObject(arg0));
1718
+ module.exports.__wbg_isSafeInteger_b9dff570f01a9100 = function(arg0) {
1719
+ const ret = Number.isSafeInteger(arg0);
2010
1720
  return ret;
2011
1721
  };
2012
1722
 
2013
- module.exports.__wbg_buffer_b7b08af79b0b0974 = function(arg0) {
2014
- const ret = getObject(arg0).buffer;
2015
- return addHeapObject(ret);
1723
+ module.exports.__wbg_buffer_ccaed51a635d8a2d = function(arg0) {
1724
+ const ret = arg0.buffer;
1725
+ return ret;
2016
1726
  };
2017
1727
 
2018
- module.exports.__wbg_newwithbyteoffsetandlength_8a2cb9ca96b27ec9 = function(arg0, arg1, arg2) {
2019
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
2020
- return addHeapObject(ret);
1728
+ module.exports.__wbg_newwithbyteoffsetandlength_7e3eb787208af730 = function(arg0, arg1, arg2) {
1729
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
1730
+ return ret;
2021
1731
  };
2022
1732
 
2023
- module.exports.__wbg_new_ea1883e1e5e86686 = function(arg0) {
2024
- const ret = new Uint8Array(getObject(arg0));
2025
- return addHeapObject(ret);
1733
+ module.exports.__wbg_new_fec2611eb9180f95 = function(arg0) {
1734
+ const ret = new Uint8Array(arg0);
1735
+ return ret;
2026
1736
  };
2027
1737
 
2028
- module.exports.__wbg_set_d1e79e2388520f18 = function(arg0, arg1, arg2) {
2029
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1738
+ module.exports.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) {
1739
+ arg0.set(arg1, arg2 >>> 0);
2030
1740
  };
2031
1741
 
2032
- module.exports.__wbg_length_8339fcf5d8ecd12e = function(arg0) {
2033
- const ret = getObject(arg0).length;
1742
+ module.exports.__wbg_length_9254c4bd3b9f23c4 = function(arg0) {
1743
+ const ret = arg0.length;
2034
1744
  return ret;
2035
1745
  };
2036
1746
 
2037
- module.exports.__wbg_instanceof_Uint8Array_247a91427532499e = function(arg0) {
1747
+ module.exports.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) {
2038
1748
  let result;
2039
1749
  try {
2040
- result = getObject(arg0) instanceof Uint8Array;
1750
+ result = arg0 instanceof Uint8Array;
2041
1751
  } catch (_) {
2042
1752
  result = false;
2043
1753
  }
@@ -2045,18 +1755,18 @@ module.exports.__wbg_instanceof_Uint8Array_247a91427532499e = function(arg0) {
2045
1755
  return ret;
2046
1756
  };
2047
1757
 
2048
- module.exports.__wbg_newwithlength_ec548f448387c968 = function(arg0) {
1758
+ module.exports.__wbg_newwithlength_76462a666eca145f = function(arg0) {
2049
1759
  const ret = new Uint8Array(arg0 >>> 0);
2050
- return addHeapObject(ret);
1760
+ return ret;
2051
1761
  };
2052
1762
 
2053
- module.exports.__wbg_subarray_7c2e3576afe181d1 = function(arg0, arg1, arg2) {
2054
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
2055
- return addHeapObject(ret);
1763
+ module.exports.__wbg_subarray_975a06f9dbd16995 = function(arg0, arg1, arg2) {
1764
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1765
+ return ret;
2056
1766
  };
2057
1767
 
2058
1768
  module.exports.__wbindgen_debug_string = function(arg0, arg1) {
2059
- const ret = debugString(getObject(arg1));
1769
+ const ret = debugString(arg1);
2060
1770
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2061
1771
  const len1 = WASM_VECTOR_LEN;
2062
1772
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
@@ -2069,7 +1779,18 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
2069
1779
 
2070
1780
  module.exports.__wbindgen_memory = function() {
2071
1781
  const ret = wasm.memory;
2072
- return addHeapObject(ret);
1782
+ return ret;
1783
+ };
1784
+
1785
+ module.exports.__wbindgen_init_externref_table = function() {
1786
+ const table = wasm.__wbindgen_export_2;
1787
+ const offset = table.grow(4);
1788
+ table.set(0, undefined);
1789
+ table.set(offset + 0, undefined);
1790
+ table.set(offset + 1, null);
1791
+ table.set(offset + 2, true);
1792
+ table.set(offset + 3, false);
1793
+ ;
2073
1794
  };
2074
1795
 
2075
1796
  const path = require('path').join(__dirname, 'kms_lib_bg.wasm');
@@ -2080,3 +1801,5 @@ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
2080
1801
  wasm = wasmInstance.exports;
2081
1802
  module.exports.__wasm = wasm;
2082
1803
 
1804
+ wasm.__wbindgen_start();
1805
+