tkms 0.9.0-rc5 → 0.9.0

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