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