@aztec/noir-acvm_js 0.0.0-test.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/nodejs/acvm_js.d.ts +183 -0
- package/nodejs/acvm_js.js +900 -0
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +33 -0
- package/package.json +52 -0
- package/web/acvm_js.d.ts +240 -0
- package/web/acvm_js.js +937 -0
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +33 -0
package/web/acvm_js.js
ADDED
|
@@ -0,0 +1,937 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
|
|
3
|
+
function addToExternrefTable0(obj) {
|
|
4
|
+
const idx = wasm.__externref_table_alloc();
|
|
5
|
+
wasm.__wbindgen_export_2.set(idx, obj);
|
|
6
|
+
return idx;
|
|
7
|
+
}
|
|
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);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
19
|
+
|
|
20
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
21
|
+
|
|
22
|
+
let cachedUint8ArrayMemory0 = null;
|
|
23
|
+
|
|
24
|
+
function getUint8ArrayMemory0() {
|
|
25
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
26
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
27
|
+
}
|
|
28
|
+
return cachedUint8ArrayMemory0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getStringFromWasm0(ptr, len) {
|
|
32
|
+
ptr = ptr >>> 0;
|
|
33
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let WASM_VECTOR_LEN = 0;
|
|
37
|
+
|
|
38
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
39
|
+
|
|
40
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
41
|
+
? function (arg, view) {
|
|
42
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
43
|
+
}
|
|
44
|
+
: function (arg, view) {
|
|
45
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
46
|
+
view.set(buf);
|
|
47
|
+
return {
|
|
48
|
+
read: arg.length,
|
|
49
|
+
written: buf.length
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
54
|
+
|
|
55
|
+
if (realloc === undefined) {
|
|
56
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
57
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
58
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
59
|
+
WASM_VECTOR_LEN = buf.length;
|
|
60
|
+
return ptr;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let len = arg.length;
|
|
64
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
65
|
+
|
|
66
|
+
const mem = getUint8ArrayMemory0();
|
|
67
|
+
|
|
68
|
+
let offset = 0;
|
|
69
|
+
|
|
70
|
+
for (; offset < len; offset++) {
|
|
71
|
+
const code = arg.charCodeAt(offset);
|
|
72
|
+
if (code > 0x7F) break;
|
|
73
|
+
mem[ptr + offset] = code;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (offset !== len) {
|
|
77
|
+
if (offset !== 0) {
|
|
78
|
+
arg = arg.slice(offset);
|
|
79
|
+
}
|
|
80
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
81
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
82
|
+
const ret = encodeString(arg, view);
|
|
83
|
+
|
|
84
|
+
offset += ret.written;
|
|
85
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
WASM_VECTOR_LEN = offset;
|
|
89
|
+
return ptr;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
let cachedDataViewMemory0 = null;
|
|
93
|
+
|
|
94
|
+
function getDataViewMemory0() {
|
|
95
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
96
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
97
|
+
}
|
|
98
|
+
return cachedDataViewMemory0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function isLikeNone(x) {
|
|
102
|
+
return x === undefined || x === null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
106
|
+
? { register: () => {}, unregister: () => {} }
|
|
107
|
+
: new FinalizationRegistry(state => {
|
|
108
|
+
wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b)
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
112
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
113
|
+
const real = (...args) => {
|
|
114
|
+
// First up with a closure we increment the internal reference
|
|
115
|
+
// count. This ensures that the Rust closure environment won't
|
|
116
|
+
// be deallocated while we're invoking it.
|
|
117
|
+
state.cnt++;
|
|
118
|
+
const a = state.a;
|
|
119
|
+
state.a = 0;
|
|
120
|
+
try {
|
|
121
|
+
return f(a, state.b, ...args);
|
|
122
|
+
} finally {
|
|
123
|
+
if (--state.cnt === 0) {
|
|
124
|
+
wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
|
|
125
|
+
CLOSURE_DTORS.unregister(state);
|
|
126
|
+
} else {
|
|
127
|
+
state.a = a;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
real.original = state;
|
|
132
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
133
|
+
return real;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function debugString(val) {
|
|
137
|
+
// primitive types
|
|
138
|
+
const type = typeof val;
|
|
139
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
140
|
+
return `${val}`;
|
|
141
|
+
}
|
|
142
|
+
if (type == 'string') {
|
|
143
|
+
return `"${val}"`;
|
|
144
|
+
}
|
|
145
|
+
if (type == 'symbol') {
|
|
146
|
+
const description = val.description;
|
|
147
|
+
if (description == null) {
|
|
148
|
+
return 'Symbol';
|
|
149
|
+
} else {
|
|
150
|
+
return `Symbol(${description})`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (type == 'function') {
|
|
154
|
+
const name = val.name;
|
|
155
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
156
|
+
return `Function(${name})`;
|
|
157
|
+
} else {
|
|
158
|
+
return 'Function';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// objects
|
|
162
|
+
if (Array.isArray(val)) {
|
|
163
|
+
const length = val.length;
|
|
164
|
+
let debug = '[';
|
|
165
|
+
if (length > 0) {
|
|
166
|
+
debug += debugString(val[0]);
|
|
167
|
+
}
|
|
168
|
+
for(let i = 1; i < length; i++) {
|
|
169
|
+
debug += ', ' + debugString(val[i]);
|
|
170
|
+
}
|
|
171
|
+
debug += ']';
|
|
172
|
+
return debug;
|
|
173
|
+
}
|
|
174
|
+
// Test for built-in
|
|
175
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
176
|
+
let className;
|
|
177
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
178
|
+
className = builtInMatches[1];
|
|
179
|
+
} else {
|
|
180
|
+
// Failed to match the standard '[object ClassName]'
|
|
181
|
+
return toString.call(val);
|
|
182
|
+
}
|
|
183
|
+
if (className == 'Object') {
|
|
184
|
+
// we're a user defined class or Object
|
|
185
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
186
|
+
// easier than looping through ownProperties of `val`.
|
|
187
|
+
try {
|
|
188
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
189
|
+
} catch (_) {
|
|
190
|
+
return 'Object';
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// errors
|
|
194
|
+
if (val instanceof Error) {
|
|
195
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
196
|
+
}
|
|
197
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
198
|
+
return className;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
202
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
203
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
204
|
+
WASM_VECTOR_LEN = arg.length;
|
|
205
|
+
return ptr;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
209
|
+
*
|
|
210
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
211
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
212
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
213
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
214
|
+
*/
|
|
215
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
216
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
217
|
+
const len0 = WASM_VECTOR_LEN;
|
|
218
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
219
|
+
return ret;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
224
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
225
|
+
*
|
|
226
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
227
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
228
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
229
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
230
|
+
*/
|
|
231
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
232
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
233
|
+
const len0 = WASM_VECTOR_LEN;
|
|
234
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
235
|
+
return ret;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
240
|
+
*
|
|
241
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
242
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
243
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
244
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
245
|
+
*/
|
|
246
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
247
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
248
|
+
const len0 = WASM_VECTOR_LEN;
|
|
249
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
250
|
+
return ret;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function takeFromExternrefTable0(idx) {
|
|
254
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
255
|
+
wasm.__externref_table_dealloc(idx);
|
|
256
|
+
return value;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
260
|
+
ptr = ptr >>> 0;
|
|
261
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
265
|
+
*
|
|
266
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
267
|
+
* @returns {Uint8Array} A compressed witness map
|
|
268
|
+
*/
|
|
269
|
+
export function compressWitness(witness_map) {
|
|
270
|
+
const ret = wasm.compressWitness(witness_map);
|
|
271
|
+
if (ret[3]) {
|
|
272
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
273
|
+
}
|
|
274
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
275
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
276
|
+
return v1;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
281
|
+
* This should be used to only fetch the witness map for the main function.
|
|
282
|
+
*
|
|
283
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
284
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
285
|
+
*/
|
|
286
|
+
export function decompressWitness(compressed_witness) {
|
|
287
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
288
|
+
const len0 = WASM_VECTOR_LEN;
|
|
289
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
290
|
+
if (ret[2]) {
|
|
291
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
292
|
+
}
|
|
293
|
+
return takeFromExternrefTable0(ret[0]);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
298
|
+
*
|
|
299
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
300
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
301
|
+
*/
|
|
302
|
+
export function compressWitnessStack(witness_stack) {
|
|
303
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
304
|
+
if (ret[3]) {
|
|
305
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
306
|
+
}
|
|
307
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
308
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
309
|
+
return v1;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
314
|
+
*
|
|
315
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
316
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
317
|
+
*/
|
|
318
|
+
export function decompressWitnessStack(compressed_witness) {
|
|
319
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
320
|
+
const len0 = WASM_VECTOR_LEN;
|
|
321
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
322
|
+
if (ret[2]) {
|
|
323
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
324
|
+
}
|
|
325
|
+
return takeFromExternrefTable0(ret[0]);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Sets the package's logging level.
|
|
330
|
+
*
|
|
331
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
332
|
+
*/
|
|
333
|
+
export function initLogLevel(filter) {
|
|
334
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
335
|
+
const len0 = WASM_VECTOR_LEN;
|
|
336
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
337
|
+
if (ret[1]) {
|
|
338
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
344
|
+
* @param {string} lhs
|
|
345
|
+
* @param {string} rhs
|
|
346
|
+
* @returns {string}
|
|
347
|
+
*/
|
|
348
|
+
export function and(lhs, rhs) {
|
|
349
|
+
const ret = wasm.and(lhs, rhs);
|
|
350
|
+
return ret;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
355
|
+
* @param {string} lhs
|
|
356
|
+
* @param {string} rhs
|
|
357
|
+
* @returns {string}
|
|
358
|
+
*/
|
|
359
|
+
export function xor(lhs, rhs) {
|
|
360
|
+
const ret = wasm.xor(lhs, rhs);
|
|
361
|
+
return ret;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
let cachedUint32ArrayMemory0 = null;
|
|
365
|
+
|
|
366
|
+
function getUint32ArrayMemory0() {
|
|
367
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
368
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
369
|
+
}
|
|
370
|
+
return cachedUint32ArrayMemory0;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
374
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
375
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
376
|
+
WASM_VECTOR_LEN = arg.length;
|
|
377
|
+
return ptr;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
381
|
+
ptr = ptr >>> 0;
|
|
382
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Sha256 compression function
|
|
386
|
+
* @param {Uint32Array} inputs
|
|
387
|
+
* @param {Uint32Array} state
|
|
388
|
+
* @returns {Uint32Array}
|
|
389
|
+
*/
|
|
390
|
+
export function sha256_compression(inputs, state) {
|
|
391
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
392
|
+
const len0 = WASM_VECTOR_LEN;
|
|
393
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
394
|
+
const len1 = WASM_VECTOR_LEN;
|
|
395
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
396
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
397
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
398
|
+
return v3;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
403
|
+
* @param {Uint8Array} inputs
|
|
404
|
+
* @returns {Uint8Array}
|
|
405
|
+
*/
|
|
406
|
+
export function blake2s256(inputs) {
|
|
407
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
408
|
+
const len0 = WASM_VECTOR_LEN;
|
|
409
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
410
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
411
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
412
|
+
return v2;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
417
|
+
* @param {Uint8Array} hashed_msg
|
|
418
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
419
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
420
|
+
* @param {Uint8Array} signature
|
|
421
|
+
* @returns {boolean}
|
|
422
|
+
*/
|
|
423
|
+
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
424
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
425
|
+
const len0 = WASM_VECTOR_LEN;
|
|
426
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
427
|
+
const len1 = WASM_VECTOR_LEN;
|
|
428
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
429
|
+
const len2 = WASM_VECTOR_LEN;
|
|
430
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
431
|
+
const len3 = WASM_VECTOR_LEN;
|
|
432
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
433
|
+
return ret !== 0;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
438
|
+
* @param {Uint8Array} hashed_msg
|
|
439
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
440
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
441
|
+
* @param {Uint8Array} signature
|
|
442
|
+
* @returns {boolean}
|
|
443
|
+
*/
|
|
444
|
+
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
445
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
446
|
+
const len0 = WASM_VECTOR_LEN;
|
|
447
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
448
|
+
const len1 = WASM_VECTOR_LEN;
|
|
449
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
450
|
+
const len2 = WASM_VECTOR_LEN;
|
|
451
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
452
|
+
const len3 = WASM_VECTOR_LEN;
|
|
453
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
454
|
+
return ret !== 0;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
459
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
460
|
+
*/
|
|
461
|
+
export function buildInfo() {
|
|
462
|
+
const ret = wasm.buildInfo();
|
|
463
|
+
return ret;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
468
|
+
*
|
|
469
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
470
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
471
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
472
|
+
* @param {Uint8Array} program
|
|
473
|
+
* @param {WitnessMap} witness_map
|
|
474
|
+
* @returns {WitnessMap}
|
|
475
|
+
*/
|
|
476
|
+
export function getReturnWitness(program, witness_map) {
|
|
477
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
478
|
+
const len0 = WASM_VECTOR_LEN;
|
|
479
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
480
|
+
if (ret[2]) {
|
|
481
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
482
|
+
}
|
|
483
|
+
return takeFromExternrefTable0(ret[0]);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
488
|
+
*
|
|
489
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
490
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
491
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
492
|
+
* @param {Uint8Array} program
|
|
493
|
+
* @param {WitnessMap} solved_witness
|
|
494
|
+
* @returns {WitnessMap}
|
|
495
|
+
*/
|
|
496
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
497
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
498
|
+
const len0 = WASM_VECTOR_LEN;
|
|
499
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
500
|
+
if (ret[2]) {
|
|
501
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
502
|
+
}
|
|
503
|
+
return takeFromExternrefTable0(ret[0]);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
508
|
+
*
|
|
509
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
510
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
511
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
512
|
+
* @param {Uint8Array} program
|
|
513
|
+
* @param {WitnessMap} solved_witness
|
|
514
|
+
* @returns {WitnessMap}
|
|
515
|
+
*/
|
|
516
|
+
export function getPublicWitness(program, solved_witness) {
|
|
517
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
518
|
+
const len0 = WASM_VECTOR_LEN;
|
|
519
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
520
|
+
if (ret[2]) {
|
|
521
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
522
|
+
}
|
|
523
|
+
return takeFromExternrefTable0(ret[0]);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
527
|
+
wasm.closure265_externref_shim(arg0, arg1, arg2);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
531
|
+
wasm.closure826_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
535
|
+
wasm.closure830_externref_shim(arg0, arg1, arg2, arg3);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
async function __wbg_load(module, imports) {
|
|
539
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
540
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
541
|
+
try {
|
|
542
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
543
|
+
|
|
544
|
+
} catch (e) {
|
|
545
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
546
|
+
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);
|
|
547
|
+
|
|
548
|
+
} else {
|
|
549
|
+
throw e;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
const bytes = await module.arrayBuffer();
|
|
555
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
556
|
+
|
|
557
|
+
} else {
|
|
558
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
559
|
+
|
|
560
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
561
|
+
return { instance, module };
|
|
562
|
+
|
|
563
|
+
} else {
|
|
564
|
+
return instance;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
function __wbg_get_imports() {
|
|
570
|
+
const imports = {};
|
|
571
|
+
imports.wbg = {};
|
|
572
|
+
imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
573
|
+
const ret = arg0.call(arg1);
|
|
574
|
+
return ret;
|
|
575
|
+
}, arguments) };
|
|
576
|
+
imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
577
|
+
const ret = arg0.call(arg1, arg2);
|
|
578
|
+
return ret;
|
|
579
|
+
}, arguments) };
|
|
580
|
+
imports.wbg.__wbg_call_833bed5770ea2041 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
581
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
582
|
+
return ret;
|
|
583
|
+
}, arguments) };
|
|
584
|
+
imports.wbg.__wbg_constructor_003f4a4118e07291 = function(arg0) {
|
|
585
|
+
const ret = new Error(arg0);
|
|
586
|
+
return ret;
|
|
587
|
+
};
|
|
588
|
+
imports.wbg.__wbg_constructor_c456dcccc52847dd = function(arg0) {
|
|
589
|
+
const ret = new Error(arg0);
|
|
590
|
+
return ret;
|
|
591
|
+
};
|
|
592
|
+
imports.wbg.__wbg_debug_3cb59063b29f58c1 = function(arg0) {
|
|
593
|
+
console.debug(arg0);
|
|
594
|
+
};
|
|
595
|
+
imports.wbg.__wbg_debug_e17b51583ca6a632 = function(arg0, arg1, arg2, arg3) {
|
|
596
|
+
console.debug(arg0, arg1, arg2, arg3);
|
|
597
|
+
};
|
|
598
|
+
imports.wbg.__wbg_error_524f506f44df1645 = function(arg0) {
|
|
599
|
+
console.error(arg0);
|
|
600
|
+
};
|
|
601
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
602
|
+
let deferred0_0;
|
|
603
|
+
let deferred0_1;
|
|
604
|
+
try {
|
|
605
|
+
deferred0_0 = arg0;
|
|
606
|
+
deferred0_1 = arg1;
|
|
607
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
608
|
+
} finally {
|
|
609
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
imports.wbg.__wbg_error_80de38b3f7cc3c3c = function(arg0, arg1, arg2, arg3) {
|
|
613
|
+
console.error(arg0, arg1, arg2, arg3);
|
|
614
|
+
};
|
|
615
|
+
imports.wbg.__wbg_forEach_d6a05ca96422eff9 = function(arg0, arg1, arg2) {
|
|
616
|
+
try {
|
|
617
|
+
var state0 = {a: arg1, b: arg2};
|
|
618
|
+
var cb0 = (arg0, arg1, arg2) => {
|
|
619
|
+
const a = state0.a;
|
|
620
|
+
state0.a = 0;
|
|
621
|
+
try {
|
|
622
|
+
return __wbg_adapter_89(a, state0.b, arg0, arg1, arg2);
|
|
623
|
+
} finally {
|
|
624
|
+
state0.a = a;
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
arg0.forEach(cb0);
|
|
628
|
+
} finally {
|
|
629
|
+
state0.a = state0.b = 0;
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
imports.wbg.__wbg_forEach_e1cf6f7c8ecb7dae = function(arg0, arg1, arg2) {
|
|
633
|
+
try {
|
|
634
|
+
var state0 = {a: arg1, b: arg2};
|
|
635
|
+
var cb0 = (arg0, arg1) => {
|
|
636
|
+
const a = state0.a;
|
|
637
|
+
state0.a = 0;
|
|
638
|
+
try {
|
|
639
|
+
return __wbg_adapter_110(a, state0.b, arg0, arg1);
|
|
640
|
+
} finally {
|
|
641
|
+
state0.a = a;
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
arg0.forEach(cb0);
|
|
645
|
+
} finally {
|
|
646
|
+
state0.a = state0.b = 0;
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
imports.wbg.__wbg_fromEntries_524679eecb0bdc2e = function() { return handleError(function (arg0) {
|
|
650
|
+
const ret = Object.fromEntries(arg0);
|
|
651
|
+
return ret;
|
|
652
|
+
}, arguments) };
|
|
653
|
+
imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
|
|
654
|
+
const ret = Array.from(arg0);
|
|
655
|
+
return ret;
|
|
656
|
+
};
|
|
657
|
+
imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
|
|
658
|
+
const ret = arg0[arg1 >>> 0];
|
|
659
|
+
return ret;
|
|
660
|
+
};
|
|
661
|
+
imports.wbg.__wbg_info_033d8b8a0838f1d3 = function(arg0, arg1, arg2, arg3) {
|
|
662
|
+
console.info(arg0, arg1, arg2, arg3);
|
|
663
|
+
};
|
|
664
|
+
imports.wbg.__wbg_info_3daf2e093e091b66 = function(arg0) {
|
|
665
|
+
console.info(arg0);
|
|
666
|
+
};
|
|
667
|
+
imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
|
|
668
|
+
const ret = arg0.length;
|
|
669
|
+
return ret;
|
|
670
|
+
};
|
|
671
|
+
imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
672
|
+
try {
|
|
673
|
+
var state0 = {a: arg0, b: arg1};
|
|
674
|
+
var cb0 = (arg0, arg1) => {
|
|
675
|
+
const a = state0.a;
|
|
676
|
+
state0.a = 0;
|
|
677
|
+
try {
|
|
678
|
+
return __wbg_adapter_110(a, state0.b, arg0, arg1);
|
|
679
|
+
} finally {
|
|
680
|
+
state0.a = a;
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
const ret = new Promise(cb0);
|
|
684
|
+
return ret;
|
|
685
|
+
} finally {
|
|
686
|
+
state0.a = state0.b = 0;
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
imports.wbg.__wbg_new_3f4c5c451d69e970 = function() {
|
|
690
|
+
const ret = new Map();
|
|
691
|
+
return ret;
|
|
692
|
+
};
|
|
693
|
+
imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
|
|
694
|
+
const ret = new Map();
|
|
695
|
+
return ret;
|
|
696
|
+
};
|
|
697
|
+
imports.wbg.__wbg_new_78feb108b6472713 = function() {
|
|
698
|
+
const ret = new Array();
|
|
699
|
+
return ret;
|
|
700
|
+
};
|
|
701
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
702
|
+
const ret = new Error();
|
|
703
|
+
return ret;
|
|
704
|
+
};
|
|
705
|
+
imports.wbg.__wbg_new_a324c5957dd8b845 = function() {
|
|
706
|
+
const ret = new Array();
|
|
707
|
+
return ret;
|
|
708
|
+
};
|
|
709
|
+
imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
710
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
711
|
+
return ret;
|
|
712
|
+
};
|
|
713
|
+
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
714
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
715
|
+
return ret;
|
|
716
|
+
};
|
|
717
|
+
imports.wbg.__wbg_parse_def2e24ef1252aff = function() { return handleError(function (arg0, arg1) {
|
|
718
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
719
|
+
return ret;
|
|
720
|
+
}, arguments) };
|
|
721
|
+
imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
|
|
722
|
+
const ret = arg0.push(arg1);
|
|
723
|
+
return ret;
|
|
724
|
+
};
|
|
725
|
+
imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
|
|
726
|
+
queueMicrotask(arg0);
|
|
727
|
+
};
|
|
728
|
+
imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
|
|
729
|
+
const ret = arg0.queueMicrotask;
|
|
730
|
+
return ret;
|
|
731
|
+
};
|
|
732
|
+
imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) {
|
|
733
|
+
const ret = Promise.resolve(arg0);
|
|
734
|
+
return ret;
|
|
735
|
+
};
|
|
736
|
+
imports.wbg.__wbg_reverse_71c11f9686a5c11b = function(arg0) {
|
|
737
|
+
const ret = arg0.reverse();
|
|
738
|
+
return ret;
|
|
739
|
+
};
|
|
740
|
+
imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
|
|
741
|
+
const ret = arg0.set(arg1, arg2);
|
|
742
|
+
return ret;
|
|
743
|
+
};
|
|
744
|
+
imports.wbg.__wbg_set_bb8cecf6a62b9f46 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
745
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
746
|
+
return ret;
|
|
747
|
+
}, arguments) };
|
|
748
|
+
imports.wbg.__wbg_setcause_180f5110152d3ce3 = function(arg0, arg1) {
|
|
749
|
+
arg0.cause = arg1;
|
|
750
|
+
};
|
|
751
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
752
|
+
const ret = arg1.stack;
|
|
753
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
754
|
+
const len1 = WASM_VECTOR_LEN;
|
|
755
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
756
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
757
|
+
};
|
|
758
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
|
|
759
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
760
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
761
|
+
};
|
|
762
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
|
|
763
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
764
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
765
|
+
};
|
|
766
|
+
imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
|
|
767
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
768
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
769
|
+
};
|
|
770
|
+
imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
|
|
771
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
772
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
773
|
+
};
|
|
774
|
+
imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
|
|
775
|
+
const ret = arg0.then(arg1);
|
|
776
|
+
return ret;
|
|
777
|
+
};
|
|
778
|
+
imports.wbg.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) {
|
|
779
|
+
const ret = arg0.then(arg1, arg2);
|
|
780
|
+
return ret;
|
|
781
|
+
};
|
|
782
|
+
imports.wbg.__wbg_values_fcb8ba8c0aad8b58 = function(arg0) {
|
|
783
|
+
const ret = Object.values(arg0);
|
|
784
|
+
return ret;
|
|
785
|
+
};
|
|
786
|
+
imports.wbg.__wbg_warn_4ca3906c248c47c4 = function(arg0) {
|
|
787
|
+
console.warn(arg0);
|
|
788
|
+
};
|
|
789
|
+
imports.wbg.__wbg_warn_aaf1f4664a035bd6 = function(arg0, arg1, arg2, arg3) {
|
|
790
|
+
console.warn(arg0, arg1, arg2, arg3);
|
|
791
|
+
};
|
|
792
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
793
|
+
const obj = arg0.original;
|
|
794
|
+
if (obj.cnt-- == 1) {
|
|
795
|
+
obj.a = 0;
|
|
796
|
+
return true;
|
|
797
|
+
}
|
|
798
|
+
const ret = false;
|
|
799
|
+
return ret;
|
|
800
|
+
};
|
|
801
|
+
imports.wbg.__wbindgen_closure_wrapper740 = function(arg0, arg1, arg2) {
|
|
802
|
+
const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_30);
|
|
803
|
+
return ret;
|
|
804
|
+
};
|
|
805
|
+
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
806
|
+
const ret = debugString(arg1);
|
|
807
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
808
|
+
const len1 = WASM_VECTOR_LEN;
|
|
809
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
810
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
811
|
+
};
|
|
812
|
+
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
813
|
+
const table = wasm.__wbindgen_export_2;
|
|
814
|
+
const offset = table.grow(4);
|
|
815
|
+
table.set(0, undefined);
|
|
816
|
+
table.set(offset + 0, undefined);
|
|
817
|
+
table.set(offset + 1, null);
|
|
818
|
+
table.set(offset + 2, true);
|
|
819
|
+
table.set(offset + 3, false);
|
|
820
|
+
;
|
|
821
|
+
};
|
|
822
|
+
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
823
|
+
const ret = Array.isArray(arg0);
|
|
824
|
+
return ret;
|
|
825
|
+
};
|
|
826
|
+
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
827
|
+
const ret = typeof(arg0) === 'function';
|
|
828
|
+
return ret;
|
|
829
|
+
};
|
|
830
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
831
|
+
const ret = typeof(arg0) === 'string';
|
|
832
|
+
return ret;
|
|
833
|
+
};
|
|
834
|
+
imports.wbg.__wbindgen_is_undefined = function(arg0) {
|
|
835
|
+
const ret = arg0 === undefined;
|
|
836
|
+
return ret;
|
|
837
|
+
};
|
|
838
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
839
|
+
const obj = arg1;
|
|
840
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
841
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
842
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
843
|
+
};
|
|
844
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
845
|
+
const ret = arg0;
|
|
846
|
+
return ret;
|
|
847
|
+
};
|
|
848
|
+
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
849
|
+
const obj = arg1;
|
|
850
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
851
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
852
|
+
var len1 = WASM_VECTOR_LEN;
|
|
853
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
854
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
855
|
+
};
|
|
856
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
857
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
858
|
+
return ret;
|
|
859
|
+
};
|
|
860
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
861
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
return imports;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
function __wbg_init_memory(imports, memory) {
|
|
868
|
+
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
function __wbg_finalize_init(instance, module) {
|
|
872
|
+
wasm = instance.exports;
|
|
873
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
874
|
+
cachedDataViewMemory0 = null;
|
|
875
|
+
cachedUint32ArrayMemory0 = null;
|
|
876
|
+
cachedUint8ArrayMemory0 = null;
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
wasm.__wbindgen_start();
|
|
880
|
+
return wasm;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
function initSync(module) {
|
|
884
|
+
if (wasm !== undefined) return wasm;
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
if (typeof module !== 'undefined') {
|
|
888
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
889
|
+
({module} = module)
|
|
890
|
+
} else {
|
|
891
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
const imports = __wbg_get_imports();
|
|
896
|
+
|
|
897
|
+
__wbg_init_memory(imports);
|
|
898
|
+
|
|
899
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
900
|
+
module = new WebAssembly.Module(module);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
904
|
+
|
|
905
|
+
return __wbg_finalize_init(instance, module);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
async function __wbg_init(module_or_path) {
|
|
909
|
+
if (wasm !== undefined) return wasm;
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
if (typeof module_or_path !== 'undefined') {
|
|
913
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
914
|
+
({module_or_path} = module_or_path)
|
|
915
|
+
} else {
|
|
916
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
if (typeof module_or_path === 'undefined') {
|
|
921
|
+
module_or_path = new URL('acvm_js_bg.wasm', import.meta.url);
|
|
922
|
+
}
|
|
923
|
+
const imports = __wbg_get_imports();
|
|
924
|
+
|
|
925
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
926
|
+
module_or_path = fetch(module_or_path);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
__wbg_init_memory(imports);
|
|
930
|
+
|
|
931
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
932
|
+
|
|
933
|
+
return __wbg_finalize_init(instance, module);
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
export { initSync };
|
|
937
|
+
export default __wbg_init;
|