@ethproofs/airbender-wasm-stark-verifier 0.1.2 → 0.3.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 +37 -56
- package/dist/index.cjs +369 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +338 -0
- package/dist/index.js.map +1 -0
- package/dist/proof_verifier_wasm_bg.wasm +0 -0
- package/package.json +18 -21
- package/pkg/README.md +0 -85
- package/pkg/ethproofs_verifier_lib.d.ts +0 -4
- package/pkg/ethproofs_verifier_lib.js +0 -5
- package/pkg/ethproofs_verifier_lib_bg.js +0 -176
- package/pkg/ethproofs_verifier_lib_bg.wasm +0 -0
- package/pkg/ethproofs_verifier_lib_bg.wasm.d.ts +0 -10
- package/pkg/package.json +0 -17
- package/test-browser.html +0 -323
- package/test-serve.mjs +0 -123
package/README.md
CHANGED
|
@@ -1,85 +1,66 @@
|
|
|
1
|
-
# Airbender
|
|
1
|
+
# Airbender WASM STARK Verifier
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A wrapper around [@matterlabs/ethproofs-airbender-verifier](https://www.npmjs.com/package/@matterlabs/ethproofs-airbender-verifier) providing a simple API for STARK proof verification.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
This module builds the `verify_proof` function from `ethproofs_verifier` into WebAssembly, enabling STARK proof verification to run directly in both web browsers and Node.js environments.
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
### Installation
|
|
5
|
+
## Installation
|
|
12
6
|
|
|
13
7
|
```bash
|
|
14
8
|
npm install @ethproofs/airbender-wasm-stark-verifier
|
|
15
9
|
```
|
|
16
10
|
|
|
17
|
-
|
|
11
|
+
## Usage
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
import init, {
|
|
21
|
-
main,
|
|
22
|
-
verify_stark,
|
|
23
|
-
} from '@ethproofs/airbender-wasm-stark-verifier';
|
|
13
|
+
### Simple API
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
```typescript
|
|
16
|
+
import { verify_stark } from '@ethproofs/airbender-wasm-stark-verifier';
|
|
27
17
|
|
|
28
|
-
// Verify a proof
|
|
29
|
-
const isValid = verify_stark(proofBytes);
|
|
18
|
+
// Verify a proof - returns true if valid
|
|
19
|
+
const isValid = await verify_stark(proofBytes);
|
|
30
20
|
```
|
|
31
21
|
|
|
32
|
-
###
|
|
22
|
+
### With Error Details
|
|
33
23
|
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
main,
|
|
37
|
-
verify_stark,
|
|
38
|
-
} = require('@ethproofs/airbender-wasm-stark-verifier');
|
|
39
|
-
|
|
40
|
-
// The Node.js version initializes automatically
|
|
24
|
+
```typescript
|
|
25
|
+
import { verify_stark_with_result } from '@ethproofs/airbender-wasm-stark-verifier';
|
|
41
26
|
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
const result = await verify_stark_with_result(proofBytes);
|
|
28
|
+
if (!result.success) {
|
|
29
|
+
console.error('Verification failed:', result.error);
|
|
30
|
+
}
|
|
44
31
|
```
|
|
45
32
|
|
|
46
|
-
|
|
33
|
+
### Advanced Usage
|
|
47
34
|
|
|
48
|
-
|
|
35
|
+
For more control, use the full verifier API:
|
|
49
36
|
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
```
|
|
37
|
+
```typescript
|
|
38
|
+
import { createVerifier } from '@ethproofs/airbender-wasm-stark-verifier';
|
|
53
39
|
|
|
54
|
-
|
|
40
|
+
// Create verifier with default options
|
|
41
|
+
const verifier = await createVerifier();
|
|
55
42
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
// Or with custom setup/layout for non-default circuit versions
|
|
44
|
+
const verifier = await createVerifier({
|
|
45
|
+
setupBin: setupBytes,
|
|
46
|
+
layoutBin: layoutBytes,
|
|
47
|
+
});
|
|
60
48
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
npm run test:node
|
|
49
|
+
// Deserialize and verify
|
|
50
|
+
const handle = verifier.deserializeProofBytes(proofBytes);
|
|
51
|
+
const result = verifier.verifyProof(handle);
|
|
65
52
|
```
|
|
66
53
|
|
|
67
|
-
|
|
54
|
+
## API Reference
|
|
68
55
|
|
|
69
|
-
|
|
56
|
+
- `verify_stark(proofBytes: Uint8Array): Promise<boolean>` - simple verification that returns `true` if the proof is valid.
|
|
70
57
|
|
|
71
|
-
|
|
72
|
-
npm run test
|
|
73
|
-
```
|
|
58
|
+
- `verify_stark_with_result(proofBytes: Uint8Array): Promise<VerificationResult>` - returns an object with `success` boolean and optional `error` string.
|
|
74
59
|
|
|
75
|
-
|
|
60
|
+
- `createVerifier(options?: VerifierOptions): Promise<Verifier>` - creates a verifier instance for advanced usage. Optionally accepts custom `setupBin` and `layoutBin` for non-default circuit versions.
|
|
76
61
|
|
|
77
|
-
-
|
|
78
|
-
- File upload interface for proof and verification key files
|
|
79
|
-
- Interactive STARK proof verification
|
|
80
|
-
- Performance metrics and detailed logging
|
|
81
|
-
- Error handling and user feedback
|
|
62
|
+
- `resetVerifier(): void` - resets the cached verifier instance used by the simple API.
|
|
82
63
|
|
|
83
|
-
|
|
64
|
+
## License
|
|
84
65
|
|
|
85
|
-
|
|
66
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
createVerifier: () => createVerifier,
|
|
24
|
+
resetVerifier: () => resetVerifier,
|
|
25
|
+
verify_stark: () => verify_stark,
|
|
26
|
+
verify_stark_with_result: () => verify_stark_with_result
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
|
|
30
|
+
// node_modules/@matterlabs/ethproofs-airbender-verifier/wasm/pkg/proof_verifier_wasm.js
|
|
31
|
+
var import_meta = {};
|
|
32
|
+
var wasm;
|
|
33
|
+
function _assertClass(instance, klass) {
|
|
34
|
+
if (!(instance instanceof klass)) {
|
|
35
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
var cachedDataViewMemory0 = null;
|
|
39
|
+
function getDataViewMemory0() {
|
|
40
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
41
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
42
|
+
}
|
|
43
|
+
return cachedDataViewMemory0;
|
|
44
|
+
}
|
|
45
|
+
function getStringFromWasm0(ptr, len) {
|
|
46
|
+
ptr = ptr >>> 0;
|
|
47
|
+
return decodeText(ptr, len);
|
|
48
|
+
}
|
|
49
|
+
var cachedUint8ArrayMemory0 = null;
|
|
50
|
+
function getUint8ArrayMemory0() {
|
|
51
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
52
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
53
|
+
}
|
|
54
|
+
return cachedUint8ArrayMemory0;
|
|
55
|
+
}
|
|
56
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
57
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
58
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
59
|
+
WASM_VECTOR_LEN = arg.length;
|
|
60
|
+
return ptr;
|
|
61
|
+
}
|
|
62
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
63
|
+
if (realloc === void 0) {
|
|
64
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
65
|
+
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
66
|
+
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
67
|
+
WASM_VECTOR_LEN = buf.length;
|
|
68
|
+
return ptr2;
|
|
69
|
+
}
|
|
70
|
+
let len = arg.length;
|
|
71
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
72
|
+
const mem = getUint8ArrayMemory0();
|
|
73
|
+
let offset = 0;
|
|
74
|
+
for (; offset < len; offset++) {
|
|
75
|
+
const code = arg.charCodeAt(offset);
|
|
76
|
+
if (code > 127) break;
|
|
77
|
+
mem[ptr + offset] = code;
|
|
78
|
+
}
|
|
79
|
+
if (offset !== len) {
|
|
80
|
+
if (offset !== 0) {
|
|
81
|
+
arg = arg.slice(offset);
|
|
82
|
+
}
|
|
83
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
84
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
85
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
86
|
+
offset += ret.written;
|
|
87
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
88
|
+
}
|
|
89
|
+
WASM_VECTOR_LEN = offset;
|
|
90
|
+
return ptr;
|
|
91
|
+
}
|
|
92
|
+
function takeFromExternrefTable0(idx) {
|
|
93
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
94
|
+
wasm.__externref_table_dealloc(idx);
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
98
|
+
cachedTextDecoder.decode();
|
|
99
|
+
var MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
100
|
+
var numBytesDecoded = 0;
|
|
101
|
+
function decodeText(ptr, len) {
|
|
102
|
+
numBytesDecoded += len;
|
|
103
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
104
|
+
cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
105
|
+
cachedTextDecoder.decode();
|
|
106
|
+
numBytesDecoded = len;
|
|
107
|
+
}
|
|
108
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
109
|
+
}
|
|
110
|
+
var cachedTextEncoder = new TextEncoder();
|
|
111
|
+
if (!("encodeInto" in cachedTextEncoder)) {
|
|
112
|
+
cachedTextEncoder.encodeInto = function(arg, view) {
|
|
113
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
114
|
+
view.set(buf);
|
|
115
|
+
return {
|
|
116
|
+
read: arg.length,
|
|
117
|
+
written: buf.length
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
var WASM_VECTOR_LEN = 0;
|
|
122
|
+
var ProofHandleFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
123
|
+
}, unregister: () => {
|
|
124
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_proofhandle_free(ptr >>> 0, 1));
|
|
125
|
+
var VerifyResultFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
126
|
+
}, unregister: () => {
|
|
127
|
+
} } : new FinalizationRegistry((ptr) => wasm.__wbg_verifyresult_free(ptr >>> 0, 1));
|
|
128
|
+
var ProofHandle = class _ProofHandle {
|
|
129
|
+
static __wrap(ptr) {
|
|
130
|
+
ptr = ptr >>> 0;
|
|
131
|
+
const obj = Object.create(_ProofHandle.prototype);
|
|
132
|
+
obj.__wbg_ptr = ptr;
|
|
133
|
+
ProofHandleFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
134
|
+
return obj;
|
|
135
|
+
}
|
|
136
|
+
__destroy_into_raw() {
|
|
137
|
+
const ptr = this.__wbg_ptr;
|
|
138
|
+
this.__wbg_ptr = 0;
|
|
139
|
+
ProofHandleFinalization.unregister(this);
|
|
140
|
+
return ptr;
|
|
141
|
+
}
|
|
142
|
+
free() {
|
|
143
|
+
const ptr = this.__destroy_into_raw();
|
|
144
|
+
wasm.__wbg_proofhandle_free(ptr, 0);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
if (Symbol.dispose) ProofHandle.prototype[Symbol.dispose] = ProofHandle.prototype.free;
|
|
148
|
+
var VerifyResult = class _VerifyResult {
|
|
149
|
+
static __wrap(ptr) {
|
|
150
|
+
ptr = ptr >>> 0;
|
|
151
|
+
const obj = Object.create(_VerifyResult.prototype);
|
|
152
|
+
obj.__wbg_ptr = ptr;
|
|
153
|
+
VerifyResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
154
|
+
return obj;
|
|
155
|
+
}
|
|
156
|
+
__destroy_into_raw() {
|
|
157
|
+
const ptr = this.__wbg_ptr;
|
|
158
|
+
this.__wbg_ptr = 0;
|
|
159
|
+
VerifyResultFinalization.unregister(this);
|
|
160
|
+
return ptr;
|
|
161
|
+
}
|
|
162
|
+
free() {
|
|
163
|
+
const ptr = this.__destroy_into_raw();
|
|
164
|
+
wasm.__wbg_verifyresult_free(ptr, 0);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @returns {any | undefined}
|
|
168
|
+
*/
|
|
169
|
+
error() {
|
|
170
|
+
const ret = wasm.verifyresult_error(this.__wbg_ptr);
|
|
171
|
+
return ret;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* @returns {boolean}
|
|
175
|
+
*/
|
|
176
|
+
get success() {
|
|
177
|
+
const ret = wasm.verifyresult_success(this.__wbg_ptr);
|
|
178
|
+
return ret !== 0;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
if (Symbol.dispose) VerifyResult.prototype[Symbol.dispose] = VerifyResult.prototype.free;
|
|
182
|
+
function deserialize_proof_bytes(proof_bytes) {
|
|
183
|
+
const ptr0 = passArray8ToWasm0(proof_bytes, wasm.__wbindgen_malloc);
|
|
184
|
+
const len0 = WASM_VECTOR_LEN;
|
|
185
|
+
const ret = wasm.deserialize_proof_bytes(ptr0, len0);
|
|
186
|
+
if (ret[2]) {
|
|
187
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
188
|
+
}
|
|
189
|
+
return ProofHandle.__wrap(ret[0]);
|
|
190
|
+
}
|
|
191
|
+
function init_defaults() {
|
|
192
|
+
const ret = wasm.init_defaults();
|
|
193
|
+
if (ret[1]) {
|
|
194
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function init_with(setup_bin, layout_bin) {
|
|
198
|
+
const ptr0 = passArray8ToWasm0(setup_bin, wasm.__wbindgen_malloc);
|
|
199
|
+
const len0 = WASM_VECTOR_LEN;
|
|
200
|
+
const ptr1 = passArray8ToWasm0(layout_bin, wasm.__wbindgen_malloc);
|
|
201
|
+
const len1 = WASM_VECTOR_LEN;
|
|
202
|
+
const ret = wasm.init_with(ptr0, len0, ptr1, len1);
|
|
203
|
+
if (ret[1]) {
|
|
204
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function verify_proof(handle) {
|
|
208
|
+
_assertClass(handle, ProofHandle);
|
|
209
|
+
const ret = wasm.verify_proof(handle.__wbg_ptr);
|
|
210
|
+
return VerifyResult.__wrap(ret);
|
|
211
|
+
}
|
|
212
|
+
var EXPECTED_RESPONSE_TYPES = /* @__PURE__ */ new Set(["basic", "cors", "default"]);
|
|
213
|
+
async function __wbg_load(module2, imports) {
|
|
214
|
+
if (typeof Response === "function" && module2 instanceof Response) {
|
|
215
|
+
if (typeof WebAssembly.instantiateStreaming === "function") {
|
|
216
|
+
try {
|
|
217
|
+
return await WebAssembly.instantiateStreaming(module2, imports);
|
|
218
|
+
} catch (e) {
|
|
219
|
+
const validResponse = module2.ok && EXPECTED_RESPONSE_TYPES.has(module2.type);
|
|
220
|
+
if (validResponse && module2.headers.get("Content-Type") !== "application/wasm") {
|
|
221
|
+
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);
|
|
222
|
+
} else {
|
|
223
|
+
throw e;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
const bytes = await module2.arrayBuffer();
|
|
228
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
229
|
+
} else {
|
|
230
|
+
const instance = await WebAssembly.instantiate(module2, imports);
|
|
231
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
232
|
+
return { instance, module: module2 };
|
|
233
|
+
} else {
|
|
234
|
+
return instance;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function __wbg_get_imports() {
|
|
239
|
+
const imports = {};
|
|
240
|
+
imports.wbg = {};
|
|
241
|
+
imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
242
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
243
|
+
};
|
|
244
|
+
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
245
|
+
let deferred0_0;
|
|
246
|
+
let deferred0_1;
|
|
247
|
+
try {
|
|
248
|
+
deferred0_0 = arg0;
|
|
249
|
+
deferred0_1 = arg1;
|
|
250
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
251
|
+
} finally {
|
|
252
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
|
|
256
|
+
const ret = new Error();
|
|
257
|
+
return ret;
|
|
258
|
+
};
|
|
259
|
+
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
260
|
+
const ret = arg1.stack;
|
|
261
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
262
|
+
const len1 = WASM_VECTOR_LEN;
|
|
263
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
264
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
265
|
+
};
|
|
266
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
267
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
268
|
+
return ret;
|
|
269
|
+
};
|
|
270
|
+
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
271
|
+
const table = wasm.__wbindgen_externrefs;
|
|
272
|
+
const offset = table.grow(4);
|
|
273
|
+
table.set(0, void 0);
|
|
274
|
+
table.set(offset + 0, void 0);
|
|
275
|
+
table.set(offset + 1, null);
|
|
276
|
+
table.set(offset + 2, true);
|
|
277
|
+
table.set(offset + 3, false);
|
|
278
|
+
};
|
|
279
|
+
return imports;
|
|
280
|
+
}
|
|
281
|
+
function __wbg_finalize_init(instance, module2) {
|
|
282
|
+
wasm = instance.exports;
|
|
283
|
+
__wbg_init.__wbindgen_wasm_module = module2;
|
|
284
|
+
cachedDataViewMemory0 = null;
|
|
285
|
+
cachedUint8ArrayMemory0 = null;
|
|
286
|
+
wasm.__wbindgen_start();
|
|
287
|
+
return wasm;
|
|
288
|
+
}
|
|
289
|
+
async function __wbg_init(module_or_path) {
|
|
290
|
+
if (wasm !== void 0) return wasm;
|
|
291
|
+
if (typeof module_or_path !== "undefined") {
|
|
292
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
293
|
+
({ module_or_path } = module_or_path);
|
|
294
|
+
} else {
|
|
295
|
+
console.warn("using deprecated parameters for the initialization function; pass a single object instead");
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (typeof module_or_path === "undefined") {
|
|
299
|
+
module_or_path = new URL("proof_verifier_wasm_bg.wasm", import_meta.url);
|
|
300
|
+
}
|
|
301
|
+
const imports = __wbg_get_imports();
|
|
302
|
+
if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) {
|
|
303
|
+
module_or_path = fetch(module_or_path);
|
|
304
|
+
}
|
|
305
|
+
const { instance, module: module2 } = await __wbg_load(await module_or_path, imports);
|
|
306
|
+
return __wbg_finalize_init(instance, module2);
|
|
307
|
+
}
|
|
308
|
+
var proof_verifier_wasm_default = __wbg_init;
|
|
309
|
+
|
|
310
|
+
// node_modules/@matterlabs/ethproofs-airbender-verifier/dist/index.js
|
|
311
|
+
var initPromise = null;
|
|
312
|
+
function ensureInit() {
|
|
313
|
+
if (!initPromise) {
|
|
314
|
+
initPromise = proof_verifier_wasm_default();
|
|
315
|
+
}
|
|
316
|
+
return initPromise;
|
|
317
|
+
}
|
|
318
|
+
var VerifierImpl = class {
|
|
319
|
+
deserializeProofBytes(proofBytes) {
|
|
320
|
+
return deserialize_proof_bytes(proofBytes);
|
|
321
|
+
}
|
|
322
|
+
verifyProof(handle) {
|
|
323
|
+
const result = verify_proof(handle);
|
|
324
|
+
return {
|
|
325
|
+
success: result.success,
|
|
326
|
+
error: result.error()
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
async function createVerifier(options) {
|
|
331
|
+
await ensureInit();
|
|
332
|
+
if (options) {
|
|
333
|
+
init_with(options.setupBin, options.layoutBin);
|
|
334
|
+
} else {
|
|
335
|
+
init_defaults();
|
|
336
|
+
}
|
|
337
|
+
return new VerifierImpl();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// src/index.ts
|
|
341
|
+
var cachedVerifier = null;
|
|
342
|
+
async function getVerifier() {
|
|
343
|
+
if (!cachedVerifier) {
|
|
344
|
+
cachedVerifier = await createVerifier();
|
|
345
|
+
}
|
|
346
|
+
return cachedVerifier;
|
|
347
|
+
}
|
|
348
|
+
async function verify_stark(proofBytes) {
|
|
349
|
+
const verifier = await getVerifier();
|
|
350
|
+
const handle = verifier.deserializeProofBytes(proofBytes);
|
|
351
|
+
const result = verifier.verifyProof(handle);
|
|
352
|
+
return result.success;
|
|
353
|
+
}
|
|
354
|
+
async function verify_stark_with_result(proofBytes) {
|
|
355
|
+
const verifier = await getVerifier();
|
|
356
|
+
const handle = verifier.deserializeProofBytes(proofBytes);
|
|
357
|
+
return verifier.verifyProof(handle);
|
|
358
|
+
}
|
|
359
|
+
function resetVerifier() {
|
|
360
|
+
cachedVerifier = null;
|
|
361
|
+
}
|
|
362
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
363
|
+
0 && (module.exports = {
|
|
364
|
+
createVerifier,
|
|
365
|
+
resetVerifier,
|
|
366
|
+
verify_stark,
|
|
367
|
+
verify_stark_with_result
|
|
368
|
+
});
|
|
369
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../node_modules/@matterlabs/ethproofs-airbender-verifier/wasm/pkg/proof_verifier_wasm.js","../node_modules/@matterlabs/ethproofs-airbender-verifier/dist/index.js"],"sourcesContent":["import {\n createVerifier,\n type Verifier,\n type VerifierOptions,\n type VerificationResult,\n type ProofHandle,\n} from \"@matterlabs/ethproofs-airbender-verifier\";\n\n// Re-export all types and the createVerifier function for advanced usage\nexport {\n createVerifier,\n type Verifier,\n type VerifierOptions,\n type VerificationResult,\n type ProofHandle,\n};\n\n// Cached verifier instance for the simple API\nlet cachedVerifier: Verifier | null = null;\n\n/**\n * Gets or creates a verifier instance with default options.\n * The verifier is cached for subsequent calls.\n */\nasync function getVerifier(): Promise<Verifier> {\n if (!cachedVerifier) {\n cachedVerifier = await createVerifier();\n }\n return cachedVerifier;\n}\n\n/**\n * Simple verification API that takes proof bytes and returns a boolean.\n *\n * This is a convenience wrapper around the full verifier API.\n * For more control, use `createVerifier()` directly.\n *\n * @param proofBytes - The raw proof bytes to verify\n * @returns Promise<boolean> - true if the proof is valid, false otherwise\n */\nexport async function verify_stark(proofBytes: Uint8Array): Promise<boolean> {\n const verifier = await getVerifier();\n const handle = verifier.deserializeProofBytes(proofBytes);\n const result = verifier.verifyProof(handle);\n return result.success;\n}\n\n/**\n * Verification API that returns the full result including error details.\n *\n * @param proofBytes - The raw proof bytes to verify\n * @returns Promise<VerificationResult> - Object with success boolean and optional error string\n */\nexport async function verify_stark_with_result(\n proofBytes: Uint8Array\n): Promise<VerificationResult> {\n const verifier = await getVerifier();\n const handle = verifier.deserializeProofBytes(proofBytes);\n return verifier.verifyProof(handle);\n}\n\n/**\n * Resets the cached verifier instance.\n * Call this if you need to reinitialize with different options.\n */\nexport function resetVerifier(): void {\n cachedVerifier = null;\n}\n","let wasm;\n\nfunction _assertClass(instance, klass) {\n if (!(instance instanceof klass)) {\n throw new Error(`expected instance of ${klass.name}`);\n }\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return decodeText(ptr, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeFromExternrefTable0(idx) {\n const value = wasm.__wbindgen_externrefs.get(idx);\n wasm.__externref_table_dealloc(idx);\n return value;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!('encodeInto' in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n }\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst ProofHandleFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_proofhandle_free(ptr >>> 0, 1));\n\nconst VerifyResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_verifyresult_free(ptr >>> 0, 1));\n\nexport class ProofHandle {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(ProofHandle.prototype);\n obj.__wbg_ptr = ptr;\n ProofHandleFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n ProofHandleFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_proofhandle_free(ptr, 0);\n }\n}\nif (Symbol.dispose) ProofHandle.prototype[Symbol.dispose] = ProofHandle.prototype.free;\n\nexport class VerifyResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(VerifyResult.prototype);\n obj.__wbg_ptr = ptr;\n VerifyResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n VerifyResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_verifyresult_free(ptr, 0);\n }\n /**\n * @returns {any | undefined}\n */\n error() {\n const ret = wasm.verifyresult_error(this.__wbg_ptr);\n return ret;\n }\n /**\n * @returns {boolean}\n */\n get success() {\n const ret = wasm.verifyresult_success(this.__wbg_ptr);\n return ret !== 0;\n }\n}\nif (Symbol.dispose) VerifyResult.prototype[Symbol.dispose] = VerifyResult.prototype.free;\n\n/**\n * @param {Uint8Array} proof_bytes\n * @returns {ProofHandle}\n */\nexport function deserialize_proof_bytes(proof_bytes) {\n const ptr0 = passArray8ToWasm0(proof_bytes, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.deserialize_proof_bytes(ptr0, len0);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return ProofHandle.__wrap(ret[0]);\n}\n\nexport function init_defaults() {\n const ret = wasm.init_defaults();\n if (ret[1]) {\n throw takeFromExternrefTable0(ret[0]);\n }\n}\n\n/**\n * @param {Uint8Array} setup_bin\n * @param {Uint8Array} layout_bin\n */\nexport function init_with(setup_bin, layout_bin) {\n const ptr0 = passArray8ToWasm0(setup_bin, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray8ToWasm0(layout_bin, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.init_with(ptr0, len0, ptr1, len1);\n if (ret[1]) {\n throw takeFromExternrefTable0(ret[0]);\n }\n}\n\n/**\n * @param {ProofHandle} handle\n * @returns {VerifyResult}\n */\nexport function verify_proof(handle) {\n _assertClass(handle, ProofHandle);\n const ret = wasm.verify_proof(handle.__wbg_ptr);\n return VerifyResult.__wrap(ret);\n}\n\nconst EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n 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);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n };\n imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {\n let deferred0_0;\n let deferred0_1;\n try {\n deferred0_0 = arg0;\n deferred0_1 = arg1;\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);\n }\n };\n imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {\n const ret = new Error();\n return ret;\n };\n imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {\n const ret = arg1.stack;\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n };\n imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return ret;\n };\n imports.wbg.__wbindgen_init_externref_table = function() {\n const table = wasm.__wbindgen_externrefs;\n const offset = table.grow(4);\n table.set(0, undefined);\n table.set(offset + 0, undefined);\n table.set(offset + 1, null);\n table.set(offset + 2, true);\n table.set(offset + 3, false);\n };\n\n return imports;\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n wasm.__wbindgen_start();\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('proof_verifier_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n","// src/index.ts\nimport init, {\n deserialize_proof_bytes,\n init_defaults,\n init_with,\n verify_proof\n} from \"../wasm/pkg/proof_verifier_wasm\";\nvar initPromise = null;\nfunction ensureInit() {\n if (!initPromise) {\n initPromise = init();\n }\n return initPromise;\n}\nvar VerifierImpl = class {\n deserializeProofBytes(proofBytes) {\n return deserialize_proof_bytes(proofBytes);\n }\n verifyProof(handle) {\n const result = verify_proof(handle);\n return {\n success: result.success,\n error: result.error()\n };\n }\n};\nasync function createVerifier(options) {\n await ensureInit();\n if (options) {\n init_with(options.setupBin, options.layoutBin);\n } else {\n init_defaults();\n }\n return new VerifierImpl();\n}\nexport {\n createVerifier\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA,IAAI;AAEJ,SAAS,aAAa,UAAU,OAAO;AACnC,MAAI,EAAE,oBAAoB,QAAQ;AAC9B,UAAM,IAAI,MAAM,wBAAwB,MAAM,IAAI,EAAE;AAAA,EACxD;AACJ;AAEA,IAAI,wBAAwB;AAC5B,SAAS,qBAAqB;AAC1B,MAAI,0BAA0B,QAAQ,sBAAsB,OAAO,aAAa,QAAS,sBAAsB,OAAO,aAAa,UAAa,sBAAsB,WAAW,KAAK,OAAO,QAAS;AAClM,4BAAwB,IAAI,SAAS,KAAK,OAAO,MAAM;AAAA,EAC3D;AACA,SAAO;AACX;AAEA,SAAS,mBAAmB,KAAK,KAAK;AAClC,QAAM,QAAQ;AACd,SAAO,WAAW,KAAK,GAAG;AAC9B;AAEA,IAAI,0BAA0B;AAC9B,SAAS,uBAAuB;AAC5B,MAAI,4BAA4B,QAAQ,wBAAwB,eAAe,GAAG;AAC9E,8BAA0B,IAAI,WAAW,KAAK,OAAO,MAAM;AAAA,EAC/D;AACA,SAAO;AACX;AAEA,SAAS,kBAAkB,KAAK,QAAQ;AACpC,QAAM,MAAM,OAAO,IAAI,SAAS,GAAG,CAAC,MAAM;AAC1C,uBAAqB,EAAE,IAAI,KAAK,MAAM,CAAC;AACvC,oBAAkB,IAAI;AACtB,SAAO;AACX;AAEA,SAAS,kBAAkB,KAAK,QAAQ,SAAS;AAC7C,MAAI,YAAY,QAAW;AACvB,UAAM,MAAM,kBAAkB,OAAO,GAAG;AACxC,UAAMA,OAAM,OAAO,IAAI,QAAQ,CAAC,MAAM;AACtC,yBAAqB,EAAE,SAASA,MAAKA,O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pB,YAC6B;AAC7B,QAAM,WAAW,MAAM,YAAY;AACnC,QAAM,SAAS,SAAS,sBAAsB,UAAU;AACxD,SAAO,SAAS,YAAY,MAAM;AACpC;AAMO,SAAS,gBAAsB;AACpC,mBAAiB;AACnB;","names":["ptr","module","module"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { VerificationResult } from '@matterlabs/ethproofs-airbender-verifier';
|
|
2
|
+
export { ProofHandle, VerificationResult, Verifier, VerifierOptions, createVerifier } from '@matterlabs/ethproofs-airbender-verifier';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Simple verification API that takes proof bytes and returns a boolean.
|
|
6
|
+
*
|
|
7
|
+
* This is a convenience wrapper around the full verifier API.
|
|
8
|
+
* For more control, use `createVerifier()` directly.
|
|
9
|
+
*
|
|
10
|
+
* @param proofBytes - The raw proof bytes to verify
|
|
11
|
+
* @returns Promise<boolean> - true if the proof is valid, false otherwise
|
|
12
|
+
*/
|
|
13
|
+
declare function verify_stark(proofBytes: Uint8Array): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Verification API that returns the full result including error details.
|
|
16
|
+
*
|
|
17
|
+
* @param proofBytes - The raw proof bytes to verify
|
|
18
|
+
* @returns Promise<VerificationResult> - Object with success boolean and optional error string
|
|
19
|
+
*/
|
|
20
|
+
declare function verify_stark_with_result(proofBytes: Uint8Array): Promise<VerificationResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Resets the cached verifier instance.
|
|
23
|
+
* Call this if you need to reinitialize with different options.
|
|
24
|
+
*/
|
|
25
|
+
declare function resetVerifier(): void;
|
|
26
|
+
|
|
27
|
+
export { resetVerifier, verify_stark, verify_stark_with_result };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { VerificationResult } from '@matterlabs/ethproofs-airbender-verifier';
|
|
2
|
+
export { ProofHandle, VerificationResult, Verifier, VerifierOptions, createVerifier } from '@matterlabs/ethproofs-airbender-verifier';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Simple verification API that takes proof bytes and returns a boolean.
|
|
6
|
+
*
|
|
7
|
+
* This is a convenience wrapper around the full verifier API.
|
|
8
|
+
* For more control, use `createVerifier()` directly.
|
|
9
|
+
*
|
|
10
|
+
* @param proofBytes - The raw proof bytes to verify
|
|
11
|
+
* @returns Promise<boolean> - true if the proof is valid, false otherwise
|
|
12
|
+
*/
|
|
13
|
+
declare function verify_stark(proofBytes: Uint8Array): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Verification API that returns the full result including error details.
|
|
16
|
+
*
|
|
17
|
+
* @param proofBytes - The raw proof bytes to verify
|
|
18
|
+
* @returns Promise<VerificationResult> - Object with success boolean and optional error string
|
|
19
|
+
*/
|
|
20
|
+
declare function verify_stark_with_result(proofBytes: Uint8Array): Promise<VerificationResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Resets the cached verifier instance.
|
|
23
|
+
* Call this if you need to reinitialize with different options.
|
|
24
|
+
*/
|
|
25
|
+
declare function resetVerifier(): void;
|
|
26
|
+
|
|
27
|
+
export { resetVerifier, verify_stark, verify_stark_with_result };
|