@crisp-e3/zk-inputs 0.2.1-test → 0.2.3-test
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/dist/{web/index.js → index.js} +1 -1
- package/dist/{web/index_base64.js → index_base64.js} +1 -1
- package/main.js +20 -0
- package/package.json +11 -42
- package/dist/node/index.d.ts +0 -42
- package/dist/node/index.js +0 -408
- package/dist/node/index_bg.wasm +0 -0
- package/dist/node/index_bg.wasm.d.ts +0 -18
- package/init.d.ts +0 -8
- package/init_node.cjs +0 -9
- package/init_node.js +0 -9
- package/init_web.js +0 -29
- /package/dist/{web/index.d.ts → index.d.ts} +0 -0
package/main.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
//
|
|
3
|
+
// This file is provided WITHOUT ANY WARRANTY;
|
|
4
|
+
// without even the implied warranty of MERCHANTABILITY
|
|
5
|
+
// or FITNESS FOR A PARTICULAR PURPOSE.
|
|
6
|
+
|
|
7
|
+
import { initSync } from "./dist/index.js";
|
|
8
|
+
import base64 from "./dist/index_base64.js";
|
|
9
|
+
|
|
10
|
+
const binaryString = atob(base64);
|
|
11
|
+
const len = binaryString.length;
|
|
12
|
+
const bytes = new Uint8Array(len);
|
|
13
|
+
|
|
14
|
+
for (let i = 0; i < len; i++) {
|
|
15
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
initSync({ module: bytes });
|
|
19
|
+
|
|
20
|
+
export * from "./dist/index.js";
|
package/package.json
CHANGED
|
@@ -2,57 +2,26 @@
|
|
|
2
2
|
"name": "@crisp-e3/zk-inputs",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Core logic to pre-compute CRISP ZK inputs (WASM/JavaScript bindings).",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.3-test",
|
|
6
6
|
"license": "LGPL-3.0-only",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/gnosisguild/enclave"
|
|
10
10
|
},
|
|
11
|
-
"main": "
|
|
12
|
-
"module": "
|
|
13
|
-
"types": "dist/
|
|
14
|
-
"files": [
|
|
15
|
-
"dist/",
|
|
16
|
-
"dist/node/**",
|
|
17
|
-
"dist/web/**",
|
|
18
|
-
"init_node.js",
|
|
19
|
-
"init_node.cjs",
|
|
20
|
-
"init_web.js",
|
|
21
|
-
"init.d.ts"
|
|
22
|
-
],
|
|
11
|
+
"main": "main.js",
|
|
12
|
+
"module": "main.js",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
23
14
|
"exports": {
|
|
24
15
|
".": {
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
"browser": {
|
|
30
|
-
"types": "./dist/web/index.d.ts",
|
|
31
|
-
"default": "./dist/web/index.js"
|
|
32
|
-
},
|
|
33
|
-
"default": {
|
|
34
|
-
"types": "./dist/web/index.d.ts",
|
|
35
|
-
"default": "./dist/web/index.js"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"./init": {
|
|
39
|
-
"node": {
|
|
40
|
-
"types": "./init.d.ts",
|
|
41
|
-
"import": "./init_node.js",
|
|
42
|
-
"require": "./init_node.cjs"
|
|
43
|
-
},
|
|
44
|
-
"browser": {
|
|
45
|
-
"types": "./init.d.ts",
|
|
46
|
-
"default": "./init_web.js"
|
|
47
|
-
},
|
|
48
|
-
"default": {
|
|
49
|
-
"types": "./init.d.ts",
|
|
50
|
-
"import": "./init_node.js",
|
|
51
|
-
"require": "./init_node.cjs",
|
|
52
|
-
"default": "./init_web.js"
|
|
53
|
-
}
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./main.js",
|
|
18
|
+
"default": "./main.js"
|
|
54
19
|
}
|
|
55
20
|
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist/",
|
|
23
|
+
"main.js"
|
|
24
|
+
],
|
|
56
25
|
"publishConfig": {
|
|
57
26
|
"access": "public"
|
|
58
27
|
},
|
package/dist/node/index.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* JavaScript-compatible CRISP ZK inputs generator.
|
|
5
|
-
*/
|
|
6
|
-
export class ZKInputsGenerator {
|
|
7
|
-
free(): void;
|
|
8
|
-
[Symbol.dispose](): void;
|
|
9
|
-
/**
|
|
10
|
-
* Create a new JavaScript CRISP ZK inputs generator with the specified BFV parameters.
|
|
11
|
-
*
|
|
12
|
-
* # Arguments
|
|
13
|
-
* - `degree`: Polynomial degree
|
|
14
|
-
* - `plaintext_modulus`: Plaintext modulus (will be converted to u64)
|
|
15
|
-
* - `moduli`: Array of moduli (will be converted to Vec<u64>)
|
|
16
|
-
*/
|
|
17
|
-
constructor(degree: number, plaintext_modulus: bigint, moduli: BigInt64Array);
|
|
18
|
-
/**
|
|
19
|
-
* Create a new JavaScript CRISP ZK inputs generator with default BFV parameters.
|
|
20
|
-
*/
|
|
21
|
-
static withDefaults(): ZKInputsGenerator;
|
|
22
|
-
/**
|
|
23
|
-
* Generate a CRISP ZK inputs from JavaScript.
|
|
24
|
-
*/
|
|
25
|
-
generateInputs(prev_ciphertext: Uint8Array, public_key: Uint8Array, vote: BigInt64Array): any;
|
|
26
|
-
/**
|
|
27
|
-
* Generate a public key from JavaScript.
|
|
28
|
-
*/
|
|
29
|
-
generatePublicKey(): Uint8Array;
|
|
30
|
-
/**
|
|
31
|
-
* Encrypt a vote from JavaScript.
|
|
32
|
-
*/
|
|
33
|
-
encryptVote(public_key: Uint8Array, vote: BigInt64Array): Uint8Array;
|
|
34
|
-
/**
|
|
35
|
-
* Get the BFV parameters used by the generator.
|
|
36
|
-
*/
|
|
37
|
-
getBFVParams(): any;
|
|
38
|
-
/**
|
|
39
|
-
* Get the version of the library.
|
|
40
|
-
*/
|
|
41
|
-
static version(): string;
|
|
42
|
-
}
|
package/dist/node/index.js
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
let imports = {};
|
|
3
|
-
imports['__wbindgen_placeholder__'] = module.exports;
|
|
4
|
-
|
|
5
|
-
function addToExternrefTable0(obj) {
|
|
6
|
-
const idx = wasm.__externref_table_alloc();
|
|
7
|
-
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
8
|
-
return idx;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function handleError(f, args) {
|
|
12
|
-
try {
|
|
13
|
-
return f.apply(this, args);
|
|
14
|
-
} catch (e) {
|
|
15
|
-
const idx = addToExternrefTable0(e);
|
|
16
|
-
wasm.__wbindgen_exn_store(idx);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
let cachedUint8ArrayMemory0 = null;
|
|
21
|
-
|
|
22
|
-
function getUint8ArrayMemory0() {
|
|
23
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
24
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
25
|
-
}
|
|
26
|
-
return cachedUint8ArrayMemory0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
30
|
-
|
|
31
|
-
cachedTextDecoder.decode();
|
|
32
|
-
|
|
33
|
-
function decodeText(ptr, len) {
|
|
34
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function getStringFromWasm0(ptr, len) {
|
|
38
|
-
ptr = ptr >>> 0;
|
|
39
|
-
return decodeText(ptr, len);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
43
|
-
ptr = ptr >>> 0;
|
|
44
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function isLikeNone(x) {
|
|
48
|
-
return x === undefined || x === null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let cachedBigUint64ArrayMemory0 = null;
|
|
52
|
-
|
|
53
|
-
function getBigUint64ArrayMemory0() {
|
|
54
|
-
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
|
|
55
|
-
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
56
|
-
}
|
|
57
|
-
return cachedBigUint64ArrayMemory0;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
let WASM_VECTOR_LEN = 0;
|
|
61
|
-
|
|
62
|
-
function passArray64ToWasm0(arg, malloc) {
|
|
63
|
-
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
64
|
-
getBigUint64ArrayMemory0().set(arg, ptr / 8);
|
|
65
|
-
WASM_VECTOR_LEN = arg.length;
|
|
66
|
-
return ptr;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function takeFromExternrefTable0(idx) {
|
|
70
|
-
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
71
|
-
wasm.__externref_table_dealloc(idx);
|
|
72
|
-
return value;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
76
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
77
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
78
|
-
WASM_VECTOR_LEN = arg.length;
|
|
79
|
-
return ptr;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const ZKInputsGeneratorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
83
|
-
? { register: () => {}, unregister: () => {} }
|
|
84
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_zkinputsgenerator_free(ptr >>> 0, 1));
|
|
85
|
-
/**
|
|
86
|
-
* JavaScript-compatible CRISP ZK inputs generator.
|
|
87
|
-
*/
|
|
88
|
-
class ZKInputsGenerator {
|
|
89
|
-
|
|
90
|
-
static __wrap(ptr) {
|
|
91
|
-
ptr = ptr >>> 0;
|
|
92
|
-
const obj = Object.create(ZKInputsGenerator.prototype);
|
|
93
|
-
obj.__wbg_ptr = ptr;
|
|
94
|
-
ZKInputsGeneratorFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
95
|
-
return obj;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
__destroy_into_raw() {
|
|
99
|
-
const ptr = this.__wbg_ptr;
|
|
100
|
-
this.__wbg_ptr = 0;
|
|
101
|
-
ZKInputsGeneratorFinalization.unregister(this);
|
|
102
|
-
return ptr;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
free() {
|
|
106
|
-
const ptr = this.__destroy_into_raw();
|
|
107
|
-
wasm.__wbg_zkinputsgenerator_free(ptr, 0);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Create a new JavaScript CRISP ZK inputs generator with the specified BFV parameters.
|
|
111
|
-
*
|
|
112
|
-
* # Arguments
|
|
113
|
-
* - `degree`: Polynomial degree
|
|
114
|
-
* - `plaintext_modulus`: Plaintext modulus (will be converted to u64)
|
|
115
|
-
* - `moduli`: Array of moduli (will be converted to Vec<u64>)
|
|
116
|
-
* @param {number} degree
|
|
117
|
-
* @param {bigint} plaintext_modulus
|
|
118
|
-
* @param {BigInt64Array} moduli
|
|
119
|
-
*/
|
|
120
|
-
constructor(degree, plaintext_modulus, moduli) {
|
|
121
|
-
const ptr0 = passArray64ToWasm0(moduli, wasm.__wbindgen_malloc);
|
|
122
|
-
const len0 = WASM_VECTOR_LEN;
|
|
123
|
-
const ret = wasm.zkinputsgenerator_new(degree, plaintext_modulus, ptr0, len0);
|
|
124
|
-
if (ret[2]) {
|
|
125
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
126
|
-
}
|
|
127
|
-
this.__wbg_ptr = ret[0] >>> 0;
|
|
128
|
-
ZKInputsGeneratorFinalization.register(this, this.__wbg_ptr, this);
|
|
129
|
-
return this;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Create a new JavaScript CRISP ZK inputs generator with default BFV parameters.
|
|
133
|
-
* @returns {ZKInputsGenerator}
|
|
134
|
-
*/
|
|
135
|
-
static withDefaults() {
|
|
136
|
-
const ret = wasm.zkinputsgenerator_withDefaults();
|
|
137
|
-
if (ret[2]) {
|
|
138
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
139
|
-
}
|
|
140
|
-
return ZKInputsGenerator.__wrap(ret[0]);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Generate a CRISP ZK inputs from JavaScript.
|
|
144
|
-
* @param {Uint8Array} prev_ciphertext
|
|
145
|
-
* @param {Uint8Array} public_key
|
|
146
|
-
* @param {BigInt64Array} vote
|
|
147
|
-
* @returns {any}
|
|
148
|
-
*/
|
|
149
|
-
generateInputs(prev_ciphertext, public_key, vote) {
|
|
150
|
-
const ptr0 = passArray8ToWasm0(prev_ciphertext, wasm.__wbindgen_malloc);
|
|
151
|
-
const len0 = WASM_VECTOR_LEN;
|
|
152
|
-
const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
|
|
153
|
-
const len1 = WASM_VECTOR_LEN;
|
|
154
|
-
const ptr2 = passArray64ToWasm0(vote, wasm.__wbindgen_malloc);
|
|
155
|
-
const len2 = WASM_VECTOR_LEN;
|
|
156
|
-
const ret = wasm.zkinputsgenerator_generateInputs(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
157
|
-
if (ret[2]) {
|
|
158
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
159
|
-
}
|
|
160
|
-
return takeFromExternrefTable0(ret[0]);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Generate a public key from JavaScript.
|
|
164
|
-
* @returns {Uint8Array}
|
|
165
|
-
*/
|
|
166
|
-
generatePublicKey() {
|
|
167
|
-
const ret = wasm.zkinputsgenerator_generatePublicKey(this.__wbg_ptr);
|
|
168
|
-
if (ret[3]) {
|
|
169
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
170
|
-
}
|
|
171
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
172
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
173
|
-
return v1;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Encrypt a vote from JavaScript.
|
|
177
|
-
* @param {Uint8Array} public_key
|
|
178
|
-
* @param {BigInt64Array} vote
|
|
179
|
-
* @returns {Uint8Array}
|
|
180
|
-
*/
|
|
181
|
-
encryptVote(public_key, vote) {
|
|
182
|
-
const ptr0 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
|
|
183
|
-
const len0 = WASM_VECTOR_LEN;
|
|
184
|
-
const ptr1 = passArray64ToWasm0(vote, wasm.__wbindgen_malloc);
|
|
185
|
-
const len1 = WASM_VECTOR_LEN;
|
|
186
|
-
const ret = wasm.zkinputsgenerator_encryptVote(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
187
|
-
if (ret[3]) {
|
|
188
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
189
|
-
}
|
|
190
|
-
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
191
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
192
|
-
return v3;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Get the BFV parameters used by the generator.
|
|
196
|
-
* @returns {any}
|
|
197
|
-
*/
|
|
198
|
-
getBFVParams() {
|
|
199
|
-
const ret = wasm.zkinputsgenerator_getBFVParams(this.__wbg_ptr);
|
|
200
|
-
if (ret[2]) {
|
|
201
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
202
|
-
}
|
|
203
|
-
return takeFromExternrefTable0(ret[0]);
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Get the version of the library.
|
|
207
|
-
* @returns {string}
|
|
208
|
-
*/
|
|
209
|
-
static version() {
|
|
210
|
-
let deferred1_0;
|
|
211
|
-
let deferred1_1;
|
|
212
|
-
try {
|
|
213
|
-
const ret = wasm.zkinputsgenerator_version();
|
|
214
|
-
deferred1_0 = ret[0];
|
|
215
|
-
deferred1_1 = ret[1];
|
|
216
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
217
|
-
} finally {
|
|
218
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
if (Symbol.dispose) ZKInputsGenerator.prototype[Symbol.dispose] = ZKInputsGenerator.prototype.free;
|
|
223
|
-
|
|
224
|
-
exports.ZKInputsGenerator = ZKInputsGenerator;
|
|
225
|
-
|
|
226
|
-
exports.__wbg_BigInt_7bf8b8b2f99c431a = function() { return handleError(function (arg0) {
|
|
227
|
-
const ret = BigInt(arg0);
|
|
228
|
-
return ret;
|
|
229
|
-
}, arguments) };
|
|
230
|
-
|
|
231
|
-
exports.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
|
|
232
|
-
const ret = typeof(arg0) === 'function';
|
|
233
|
-
return ret;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
exports.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
|
|
237
|
-
const val = arg0;
|
|
238
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
239
|
-
return ret;
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
exports.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
|
|
243
|
-
const ret = typeof(arg0) === 'string';
|
|
244
|
-
return ret;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
exports.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
|
|
248
|
-
const ret = arg0 === undefined;
|
|
249
|
-
return ret;
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
exports.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
|
|
253
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
exports.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
|
|
257
|
-
const ret = arg0.call(arg1, arg2);
|
|
258
|
-
return ret;
|
|
259
|
-
}, arguments) };
|
|
260
|
-
|
|
261
|
-
exports.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
|
|
262
|
-
const ret = arg0.call(arg1);
|
|
263
|
-
return ret;
|
|
264
|
-
}, arguments) };
|
|
265
|
-
|
|
266
|
-
exports.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
|
|
267
|
-
const ret = arg0.crypto;
|
|
268
|
-
return ret;
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
exports.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
|
|
272
|
-
arg0.getRandomValues(arg1);
|
|
273
|
-
}, arguments) };
|
|
274
|
-
|
|
275
|
-
exports.__wbg_length_69bca3cb64fc8748 = function(arg0) {
|
|
276
|
-
const ret = arg0.length;
|
|
277
|
-
return ret;
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
exports.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
|
|
281
|
-
const ret = arg0.msCrypto;
|
|
282
|
-
return ret;
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
exports.__wbg_new_1acc0b6eea89d040 = function() {
|
|
286
|
-
const ret = new Object();
|
|
287
|
-
return ret;
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
exports.__wbg_new_e17d9f43105b08be = function() {
|
|
291
|
-
const ret = new Array();
|
|
292
|
-
return ret;
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
exports.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
|
|
296
|
-
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
297
|
-
return ret;
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
exports.__wbg_new_with_length_01aa0dc35aa13543 = function(arg0) {
|
|
301
|
-
const ret = new Uint8Array(arg0 >>> 0);
|
|
302
|
-
return ret;
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
exports.__wbg_node_905d3e251edff8a2 = function(arg0) {
|
|
306
|
-
const ret = arg0.node;
|
|
307
|
-
return ret;
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
exports.__wbg_parse_2a704d6b78abb2b8 = function() { return handleError(function (arg0, arg1) {
|
|
311
|
-
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
312
|
-
return ret;
|
|
313
|
-
}, arguments) };
|
|
314
|
-
|
|
315
|
-
exports.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
|
|
316
|
-
const ret = arg0.process;
|
|
317
|
-
return ret;
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
exports.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
|
|
321
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
exports.__wbg_push_df81a39d04db858c = function(arg0, arg1) {
|
|
325
|
-
const ret = arg0.push(arg1);
|
|
326
|
-
return ret;
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
exports.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
|
|
330
|
-
arg0.randomFillSync(arg1);
|
|
331
|
-
}, arguments) };
|
|
332
|
-
|
|
333
|
-
exports.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
|
|
334
|
-
const ret = module.require;
|
|
335
|
-
return ret;
|
|
336
|
-
}, arguments) };
|
|
337
|
-
|
|
338
|
-
exports.__wbg_set_c2abbebe8b9ebee1 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
339
|
-
const ret = Reflect.set(arg0, arg1, arg2);
|
|
340
|
-
return ret;
|
|
341
|
-
}, arguments) };
|
|
342
|
-
|
|
343
|
-
exports.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
|
|
344
|
-
const ret = typeof global === 'undefined' ? null : global;
|
|
345
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
exports.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
|
|
349
|
-
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
350
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
exports.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
|
|
354
|
-
const ret = typeof self === 'undefined' ? null : self;
|
|
355
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
exports.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
|
|
359
|
-
const ret = typeof window === 'undefined' ? null : window;
|
|
360
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
exports.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
|
|
364
|
-
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
365
|
-
return ret;
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
exports.__wbg_versions_c01dfd4722a88165 = function(arg0) {
|
|
369
|
-
const ret = arg0.versions;
|
|
370
|
-
return ret;
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
374
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
375
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
376
|
-
return ret;
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
exports.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
380
|
-
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
381
|
-
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
382
|
-
return ret;
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
exports.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
386
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
387
|
-
const ret = arg0;
|
|
388
|
-
return ret;
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
exports.__wbindgen_init_externref_table = function() {
|
|
392
|
-
const table = wasm.__wbindgen_externrefs;
|
|
393
|
-
const offset = table.grow(4);
|
|
394
|
-
table.set(0, undefined);
|
|
395
|
-
table.set(offset + 0, undefined);
|
|
396
|
-
table.set(offset + 1, null);
|
|
397
|
-
table.set(offset + 2, true);
|
|
398
|
-
table.set(offset + 3, false);
|
|
399
|
-
;
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
const wasmPath = `${__dirname}/index_bg.wasm`;
|
|
403
|
-
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
404
|
-
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
405
|
-
const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
406
|
-
|
|
407
|
-
wasm.__wbindgen_start();
|
|
408
|
-
|
package/dist/node/index_bg.wasm
DELETED
|
Binary file
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const __wbg_zkinputsgenerator_free: (a: number, b: number) => void;
|
|
5
|
-
export const zkinputsgenerator_new: (a: number, b: bigint, c: number, d: number) => [number, number, number];
|
|
6
|
-
export const zkinputsgenerator_withDefaults: () => [number, number, number];
|
|
7
|
-
export const zkinputsgenerator_generateInputs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
8
|
-
export const zkinputsgenerator_generatePublicKey: (a: number) => [number, number, number, number];
|
|
9
|
-
export const zkinputsgenerator_encryptVote: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
10
|
-
export const zkinputsgenerator_getBFVParams: (a: number) => [number, number, number];
|
|
11
|
-
export const zkinputsgenerator_version: () => [number, number];
|
|
12
|
-
export const __wbindgen_exn_store: (a: number) => void;
|
|
13
|
-
export const __externref_table_alloc: () => number;
|
|
14
|
-
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
15
|
-
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
16
|
-
export const __externref_table_dealloc: (a: number) => void;
|
|
17
|
-
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
18
|
-
export const __wbindgen_start: () => void;
|
package/init.d.ts
DELETED
package/init_node.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
-
//
|
|
3
|
-
// This file is provided WITHOUT ANY WARRANTY;
|
|
4
|
-
// without even the implied warranty of MERCHANTABILITY
|
|
5
|
-
// or FITNESS FOR A PARTICULAR PURPOSE.
|
|
6
|
-
|
|
7
|
-
module.exports = async function init() {
|
|
8
|
-
// Node does not need to be loaded async
|
|
9
|
-
};
|
package/init_node.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
-
//
|
|
3
|
-
// This file is provided WITHOUT ANY WARRANTY;
|
|
4
|
-
// without even the implied warranty of MERCHANTABILITY
|
|
5
|
-
// or FITNESS FOR A PARTICULAR PURPOSE.
|
|
6
|
-
|
|
7
|
-
export default async function init() {
|
|
8
|
-
// Node does not need to be loaded async
|
|
9
|
-
}
|
package/init_web.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
-
//
|
|
3
|
-
// This file is provided WITHOUT ANY WARRANTY;
|
|
4
|
-
// without even the implied warranty of MERCHANTABILITY
|
|
5
|
-
// or FITNESS FOR A PARTICULAR PURPOSE.
|
|
6
|
-
|
|
7
|
-
import * as bindgen from "./dist/web/index.js";
|
|
8
|
-
|
|
9
|
-
let promise;
|
|
10
|
-
|
|
11
|
-
export default async function init() {
|
|
12
|
-
promise ??= (async () => {
|
|
13
|
-
const { default: base64 } = await import("./dist/web/index_base64.js");
|
|
14
|
-
|
|
15
|
-
const binaryString = atob(base64);
|
|
16
|
-
const len = binaryString.length;
|
|
17
|
-
const bytes = new Uint8Array(len);
|
|
18
|
-
|
|
19
|
-
for (let i = 0; i < len; i++) {
|
|
20
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
bindgen.initSync(bytes);
|
|
24
|
-
|
|
25
|
-
return bindgen;
|
|
26
|
-
})();
|
|
27
|
-
|
|
28
|
-
return promise;
|
|
29
|
-
}
|
|
File without changes
|