tfhe 0.0.1 → 0.2.4
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/LICENSE +28 -0
- package/package.json +23 -14
- package/tfhe.d.ts +483 -0
- package/tfhe.js +1530 -0
- package/tfhe_bg.wasm +0 -0
- package/README.md +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause Clear License
|
|
2
|
+
|
|
3
|
+
Copyright © 2023 ZAMA.
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
7
|
+
are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this
|
|
13
|
+
list of conditions and the following disclaimer in the documentation and/or other
|
|
14
|
+
materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of ZAMA nor the names of its contributors may be used to endorse
|
|
17
|
+
or promote products derived from this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE ZAMA AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
|
21
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
22
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
23
|
+
ZAMA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|
24
|
+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
25
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
26
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
27
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
28
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/package.json
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tfhe",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
3
|
+
"description": "TFHE-rs is a fully homomorphic encryption (FHE) library that implements Zama's variant of TFHE.",
|
|
4
|
+
"version": "0.2.4",
|
|
5
|
+
"license": "BSD-3-Clause-Clear",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/zama-ai/tfhe-rs"
|
|
8
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"tfhe_bg.wasm",
|
|
12
|
+
"tfhe.js",
|
|
13
|
+
"tfhe.d.ts"
|
|
14
|
+
],
|
|
15
|
+
"module": "tfhe.js",
|
|
16
|
+
"homepage": "https://zama.ai/",
|
|
17
|
+
"types": "tfhe.d.ts",
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"./snippets/*"
|
|
20
|
+
],
|
|
9
21
|
"keywords": [
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"wasm",
|
|
22
|
+
"fully",
|
|
23
|
+
"homomorphic",
|
|
24
|
+
"encryption",
|
|
14
25
|
"fhe",
|
|
15
|
-
"
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
"license": "ISC"
|
|
19
|
-
}
|
|
26
|
+
"cryptography"
|
|
27
|
+
]
|
|
28
|
+
}
|
package/tfhe.d.ts
ADDED
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
*/
|
|
5
|
+
export enum BooleanParameterSet {
|
|
6
|
+
Default = 0,
|
|
7
|
+
TfheLib = 1,
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
*/
|
|
11
|
+
export class Boolean {
|
|
12
|
+
free(): void;
|
|
13
|
+
/**
|
|
14
|
+
* @param {number} parameter_choice
|
|
15
|
+
* @returns {BooleanParameters}
|
|
16
|
+
*/
|
|
17
|
+
static get_parameters(parameter_choice: number): BooleanParameters;
|
|
18
|
+
/**
|
|
19
|
+
* @param {number} lwe_dimension
|
|
20
|
+
* @param {number} glwe_dimension
|
|
21
|
+
* @param {number} polynomial_size
|
|
22
|
+
* @param {number} lwe_modular_std_dev
|
|
23
|
+
* @param {number} glwe_modular_std_dev
|
|
24
|
+
* @param {number} pbs_base_log
|
|
25
|
+
* @param {number} pbs_level
|
|
26
|
+
* @param {number} ks_base_log
|
|
27
|
+
* @param {number} ks_level
|
|
28
|
+
* @returns {BooleanParameters}
|
|
29
|
+
*/
|
|
30
|
+
static new_parameters(lwe_dimension: number, glwe_dimension: number, polynomial_size: number, lwe_modular_std_dev: number, glwe_modular_std_dev: number, pbs_base_log: number, pbs_level: number, ks_base_log: number, ks_level: number): BooleanParameters;
|
|
31
|
+
/**
|
|
32
|
+
* @param {bigint} seed_high_bytes
|
|
33
|
+
* @param {bigint} seed_low_bytes
|
|
34
|
+
* @param {BooleanParameters} parameters
|
|
35
|
+
* @returns {BooleanClientKey}
|
|
36
|
+
*/
|
|
37
|
+
static new_client_key_from_seed_and_parameters(seed_high_bytes: bigint, seed_low_bytes: bigint, parameters: BooleanParameters): BooleanClientKey;
|
|
38
|
+
/**
|
|
39
|
+
* @param {BooleanParameters} parameters
|
|
40
|
+
* @returns {BooleanClientKey}
|
|
41
|
+
*/
|
|
42
|
+
static new_client_key(parameters: BooleanParameters): BooleanClientKey;
|
|
43
|
+
/**
|
|
44
|
+
* @param {BooleanClientKey} client_key
|
|
45
|
+
* @returns {BooleanPublicKey}
|
|
46
|
+
*/
|
|
47
|
+
static new_public_key(client_key: BooleanClientKey): BooleanPublicKey;
|
|
48
|
+
/**
|
|
49
|
+
* @param {BooleanClientKey} client_key
|
|
50
|
+
* @returns {BooleanCompressedServerKey}
|
|
51
|
+
*/
|
|
52
|
+
static new_compressed_server_key(client_key: BooleanClientKey): BooleanCompressedServerKey;
|
|
53
|
+
/**
|
|
54
|
+
* @param {BooleanClientKey} client_key
|
|
55
|
+
* @param {boolean} message
|
|
56
|
+
* @returns {BooleanCiphertext}
|
|
57
|
+
*/
|
|
58
|
+
static encrypt(client_key: BooleanClientKey, message: boolean): BooleanCiphertext;
|
|
59
|
+
/**
|
|
60
|
+
* @param {BooleanClientKey} client_key
|
|
61
|
+
* @param {boolean} message
|
|
62
|
+
* @returns {BooleanCompressedCiphertext}
|
|
63
|
+
*/
|
|
64
|
+
static encrypt_compressed(client_key: BooleanClientKey, message: boolean): BooleanCompressedCiphertext;
|
|
65
|
+
/**
|
|
66
|
+
* @param {BooleanCompressedCiphertext} compressed_ciphertext
|
|
67
|
+
* @returns {BooleanCiphertext}
|
|
68
|
+
*/
|
|
69
|
+
static decompress_ciphertext(compressed_ciphertext: BooleanCompressedCiphertext): BooleanCiphertext;
|
|
70
|
+
/**
|
|
71
|
+
* @param {BooleanPublicKey} public_key
|
|
72
|
+
* @param {boolean} message
|
|
73
|
+
* @returns {BooleanCiphertext}
|
|
74
|
+
*/
|
|
75
|
+
static encrypt_with_public_key(public_key: BooleanPublicKey, message: boolean): BooleanCiphertext;
|
|
76
|
+
/**
|
|
77
|
+
* @param {boolean} message
|
|
78
|
+
* @returns {BooleanCiphertext}
|
|
79
|
+
*/
|
|
80
|
+
trivial_encrypt(message: boolean): BooleanCiphertext;
|
|
81
|
+
/**
|
|
82
|
+
* @param {BooleanClientKey} client_key
|
|
83
|
+
* @param {BooleanCiphertext} ct
|
|
84
|
+
* @returns {boolean}
|
|
85
|
+
*/
|
|
86
|
+
static decrypt(client_key: BooleanClientKey, ct: BooleanCiphertext): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* @param {BooleanCiphertext} ciphertext
|
|
89
|
+
* @returns {Uint8Array}
|
|
90
|
+
*/
|
|
91
|
+
static serialize_ciphertext(ciphertext: BooleanCiphertext): Uint8Array;
|
|
92
|
+
/**
|
|
93
|
+
* @param {Uint8Array} buffer
|
|
94
|
+
* @returns {BooleanCiphertext}
|
|
95
|
+
*/
|
|
96
|
+
static deserialize_ciphertext(buffer: Uint8Array): BooleanCiphertext;
|
|
97
|
+
/**
|
|
98
|
+
* @param {BooleanCompressedCiphertext} ciphertext
|
|
99
|
+
* @returns {Uint8Array}
|
|
100
|
+
*/
|
|
101
|
+
static serialize_compressed_ciphertext(ciphertext: BooleanCompressedCiphertext): Uint8Array;
|
|
102
|
+
/**
|
|
103
|
+
* @param {Uint8Array} buffer
|
|
104
|
+
* @returns {BooleanCompressedCiphertext}
|
|
105
|
+
*/
|
|
106
|
+
static deserialize_compressed_ciphertext(buffer: Uint8Array): BooleanCompressedCiphertext;
|
|
107
|
+
/**
|
|
108
|
+
* @param {BooleanClientKey} client_key
|
|
109
|
+
* @returns {Uint8Array}
|
|
110
|
+
*/
|
|
111
|
+
static serialize_client_key(client_key: BooleanClientKey): Uint8Array;
|
|
112
|
+
/**
|
|
113
|
+
* @param {Uint8Array} buffer
|
|
114
|
+
* @returns {BooleanClientKey}
|
|
115
|
+
*/
|
|
116
|
+
static deserialize_client_key(buffer: Uint8Array): BooleanClientKey;
|
|
117
|
+
/**
|
|
118
|
+
* @param {BooleanPublicKey} public_key
|
|
119
|
+
* @returns {Uint8Array}
|
|
120
|
+
*/
|
|
121
|
+
static serialize_public_key(public_key: BooleanPublicKey): Uint8Array;
|
|
122
|
+
/**
|
|
123
|
+
* @param {Uint8Array} buffer
|
|
124
|
+
* @returns {BooleanPublicKey}
|
|
125
|
+
*/
|
|
126
|
+
static deserialize_public_key(buffer: Uint8Array): BooleanPublicKey;
|
|
127
|
+
/**
|
|
128
|
+
* @param {BooleanCompressedServerKey} server_key
|
|
129
|
+
* @returns {Uint8Array}
|
|
130
|
+
*/
|
|
131
|
+
static serialize_compressed_server_key(server_key: BooleanCompressedServerKey): Uint8Array;
|
|
132
|
+
/**
|
|
133
|
+
* @param {Uint8Array} buffer
|
|
134
|
+
* @returns {BooleanCompressedServerKey}
|
|
135
|
+
*/
|
|
136
|
+
static deserialize_compressed_server_key(buffer: Uint8Array): BooleanCompressedServerKey;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
*/
|
|
140
|
+
export class BooleanCiphertext {
|
|
141
|
+
free(): void;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
*/
|
|
145
|
+
export class BooleanClientKey {
|
|
146
|
+
free(): void;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
*/
|
|
150
|
+
export class BooleanCompressedCiphertext {
|
|
151
|
+
free(): void;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
*/
|
|
155
|
+
export class BooleanCompressedServerKey {
|
|
156
|
+
free(): void;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
*/
|
|
160
|
+
export class BooleanParameters {
|
|
161
|
+
free(): void;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
*/
|
|
165
|
+
export class BooleanPublicKey {
|
|
166
|
+
free(): void;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
*/
|
|
170
|
+
export class Shortint {
|
|
171
|
+
free(): void;
|
|
172
|
+
/**
|
|
173
|
+
* @param {number} message_bits
|
|
174
|
+
* @param {number} carry_bits
|
|
175
|
+
* @returns {ShortintParameters}
|
|
176
|
+
*/
|
|
177
|
+
static get_parameters(message_bits: number, carry_bits: number): ShortintParameters;
|
|
178
|
+
/**
|
|
179
|
+
* @param {number} message_bits
|
|
180
|
+
* @param {number} carry_bits
|
|
181
|
+
* @returns {ShortintParameters}
|
|
182
|
+
*/
|
|
183
|
+
static get_parameters_small(message_bits: number, carry_bits: number): ShortintParameters;
|
|
184
|
+
/**
|
|
185
|
+
* @param {number} lwe_dimension
|
|
186
|
+
* @param {number} glwe_dimension
|
|
187
|
+
* @param {number} polynomial_size
|
|
188
|
+
* @param {number} lwe_modular_std_dev
|
|
189
|
+
* @param {number} glwe_modular_std_dev
|
|
190
|
+
* @param {number} pbs_base_log
|
|
191
|
+
* @param {number} pbs_level
|
|
192
|
+
* @param {number} ks_base_log
|
|
193
|
+
* @param {number} ks_level
|
|
194
|
+
* @param {number} pfks_level
|
|
195
|
+
* @param {number} pfks_base_log
|
|
196
|
+
* @param {number} pfks_modular_std_dev
|
|
197
|
+
* @param {number} cbs_level
|
|
198
|
+
* @param {number} cbs_base_log
|
|
199
|
+
* @param {number} message_modulus
|
|
200
|
+
* @param {number} carry_modulus
|
|
201
|
+
* @param {number} modulus_power_of_2_exponent
|
|
202
|
+
* @returns {ShortintParameters}
|
|
203
|
+
*/
|
|
204
|
+
static new_parameters(lwe_dimension: number, glwe_dimension: number, polynomial_size: number, lwe_modular_std_dev: number, glwe_modular_std_dev: number, pbs_base_log: number, pbs_level: number, ks_base_log: number, ks_level: number, pfks_level: number, pfks_base_log: number, pfks_modular_std_dev: number, cbs_level: number, cbs_base_log: number, message_modulus: number, carry_modulus: number, modulus_power_of_2_exponent: number): ShortintParameters;
|
|
205
|
+
/**
|
|
206
|
+
* @param {bigint} seed_high_bytes
|
|
207
|
+
* @param {bigint} seed_low_bytes
|
|
208
|
+
* @param {ShortintParameters} parameters
|
|
209
|
+
* @returns {ShortintClientKey}
|
|
210
|
+
*/
|
|
211
|
+
static new_client_key_from_seed_and_parameters(seed_high_bytes: bigint, seed_low_bytes: bigint, parameters: ShortintParameters): ShortintClientKey;
|
|
212
|
+
/**
|
|
213
|
+
* @param {ShortintParameters} parameters
|
|
214
|
+
* @returns {ShortintClientKey}
|
|
215
|
+
*/
|
|
216
|
+
static new_client_key(parameters: ShortintParameters): ShortintClientKey;
|
|
217
|
+
/**
|
|
218
|
+
* @param {ShortintClientKey} client_key
|
|
219
|
+
* @returns {ShortintPublicKey}
|
|
220
|
+
*/
|
|
221
|
+
static new_public_key(client_key: ShortintClientKey): ShortintPublicKey;
|
|
222
|
+
/**
|
|
223
|
+
* @param {ShortintClientKey} client_key
|
|
224
|
+
* @returns {ShortintPublicKey}
|
|
225
|
+
*/
|
|
226
|
+
static new_public_key_small(client_key: ShortintClientKey): ShortintPublicKey;
|
|
227
|
+
/**
|
|
228
|
+
* @param {ShortintClientKey} client_key
|
|
229
|
+
* @returns {ShortintCompressedPublicKey}
|
|
230
|
+
*/
|
|
231
|
+
static new_compressed_public_key(client_key: ShortintClientKey): ShortintCompressedPublicKey;
|
|
232
|
+
/**
|
|
233
|
+
* @param {ShortintClientKey} client_key
|
|
234
|
+
* @returns {ShortintCompressedPublicKey}
|
|
235
|
+
*/
|
|
236
|
+
static new_compressed_public_key_small(client_key: ShortintClientKey): ShortintCompressedPublicKey;
|
|
237
|
+
/**
|
|
238
|
+
* @param {ShortintClientKey} client_key
|
|
239
|
+
* @returns {ShortintCompressedServerKey}
|
|
240
|
+
*/
|
|
241
|
+
static new_compressed_server_key(client_key: ShortintClientKey): ShortintCompressedServerKey;
|
|
242
|
+
/**
|
|
243
|
+
* @param {ShortintClientKey} client_key
|
|
244
|
+
* @param {bigint} message
|
|
245
|
+
* @returns {ShortintCiphertext}
|
|
246
|
+
*/
|
|
247
|
+
static encrypt(client_key: ShortintClientKey, message: bigint): ShortintCiphertext;
|
|
248
|
+
/**
|
|
249
|
+
* @param {ShortintClientKey} client_key
|
|
250
|
+
* @param {bigint} message
|
|
251
|
+
* @returns {ShortintCiphertext}
|
|
252
|
+
*/
|
|
253
|
+
static encrypt_small(client_key: ShortintClientKey, message: bigint): ShortintCiphertext;
|
|
254
|
+
/**
|
|
255
|
+
* @param {ShortintClientKey} client_key
|
|
256
|
+
* @param {bigint} message
|
|
257
|
+
* @returns {ShortintCompressedCiphertext}
|
|
258
|
+
*/
|
|
259
|
+
static encrypt_compressed(client_key: ShortintClientKey, message: bigint): ShortintCompressedCiphertext;
|
|
260
|
+
/**
|
|
261
|
+
* @param {ShortintClientKey} client_key
|
|
262
|
+
* @param {bigint} message
|
|
263
|
+
* @returns {ShortintCompressedCiphertext}
|
|
264
|
+
*/
|
|
265
|
+
static encrypt_compressed_small(client_key: ShortintClientKey, message: bigint): ShortintCompressedCiphertext;
|
|
266
|
+
/**
|
|
267
|
+
* @param {ShortintCompressedCiphertext} compressed_ciphertext
|
|
268
|
+
* @returns {ShortintCiphertext}
|
|
269
|
+
*/
|
|
270
|
+
static decompress_ciphertext(compressed_ciphertext: ShortintCompressedCiphertext): ShortintCiphertext;
|
|
271
|
+
/**
|
|
272
|
+
* @param {ShortintPublicKey} public_key
|
|
273
|
+
* @param {bigint} message
|
|
274
|
+
* @returns {ShortintCiphertext}
|
|
275
|
+
*/
|
|
276
|
+
static encrypt_with_public_key(public_key: ShortintPublicKey, message: bigint): ShortintCiphertext;
|
|
277
|
+
/**
|
|
278
|
+
* @param {ShortintCompressedPublicKey} public_key
|
|
279
|
+
* @param {bigint} message
|
|
280
|
+
* @returns {ShortintCiphertext}
|
|
281
|
+
*/
|
|
282
|
+
static encrypt_with_compressed_public_key(public_key: ShortintCompressedPublicKey, message: bigint): ShortintCiphertext;
|
|
283
|
+
/**
|
|
284
|
+
* @param {ShortintClientKey} client_key
|
|
285
|
+
* @param {ShortintCiphertext} ct
|
|
286
|
+
* @returns {bigint}
|
|
287
|
+
*/
|
|
288
|
+
static decrypt(client_key: ShortintClientKey, ct: ShortintCiphertext): bigint;
|
|
289
|
+
/**
|
|
290
|
+
* @param {ShortintCiphertext} ciphertext
|
|
291
|
+
* @returns {Uint8Array}
|
|
292
|
+
*/
|
|
293
|
+
static serialize_ciphertext(ciphertext: ShortintCiphertext): Uint8Array;
|
|
294
|
+
/**
|
|
295
|
+
* @param {Uint8Array} buffer
|
|
296
|
+
* @returns {ShortintCiphertext}
|
|
297
|
+
*/
|
|
298
|
+
static deserialize_ciphertext(buffer: Uint8Array): ShortintCiphertext;
|
|
299
|
+
/**
|
|
300
|
+
* @param {ShortintCompressedCiphertext} ciphertext
|
|
301
|
+
* @returns {Uint8Array}
|
|
302
|
+
*/
|
|
303
|
+
static serialize_compressed_ciphertext(ciphertext: ShortintCompressedCiphertext): Uint8Array;
|
|
304
|
+
/**
|
|
305
|
+
* @param {Uint8Array} buffer
|
|
306
|
+
* @returns {ShortintCompressedCiphertext}
|
|
307
|
+
*/
|
|
308
|
+
static deserialize_compressed_ciphertext(buffer: Uint8Array): ShortintCompressedCiphertext;
|
|
309
|
+
/**
|
|
310
|
+
* @param {ShortintClientKey} client_key
|
|
311
|
+
* @returns {Uint8Array}
|
|
312
|
+
*/
|
|
313
|
+
static serialize_client_key(client_key: ShortintClientKey): Uint8Array;
|
|
314
|
+
/**
|
|
315
|
+
* @param {Uint8Array} buffer
|
|
316
|
+
* @returns {ShortintClientKey}
|
|
317
|
+
*/
|
|
318
|
+
static deserialize_client_key(buffer: Uint8Array): ShortintClientKey;
|
|
319
|
+
/**
|
|
320
|
+
* @param {ShortintPublicKey} public_key
|
|
321
|
+
* @returns {Uint8Array}
|
|
322
|
+
*/
|
|
323
|
+
static serialize_public_key(public_key: ShortintPublicKey): Uint8Array;
|
|
324
|
+
/**
|
|
325
|
+
* @param {Uint8Array} buffer
|
|
326
|
+
* @returns {ShortintPublicKey}
|
|
327
|
+
*/
|
|
328
|
+
static deserialize_public_key(buffer: Uint8Array): ShortintPublicKey;
|
|
329
|
+
/**
|
|
330
|
+
* @param {ShortintCompressedPublicKey} public_key
|
|
331
|
+
* @returns {Uint8Array}
|
|
332
|
+
*/
|
|
333
|
+
static serialize_compressed_public_key(public_key: ShortintCompressedPublicKey): Uint8Array;
|
|
334
|
+
/**
|
|
335
|
+
* @param {Uint8Array} buffer
|
|
336
|
+
* @returns {ShortintCompressedPublicKey}
|
|
337
|
+
*/
|
|
338
|
+
static deserialize_compressed_public_key(buffer: Uint8Array): ShortintCompressedPublicKey;
|
|
339
|
+
/**
|
|
340
|
+
* @param {ShortintCompressedServerKey} server_key
|
|
341
|
+
* @returns {Uint8Array}
|
|
342
|
+
*/
|
|
343
|
+
static serialize_compressed_server_key(server_key: ShortintCompressedServerKey): Uint8Array;
|
|
344
|
+
/**
|
|
345
|
+
* @param {Uint8Array} buffer
|
|
346
|
+
* @returns {ShortintCompressedServerKey}
|
|
347
|
+
*/
|
|
348
|
+
static deserialize_compressed_server_key(buffer: Uint8Array): ShortintCompressedServerKey;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
*/
|
|
352
|
+
export class ShortintCiphertext {
|
|
353
|
+
free(): void;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
*/
|
|
357
|
+
export class ShortintClientKey {
|
|
358
|
+
free(): void;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
*/
|
|
362
|
+
export class ShortintCompressedCiphertext {
|
|
363
|
+
free(): void;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
*/
|
|
367
|
+
export class ShortintCompressedPublicKey {
|
|
368
|
+
free(): void;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
*/
|
|
372
|
+
export class ShortintCompressedServerKey {
|
|
373
|
+
free(): void;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
*/
|
|
377
|
+
export class ShortintParameters {
|
|
378
|
+
free(): void;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
*/
|
|
382
|
+
export class ShortintPublicKey {
|
|
383
|
+
free(): void;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
387
|
+
|
|
388
|
+
export interface InitOutput {
|
|
389
|
+
readonly memory: WebAssembly.Memory;
|
|
390
|
+
readonly __wbg_shortintciphertext_free: (a: number) => void;
|
|
391
|
+
readonly __wbg_shortintcompressedciphertext_free: (a: number) => void;
|
|
392
|
+
readonly __wbg_shortintclientkey_free: (a: number) => void;
|
|
393
|
+
readonly __wbg_shortintpublickey_free: (a: number) => void;
|
|
394
|
+
readonly __wbg_shortintcompressedpublickey_free: (a: number) => void;
|
|
395
|
+
readonly __wbg_shortintcompressedserverkey_free: (a: number) => void;
|
|
396
|
+
readonly __wbg_shortintparameters_free: (a: number) => void;
|
|
397
|
+
readonly shortint_get_parameters: (a: number, b: number, c: number) => void;
|
|
398
|
+
readonly shortint_get_parameters_small: (a: number, b: number, c: number) => void;
|
|
399
|
+
readonly shortint_new_parameters: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number) => number;
|
|
400
|
+
readonly shortint_new_client_key_from_seed_and_parameters: (a: number, b: number, c: number, d: number) => void;
|
|
401
|
+
readonly shortint_new_client_key: (a: number) => number;
|
|
402
|
+
readonly shortint_new_public_key: (a: number) => number;
|
|
403
|
+
readonly shortint_new_public_key_small: (a: number) => number;
|
|
404
|
+
readonly shortint_new_compressed_public_key: (a: number) => number;
|
|
405
|
+
readonly shortint_new_compressed_public_key_small: (a: number) => number;
|
|
406
|
+
readonly shortint_new_compressed_server_key: (a: number) => number;
|
|
407
|
+
readonly shortint_encrypt: (a: number, b: number) => number;
|
|
408
|
+
readonly shortint_encrypt_small: (a: number, b: number) => number;
|
|
409
|
+
readonly shortint_encrypt_compressed: (a: number, b: number) => number;
|
|
410
|
+
readonly shortint_encrypt_compressed_small: (a: number, b: number) => number;
|
|
411
|
+
readonly shortint_decompress_ciphertext: (a: number) => number;
|
|
412
|
+
readonly shortint_encrypt_with_public_key: (a: number, b: number) => number;
|
|
413
|
+
readonly shortint_encrypt_with_compressed_public_key: (a: number, b: number) => number;
|
|
414
|
+
readonly shortint_decrypt: (a: number, b: number) => number;
|
|
415
|
+
readonly shortint_serialize_ciphertext: (a: number, b: number) => void;
|
|
416
|
+
readonly shortint_deserialize_ciphertext: (a: number, b: number, c: number) => void;
|
|
417
|
+
readonly shortint_serialize_compressed_ciphertext: (a: number, b: number) => void;
|
|
418
|
+
readonly shortint_deserialize_compressed_ciphertext: (a: number, b: number, c: number) => void;
|
|
419
|
+
readonly shortint_serialize_client_key: (a: number, b: number) => void;
|
|
420
|
+
readonly shortint_deserialize_client_key: (a: number, b: number, c: number) => void;
|
|
421
|
+
readonly shortint_serialize_public_key: (a: number, b: number) => void;
|
|
422
|
+
readonly shortint_deserialize_public_key: (a: number, b: number, c: number) => void;
|
|
423
|
+
readonly shortint_serialize_compressed_public_key: (a: number, b: number) => void;
|
|
424
|
+
readonly shortint_deserialize_compressed_public_key: (a: number, b: number, c: number) => void;
|
|
425
|
+
readonly shortint_serialize_compressed_server_key: (a: number, b: number) => void;
|
|
426
|
+
readonly shortint_deserialize_compressed_server_key: (a: number, b: number, c: number) => void;
|
|
427
|
+
readonly __wbg_shortint_free: (a: number) => void;
|
|
428
|
+
readonly __wbg_booleanciphertext_free: (a: number) => void;
|
|
429
|
+
readonly __wbg_booleancompressedciphertext_free: (a: number) => void;
|
|
430
|
+
readonly __wbg_booleanclientkey_free: (a: number) => void;
|
|
431
|
+
readonly __wbg_booleanpublickey_free: (a: number) => void;
|
|
432
|
+
readonly __wbg_booleancompressedserverkey_free: (a: number) => void;
|
|
433
|
+
readonly __wbg_booleanparameters_free: (a: number) => void;
|
|
434
|
+
readonly boolean_get_parameters: (a: number, b: number) => void;
|
|
435
|
+
readonly boolean_new_parameters: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
436
|
+
readonly boolean_new_client_key_from_seed_and_parameters: (a: number, b: number, c: number) => number;
|
|
437
|
+
readonly boolean_new_client_key: (a: number) => number;
|
|
438
|
+
readonly boolean_new_public_key: (a: number) => number;
|
|
439
|
+
readonly boolean_new_compressed_server_key: (a: number) => number;
|
|
440
|
+
readonly boolean_encrypt: (a: number, b: number) => number;
|
|
441
|
+
readonly boolean_encrypt_compressed: (a: number, b: number) => number;
|
|
442
|
+
readonly boolean_decompress_ciphertext: (a: number) => number;
|
|
443
|
+
readonly boolean_encrypt_with_public_key: (a: number, b: number) => number;
|
|
444
|
+
readonly boolean_trivial_encrypt: (a: number, b: number) => number;
|
|
445
|
+
readonly boolean_decrypt: (a: number, b: number) => number;
|
|
446
|
+
readonly boolean_serialize_ciphertext: (a: number, b: number) => void;
|
|
447
|
+
readonly boolean_deserialize_ciphertext: (a: number, b: number, c: number) => void;
|
|
448
|
+
readonly boolean_serialize_compressed_ciphertext: (a: number, b: number) => void;
|
|
449
|
+
readonly boolean_deserialize_compressed_ciphertext: (a: number, b: number, c: number) => void;
|
|
450
|
+
readonly boolean_serialize_client_key: (a: number, b: number) => void;
|
|
451
|
+
readonly boolean_deserialize_client_key: (a: number, b: number, c: number) => void;
|
|
452
|
+
readonly boolean_serialize_public_key: (a: number, b: number) => void;
|
|
453
|
+
readonly boolean_deserialize_public_key: (a: number, b: number, c: number) => void;
|
|
454
|
+
readonly boolean_serialize_compressed_server_key: (a: number, b: number) => void;
|
|
455
|
+
readonly boolean_deserialize_compressed_server_key: (a: number, b: number, c: number) => void;
|
|
456
|
+
readonly __wbg_boolean_free: (a: number) => void;
|
|
457
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
458
|
+
readonly __wbindgen_free: (a: number, b: number) => void;
|
|
459
|
+
readonly __wbindgen_malloc: (a: number) => number;
|
|
460
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
461
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
465
|
+
/**
|
|
466
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
467
|
+
* a precompiled `WebAssembly.Module`.
|
|
468
|
+
*
|
|
469
|
+
* @param {SyncInitInput} module
|
|
470
|
+
*
|
|
471
|
+
* @returns {InitOutput}
|
|
472
|
+
*/
|
|
473
|
+
export function initSync(module: SyncInitInput): InitOutput;
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
477
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
478
|
+
*
|
|
479
|
+
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
480
|
+
*
|
|
481
|
+
* @returns {Promise<InitOutput>}
|
|
482
|
+
*/
|
|
483
|
+
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|