@hyperdag/proof-verifier 0.1.0 → 0.2.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 +54 -51
- package/js/index.js +38 -38
- package/package.json +36 -37
- package/pkg/README.md +51 -50
- package/pkg/hyperdag_proof_verifier.d.ts +6 -6
- package/pkg/hyperdag_proof_verifier.js +9 -9
- package/pkg/hyperdag_proof_verifier_bg.js +170 -170
- package/pkg/hyperdag_proof_verifier_bg.wasm +0 -0
- package/pkg/hyperdag_proof_verifier_bg.wasm.d.ts +9 -9
- package/pkg/package.json +24 -22
- package/pkg-node/README.md +51 -50
- package/pkg-node/hyperdag_proof_verifier.d.ts +6 -6
- package/pkg-node/hyperdag_proof_verifier.js +176 -176
- package/pkg-node/hyperdag_proof_verifier_bg.wasm +0 -0
- package/pkg-node/hyperdag_proof_verifier_bg.wasm.d.ts +9 -9
- package/pkg-node/package.json +18 -16
- package/pkg-web/README.md +51 -50
- package/pkg-web/hyperdag_proof_verifier.d.ts +40 -40
- package/pkg-web/hyperdag_proof_verifier.js +269 -269
- package/pkg-web/hyperdag_proof_verifier_bg.wasm +0 -0
- package/pkg-web/hyperdag_proof_verifier_bg.wasm.d.ts +9 -9
- package/pkg-web/package.json +22 -20
- package/LICENSE-MIT +0 -21
- package/pkg/LICENSE-MIT +0 -21
- package/pkg-node/LICENSE-MIT +0 -21
- package/pkg-web/LICENSE-MIT +0 -21
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
export function init_panic_hook() {
|
|
2
|
-
wasm.init_panic_hook();
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @param {string} input_json
|
|
7
|
-
* @returns {string}
|
|
8
|
-
*/
|
|
9
|
-
export function verify_proof(input_json) {
|
|
10
|
-
let deferred2_0;
|
|
11
|
-
let deferred2_1;
|
|
12
|
-
try {
|
|
13
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
14
|
-
const ptr0 = passStringToWasm0(input_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
15
|
-
const len0 = WASM_VECTOR_LEN;
|
|
16
|
-
wasm.verify_proof(retptr, ptr0, len0);
|
|
17
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
18
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19
|
-
deferred2_0 = r0;
|
|
20
|
-
deferred2_1 = r1;
|
|
21
|
-
return getStringFromWasm0(r0, r1);
|
|
22
|
-
} finally {
|
|
23
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
24
|
-
wasm.__wbindgen_export(deferred2_0, deferred2_1, 1);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
28
|
-
let deferred0_0;
|
|
29
|
-
let deferred0_1;
|
|
30
|
-
try {
|
|
31
|
-
deferred0_0 = arg0;
|
|
32
|
-
deferred0_1 = arg1;
|
|
33
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
34
|
-
} finally {
|
|
35
|
-
wasm.__wbindgen_export(deferred0_0, deferred0_1, 1);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export function __wbg_new_227d7c05414eb861() {
|
|
39
|
-
const ret = new Error();
|
|
40
|
-
return addHeapObject(ret);
|
|
41
|
-
}
|
|
42
|
-
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
43
|
-
const ret = getObject(arg1).stack;
|
|
44
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
45
|
-
const len1 = WASM_VECTOR_LEN;
|
|
46
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
47
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
48
|
-
}
|
|
49
|
-
export function __wbindgen_object_drop_ref(arg0) {
|
|
50
|
-
takeObject(arg0);
|
|
51
|
-
}
|
|
52
|
-
function addHeapObject(obj) {
|
|
53
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
54
|
-
const idx = heap_next;
|
|
55
|
-
heap_next = heap[idx];
|
|
56
|
-
|
|
57
|
-
heap[idx] = obj;
|
|
58
|
-
return idx;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function dropObject(idx) {
|
|
62
|
-
if (idx < 1028) return;
|
|
63
|
-
heap[idx] = heap_next;
|
|
64
|
-
heap_next = idx;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
let cachedDataViewMemory0 = null;
|
|
68
|
-
function getDataViewMemory0() {
|
|
69
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
70
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
71
|
-
}
|
|
72
|
-
return cachedDataViewMemory0;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function getStringFromWasm0(ptr, len) {
|
|
76
|
-
return decodeText(ptr >>> 0, len);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
let cachedUint8ArrayMemory0 = null;
|
|
80
|
-
function getUint8ArrayMemory0() {
|
|
81
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
82
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
83
|
-
}
|
|
84
|
-
return cachedUint8ArrayMemory0;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function getObject(idx) { return heap[idx]; }
|
|
88
|
-
|
|
89
|
-
let heap = new Array(1024).fill(undefined);
|
|
90
|
-
heap.push(undefined, null, true, false);
|
|
91
|
-
|
|
92
|
-
let heap_next = heap.length;
|
|
93
|
-
|
|
94
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
95
|
-
if (realloc === undefined) {
|
|
96
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
97
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
98
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
99
|
-
WASM_VECTOR_LEN = buf.length;
|
|
100
|
-
return ptr;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
let len = arg.length;
|
|
104
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
105
|
-
|
|
106
|
-
const mem = getUint8ArrayMemory0();
|
|
107
|
-
|
|
108
|
-
let offset = 0;
|
|
109
|
-
|
|
110
|
-
for (; offset < len; offset++) {
|
|
111
|
-
const code = arg.charCodeAt(offset);
|
|
112
|
-
if (code > 0x7F) break;
|
|
113
|
-
mem[ptr + offset] = code;
|
|
114
|
-
}
|
|
115
|
-
if (offset !== len) {
|
|
116
|
-
if (offset !== 0) {
|
|
117
|
-
arg = arg.slice(offset);
|
|
118
|
-
}
|
|
119
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
120
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
121
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
122
|
-
|
|
123
|
-
offset += ret.written;
|
|
124
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
WASM_VECTOR_LEN = offset;
|
|
128
|
-
return ptr;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function takeObject(idx) {
|
|
132
|
-
const ret = getObject(idx);
|
|
133
|
-
dropObject(idx);
|
|
134
|
-
return ret;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
138
|
-
cachedTextDecoder.decode();
|
|
139
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
140
|
-
let numBytesDecoded = 0;
|
|
141
|
-
function decodeText(ptr, len) {
|
|
142
|
-
numBytesDecoded += len;
|
|
143
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
144
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
145
|
-
cachedTextDecoder.decode();
|
|
146
|
-
numBytesDecoded = len;
|
|
147
|
-
}
|
|
148
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const cachedTextEncoder = new TextEncoder();
|
|
152
|
-
|
|
153
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
154
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
155
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
156
|
-
view.set(buf);
|
|
157
|
-
return {
|
|
158
|
-
read: arg.length,
|
|
159
|
-
written: buf.length
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
let WASM_VECTOR_LEN = 0;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
let wasm;
|
|
168
|
-
export function __wbg_set_wasm(val) {
|
|
169
|
-
wasm = val;
|
|
170
|
-
}
|
|
1
|
+
export function init_panic_hook() {
|
|
2
|
+
wasm.init_panic_hook();
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} input_json
|
|
7
|
+
* @returns {string}
|
|
8
|
+
*/
|
|
9
|
+
export function verify_proof(input_json) {
|
|
10
|
+
let deferred2_0;
|
|
11
|
+
let deferred2_1;
|
|
12
|
+
try {
|
|
13
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
14
|
+
const ptr0 = passStringToWasm0(input_json, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
15
|
+
const len0 = WASM_VECTOR_LEN;
|
|
16
|
+
wasm.verify_proof(retptr, ptr0, len0);
|
|
17
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
18
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
19
|
+
deferred2_0 = r0;
|
|
20
|
+
deferred2_1 = r1;
|
|
21
|
+
return getStringFromWasm0(r0, r1);
|
|
22
|
+
} finally {
|
|
23
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
24
|
+
wasm.__wbindgen_export(deferred2_0, deferred2_1, 1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
28
|
+
let deferred0_0;
|
|
29
|
+
let deferred0_1;
|
|
30
|
+
try {
|
|
31
|
+
deferred0_0 = arg0;
|
|
32
|
+
deferred0_1 = arg1;
|
|
33
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
34
|
+
} finally {
|
|
35
|
+
wasm.__wbindgen_export(deferred0_0, deferred0_1, 1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function __wbg_new_227d7c05414eb861() {
|
|
39
|
+
const ret = new Error();
|
|
40
|
+
return addHeapObject(ret);
|
|
41
|
+
}
|
|
42
|
+
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
43
|
+
const ret = getObject(arg1).stack;
|
|
44
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
45
|
+
const len1 = WASM_VECTOR_LEN;
|
|
46
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
47
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
48
|
+
}
|
|
49
|
+
export function __wbindgen_object_drop_ref(arg0) {
|
|
50
|
+
takeObject(arg0);
|
|
51
|
+
}
|
|
52
|
+
function addHeapObject(obj) {
|
|
53
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
54
|
+
const idx = heap_next;
|
|
55
|
+
heap_next = heap[idx];
|
|
56
|
+
|
|
57
|
+
heap[idx] = obj;
|
|
58
|
+
return idx;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function dropObject(idx) {
|
|
62
|
+
if (idx < 1028) return;
|
|
63
|
+
heap[idx] = heap_next;
|
|
64
|
+
heap_next = idx;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let cachedDataViewMemory0 = null;
|
|
68
|
+
function getDataViewMemory0() {
|
|
69
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
70
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
71
|
+
}
|
|
72
|
+
return cachedDataViewMemory0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function getStringFromWasm0(ptr, len) {
|
|
76
|
+
return decodeText(ptr >>> 0, len);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let cachedUint8ArrayMemory0 = null;
|
|
80
|
+
function getUint8ArrayMemory0() {
|
|
81
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
82
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
83
|
+
}
|
|
84
|
+
return cachedUint8ArrayMemory0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function getObject(idx) { return heap[idx]; }
|
|
88
|
+
|
|
89
|
+
let heap = new Array(1024).fill(undefined);
|
|
90
|
+
heap.push(undefined, null, true, false);
|
|
91
|
+
|
|
92
|
+
let heap_next = heap.length;
|
|
93
|
+
|
|
94
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
95
|
+
if (realloc === undefined) {
|
|
96
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
97
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
98
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
99
|
+
WASM_VECTOR_LEN = buf.length;
|
|
100
|
+
return ptr;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let len = arg.length;
|
|
104
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
105
|
+
|
|
106
|
+
const mem = getUint8ArrayMemory0();
|
|
107
|
+
|
|
108
|
+
let offset = 0;
|
|
109
|
+
|
|
110
|
+
for (; offset < len; offset++) {
|
|
111
|
+
const code = arg.charCodeAt(offset);
|
|
112
|
+
if (code > 0x7F) break;
|
|
113
|
+
mem[ptr + offset] = code;
|
|
114
|
+
}
|
|
115
|
+
if (offset !== len) {
|
|
116
|
+
if (offset !== 0) {
|
|
117
|
+
arg = arg.slice(offset);
|
|
118
|
+
}
|
|
119
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
120
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
121
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
122
|
+
|
|
123
|
+
offset += ret.written;
|
|
124
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
WASM_VECTOR_LEN = offset;
|
|
128
|
+
return ptr;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function takeObject(idx) {
|
|
132
|
+
const ret = getObject(idx);
|
|
133
|
+
dropObject(idx);
|
|
134
|
+
return ret;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
138
|
+
cachedTextDecoder.decode();
|
|
139
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
140
|
+
let numBytesDecoded = 0;
|
|
141
|
+
function decodeText(ptr, len) {
|
|
142
|
+
numBytesDecoded += len;
|
|
143
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
144
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
145
|
+
cachedTextDecoder.decode();
|
|
146
|
+
numBytesDecoded = len;
|
|
147
|
+
}
|
|
148
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const cachedTextEncoder = new TextEncoder();
|
|
152
|
+
|
|
153
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
154
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
155
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
156
|
+
view.set(buf);
|
|
157
|
+
return {
|
|
158
|
+
read: arg.length,
|
|
159
|
+
written: buf.length
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let WASM_VECTOR_LEN = 0;
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
let wasm;
|
|
168
|
+
export function __wbg_set_wasm(val) {
|
|
169
|
+
wasm = val;
|
|
170
|
+
}
|
|
Binary file
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const verify_proof: (a: number, b: number, c: number) => void;
|
|
5
|
-
export const init_panic_hook: () => void;
|
|
6
|
-
export const __wbindgen_export: (a: number, b: number, c: number) => void;
|
|
7
|
-
export const __wbindgen_export2: (a: number, b: number) => number;
|
|
8
|
-
export const __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
9
|
-
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const verify_proof: (a: number, b: number, c: number) => void;
|
|
5
|
+
export const init_panic_hook: () => void;
|
|
6
|
+
export const __wbindgen_export: (a: number, b: number, c: number) => void;
|
|
7
|
+
export const __wbindgen_export2: (a: number, b: number) => number;
|
|
8
|
+
export const __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
9
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
package/pkg/package.json
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "hyperdag-proof-verifier",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"description": "Client-side Plonky3 STARK verifier for HyperDAG RepID proofs",
|
|
5
|
-
"version": "0.
|
|
6
|
-
"license": "MIT OR Apache-2.0",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/DealAppSeo/hyperdag-proof-verifier"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"hyperdag_proof_verifier_bg.wasm",
|
|
13
|
-
"hyperdag_proof_verifier.js",
|
|
14
|
-
"hyperdag_proof_verifier_bg.js",
|
|
15
|
-
"hyperdag_proof_verifier.d.ts"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "hyperdag-proof-verifier",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "Client-side Plonky3 STARK verifier for HyperDAG RepID proofs",
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"license": "MIT OR Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/DealAppSeo/hyperdag-proof-verifier"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"hyperdag_proof_verifier_bg.wasm",
|
|
13
|
+
"hyperdag_proof_verifier.js",
|
|
14
|
+
"hyperdag_proof_verifier_bg.js",
|
|
15
|
+
"hyperdag_proof_verifier.d.ts",
|
|
16
|
+
"LICENSE-APACHE",
|
|
17
|
+
"LICENSE-MIT"
|
|
18
|
+
],
|
|
19
|
+
"main": "hyperdag_proof_verifier.js",
|
|
20
|
+
"types": "hyperdag_proof_verifier.d.ts",
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"./hyperdag_proof_verifier.js",
|
|
23
|
+
"./snippets/*"
|
|
24
|
+
]
|
|
23
25
|
}
|
package/pkg-node/README.md
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
# @hyperdag/proof-verifier
|
|
2
|
-
Verify HyperDAG STARK proofs in your browser or Node app. No server trust.
|
|
3
|
-
|
|
4
|
-
## Why this exists
|
|
5
|
-
HyperDAG's zkp-postcard service generates Plonky3 STARK proofs for every agent decision. If you trust HyperDAG's server when it says `verified: true`, you're just trusting a server. With this package, your code verifies the cryptographic proof itself — locally, deterministically, with no network call.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
```bash
|
|
9
|
-
npm install @hyperdag/proof-verifier
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Usage (3 lines)
|
|
13
|
-
```js
|
|
14
|
-
import { verify } from '@hyperdag/proof-verifier';
|
|
15
|
-
const result = await verify(proofBytes, statement);
|
|
16
|
-
console.log(result.verified); // true | false
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## End-to-end example with the SDK
|
|
20
|
-
```js
|
|
21
|
-
import { TrustShell } from '@hyperdag/trustshell';
|
|
22
|
-
import { verify } from '@hyperdag/proof-verifier';
|
|
23
|
-
|
|
24
|
-
const trust = new TrustShell({ ...config });
|
|
25
|
-
const decision = await trust.report({ ... });
|
|
26
|
-
const proof = await trust.getProof(decision.proof_job_id);
|
|
27
|
-
const result = await verify(proof.proof_bytes, proof.statement);
|
|
28
|
-
if (!result.verified) throw new Error('proof failed verification — DO NOT TRUST');
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## What gets verified
|
|
32
|
-
- The agent had the claimed RepID at the claimed time.
|
|
33
|
-
- The RepID fits within the 32-bit range check relative to the threshold.
|
|
34
|
-
- The statement claim (score > threshold) is cryptographically consistent with the proof.
|
|
35
|
-
|
|
36
|
-
## Bundle size
|
|
37
|
-
| Target | .wasm size |
|
|
38
|
-
|---------|-----------|
|
|
39
|
-
| bundler |
|
|
40
|
-
| nodejs |
|
|
41
|
-
| web |
|
|
42
|
-
|
|
43
|
-
## Performance
|
|
44
|
-
Verify time (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
# @hyperdag/proof-verifier
|
|
2
|
+
Verify HyperDAG STARK proofs in your browser or Node app. No server trust.
|
|
3
|
+
|
|
4
|
+
## Why this exists
|
|
5
|
+
HyperDAG's zkp-postcard service generates Plonky3 STARK proofs for every agent decision. If you trust HyperDAG's server when it says `verified: true`, you're just trusting a server. With this package, your code verifies the cryptographic proof itself — locally, deterministically, with no network call.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
```bash
|
|
9
|
+
npm install @hyperdag/proof-verifier
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage (3 lines)
|
|
13
|
+
```js
|
|
14
|
+
import { verify } from '@hyperdag/proof-verifier';
|
|
15
|
+
const result = await verify(proofBytes, statement);
|
|
16
|
+
console.log(result.verified); // true | false
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## End-to-end example with the SDK
|
|
20
|
+
```js
|
|
21
|
+
import { TrustShell } from '@hyperdag/trustshell';
|
|
22
|
+
import { verify } from '@hyperdag/proof-verifier';
|
|
23
|
+
|
|
24
|
+
const trust = new TrustShell({ ...config });
|
|
25
|
+
const decision = await trust.report({ ... });
|
|
26
|
+
const proof = await trust.getProof(decision.proof_job_id);
|
|
27
|
+
const result = await verify(proof.proof_bytes, proof.statement);
|
|
28
|
+
if (!result.verified) throw new Error('proof failed verification — DO NOT TRUST');
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## What gets verified
|
|
32
|
+
- The agent had the claimed RepID at the claimed time.
|
|
33
|
+
- The RepID fits within the 32-bit range check relative to the threshold.
|
|
34
|
+
- The statement claim (score > threshold) is cryptographically consistent with the proof.
|
|
35
|
+
|
|
36
|
+
## Bundle size
|
|
37
|
+
| Target | .wasm size |
|
|
38
|
+
|---------|-----------|
|
|
39
|
+
| bundler | 230 KB |
|
|
40
|
+
| nodejs | 230 KB |
|
|
41
|
+
| web | 230 KB |
|
|
42
|
+
|
|
43
|
+
## Performance
|
|
44
|
+
Verify time (avg on Node 22, Windows): ~110 ms
|
|
45
|
+
Verify time (estimated Chrome/M3): ~150 ms
|
|
46
|
+
|
|
47
|
+
## Plonky3 version pinning
|
|
48
|
+
This verifier is pinned to the EXACT Plonky3 revisions used by zkp-postcard. Mismatched versions cannot verify. See Cargo.toml.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
MIT OR Apache-2.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
export function init_panic_hook(): void;
|
|
5
|
-
|
|
6
|
-
export function verify_proof(input_json: string): string;
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export function init_panic_hook(): void;
|
|
5
|
+
|
|
6
|
+
export function verify_proof(input_json: string): string;
|