@typeberry/native 0.0.4-e18a946 → 0.2.0-bd1a174

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.
@@ -0,0 +1,344 @@
1
+ //#region bandersnatch/wasm-binding/pkg/bandersnatch_wasm.js
2
+ /**
3
+ * @param {number} ring_size
4
+ * @param {Uint8Array} commitment
5
+ * @param {Uint8Array} tickets_data
6
+ * @param {number} vrf_input_data_len
7
+ * @returns {Uint8Array}
8
+ */
9
+ function batch_verify_tickets(ring_size, commitment, tickets_data, vrf_input_data_len) {
10
+ const ptr0 = passArray8ToWasm0(commitment, wasm.__wbindgen_malloc);
11
+ const len0 = WASM_VECTOR_LEN;
12
+ const ptr1 = passArray8ToWasm0(tickets_data, wasm.__wbindgen_malloc);
13
+ const len1 = WASM_VECTOR_LEN;
14
+ const ret = wasm.batch_verify_tickets(ring_size, ptr0, len0, ptr1, len1, vrf_input_data_len);
15
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
16
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
17
+ return v3;
18
+ }
19
+ /**
20
+ * @param {Uint8Array} seed
21
+ * @returns {Uint8Array}
22
+ */
23
+ function derive_public_key(seed) {
24
+ const ptr0 = passArray8ToWasm0(seed, wasm.__wbindgen_malloc);
25
+ const len0 = WASM_VECTOR_LEN;
26
+ const ret = wasm.derive_public_key(ptr0, len0);
27
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
28
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
29
+ return v2;
30
+ }
31
+ /**
32
+ * @param {Uint8Array} secret_seed
33
+ * @param {Uint8Array} input
34
+ * @param {Uint8Array} aux_data
35
+ * @returns {Uint8Array}
36
+ */
37
+ function generate_seal(secret_seed, input, aux_data) {
38
+ const ptr0 = passArray8ToWasm0(secret_seed, wasm.__wbindgen_malloc);
39
+ const len0 = WASM_VECTOR_LEN;
40
+ const ptr1 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
41
+ const len1 = WASM_VECTOR_LEN;
42
+ const ptr2 = passArray8ToWasm0(aux_data, wasm.__wbindgen_malloc);
43
+ const len2 = WASM_VECTOR_LEN;
44
+ const ret = wasm.generate_seal(ptr0, len0, ptr1, len1, ptr2, len2);
45
+ var v4 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
46
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
47
+ return v4;
48
+ }
49
+ /**
50
+ * @param {Uint8Array} keys
51
+ * @returns {Uint8Array}
52
+ */
53
+ function ring_commitment(keys) {
54
+ const ptr0 = passArray8ToWasm0(keys, wasm.__wbindgen_malloc);
55
+ const len0 = WASM_VECTOR_LEN;
56
+ const ret = wasm.ring_commitment(ptr0, len0);
57
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
58
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
59
+ return v2;
60
+ }
61
+ /**
62
+ * @param {Uint8Array} signer_key
63
+ * @param {Uint8Array} seal_data
64
+ * @param {Uint8Array} seal_payload
65
+ * @param {Uint8Array} unsealed_header
66
+ * @param {Uint8Array} entropy_data
67
+ * @param {Uint8Array} entropy_prefix
68
+ * @returns {Uint8Array}
69
+ */
70
+ function verify_header_seals(signer_key, seal_data, seal_payload, unsealed_header, entropy_data, entropy_prefix) {
71
+ const ptr0 = passArray8ToWasm0(signer_key, wasm.__wbindgen_malloc);
72
+ const len0 = WASM_VECTOR_LEN;
73
+ const ptr1 = passArray8ToWasm0(seal_data, wasm.__wbindgen_malloc);
74
+ const len1 = WASM_VECTOR_LEN;
75
+ const ptr2 = passArray8ToWasm0(seal_payload, wasm.__wbindgen_malloc);
76
+ const len2 = WASM_VECTOR_LEN;
77
+ const ptr3 = passArray8ToWasm0(unsealed_header, wasm.__wbindgen_malloc);
78
+ const len3 = WASM_VECTOR_LEN;
79
+ const ptr4 = passArray8ToWasm0(entropy_data, wasm.__wbindgen_malloc);
80
+ const len4 = WASM_VECTOR_LEN;
81
+ const ptr5 = passArray8ToWasm0(entropy_prefix, wasm.__wbindgen_malloc);
82
+ const len5 = WASM_VECTOR_LEN;
83
+ const ret = wasm.verify_header_seals(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
84
+ var v7 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
85
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
86
+ return v7;
87
+ }
88
+ /**
89
+ * @param {Uint8Array} signer_key
90
+ * @param {Uint8Array} seal_data
91
+ * @param {Uint8Array} payload
92
+ * @param {Uint8Array} aux_data
93
+ * @returns {Uint8Array}
94
+ */
95
+ function verify_seal(signer_key, seal_data, payload, aux_data) {
96
+ const ptr0 = passArray8ToWasm0(signer_key, wasm.__wbindgen_malloc);
97
+ const len0 = WASM_VECTOR_LEN;
98
+ const ptr1 = passArray8ToWasm0(seal_data, wasm.__wbindgen_malloc);
99
+ const len1 = WASM_VECTOR_LEN;
100
+ const ptr2 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
101
+ const len2 = WASM_VECTOR_LEN;
102
+ const ptr3 = passArray8ToWasm0(aux_data, wasm.__wbindgen_malloc);
103
+ const len3 = WASM_VECTOR_LEN;
104
+ const ret = wasm.verify_seal(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
105
+ var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
106
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
107
+ return v5;
108
+ }
109
+ /**
110
+ * @param {Uint8Array} secret_seed
111
+ * @param {Uint8Array} input
112
+ * @returns {Uint8Array}
113
+ */
114
+ function vrf_output_hash(secret_seed, input) {
115
+ const ptr0 = passArray8ToWasm0(secret_seed, wasm.__wbindgen_malloc);
116
+ const len0 = WASM_VECTOR_LEN;
117
+ const ptr1 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
118
+ const len1 = WASM_VECTOR_LEN;
119
+ const ret = wasm.vrf_output_hash(ptr0, len0, ptr1, len1);
120
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
121
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
122
+ return v3;
123
+ }
124
+ function __wbg_get_imports() {
125
+ const import0 = {
126
+ __proto__: null,
127
+ __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
128
+ return typeof arg0 === "function";
129
+ },
130
+ __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
131
+ const val = arg0;
132
+ return typeof val === "object" && val !== null;
133
+ },
134
+ __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
135
+ return typeof arg0 === "string";
136
+ },
137
+ __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
138
+ return arg0 === void 0;
139
+ },
140
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
141
+ throw new Error(getStringFromWasm0(arg0, arg1));
142
+ },
143
+ __wbg_call_389efe28435a9388: function() {
144
+ return handleError(function(arg0, arg1) {
145
+ return arg0.call(arg1);
146
+ }, arguments);
147
+ },
148
+ __wbg_call_4708e0c13bdc8e95: function() {
149
+ return handleError(function(arg0, arg1, arg2) {
150
+ return arg0.call(arg1, arg2);
151
+ }, arguments);
152
+ },
153
+ __wbg_crypto_86f2631e91b51511: function(arg0) {
154
+ return arg0.crypto;
155
+ },
156
+ __wbg_getRandomValues_b3f15fcbfabb0f8b: function() {
157
+ return handleError(function(arg0, arg1) {
158
+ arg0.getRandomValues(arg1);
159
+ }, arguments);
160
+ },
161
+ __wbg_length_32ed9a279acd054c: function(arg0) {
162
+ return arg0.length;
163
+ },
164
+ __wbg_msCrypto_d562bbe83e0d4b91: function(arg0) {
165
+ return arg0.msCrypto;
166
+ },
167
+ __wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
168
+ return new Function(getStringFromWasm0(arg0, arg1));
169
+ },
170
+ __wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
171
+ return new Uint8Array(arg0 >>> 0);
172
+ },
173
+ __wbg_node_e1f24f89a7336c2e: function(arg0) {
174
+ return arg0.node;
175
+ },
176
+ __wbg_process_3975fd6c72f520aa: function(arg0) {
177
+ return arg0.process;
178
+ },
179
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
180
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
181
+ },
182
+ __wbg_randomFillSync_f8c153b79f285817: function() {
183
+ return handleError(function(arg0, arg1) {
184
+ arg0.randomFillSync(arg1);
185
+ }, arguments);
186
+ },
187
+ __wbg_require_b74f47fc2d022fd6: function() {
188
+ return handleError(function() {
189
+ return module.require;
190
+ }, arguments);
191
+ },
192
+ __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
193
+ const ret = typeof global === "undefined" ? null : global;
194
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
195
+ },
196
+ __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
197
+ const ret = typeof globalThis === "undefined" ? null : globalThis;
198
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
199
+ },
200
+ __wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
201
+ const ret = typeof self === "undefined" ? null : self;
202
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
203
+ },
204
+ __wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
205
+ const ret = typeof window === "undefined" ? null : window;
206
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
207
+ },
208
+ __wbg_subarray_a96e1fef17ed23cb: function(arg0, arg1, arg2) {
209
+ return arg0.subarray(arg1 >>> 0, arg2 >>> 0);
210
+ },
211
+ __wbg_versions_4e31226f5e8dc909: function(arg0) {
212
+ return arg0.versions;
213
+ },
214
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
215
+ return getArrayU8FromWasm0(arg0, arg1);
216
+ },
217
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
218
+ return getStringFromWasm0(arg0, arg1);
219
+ },
220
+ __wbindgen_init_externref_table: function() {
221
+ const table = wasm.__wbindgen_externrefs;
222
+ const offset = table.grow(4);
223
+ table.set(0, void 0);
224
+ table.set(offset + 0, void 0);
225
+ table.set(offset + 1, null);
226
+ table.set(offset + 2, true);
227
+ table.set(offset + 3, false);
228
+ }
229
+ };
230
+ return {
231
+ __proto__: null,
232
+ "./bandersnatch_wasm_bg.js": import0
233
+ };
234
+ }
235
+ function addToExternrefTable0(obj) {
236
+ const idx = wasm.__externref_table_alloc();
237
+ wasm.__wbindgen_externrefs.set(idx, obj);
238
+ return idx;
239
+ }
240
+ function getArrayU8FromWasm0(ptr, len) {
241
+ ptr = ptr >>> 0;
242
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
243
+ }
244
+ function getStringFromWasm0(ptr, len) {
245
+ ptr = ptr >>> 0;
246
+ return decodeText(ptr, len);
247
+ }
248
+ let cachedUint8ArrayMemory0 = null;
249
+ function getUint8ArrayMemory0() {
250
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
251
+ return cachedUint8ArrayMemory0;
252
+ }
253
+ function handleError(f, args) {
254
+ try {
255
+ return f.apply(this, args);
256
+ } catch (e) {
257
+ const idx = addToExternrefTable0(e);
258
+ wasm.__wbindgen_exn_store(idx);
259
+ }
260
+ }
261
+ function isLikeNone(x) {
262
+ return x === void 0 || x === null;
263
+ }
264
+ function passArray8ToWasm0(arg, malloc) {
265
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
266
+ getUint8ArrayMemory0().set(arg, ptr / 1);
267
+ WASM_VECTOR_LEN = arg.length;
268
+ return ptr;
269
+ }
270
+ let cachedTextDecoder = new TextDecoder("utf-8", {
271
+ ignoreBOM: true,
272
+ fatal: true
273
+ });
274
+ cachedTextDecoder.decode();
275
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
276
+ let numBytesDecoded = 0;
277
+ function decodeText(ptr, len) {
278
+ numBytesDecoded += len;
279
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
280
+ cachedTextDecoder = new TextDecoder("utf-8", {
281
+ ignoreBOM: true,
282
+ fatal: true
283
+ });
284
+ cachedTextDecoder.decode();
285
+ numBytesDecoded = len;
286
+ }
287
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
288
+ }
289
+ let WASM_VECTOR_LEN = 0, wasm;
290
+ function __wbg_finalize_init(instance, module$1) {
291
+ wasm = instance.exports;
292
+ cachedUint8ArrayMemory0 = null;
293
+ wasm.__wbindgen_start();
294
+ return wasm;
295
+ }
296
+ async function __wbg_load(module$1, imports) {
297
+ if (typeof Response === "function" && module$1 instanceof Response) {
298
+ if (typeof WebAssembly.instantiateStreaming === "function") try {
299
+ return await WebAssembly.instantiateStreaming(module$1, imports);
300
+ } catch (e) {
301
+ if (module$1.ok && expectedResponseType(module$1.type) && module$1.headers.get("Content-Type") !== "application/wasm") 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);
302
+ else throw e;
303
+ }
304
+ const bytes = await module$1.arrayBuffer();
305
+ return await WebAssembly.instantiate(bytes, imports);
306
+ } else {
307
+ const instance = await WebAssembly.instantiate(module$1, imports);
308
+ if (instance instanceof WebAssembly.Instance) return {
309
+ instance,
310
+ module: module$1
311
+ };
312
+ else return instance;
313
+ }
314
+ function expectedResponseType(type) {
315
+ switch (type) {
316
+ case "basic":
317
+ case "cors":
318
+ case "default": return true;
319
+ }
320
+ return false;
321
+ }
322
+ }
323
+ function initSync(module$1) {
324
+ if (wasm !== void 0) return wasm;
325
+ if (module$1 !== void 0) if (Object.getPrototypeOf(module$1) === Object.prototype) ({module: module$1} = module$1);
326
+ else console.warn("using deprecated parameters for `initSync()`; pass a single object instead");
327
+ const imports = __wbg_get_imports();
328
+ if (!(module$1 instanceof WebAssembly.Module)) module$1 = new WebAssembly.Module(module$1);
329
+ const instance = new WebAssembly.Instance(module$1, imports);
330
+ return __wbg_finalize_init(instance, module$1);
331
+ }
332
+ async function __wbg_init(module_or_path) {
333
+ if (wasm !== void 0) return wasm;
334
+ if (module_or_path !== void 0) if (Object.getPrototypeOf(module_or_path) === Object.prototype) ({module_or_path} = module_or_path);
335
+ else console.warn("using deprecated parameters for the initialization function; pass a single object instead");
336
+ if (module_or_path === void 0) module_or_path = new URL("bandersnatch_wasm_bg.wasm", import.meta.url);
337
+ const imports = __wbg_get_imports();
338
+ if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) module_or_path = fetch(module_or_path);
339
+ const { instance, module: module$1 } = await __wbg_load(await module_or_path, imports);
340
+ return __wbg_finalize_init(instance, module$1);
341
+ }
342
+
343
+ //#endregion
344
+ export { batch_verify_tickets, __wbg_init as default, derive_public_key, generate_seal, initSync, ring_commitment, verify_header_seals, verify_seal, vrf_output_hash };
package/index.d.ts CHANGED
@@ -1,92 +1,5 @@
1
- declare namespace bandersnatch_d_exports {
2
- export { InitInput$2 as InitInput, InitOutput$2 as InitOutput, SyncInitInput$2 as SyncInitInput, batch_verify_tickets, __wbg_init$2 as default, derive_public_key, generate_seal, initSync$2 as initSync, ring_commitment, verify_seal };
3
- }
4
- /* tslint:disable */
5
- /* eslint-disable */
6
- /**
7
- * Seal verification as defined in:
8
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
9
- * or
10
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
11
- */
12
- declare function verify_seal(signer_key: Uint8Array, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
13
- /**
14
- * Generate seal that is verifiable using `verify_seal` function.
15
- *
16
- * # Arguments
17
- * * `secret_seed` - Seed used to derive the secret key
18
- * * `input` - VRF input data
19
- * * `aux_data` - Auxiliary data for the VRF proof
20
- *
21
- * # Returns
22
- * A byte vector with the following format:
23
- * - On success (97 bytes):
24
- * - Byte 0: Status code `0` (RESULT_OK)
25
- * - Bytes 1-32: Serialized VRF output (32 bytes, compressed)
26
- * - Bytes 33-96: Serialized IETF VRF proof (64 bytes, compressed)
27
- * - On error (1 byte):
28
- * - Byte 0: Status code `1` (RESULT_ERR)
29
- *
30
- * Returns an error if the input cannot be converted to a valid VRF input point
31
- * or if serialization of the output or proof fails.
32
- */
33
- declare function generate_seal(secret_seed: Uint8Array, input: Uint8Array, aux_data: Uint8Array): Uint8Array;
34
- /**
35
- * Derive Private and Public Key from Seed
36
- *
37
- * returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
38
- */
39
- declare function derive_public_key(seed: Uint8Array): Uint8Array;
40
- /**
41
- * Verify multiple tickets at once as defined in:
42
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
43
- *
44
- * NOTE: the aux_data of VRF function is empty!
45
- */
46
- declare function batch_verify_tickets(ring_size: number, commitment: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
47
- /**
48
- * Generate ring commitment given concatenation of ring keys.
49
- */
50
- declare function ring_commitment(keys: Uint8Array): Uint8Array;
51
- type InitInput$2 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
52
- interface InitOutput$2 {
53
- readonly memory: WebAssembly.Memory;
54
- readonly batch_verify_tickets: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
55
- readonly derive_public_key: (a: number, b: number) => [number, number];
56
- readonly generate_seal: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
57
- readonly ring_commitment: (a: number, b: number) => [number, number];
58
- readonly verify_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
59
- readonly __wbindgen_export_0: WebAssembly.Table;
60
- readonly __wbindgen_malloc: (a: number, b: number) => number;
61
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
62
- readonly __wbindgen_start: () => void;
63
- }
64
- type SyncInitInput$2 = BufferSource | WebAssembly.Module;
65
- /**
66
- * Instantiates the given `module`, which can either be bytes or
67
- * a precompiled `WebAssembly.Module`.
68
- *
69
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
70
- *
71
- * @returns {InitOutput}
72
- */
73
- declare function initSync$2(module: {
74
- module: SyncInitInput$2;
75
- } | SyncInitInput$2): InitOutput$2;
76
-
77
- /**
78
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
79
- * for everything else, calls `WebAssembly.instantiate` directly.
80
- *
81
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
82
- *
83
- * @returns {Promise<InitOutput>}
84
- */
85
- declare function __wbg_init$2(module_or_path?: {
86
- module_or_path: InitInput$2 | Promise<InitInput$2>;
87
- } | InitInput$2 | Promise<InitInput$2>): Promise<InitOutput$2>;
88
1
  declare namespace ed25519_wasm_d_exports {
89
- export { InitInput$1 as InitInput, InitOutput$1 as InitOutput, SyncInitInput$1 as SyncInitInput, __wbg_init$1 as default, initSync$1 as initSync, verify_ed25519, verify_ed25519_batch };
2
+ export { InitInput$2 as InitInput, InitOutput$1 as InitOutput, SyncInitInput$1 as SyncInitInput, __wbg_init$1 as default, initSync$1 as initSync, verify_ed25519, verify_ed25519_batch };
90
3
  }
91
4
  /* tslint:disable */
92
5
  /* eslint-disable */
@@ -103,7 +16,7 @@ declare function verify_ed25519(data: Uint8Array): Uint8Array;
103
16
  *
104
17
  */
105
18
  declare function verify_ed25519_batch(data: Uint8Array): boolean;
106
- type InitInput$1 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
19
+ type InitInput$2 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
107
20
  interface InitOutput$1 {
108
21
  readonly memory: WebAssembly.Memory;
109
22
  readonly verify_ed25519: (a: number, b: number) => [number, number];
@@ -135,15 +48,15 @@ declare function initSync$1(module: {
135
48
  * @returns {Promise<InitOutput>}
136
49
  */
137
50
  declare function __wbg_init$1(module_or_path?: {
138
- module_or_path: InitInput$1 | Promise<InitInput$1>;
139
- } | InitInput$1 | Promise<InitInput$1>): Promise<InitOutput$1>;
51
+ module_or_path: InitInput$2 | Promise<InitInput$2>;
52
+ } | InitInput$2 | Promise<InitInput$2>): Promise<InitOutput$1>;
140
53
  declare namespace reed_solomon_wasm_d_exports {
141
- export { InitInput, InitOutput, ShardsCollection, SyncInitInput, decode, __wbg_init as default, encode, initSync };
54
+ export { InitInput$1 as InitInput, InitOutput, ShardsCollection, SyncInitInput, decode, __wbg_init as default, encode, initSync };
142
55
  }
143
56
  /* tslint:disable */
144
57
  /* eslint-disable */
145
- declare function encode(recovery_count: number, shards: ShardsCollection): ShardsCollection;
146
58
  declare function decode(original_count: number, recovery_count: number, shards: ShardsCollection): ShardsCollection;
59
+ declare function encode(recovery_count: number, shards: ShardsCollection): ShardsCollection;
147
60
  /**
148
61
  * Collection of shards (either input or output).
149
62
  *
@@ -186,7 +99,7 @@ declare class ShardsCollection {
186
99
  */
187
100
  shard_len: number;
188
101
  }
189
- type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
102
+ type InitInput$1 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
190
103
  interface InitOutput {
191
104
  readonly memory: WebAssembly.Memory;
192
105
  readonly __wbg_get_shardscollection_length: (a: number) => number;
@@ -226,15 +139,54 @@ declare function initSync(module: {
226
139
  * @returns {Promise<InitOutput>}
227
140
  */
228
141
  declare function __wbg_init(module_or_path?: {
229
- module_or_path: InitInput | Promise<InitInput>;
230
- } | InitInput | Promise<InitInput>): Promise<InitOutput>;
142
+ module_or_path: InitInput$1 | Promise<InitInput$1>;
143
+ } | InitInput$1 | Promise<InitInput$1>): Promise<InitOutput>;
144
+ //#endregion
145
+ //#region bandersnatch/wasm-binding/pkg/bandersnatch_wasm.d.ts
146
+ type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
147
+ declare namespace index_d_exports {
148
+ export { BandersnatchApi, InitOptions, batchVerifyTickets, init$1 as default, derivePublicKey, generateSeal, getNativeBindingError, isInitialized, isNativeBinding, ringCommitment, verifyHeaderSeals, verifySeal, vrfOutputHash };
149
+ }
150
+ type BandersnatchApi = {
151
+ isNativeBinding: () => boolean;
152
+ ringCommitment: (keys: Uint8Array) => Uint8Array;
153
+ derivePublicKey: (seed: Uint8Array) => Uint8Array;
154
+ verifyHeaderSeals: (signerKey: Uint8Array, sealData: Uint8Array, sealPayload: Uint8Array, unsealedHeader: Uint8Array, entropyData: Uint8Array, entropyPrefix: Uint8Array) => Uint8Array;
155
+ verifySeal: (signerKey: Uint8Array, sealData: Uint8Array, payload: Uint8Array, auxData: Uint8Array) => Uint8Array;
156
+ generateSeal: (secretSeed: Uint8Array, input: Uint8Array, auxData: Uint8Array) => Uint8Array;
157
+ vrfOutputHash: (secretSeed: Uint8Array, input: Uint8Array) => Uint8Array;
158
+ batchVerifyTickets: (ringSize: number, commitment: Uint8Array, ticketsData: Uint8Array, vrfInputDataLen: number) => Uint8Array;
159
+ };
160
+ type InitOptions = {
161
+ module_or_path?: InitInput | Promise<InitInput>;
162
+ };
163
+ declare function init$1(options?: InitOptions): Promise<BandersnatchApi>;
164
+ /**
165
+ * Check if the binding is initialized already.
166
+ */
167
+ declare function isInitialized(): boolean;
168
+ /**
169
+ * Returns true if native binding is used.
170
+ */
171
+ declare function isNativeBinding(): boolean;
172
+ /**
173
+ * Returns native binding initialisation error (if any).
174
+ */
175
+ declare function getNativeBindingError(): string | null;
176
+ declare function ringCommitment(keys: Uint8Array): Uint8Array;
177
+ declare function derivePublicKey(seed: Uint8Array): Uint8Array;
178
+ declare function verifyHeaderSeals(signerKey: Uint8Array, sealData: Uint8Array, sealPayload: Uint8Array, unsealedHeader: Uint8Array, entropyData: Uint8Array, entropyPrefix: Uint8Array): Uint8Array;
179
+ declare function verifySeal(signerKey: Uint8Array, sealData: Uint8Array, payload: Uint8Array, auxData: Uint8Array): Uint8Array;
180
+ declare function generateSeal(secretSeed: Uint8Array, input: Uint8Array, auxData: Uint8Array): Uint8Array;
181
+ declare function vrfOutputHash(secretSeed: Uint8Array, input: Uint8Array): Uint8Array;
182
+ declare function batchVerifyTickets(ringSize: number, commitment: Uint8Array, ticketsData: Uint8Array, vrfInputDataLen: number): Uint8Array;
231
183
  //#endregion
232
184
  //#region native/index.d.ts
233
185
  declare function initAll(): Promise<void>;
234
186
  declare const init: {
235
- bandersnatch: any;
236
- ed25519: any;
237
- reedSolomon: any;
187
+ bandersnatch: () => Promise<any>;
188
+ ed25519: () => Promise<InitOutput$1>;
189
+ reedSolomon: () => Promise<InitOutput>;
238
190
  };
239
191
  //#endregion
240
- export { bandersnatch_d_exports as bandersnatch, ed25519_wasm_d_exports as ed25519, init, initAll, reed_solomon_wasm_d_exports as reedSolomon };
192
+ export { index_d_exports as bandersnatch, ed25519_wasm_d_exports as ed25519, init, initAll, reed_solomon_wasm_d_exports as reedSolomon };