@crisp-e3/zk-inputs 0.5.7 → 0.5.9
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/index.d.ts +79 -70
- package/dist/index.js +413 -298
- package/dist/index_base64.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,88 +1,97 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* JavaScript-compatible CRISP ZK inputs generator.
|
|
6
|
+
*/
|
|
4
7
|
export class ZKInputsGenerator {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
8
|
+
free(): void;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
/**
|
|
11
|
+
* Compute the commitment to a set of ciphertext polynomials from JavaScript.
|
|
12
|
+
*/
|
|
13
|
+
computeCiphertextCommitment(ct0is: any, ct1is: any): string;
|
|
14
|
+
/**
|
|
15
|
+
* Encrypt a vote from JavaScript.
|
|
16
|
+
*/
|
|
17
|
+
encryptVote(public_key: Uint8Array, vote: BigInt64Array): Uint8Array;
|
|
18
|
+
/**
|
|
19
|
+
* Generate CRISP ZK inputs from JavaScript.
|
|
20
|
+
*/
|
|
21
|
+
generateInputs(prev_ciphertext: Uint8Array, public_key: Uint8Array, vote: BigInt64Array): any;
|
|
22
|
+
/**
|
|
23
|
+
* Generate CRISP ZK inputs for a vote update (either from voter or as a masker) from JavaScript.
|
|
24
|
+
*/
|
|
25
|
+
generateInputsForUpdate(prev_ciphertext: Uint8Array, public_key: Uint8Array, vote: BigInt64Array): any;
|
|
26
|
+
/**
|
|
27
|
+
* Generate a public key from JavaScript.
|
|
28
|
+
*/
|
|
29
|
+
generatePublicKey(): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Get the BFV parameters used by the generator.
|
|
32
|
+
*/
|
|
33
|
+
getBFVParams(): any;
|
|
34
|
+
/**
|
|
35
|
+
* Create a new JavaScript CRISP ZK inputs generator with the specified BFV parameters.
|
|
36
|
+
*
|
|
37
|
+
* # Arguments
|
|
38
|
+
* - `degree`: Polynomial degree
|
|
39
|
+
* - `plaintext_modulus`: Plaintext modulus (will be converted to u64)
|
|
40
|
+
* - `moduli`: Array of moduli (will be converted to Vec<u64>)
|
|
41
|
+
*/
|
|
42
|
+
constructor(degree: number, plaintext_modulus: bigint, moduli: BigInt64Array);
|
|
43
|
+
/**
|
|
44
|
+
* Get the version of the library.
|
|
45
|
+
*/
|
|
46
|
+
static version(): string;
|
|
47
|
+
/**
|
|
48
|
+
* Create a new JavaScript CRISP ZK inputs generator with default BFV parameters.
|
|
49
|
+
*/
|
|
50
|
+
static withDefaults(): ZKInputsGenerator;
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
47
54
|
|
|
48
55
|
export interface InitOutput {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
readonly memory: WebAssembly.Memory;
|
|
57
|
+
readonly __wbg_zkinputsgenerator_free: (a: number, b: number) => void;
|
|
58
|
+
readonly zkinputsgenerator_new: (a: number, b: bigint, c: number, d: number) => [number, number, number];
|
|
59
|
+
readonly zkinputsgenerator_withDefaults: () => [number, number, number];
|
|
60
|
+
readonly zkinputsgenerator_generateInputs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
61
|
+
readonly zkinputsgenerator_generateInputsForUpdate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
62
|
+
readonly zkinputsgenerator_generatePublicKey: (a: number) => [number, number, number, number];
|
|
63
|
+
readonly zkinputsgenerator_computeCiphertextCommitment: (a: number, b: any, c: any) => [number, number, number, number];
|
|
64
|
+
readonly zkinputsgenerator_encryptVote: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
65
|
+
readonly zkinputsgenerator_getBFVParams: (a: number) => [number, number, number];
|
|
66
|
+
readonly zkinputsgenerator_version: () => [number, number];
|
|
67
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
68
|
+
readonly __externref_table_alloc: () => number;
|
|
69
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
70
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
71
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
72
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
73
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
74
|
+
readonly __wbindgen_start: () => void;
|
|
66
75
|
}
|
|
67
76
|
|
|
68
77
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
69
78
|
|
|
70
79
|
/**
|
|
71
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
72
|
-
* a precompiled `WebAssembly.Module`.
|
|
73
|
-
*
|
|
74
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
75
|
-
*
|
|
76
|
-
* @returns {InitOutput}
|
|
77
|
-
*/
|
|
80
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
81
|
+
* a precompiled `WebAssembly.Module`.
|
|
82
|
+
*
|
|
83
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
84
|
+
*
|
|
85
|
+
* @returns {InitOutput}
|
|
86
|
+
*/
|
|
78
87
|
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
79
88
|
|
|
80
89
|
/**
|
|
81
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
82
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
83
|
-
*
|
|
84
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
85
|
-
*
|
|
86
|
-
* @returns {Promise<InitOutput>}
|
|
87
|
-
*/
|
|
90
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
91
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
92
|
+
*
|
|
93
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
94
|
+
*
|
|
95
|
+
* @returns {Promise<InitOutput>}
|
|
96
|
+
*/
|
|
88
97
|
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|