@crisp-e3/zk-inputs 0.4.2 → 0.5.2

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/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * JavaScript-compatible CRISP ZK inputs generator.
5
- */
3
+
6
4
  export class ZKInputsGenerator {
7
5
  free(): void;
8
6
  [Symbol.dispose](): void;
@@ -63,6 +61,7 @@ export interface InitOutput {
63
61
  }
64
62
 
65
63
  export type SyncInitInput = BufferSource | WebAssembly.Module;
64
+
66
65
  /**
67
66
  * Instantiates the given `module`, which can either be bytes or
68
67
  * a precompiled `WebAssembly.Module`.
package/dist/index.js CHANGED
@@ -6,17 +6,25 @@ function addToExternrefTable0(obj) {
6
6
  return idx;
7
7
  }
8
8
 
9
- function handleError(f, args) {
10
- try {
11
- return f.apply(this, args);
12
- } catch (e) {
13
- const idx = addToExternrefTable0(e);
14
- wasm.__wbindgen_exn_store(idx);
9
+ function getArrayU8FromWasm0(ptr, len) {
10
+ ptr = ptr >>> 0;
11
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
12
+ }
13
+
14
+ let cachedBigUint64ArrayMemory0 = null;
15
+ function getBigUint64ArrayMemory0() {
16
+ if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
17
+ cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
15
18
  }
19
+ return cachedBigUint64ArrayMemory0;
16
20
  }
17
21
 
18
- let cachedUint8ArrayMemory0 = null;
22
+ function getStringFromWasm0(ptr, len) {
23
+ ptr = ptr >>> 0;
24
+ return decodeText(ptr, len);
25
+ }
19
26
 
27
+ let cachedUint8ArrayMemory0 = null;
20
28
  function getUint8ArrayMemory0() {
21
29
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
22
30
  cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
@@ -24,47 +32,19 @@ function getUint8ArrayMemory0() {
24
32
  return cachedUint8ArrayMemory0;
25
33
  }
26
34
 
27
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
28
-
29
- cachedTextDecoder.decode();
30
-
31
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
32
- let numBytesDecoded = 0;
33
- function decodeText(ptr, len) {
34
- numBytesDecoded += len;
35
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
36
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
37
- cachedTextDecoder.decode();
38
- numBytesDecoded = len;
35
+ function handleError(f, args) {
36
+ try {
37
+ return f.apply(this, args);
38
+ } catch (e) {
39
+ const idx = addToExternrefTable0(e);
40
+ wasm.__wbindgen_exn_store(idx);
39
41
  }
40
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
41
- }
42
-
43
- function getStringFromWasm0(ptr, len) {
44
- ptr = ptr >>> 0;
45
- return decodeText(ptr, len);
46
- }
47
-
48
- function getArrayU8FromWasm0(ptr, len) {
49
- ptr = ptr >>> 0;
50
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
51
42
  }
52
43
 
53
44
  function isLikeNone(x) {
54
45
  return x === undefined || x === null;
55
46
  }
56
47
 
57
- let cachedBigUint64ArrayMemory0 = null;
58
-
59
- function getBigUint64ArrayMemory0() {
60
- if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
61
- cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
62
- }
63
- return cachedBigUint64ArrayMemory0;
64
- }
65
-
66
- let WASM_VECTOR_LEN = 0;
67
-
68
48
  function passArray64ToWasm0(arg, malloc) {
69
49
  const ptr = malloc(arg.length * 8, 8) >>> 0;
70
50
  getBigUint64ArrayMemory0().set(arg, ptr / 8);
@@ -72,27 +52,43 @@ function passArray64ToWasm0(arg, malloc) {
72
52
  return ptr;
73
53
  }
74
54
 
55
+ function passArray8ToWasm0(arg, malloc) {
56
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
57
+ getUint8ArrayMemory0().set(arg, ptr / 1);
58
+ WASM_VECTOR_LEN = arg.length;
59
+ return ptr;
60
+ }
61
+
75
62
  function takeFromExternrefTable0(idx) {
76
63
  const value = wasm.__wbindgen_externrefs.get(idx);
77
64
  wasm.__externref_table_dealloc(idx);
78
65
  return value;
79
66
  }
80
67
 
81
- function passArray8ToWasm0(arg, malloc) {
82
- const ptr = malloc(arg.length * 1, 1) >>> 0;
83
- getUint8ArrayMemory0().set(arg, ptr / 1);
84
- WASM_VECTOR_LEN = arg.length;
85
- return ptr;
68
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
69
+ cachedTextDecoder.decode();
70
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
71
+ let numBytesDecoded = 0;
72
+ function decodeText(ptr, len) {
73
+ numBytesDecoded += len;
74
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
75
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
76
+ cachedTextDecoder.decode();
77
+ numBytesDecoded = len;
78
+ }
79
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
86
80
  }
87
81
 
82
+ let WASM_VECTOR_LEN = 0;
83
+
88
84
  const ZKInputsGeneratorFinalization = (typeof FinalizationRegistry === 'undefined')
89
85
  ? { register: () => {}, unregister: () => {} }
90
86
  : new FinalizationRegistry(ptr => wasm.__wbg_zkinputsgenerator_free(ptr >>> 0, 1));
87
+
91
88
  /**
92
89
  * JavaScript-compatible CRISP ZK inputs generator.
93
90
  */
94
91
  export class ZKInputsGenerator {
95
-
96
92
  static __wrap(ptr) {
97
93
  ptr = ptr >>> 0;
98
94
  const obj = Object.create(ZKInputsGenerator.prototype);
@@ -100,14 +96,12 @@ export class ZKInputsGenerator {
100
96
  ZKInputsGeneratorFinalization.register(obj, obj.__wbg_ptr, obj);
101
97
  return obj;
102
98
  }
103
-
104
99
  __destroy_into_raw() {
105
100
  const ptr = this.__wbg_ptr;
106
101
  this.__wbg_ptr = 0;
107
102
  ZKInputsGeneratorFinalization.unregister(this);
108
103
  return ptr;
109
104
  }
110
-
111
105
  free() {
112
106
  const ptr = this.__destroy_into_raw();
113
107
  wasm.__wbg_zkinputsgenerator_free(ptr, 0);
@@ -234,7 +228,6 @@ async function __wbg_load(module, imports) {
234
228
  if (typeof WebAssembly.instantiateStreaming === 'function') {
235
229
  try {
236
230
  return await WebAssembly.instantiateStreaming(module, imports);
237
-
238
231
  } catch (e) {
239
232
  const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
240
233
 
@@ -249,13 +242,11 @@ async function __wbg_load(module, imports) {
249
242
 
250
243
  const bytes = await module.arrayBuffer();
251
244
  return await WebAssembly.instantiate(bytes, imports);
252
-
253
245
  } else {
254
246
  const instance = await WebAssembly.instantiate(module, imports);
255
247
 
256
248
  if (instance instanceof WebAssembly.Instance) {
257
249
  return { instance, module };
258
-
259
250
  } else {
260
251
  return instance;
261
252
  }
@@ -265,35 +256,35 @@ async function __wbg_load(module, imports) {
265
256
  function __wbg_get_imports() {
266
257
  const imports = {};
267
258
  imports.wbg = {};
268
- imports.wbg.__wbg_BigInt_7bf8b8b2f99c431a = function() { return handleError(function (arg0) {
259
+ imports.wbg.__wbg_BigInt_811579177bbea12d = function() { return handleError(function (arg0) {
269
260
  const ret = BigInt(arg0);
270
261
  return ret;
271
262
  }, arguments) };
272
- imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
263
+ imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
273
264
  const ret = typeof(arg0) === 'function';
274
265
  return ret;
275
266
  };
276
- imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
267
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
277
268
  const val = arg0;
278
269
  const ret = typeof(val) === 'object' && val !== null;
279
270
  return ret;
280
271
  };
281
- imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
272
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
282
273
  const ret = typeof(arg0) === 'string';
283
274
  return ret;
284
275
  };
285
- imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
276
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
286
277
  const ret = arg0 === undefined;
287
278
  return ret;
288
279
  };
289
- imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
280
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
290
281
  throw new Error(getStringFromWasm0(arg0, arg1));
291
282
  };
292
- imports.wbg.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
283
+ imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
293
284
  const ret = arg0.call(arg1, arg2);
294
285
  return ret;
295
286
  }, arguments) };
296
- imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
287
+ imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
297
288
  const ret = arg0.call(arg1);
298
289
  return ret;
299
290
  }, arguments) };
@@ -304,7 +295,7 @@ function __wbg_get_imports() {
304
295
  imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
305
296
  arg0.getRandomValues(arg1);
306
297
  }, arguments) };
307
- imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
298
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
308
299
  const ret = arg0.length;
309
300
  return ret;
310
301
  };
@@ -312,19 +303,19 @@ function __wbg_get_imports() {
312
303
  const ret = arg0.msCrypto;
313
304
  return ret;
314
305
  };
315
- imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
306
+ imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
316
307
  const ret = new Object();
317
308
  return ret;
318
309
  };
319
- imports.wbg.__wbg_new_e17d9f43105b08be = function() {
310
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
320
311
  const ret = new Array();
321
312
  return ret;
322
313
  };
323
- imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
314
+ imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
324
315
  const ret = new Function(getStringFromWasm0(arg0, arg1));
325
316
  return ret;
326
317
  };
327
- imports.wbg.__wbg_new_with_length_01aa0dc35aa13543 = function(arg0) {
318
+ imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
328
319
  const ret = new Uint8Array(arg0 >>> 0);
329
320
  return ret;
330
321
  };
@@ -332,7 +323,7 @@ function __wbg_get_imports() {
332
323
  const ret = arg0.node;
333
324
  return ret;
334
325
  };
335
- imports.wbg.__wbg_parse_2a704d6b78abb2b8 = function() { return handleError(function (arg0, arg1) {
326
+ imports.wbg.__wbg_parse_a09a54cf72639456 = function() { return handleError(function (arg0, arg1) {
336
327
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
337
328
  return ret;
338
329
  }, arguments) };
@@ -340,10 +331,10 @@ function __wbg_get_imports() {
340
331
  const ret = arg0.process;
341
332
  return ret;
342
333
  };
343
- imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
334
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
344
335
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
345
336
  };
346
- imports.wbg.__wbg_push_df81a39d04db858c = function(arg0, arg1) {
337
+ imports.wbg.__wbg_push_7d9be8f38fc13975 = function(arg0, arg1) {
347
338
  const ret = arg0.push(arg1);
348
339
  return ret;
349
340
  };
@@ -354,27 +345,27 @@ function __wbg_get_imports() {
354
345
  const ret = module.require;
355
346
  return ret;
356
347
  }, arguments) };
357
- imports.wbg.__wbg_set_c2abbebe8b9ebee1 = function() { return handleError(function (arg0, arg1, arg2) {
348
+ imports.wbg.__wbg_set_781438a03c0c3c81 = function() { return handleError(function (arg0, arg1, arg2) {
358
349
  const ret = Reflect.set(arg0, arg1, arg2);
359
350
  return ret;
360
351
  }, arguments) };
361
- imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
352
+ imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
362
353
  const ret = typeof global === 'undefined' ? null : global;
363
354
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
364
355
  };
365
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
356
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
366
357
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
367
358
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
368
359
  };
369
- imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
360
+ imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
370
361
  const ret = typeof self === 'undefined' ? null : self;
371
362
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
372
363
  };
373
- imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
364
+ imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
374
365
  const ret = typeof window === 'undefined' ? null : window;
375
366
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
376
367
  };
377
- imports.wbg.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
368
+ imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
378
369
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
379
370
  return ret;
380
371
  };
@@ -405,7 +396,6 @@ function __wbg_get_imports() {
405
396
  table.set(offset + 1, null);
406
397
  table.set(offset + 2, true);
407
398
  table.set(offset + 3, false);
408
- ;
409
399
  };
410
400
 
411
401
  return imports;
@@ -435,13 +425,10 @@ function initSync(module) {
435
425
  }
436
426
 
437
427
  const imports = __wbg_get_imports();
438
-
439
428
  if (!(module instanceof WebAssembly.Module)) {
440
429
  module = new WebAssembly.Module(module);
441
430
  }
442
-
443
431
  const instance = new WebAssembly.Instance(module, imports);
444
-
445
432
  return __wbg_finalize_init(instance, module);
446
433
  }
447
434