@quilibrium/quilibrium-js-bls48581-sdk 2.1.0-2 → 2.1.0-3
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 +122 -1
- package/dist/index.esm.js +228 -2
- package/dist/index.js +230 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -1,3 +1,124 @@
|
|
1
|
+
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
2
|
+
|
3
|
+
interface InitOutput {
|
4
|
+
readonly memory: WebAssembly.Memory;
|
5
|
+
readonly js_init: () => void;
|
6
|
+
readonly js_commit_raw: (a: number, b: number, c: number, d: number) => void;
|
7
|
+
readonly js_prove_raw: (a: number, b: number, c: number, d: number, e: number) => void;
|
8
|
+
readonly js_verify_raw: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
9
|
+
readonly js_bls_keygen: (a: number) => void;
|
10
|
+
readonly js_bls_sign: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
11
|
+
readonly js_bls_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
12
|
+
readonly js_bls_aggregate: (a: number, b: number, c: number, d: number, e: number) => void;
|
13
|
+
readonly js_prove_multiple: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
14
|
+
readonly js_verify_multiple: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
|
15
|
+
readonly uniffi_bls48581_checksum_func_bls_aggregate: () => number;
|
16
|
+
readonly uniffi_bls48581_checksum_func_bls_keygen: () => number;
|
17
|
+
readonly uniffi_bls48581_checksum_func_bls_sign: () => number;
|
18
|
+
readonly uniffi_bls48581_checksum_func_bls_verify: () => number;
|
19
|
+
readonly uniffi_bls48581_checksum_func_commit_raw: () => number;
|
20
|
+
readonly uniffi_bls48581_checksum_func_init: () => number;
|
21
|
+
readonly uniffi_bls48581_checksum_func_prove_multiple: () => number;
|
22
|
+
readonly uniffi_bls48581_checksum_func_prove_raw: () => number;
|
23
|
+
readonly uniffi_bls48581_checksum_func_verify_multiple: () => number;
|
24
|
+
readonly uniffi_bls48581_checksum_func_verify_raw: () => number;
|
25
|
+
readonly ffi_bls48581_uniffi_contract_version: () => number;
|
26
|
+
readonly ffi_bls48581_rustbuffer_alloc: (a: number, b: number, c: number) => void;
|
27
|
+
readonly ffi_bls48581_rustbuffer_from_bytes: (a: number, b: number, c: number, d: number) => void;
|
28
|
+
readonly ffi_bls48581_rustbuffer_free: (a: number, b: number, c: number, d: number) => void;
|
29
|
+
readonly ffi_bls48581_rustbuffer_reserve: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
30
|
+
readonly ffi_bls48581_foreign_executor_callback_set: (a: number) => void;
|
31
|
+
readonly ffi_bls48581_rust_future_continuation_callback_set: (a: number) => void;
|
32
|
+
readonly ffi_bls48581_rust_future_complete_u8: (a: number, b: number) => number;
|
33
|
+
readonly ffi_bls48581_rust_future_complete_i8: (a: number, b: number) => number;
|
34
|
+
readonly ffi_bls48581_rust_future_complete_u16: (a: number, b: number) => number;
|
35
|
+
readonly ffi_bls48581_rust_future_complete_i16: (a: number, b: number) => number;
|
36
|
+
readonly ffi_bls48581_rust_future_complete_i32: (a: number, b: number) => number;
|
37
|
+
readonly ffi_bls48581_rust_future_complete_i64: (a: number, b: number) => number;
|
38
|
+
readonly ffi_bls48581_rust_future_poll_f32: (a: number, b: number) => void;
|
39
|
+
readonly ffi_bls48581_rust_future_cancel_f32: (a: number) => void;
|
40
|
+
readonly ffi_bls48581_rust_future_complete_f32: (a: number, b: number) => number;
|
41
|
+
readonly ffi_bls48581_rust_future_free_f32: (a: number) => void;
|
42
|
+
readonly ffi_bls48581_rust_future_complete_f64: (a: number, b: number) => number;
|
43
|
+
readonly ffi_bls48581_rust_future_complete_rust_buffer: (a: number, b: number, c: number) => void;
|
44
|
+
readonly ffi_bls48581_rust_future_complete_void: (a: number, b: number) => void;
|
45
|
+
readonly uniffi_bls48581_fn_func_bls_aggregate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
46
|
+
readonly uniffi_bls48581_fn_func_bls_keygen: (a: number, b: number) => void;
|
47
|
+
readonly uniffi_bls48581_fn_func_bls_sign: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
48
|
+
readonly uniffi_bls48581_fn_func_bls_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => number;
|
49
|
+
readonly uniffi_bls48581_fn_func_commit_raw: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
50
|
+
readonly uniffi_bls48581_fn_func_init: (a: number) => void;
|
51
|
+
readonly uniffi_bls48581_fn_func_prove_multiple: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
|
52
|
+
readonly uniffi_bls48581_fn_func_prove_raw: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
53
|
+
readonly uniffi_bls48581_fn_func_verify_multiple: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number) => number;
|
54
|
+
readonly uniffi_bls48581_fn_func_verify_raw: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => number;
|
55
|
+
readonly ffi_bls48581_rust_future_free_u8: (a: number) => void;
|
56
|
+
readonly ffi_bls48581_rust_future_free_u16: (a: number) => void;
|
57
|
+
readonly ffi_bls48581_rust_future_free_i8: (a: number) => void;
|
58
|
+
readonly ffi_bls48581_rust_future_free_u32: (a: number) => void;
|
59
|
+
readonly ffi_bls48581_rust_future_free_i32: (a: number) => void;
|
60
|
+
readonly ffi_bls48581_rust_future_free_u64: (a: number) => void;
|
61
|
+
readonly ffi_bls48581_rust_future_free_i64: (a: number) => void;
|
62
|
+
readonly ffi_bls48581_rust_future_free_i16: (a: number) => void;
|
63
|
+
readonly ffi_bls48581_rust_future_free_f64: (a: number) => void;
|
64
|
+
readonly ffi_bls48581_rust_future_free_pointer: (a: number) => void;
|
65
|
+
readonly ffi_bls48581_rust_future_free_rust_buffer: (a: number) => void;
|
66
|
+
readonly ffi_bls48581_rust_future_free_void: (a: number) => void;
|
67
|
+
readonly ffi_bls48581_rust_future_poll_u8: (a: number, b: number) => void;
|
68
|
+
readonly ffi_bls48581_rust_future_poll_u16: (a: number, b: number) => void;
|
69
|
+
readonly ffi_bls48581_rust_future_poll_i8: (a: number, b: number) => void;
|
70
|
+
readonly ffi_bls48581_rust_future_poll_u32: (a: number, b: number) => void;
|
71
|
+
readonly ffi_bls48581_rust_future_poll_i32: (a: number, b: number) => void;
|
72
|
+
readonly ffi_bls48581_rust_future_poll_u64: (a: number, b: number) => void;
|
73
|
+
readonly ffi_bls48581_rust_future_poll_i64: (a: number, b: number) => void;
|
74
|
+
readonly ffi_bls48581_rust_future_poll_i16: (a: number, b: number) => void;
|
75
|
+
readonly ffi_bls48581_rust_future_poll_f64: (a: number, b: number) => void;
|
76
|
+
readonly ffi_bls48581_rust_future_poll_pointer: (a: number, b: number) => void;
|
77
|
+
readonly ffi_bls48581_rust_future_poll_rust_buffer: (a: number, b: number) => void;
|
78
|
+
readonly ffi_bls48581_rust_future_poll_void: (a: number, b: number) => void;
|
79
|
+
readonly ffi_bls48581_rust_future_complete_u32: (a: number, b: number) => number;
|
80
|
+
readonly ffi_bls48581_rust_future_complete_u64: (a: number, b: number) => number;
|
81
|
+
readonly ffi_bls48581_rust_future_complete_pointer: (a: number, b: number) => number;
|
82
|
+
readonly ffi_bls48581_rust_future_cancel_u8: (a: number) => void;
|
83
|
+
readonly ffi_bls48581_rust_future_cancel_u16: (a: number) => void;
|
84
|
+
readonly ffi_bls48581_rust_future_cancel_i8: (a: number) => void;
|
85
|
+
readonly ffi_bls48581_rust_future_cancel_u32: (a: number) => void;
|
86
|
+
readonly ffi_bls48581_rust_future_cancel_i32: (a: number) => void;
|
87
|
+
readonly ffi_bls48581_rust_future_cancel_u64: (a: number) => void;
|
88
|
+
readonly ffi_bls48581_rust_future_cancel_i64: (a: number) => void;
|
89
|
+
readonly ffi_bls48581_rust_future_cancel_i16: (a: number) => void;
|
90
|
+
readonly ffi_bls48581_rust_future_cancel_f64: (a: number) => void;
|
91
|
+
readonly ffi_bls48581_rust_future_cancel_pointer: (a: number) => void;
|
92
|
+
readonly ffi_bls48581_rust_future_cancel_rust_buffer: (a: number) => void;
|
93
|
+
readonly ffi_bls48581_rust_future_cancel_void: (a: number) => void;
|
94
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
95
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
96
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
97
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
98
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
99
|
+
}
|
100
|
+
|
101
|
+
type SyncInitInput = BufferSource | WebAssembly.Module;
|
102
|
+
/**
|
103
|
+
* Instantiates the given `module`, which can either be bytes or
|
104
|
+
* a precompiled `WebAssembly.Module`.
|
105
|
+
*
|
106
|
+
* @param {SyncInitInput} module
|
107
|
+
*
|
108
|
+
* @returns {InitOutput}
|
109
|
+
*/
|
110
|
+
declare function initSync(module: SyncInitInput): InitOutput;
|
111
|
+
|
112
|
+
/**
|
113
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
114
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
115
|
+
*
|
116
|
+
* @param {InitInput | Promise<InitInput>} module_or_path
|
117
|
+
*
|
118
|
+
* @returns {Promise<InitOutput>}
|
119
|
+
*/
|
120
|
+
declare function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
121
|
+
|
1
122
|
declare function BLS48581CommitRaw(data: ArrayBuffer, poly_size: number): Buffer;
|
2
123
|
declare function BLS48581ProveRaw(data: ArrayBuffer, index: number, poly_size: number): Buffer;
|
3
124
|
declare function BLS48581VerifyRaw(data: ArrayBuffer, commit: ArrayBuffer, index: number, proof: ArrayBuffer, poly_size: number): Buffer;
|
@@ -41,4 +162,4 @@ declare namespace bls48581 {
|
|
41
162
|
};
|
42
163
|
}
|
43
164
|
|
44
|
-
export { bls48581 };
|
165
|
+
export { bls48581, __wbg_init as init, initSync };
|
package/dist/index.esm.js
CHANGED
@@ -6,7 +6,30 @@ const heap = new Array(128).fill(undefined);
|
|
6
6
|
|
7
7
|
heap.push(undefined, null, true, false);
|
8
8
|
|
9
|
-
heap
|
9
|
+
function getObject(idx) { return heap[idx]; }
|
10
|
+
|
11
|
+
let heap_next = heap.length;
|
12
|
+
|
13
|
+
function addHeapObject(obj) {
|
14
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
15
|
+
const idx = heap_next;
|
16
|
+
heap_next = heap[idx];
|
17
|
+
|
18
|
+
heap[idx] = obj;
|
19
|
+
return idx;
|
20
|
+
}
|
21
|
+
|
22
|
+
function dropObject(idx) {
|
23
|
+
if (idx < 132) return;
|
24
|
+
heap[idx] = heap_next;
|
25
|
+
heap_next = idx;
|
26
|
+
}
|
27
|
+
|
28
|
+
function takeObject(idx) {
|
29
|
+
const ret = getObject(idx);
|
30
|
+
dropObject(idx);
|
31
|
+
return ret;
|
32
|
+
}
|
10
33
|
|
11
34
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
12
35
|
|
@@ -342,6 +365,209 @@ function js_verify_multiple(commits, y_bytes, indices, poly_size, c_q_bytes, pro
|
|
342
365
|
}
|
343
366
|
}
|
344
367
|
|
368
|
+
function handleError(f, args) {
|
369
|
+
try {
|
370
|
+
return f.apply(this, args);
|
371
|
+
} catch (e) {
|
372
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
376
|
+
async function __wbg_load(module, imports) {
|
377
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
378
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
379
|
+
try {
|
380
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
381
|
+
|
382
|
+
} catch (e) {
|
383
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
384
|
+
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);
|
385
|
+
|
386
|
+
} else {
|
387
|
+
throw e;
|
388
|
+
}
|
389
|
+
}
|
390
|
+
}
|
391
|
+
|
392
|
+
const bytes = await module.arrayBuffer();
|
393
|
+
return await WebAssembly.instantiate(bytes, imports);
|
394
|
+
|
395
|
+
} else {
|
396
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
397
|
+
|
398
|
+
if (instance instanceof WebAssembly.Instance) {
|
399
|
+
return { instance, module };
|
400
|
+
|
401
|
+
} else {
|
402
|
+
return instance;
|
403
|
+
}
|
404
|
+
}
|
405
|
+
}
|
406
|
+
|
407
|
+
function __wbg_get_imports() {
|
408
|
+
const imports = {};
|
409
|
+
imports.wbg = {};
|
410
|
+
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
411
|
+
const ret = getObject(arg0);
|
412
|
+
return addHeapObject(ret);
|
413
|
+
};
|
414
|
+
imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
|
415
|
+
const ret = getObject(arg0).crypto;
|
416
|
+
return addHeapObject(ret);
|
417
|
+
};
|
418
|
+
imports.wbg.__wbindgen_is_object = function(arg0) {
|
419
|
+
const val = getObject(arg0);
|
420
|
+
const ret = typeof(val) === 'object' && val !== null;
|
421
|
+
return ret;
|
422
|
+
};
|
423
|
+
imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) {
|
424
|
+
const ret = getObject(arg0).process;
|
425
|
+
return addHeapObject(ret);
|
426
|
+
};
|
427
|
+
imports.wbg.__wbg_versions_f686565e586dd935 = function(arg0) {
|
428
|
+
const ret = getObject(arg0).versions;
|
429
|
+
return addHeapObject(ret);
|
430
|
+
};
|
431
|
+
imports.wbg.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
|
432
|
+
const ret = getObject(arg0).node;
|
433
|
+
return addHeapObject(ret);
|
434
|
+
};
|
435
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
436
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
437
|
+
return ret;
|
438
|
+
};
|
439
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
440
|
+
takeObject(arg0);
|
441
|
+
};
|
442
|
+
imports.wbg.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
|
443
|
+
const ret = module.require;
|
444
|
+
return addHeapObject(ret);
|
445
|
+
}, arguments) };
|
446
|
+
imports.wbg.__wbindgen_is_function = function(arg0) {
|
447
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
448
|
+
return ret;
|
449
|
+
};
|
450
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
451
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
452
|
+
return addHeapObject(ret);
|
453
|
+
};
|
454
|
+
imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
|
455
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
456
|
+
return addHeapObject(ret);
|
457
|
+
}, arguments) };
|
458
|
+
imports.wbg.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
|
459
|
+
const ret = getObject(arg0).msCrypto;
|
460
|
+
return addHeapObject(ret);
|
461
|
+
};
|
462
|
+
imports.wbg.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
|
463
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
464
|
+
return addHeapObject(ret);
|
465
|
+
};
|
466
|
+
imports.wbg.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
|
467
|
+
const ret = self.self;
|
468
|
+
return addHeapObject(ret);
|
469
|
+
}, arguments) };
|
470
|
+
imports.wbg.__wbg_window_c6fb939a7f436783 = function() { return handleError(function () {
|
471
|
+
const ret = window.window;
|
472
|
+
return addHeapObject(ret);
|
473
|
+
}, arguments) };
|
474
|
+
imports.wbg.__wbg_globalThis_d1e6af4856ba331b = function() { return handleError(function () {
|
475
|
+
const ret = globalThis.globalThis;
|
476
|
+
return addHeapObject(ret);
|
477
|
+
}, arguments) };
|
478
|
+
imports.wbg.__wbg_global_207b558942527489 = function() { return handleError(function () {
|
479
|
+
const ret = global.global;
|
480
|
+
return addHeapObject(ret);
|
481
|
+
}, arguments) };
|
482
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
483
|
+
const ret = getObject(arg0) === undefined;
|
484
|
+
return ret;
|
485
|
+
};
|
486
|
+
imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
|
487
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
488
|
+
return addHeapObject(ret);
|
489
|
+
};
|
490
|
+
imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
|
491
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
492
|
+
return addHeapObject(ret);
|
493
|
+
}, arguments) };
|
494
|
+
imports.wbg.__wbindgen_memory = function() {
|
495
|
+
const ret = wasm.memory;
|
496
|
+
return addHeapObject(ret);
|
497
|
+
};
|
498
|
+
imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
|
499
|
+
const ret = getObject(arg0).buffer;
|
500
|
+
return addHeapObject(ret);
|
501
|
+
};
|
502
|
+
imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
|
503
|
+
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
504
|
+
return addHeapObject(ret);
|
505
|
+
};
|
506
|
+
imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
|
507
|
+
getObject(arg0).randomFillSync(takeObject(arg1));
|
508
|
+
}, arguments) };
|
509
|
+
imports.wbg.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
|
510
|
+
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
511
|
+
return addHeapObject(ret);
|
512
|
+
};
|
513
|
+
imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
|
514
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
515
|
+
}, arguments) };
|
516
|
+
imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
|
517
|
+
const ret = new Uint8Array(getObject(arg0));
|
518
|
+
return addHeapObject(ret);
|
519
|
+
};
|
520
|
+
imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
|
521
|
+
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
522
|
+
};
|
523
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
524
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
525
|
+
};
|
526
|
+
|
527
|
+
return imports;
|
528
|
+
}
|
529
|
+
|
530
|
+
function __wbg_finalize_init(instance, module) {
|
531
|
+
wasm = instance.exports;
|
532
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
533
|
+
cachedInt32Memory0 = null;
|
534
|
+
cachedUint8Memory0 = null;
|
535
|
+
|
536
|
+
|
537
|
+
return wasm;
|
538
|
+
}
|
539
|
+
|
540
|
+
function initSync(module) {
|
541
|
+
if (wasm !== undefined) return wasm;
|
542
|
+
|
543
|
+
const imports = __wbg_get_imports();
|
544
|
+
|
545
|
+
if (!(module instanceof WebAssembly.Module)) {
|
546
|
+
module = new WebAssembly.Module(module);
|
547
|
+
}
|
548
|
+
|
549
|
+
const instance = new WebAssembly.Instance(module, imports);
|
550
|
+
|
551
|
+
return __wbg_finalize_init(instance, module);
|
552
|
+
}
|
553
|
+
|
554
|
+
async function __wbg_init(input) {
|
555
|
+
if (wasm !== undefined) return wasm;
|
556
|
+
|
557
|
+
if (typeof input === 'undefined') {
|
558
|
+
input = new URL('bls48581wasm_bg.wasm', import.meta.url);
|
559
|
+
}
|
560
|
+
const imports = __wbg_get_imports();
|
561
|
+
|
562
|
+
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
563
|
+
input = fetch(input);
|
564
|
+
}
|
565
|
+
|
566
|
+
const { instance, module } = await __wbg_load(await input, imports);
|
567
|
+
|
568
|
+
return __wbg_finalize_init(instance, module);
|
569
|
+
}
|
570
|
+
|
345
571
|
class BLS48581Error extends Error {
|
346
572
|
}
|
347
573
|
function BLS48581CommitRaw(data, poly_size) {
|
@@ -451,4 +677,4 @@ var bls48581 = /*#__PURE__*/Object.freeze({
|
|
451
677
|
|
452
678
|
window.Buffer = Buffer$1;
|
453
679
|
|
454
|
-
export { bls48581 };
|
680
|
+
export { bls48581, __wbg_init as init, initSync };
|
package/dist/index.js
CHANGED
@@ -2,13 +2,37 @@
|
|
2
2
|
|
3
3
|
var buffer = require('buffer');
|
4
4
|
|
5
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
5
6
|
let wasm;
|
6
7
|
|
7
8
|
const heap = new Array(128).fill(undefined);
|
8
9
|
|
9
10
|
heap.push(undefined, null, true, false);
|
10
11
|
|
11
|
-
heap
|
12
|
+
function getObject(idx) { return heap[idx]; }
|
13
|
+
|
14
|
+
let heap_next = heap.length;
|
15
|
+
|
16
|
+
function addHeapObject(obj) {
|
17
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
18
|
+
const idx = heap_next;
|
19
|
+
heap_next = heap[idx];
|
20
|
+
|
21
|
+
heap[idx] = obj;
|
22
|
+
return idx;
|
23
|
+
}
|
24
|
+
|
25
|
+
function dropObject(idx) {
|
26
|
+
if (idx < 132) return;
|
27
|
+
heap[idx] = heap_next;
|
28
|
+
heap_next = idx;
|
29
|
+
}
|
30
|
+
|
31
|
+
function takeObject(idx) {
|
32
|
+
const ret = getObject(idx);
|
33
|
+
dropObject(idx);
|
34
|
+
return ret;
|
35
|
+
}
|
12
36
|
|
13
37
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
14
38
|
|
@@ -344,6 +368,209 @@ function js_verify_multiple(commits, y_bytes, indices, poly_size, c_q_bytes, pro
|
|
344
368
|
}
|
345
369
|
}
|
346
370
|
|
371
|
+
function handleError(f, args) {
|
372
|
+
try {
|
373
|
+
return f.apply(this, args);
|
374
|
+
} catch (e) {
|
375
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
376
|
+
}
|
377
|
+
}
|
378
|
+
|
379
|
+
async function __wbg_load(module, imports) {
|
380
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
381
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
382
|
+
try {
|
383
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
384
|
+
|
385
|
+
} catch (e) {
|
386
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
387
|
+
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);
|
388
|
+
|
389
|
+
} else {
|
390
|
+
throw e;
|
391
|
+
}
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
395
|
+
const bytes = await module.arrayBuffer();
|
396
|
+
return await WebAssembly.instantiate(bytes, imports);
|
397
|
+
|
398
|
+
} else {
|
399
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
400
|
+
|
401
|
+
if (instance instanceof WebAssembly.Instance) {
|
402
|
+
return { instance, module };
|
403
|
+
|
404
|
+
} else {
|
405
|
+
return instance;
|
406
|
+
}
|
407
|
+
}
|
408
|
+
}
|
409
|
+
|
410
|
+
function __wbg_get_imports() {
|
411
|
+
const imports = {};
|
412
|
+
imports.wbg = {};
|
413
|
+
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
414
|
+
const ret = getObject(arg0);
|
415
|
+
return addHeapObject(ret);
|
416
|
+
};
|
417
|
+
imports.wbg.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
|
418
|
+
const ret = getObject(arg0).crypto;
|
419
|
+
return addHeapObject(ret);
|
420
|
+
};
|
421
|
+
imports.wbg.__wbindgen_is_object = function(arg0) {
|
422
|
+
const val = getObject(arg0);
|
423
|
+
const ret = typeof(val) === 'object' && val !== null;
|
424
|
+
return ret;
|
425
|
+
};
|
426
|
+
imports.wbg.__wbg_process_4a72847cc503995b = function(arg0) {
|
427
|
+
const ret = getObject(arg0).process;
|
428
|
+
return addHeapObject(ret);
|
429
|
+
};
|
430
|
+
imports.wbg.__wbg_versions_f686565e586dd935 = function(arg0) {
|
431
|
+
const ret = getObject(arg0).versions;
|
432
|
+
return addHeapObject(ret);
|
433
|
+
};
|
434
|
+
imports.wbg.__wbg_node_104a2ff8d6ea03a2 = function(arg0) {
|
435
|
+
const ret = getObject(arg0).node;
|
436
|
+
return addHeapObject(ret);
|
437
|
+
};
|
438
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
439
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
440
|
+
return ret;
|
441
|
+
};
|
442
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
443
|
+
takeObject(arg0);
|
444
|
+
};
|
445
|
+
imports.wbg.__wbg_require_cca90b1a94a0255b = function() { return handleError(function () {
|
446
|
+
const ret = module.require;
|
447
|
+
return addHeapObject(ret);
|
448
|
+
}, arguments) };
|
449
|
+
imports.wbg.__wbindgen_is_function = function(arg0) {
|
450
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
451
|
+
return ret;
|
452
|
+
};
|
453
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
454
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
455
|
+
return addHeapObject(ret);
|
456
|
+
};
|
457
|
+
imports.wbg.__wbg_call_b3ca7c6051f9bec1 = function() { return handleError(function (arg0, arg1, arg2) {
|
458
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
459
|
+
return addHeapObject(ret);
|
460
|
+
}, arguments) };
|
461
|
+
imports.wbg.__wbg_msCrypto_eb05e62b530a1508 = function(arg0) {
|
462
|
+
const ret = getObject(arg0).msCrypto;
|
463
|
+
return addHeapObject(ret);
|
464
|
+
};
|
465
|
+
imports.wbg.__wbg_newwithlength_e9b4878cebadb3d3 = function(arg0) {
|
466
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
467
|
+
return addHeapObject(ret);
|
468
|
+
};
|
469
|
+
imports.wbg.__wbg_self_ce0dbfc45cf2f5be = function() { return handleError(function () {
|
470
|
+
const ret = self.self;
|
471
|
+
return addHeapObject(ret);
|
472
|
+
}, arguments) };
|
473
|
+
imports.wbg.__wbg_window_c6fb939a7f436783 = function() { return handleError(function () {
|
474
|
+
const ret = window.window;
|
475
|
+
return addHeapObject(ret);
|
476
|
+
}, arguments) };
|
477
|
+
imports.wbg.__wbg_globalThis_d1e6af4856ba331b = function() { return handleError(function () {
|
478
|
+
const ret = globalThis.globalThis;
|
479
|
+
return addHeapObject(ret);
|
480
|
+
}, arguments) };
|
481
|
+
imports.wbg.__wbg_global_207b558942527489 = function() { return handleError(function () {
|
482
|
+
const ret = global.global;
|
483
|
+
return addHeapObject(ret);
|
484
|
+
}, arguments) };
|
485
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
486
|
+
const ret = getObject(arg0) === undefined;
|
487
|
+
return ret;
|
488
|
+
};
|
489
|
+
imports.wbg.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
|
490
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
491
|
+
return addHeapObject(ret);
|
492
|
+
};
|
493
|
+
imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
|
494
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
495
|
+
return addHeapObject(ret);
|
496
|
+
}, arguments) };
|
497
|
+
imports.wbg.__wbindgen_memory = function() {
|
498
|
+
const ret = wasm.memory;
|
499
|
+
return addHeapObject(ret);
|
500
|
+
};
|
501
|
+
imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
|
502
|
+
const ret = getObject(arg0).buffer;
|
503
|
+
return addHeapObject(ret);
|
504
|
+
};
|
505
|
+
imports.wbg.__wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb = function(arg0, arg1, arg2) {
|
506
|
+
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
507
|
+
return addHeapObject(ret);
|
508
|
+
};
|
509
|
+
imports.wbg.__wbg_randomFillSync_5c9c955aa56b6049 = function() { return handleError(function (arg0, arg1) {
|
510
|
+
getObject(arg0).randomFillSync(takeObject(arg1));
|
511
|
+
}, arguments) };
|
512
|
+
imports.wbg.__wbg_subarray_a1f73cd4b5b42fe1 = function(arg0, arg1, arg2) {
|
513
|
+
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
514
|
+
return addHeapObject(ret);
|
515
|
+
};
|
516
|
+
imports.wbg.__wbg_getRandomValues_3aa56aa6edec874c = function() { return handleError(function (arg0, arg1) {
|
517
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
518
|
+
}, arguments) };
|
519
|
+
imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
|
520
|
+
const ret = new Uint8Array(getObject(arg0));
|
521
|
+
return addHeapObject(ret);
|
522
|
+
};
|
523
|
+
imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
|
524
|
+
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
525
|
+
};
|
526
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
527
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
528
|
+
};
|
529
|
+
|
530
|
+
return imports;
|
531
|
+
}
|
532
|
+
|
533
|
+
function __wbg_finalize_init(instance, module) {
|
534
|
+
wasm = instance.exports;
|
535
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
536
|
+
cachedInt32Memory0 = null;
|
537
|
+
cachedUint8Memory0 = null;
|
538
|
+
|
539
|
+
|
540
|
+
return wasm;
|
541
|
+
}
|
542
|
+
|
543
|
+
function initSync(module) {
|
544
|
+
if (wasm !== undefined) return wasm;
|
545
|
+
|
546
|
+
const imports = __wbg_get_imports();
|
547
|
+
|
548
|
+
if (!(module instanceof WebAssembly.Module)) {
|
549
|
+
module = new WebAssembly.Module(module);
|
550
|
+
}
|
551
|
+
|
552
|
+
const instance = new WebAssembly.Instance(module, imports);
|
553
|
+
|
554
|
+
return __wbg_finalize_init(instance, module);
|
555
|
+
}
|
556
|
+
|
557
|
+
async function __wbg_init(input) {
|
558
|
+
if (wasm !== undefined) return wasm;
|
559
|
+
|
560
|
+
if (typeof input === 'undefined') {
|
561
|
+
input = new URL('bls48581wasm_bg.wasm', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
|
562
|
+
}
|
563
|
+
const imports = __wbg_get_imports();
|
564
|
+
|
565
|
+
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
566
|
+
input = fetch(input);
|
567
|
+
}
|
568
|
+
|
569
|
+
const { instance, module } = await __wbg_load(await input, imports);
|
570
|
+
|
571
|
+
return __wbg_finalize_init(instance, module);
|
572
|
+
}
|
573
|
+
|
347
574
|
class BLS48581Error extends Error {
|
348
575
|
}
|
349
576
|
function BLS48581CommitRaw(data, poly_size) {
|
@@ -454,3 +681,5 @@ var bls48581 = /*#__PURE__*/Object.freeze({
|
|
454
681
|
window.Buffer = buffer.Buffer;
|
455
682
|
|
456
683
|
exports.bls48581 = bls48581;
|
684
|
+
exports.init = __wbg_init;
|
685
|
+
exports.initSync = initSync;
|