tfhe 0.2.5 → 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.
Files changed (5) hide show
  1. package/README.md +19 -6
  2. package/package.json +1 -1
  3. package/tfhe.d.ts +1279 -128
  4. package/tfhe.js +4142 -327
  5. package/tfhe_bg.wasm +0 -0
package/tfhe.js CHANGED
@@ -1,5 +1,20 @@
1
1
  let wasm;
2
2
 
3
+ const heap = new Array(128).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ let heap_next = heap.length;
8
+
9
+ function addHeapObject(obj) {
10
+ if (heap_next === heap.length) heap.push(heap.length + 1);
11
+ const idx = heap_next;
12
+ heap_next = heap[idx];
13
+
14
+ heap[idx] = obj;
15
+ return idx;
16
+ }
17
+
3
18
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
19
 
5
20
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -18,21 +33,6 @@ function getStringFromWasm0(ptr, len) {
18
33
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
19
34
  }
20
35
 
21
- const heap = new Array(128).fill(undefined);
22
-
23
- heap.push(undefined, null, true, false);
24
-
25
- let heap_next = heap.length;
26
-
27
- function addHeapObject(obj) {
28
- if (heap_next === heap.length) heap.push(heap.length + 1);
29
- const idx = heap_next;
30
- heap_next = heap[idx];
31
-
32
- heap[idx] = obj;
33
- return idx;
34
- }
35
-
36
36
  function getObject(idx) { return heap[idx]; }
37
37
 
38
38
  function dropObject(idx) {
@@ -47,6 +47,19 @@ function takeObject(idx) {
47
47
  return ret;
48
48
  }
49
49
 
50
+ function isLikeNone(x) {
51
+ return x === undefined || x === null;
52
+ }
53
+
54
+ let cachedBigInt64Memory0 = null;
55
+
56
+ function getBigInt64Memory0() {
57
+ if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) {
58
+ cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer);
59
+ }
60
+ return cachedBigInt64Memory0;
61
+ }
62
+
50
63
  let cachedInt32Memory0 = null;
51
64
 
52
65
  function getInt32Memory0() {
@@ -56,27 +69,73 @@ function getInt32Memory0() {
56
69
  return cachedInt32Memory0;
57
70
  }
58
71
 
59
- function _assertClass(instance, klass) {
60
- if (!(instance instanceof klass)) {
61
- throw new Error(`expected instance of ${klass.name}`);
72
+ function debugString(val) {
73
+ // primitive types
74
+ const type = typeof val;
75
+ if (type == 'number' || type == 'boolean' || val == null) {
76
+ return `${val}`;
62
77
  }
63
- return instance.ptr;
64
- }
65
-
66
- function getArrayU8FromWasm0(ptr, len) {
67
- ptr = ptr >>> 0;
68
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
78
+ if (type == 'string') {
79
+ return `"${val}"`;
80
+ }
81
+ if (type == 'symbol') {
82
+ const description = val.description;
83
+ if (description == null) {
84
+ return 'Symbol';
85
+ } else {
86
+ return `Symbol(${description})`;
87
+ }
88
+ }
89
+ if (type == 'function') {
90
+ const name = val.name;
91
+ if (typeof name == 'string' && name.length > 0) {
92
+ return `Function(${name})`;
93
+ } else {
94
+ return 'Function';
95
+ }
96
+ }
97
+ // objects
98
+ if (Array.isArray(val)) {
99
+ const length = val.length;
100
+ let debug = '[';
101
+ if (length > 0) {
102
+ debug += debugString(val[0]);
103
+ }
104
+ for(let i = 1; i < length; i++) {
105
+ debug += ', ' + debugString(val[i]);
106
+ }
107
+ debug += ']';
108
+ return debug;
109
+ }
110
+ // Test for built-in
111
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
112
+ let className;
113
+ if (builtInMatches.length > 1) {
114
+ className = builtInMatches[1];
115
+ } else {
116
+ // Failed to match the standard '[object ClassName]'
117
+ return toString.call(val);
118
+ }
119
+ if (className == 'Object') {
120
+ // we're a user defined class or Object
121
+ // JSON.stringify avoids problems with cycles, and is generally much
122
+ // easier than looping through ownProperties of `val`.
123
+ try {
124
+ return 'Object(' + JSON.stringify(val) + ')';
125
+ } catch (_) {
126
+ return 'Object';
127
+ }
128
+ }
129
+ // errors
130
+ if (val instanceof Error) {
131
+ return `${val.name}: ${val.message}\n${val.stack}`;
132
+ }
133
+ // TODO we could test for more things here, like `Set`s and `Map`s.
134
+ return className;
69
135
  }
70
136
 
71
137
  let WASM_VECTOR_LEN = 0;
72
138
 
73
- function passArray8ToWasm0(arg, malloc) {
74
- const ptr = malloc(arg.length * 1, 1) >>> 0;
75
- getUint8Memory0().set(arg, ptr / 1);
76
- WASM_VECTOR_LEN = arg.length;
77
- return ptr;
78
- }
79
-
80
139
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
81
140
 
82
141
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -130,6 +189,99 @@ function passStringToWasm0(arg, malloc, realloc) {
130
189
  return ptr;
131
190
  }
132
191
 
192
+ function _assertClass(instance, klass) {
193
+ if (!(instance instanceof klass)) {
194
+ throw new Error(`expected instance of ${klass.name}`);
195
+ }
196
+ return instance.ptr;
197
+ }
198
+
199
+ function getArrayU8FromWasm0(ptr, len) {
200
+ ptr = ptr >>> 0;
201
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
202
+ }
203
+
204
+ function passArray8ToWasm0(arg, malloc) {
205
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
206
+ getUint8Memory0().set(arg, ptr / 1);
207
+ WASM_VECTOR_LEN = arg.length;
208
+ return ptr;
209
+ }
210
+
211
+ let cachedUint32Memory0 = null;
212
+
213
+ function getUint32Memory0() {
214
+ if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
215
+ cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
216
+ }
217
+ return cachedUint32Memory0;
218
+ }
219
+
220
+ function passArrayJsValueToWasm0(array, malloc) {
221
+ const ptr = malloc(array.length * 4, 4) >>> 0;
222
+ const mem = getUint32Memory0();
223
+ for (let i = 0; i < array.length; i++) {
224
+ mem[ptr / 4 + i] = addHeapObject(array[i]);
225
+ }
226
+ WASM_VECTOR_LEN = array.length;
227
+ return ptr;
228
+ }
229
+
230
+ function getArrayJsValueFromWasm0(ptr, len) {
231
+ ptr = ptr >>> 0;
232
+ const mem = getUint32Memory0();
233
+ const slice = mem.subarray(ptr / 4, ptr / 4 + len);
234
+ const result = [];
235
+ for (let i = 0; i < slice.length; i++) {
236
+ result.push(takeObject(slice[i]));
237
+ }
238
+ return result;
239
+ }
240
+
241
+ let cachedUint16Memory0 = null;
242
+
243
+ function getUint16Memory0() {
244
+ if (cachedUint16Memory0 === null || cachedUint16Memory0.byteLength === 0) {
245
+ cachedUint16Memory0 = new Uint16Array(wasm.memory.buffer);
246
+ }
247
+ return cachedUint16Memory0;
248
+ }
249
+
250
+ function passArray16ToWasm0(arg, malloc) {
251
+ const ptr = malloc(arg.length * 2, 2) >>> 0;
252
+ getUint16Memory0().set(arg, ptr / 2);
253
+ WASM_VECTOR_LEN = arg.length;
254
+ return ptr;
255
+ }
256
+
257
+ function passArray32ToWasm0(arg, malloc) {
258
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
259
+ getUint32Memory0().set(arg, ptr / 4);
260
+ WASM_VECTOR_LEN = arg.length;
261
+ return ptr;
262
+ }
263
+
264
+ let cachedBigUint64Memory0 = null;
265
+
266
+ function getBigUint64Memory0() {
267
+ if (cachedBigUint64Memory0 === null || cachedBigUint64Memory0.byteLength === 0) {
268
+ cachedBigUint64Memory0 = new BigUint64Array(wasm.memory.buffer);
269
+ }
270
+ return cachedBigUint64Memory0;
271
+ }
272
+
273
+ function passArray64ToWasm0(arg, malloc) {
274
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
275
+ getBigUint64Memory0().set(arg, ptr / 8);
276
+ WASM_VECTOR_LEN = arg.length;
277
+ return ptr;
278
+ }
279
+ /**
280
+ */
281
+ export function init_panic_hook() {
282
+ wasm.init_panic_hook();
283
+ }
284
+
133
285
  function handleError(f, args) {
134
286
  try {
135
287
  return f.apply(this, args);
@@ -139,6 +291,12 @@ function handleError(f, args) {
139
291
  }
140
292
  /**
141
293
  */
294
+ export const ShortintEncryptionKeyChoice = Object.freeze({ Big:0,"0":"Big",Small:1,"1":"Small", });
295
+ /**
296
+ */
297
+ export const ShortintParametersName = Object.freeze({ PARAM_MESSAGE_1_CARRY_0_KS_PBS:0,"0":"PARAM_MESSAGE_1_CARRY_0_KS_PBS",PARAM_MESSAGE_1_CARRY_1_KS_PBS:1,"1":"PARAM_MESSAGE_1_CARRY_1_KS_PBS",PARAM_MESSAGE_2_CARRY_0_KS_PBS:2,"2":"PARAM_MESSAGE_2_CARRY_0_KS_PBS",PARAM_MESSAGE_1_CARRY_2_KS_PBS:3,"3":"PARAM_MESSAGE_1_CARRY_2_KS_PBS",PARAM_MESSAGE_2_CARRY_1_KS_PBS:4,"4":"PARAM_MESSAGE_2_CARRY_1_KS_PBS",PARAM_MESSAGE_3_CARRY_0_KS_PBS:5,"5":"PARAM_MESSAGE_3_CARRY_0_KS_PBS",PARAM_MESSAGE_1_CARRY_3_KS_PBS:6,"6":"PARAM_MESSAGE_1_CARRY_3_KS_PBS",PARAM_MESSAGE_2_CARRY_2_KS_PBS:7,"7":"PARAM_MESSAGE_2_CARRY_2_KS_PBS",PARAM_MESSAGE_3_CARRY_1_KS_PBS:8,"8":"PARAM_MESSAGE_3_CARRY_1_KS_PBS",PARAM_MESSAGE_4_CARRY_0_KS_PBS:9,"9":"PARAM_MESSAGE_4_CARRY_0_KS_PBS",PARAM_MESSAGE_1_CARRY_4_KS_PBS:10,"10":"PARAM_MESSAGE_1_CARRY_4_KS_PBS",PARAM_MESSAGE_2_CARRY_3_KS_PBS:11,"11":"PARAM_MESSAGE_2_CARRY_3_KS_PBS",PARAM_MESSAGE_3_CARRY_2_KS_PBS:12,"12":"PARAM_MESSAGE_3_CARRY_2_KS_PBS",PARAM_MESSAGE_4_CARRY_1_KS_PBS:13,"13":"PARAM_MESSAGE_4_CARRY_1_KS_PBS",PARAM_MESSAGE_5_CARRY_0_KS_PBS:14,"14":"PARAM_MESSAGE_5_CARRY_0_KS_PBS",PARAM_MESSAGE_1_CARRY_5_KS_PBS:15,"15":"PARAM_MESSAGE_1_CARRY_5_KS_PBS",PARAM_MESSAGE_2_CARRY_4_KS_PBS:16,"16":"PARAM_MESSAGE_2_CARRY_4_KS_PBS",PARAM_MESSAGE_3_CARRY_3_KS_PBS:17,"17":"PARAM_MESSAGE_3_CARRY_3_KS_PBS",PARAM_MESSAGE_4_CARRY_2_KS_PBS:18,"18":"PARAM_MESSAGE_4_CARRY_2_KS_PBS",PARAM_MESSAGE_5_CARRY_1_KS_PBS:19,"19":"PARAM_MESSAGE_5_CARRY_1_KS_PBS",PARAM_MESSAGE_6_CARRY_0_KS_PBS:20,"20":"PARAM_MESSAGE_6_CARRY_0_KS_PBS",PARAM_MESSAGE_1_CARRY_6_KS_PBS:21,"21":"PARAM_MESSAGE_1_CARRY_6_KS_PBS",PARAM_MESSAGE_2_CARRY_5_KS_PBS:22,"22":"PARAM_MESSAGE_2_CARRY_5_KS_PBS",PARAM_MESSAGE_3_CARRY_4_KS_PBS:23,"23":"PARAM_MESSAGE_3_CARRY_4_KS_PBS",PARAM_MESSAGE_4_CARRY_3_KS_PBS:24,"24":"PARAM_MESSAGE_4_CARRY_3_KS_PBS",PARAM_MESSAGE_5_CARRY_2_KS_PBS:25,"25":"PARAM_MESSAGE_5_CARRY_2_KS_PBS",PARAM_MESSAGE_6_CARRY_1_KS_PBS:26,"26":"PARAM_MESSAGE_6_CARRY_1_KS_PBS",PARAM_MESSAGE_7_CARRY_0_KS_PBS:27,"27":"PARAM_MESSAGE_7_CARRY_0_KS_PBS",PARAM_MESSAGE_1_CARRY_7_KS_PBS:28,"28":"PARAM_MESSAGE_1_CARRY_7_KS_PBS",PARAM_MESSAGE_2_CARRY_6_KS_PBS:29,"29":"PARAM_MESSAGE_2_CARRY_6_KS_PBS",PARAM_MESSAGE_3_CARRY_5_KS_PBS:30,"30":"PARAM_MESSAGE_3_CARRY_5_KS_PBS",PARAM_MESSAGE_4_CARRY_4_KS_PBS:31,"31":"PARAM_MESSAGE_4_CARRY_4_KS_PBS",PARAM_MESSAGE_5_CARRY_3_KS_PBS:32,"32":"PARAM_MESSAGE_5_CARRY_3_KS_PBS",PARAM_MESSAGE_6_CARRY_2_KS_PBS:33,"33":"PARAM_MESSAGE_6_CARRY_2_KS_PBS",PARAM_MESSAGE_7_CARRY_1_KS_PBS:34,"34":"PARAM_MESSAGE_7_CARRY_1_KS_PBS",PARAM_MESSAGE_8_CARRY_0_KS_PBS:35,"35":"PARAM_MESSAGE_8_CARRY_0_KS_PBS",PARAM_MESSAGE_1_CARRY_1_PBS_KS:36,"36":"PARAM_MESSAGE_1_CARRY_1_PBS_KS",PARAM_MESSAGE_2_CARRY_2_PBS_KS:37,"37":"PARAM_MESSAGE_2_CARRY_2_PBS_KS",PARAM_MESSAGE_3_CARRY_3_PBS_KS:38,"38":"PARAM_MESSAGE_3_CARRY_3_PBS_KS",PARAM_MESSAGE_4_CARRY_4_PBS_KS:39,"39":"PARAM_MESSAGE_4_CARRY_4_PBS_KS",PARAM_MESSAGE_1_CARRY_2_COMPACT_PK_KS_PBS:40,"40":"PARAM_MESSAGE_1_CARRY_2_COMPACT_PK_KS_PBS",PARAM_MESSAGE_1_CARRY_3_COMPACT_PK_KS_PBS:41,"41":"PARAM_MESSAGE_1_CARRY_3_COMPACT_PK_KS_PBS",PARAM_MESSAGE_1_CARRY_4_COMPACT_PK_KS_PBS:42,"42":"PARAM_MESSAGE_1_CARRY_4_COMPACT_PK_KS_PBS",PARAM_MESSAGE_1_CARRY_5_COMPACT_PK_KS_PBS:43,"43":"PARAM_MESSAGE_1_CARRY_5_COMPACT_PK_KS_PBS",PARAM_MESSAGE_1_CARRY_6_COMPACT_PK_KS_PBS:44,"44":"PARAM_MESSAGE_1_CARRY_6_COMPACT_PK_KS_PBS",PARAM_MESSAGE_1_CARRY_7_COMPACT_PK_KS_PBS:45,"45":"PARAM_MESSAGE_1_CARRY_7_COMPACT_PK_KS_PBS",PARAM_MESSAGE_2_CARRY_1_COMPACT_PK_KS_PBS:46,"46":"PARAM_MESSAGE_2_CARRY_1_COMPACT_PK_KS_PBS",PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS:47,"47":"PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_KS_PBS",PARAM_MESSAGE_2_CARRY_3_COMPACT_PK_KS_PBS:48,"48":"PARAM_MESSAGE_2_CARRY_3_COMPACT_PK_KS_PBS",PARAM_MESSAGE_2_CARRY_4_COMPACT_PK_KS_PBS:49,"49":"PARAM_MESSAGE_2_CARRY_4_COMPACT_PK_KS_PBS",PARAM_MESSAGE_2_CARRY_5_COMPACT_PK_KS_PBS:50,"50":"PARAM_MESSAGE_2_CARRY_5_COMPACT_PK_KS_PBS",PARAM_MESSAGE_2_CARRY_6_COMPACT_PK_KS_PBS:51,"51":"PARAM_MESSAGE_2_CARRY_6_COMPACT_PK_KS_PBS",PARAM_MESSAGE_3_CARRY_1_COMPACT_PK_KS_PBS:52,"52":"PARAM_MESSAGE_3_CARRY_1_COMPACT_PK_KS_PBS",PARAM_MESSAGE_3_CARRY_2_COMPACT_PK_KS_PBS:53,"53":"PARAM_MESSAGE_3_CARRY_2_COMPACT_PK_KS_PBS",PARAM_MESSAGE_3_CARRY_3_COMPACT_PK_KS_PBS:54,"54":"PARAM_MESSAGE_3_CARRY_3_COMPACT_PK_KS_PBS",PARAM_MESSAGE_3_CARRY_4_COMPACT_PK_KS_PBS:55,"55":"PARAM_MESSAGE_3_CARRY_4_COMPACT_PK_KS_PBS",PARAM_MESSAGE_3_CARRY_5_COMPACT_PK_KS_PBS:56,"56":"PARAM_MESSAGE_3_CARRY_5_COMPACT_PK_KS_PBS",PARAM_MESSAGE_4_CARRY_1_COMPACT_PK_KS_PBS:57,"57":"PARAM_MESSAGE_4_CARRY_1_COMPACT_PK_KS_PBS",PARAM_MESSAGE_4_CARRY_2_COMPACT_PK_KS_PBS:58,"58":"PARAM_MESSAGE_4_CARRY_2_COMPACT_PK_KS_PBS",PARAM_MESSAGE_4_CARRY_3_COMPACT_PK_KS_PBS:59,"59":"PARAM_MESSAGE_4_CARRY_3_COMPACT_PK_KS_PBS",PARAM_MESSAGE_4_CARRY_4_COMPACT_PK_KS_PBS:60,"60":"PARAM_MESSAGE_4_CARRY_4_COMPACT_PK_KS_PBS",PARAM_MESSAGE_5_CARRY_1_COMPACT_PK_KS_PBS:61,"61":"PARAM_MESSAGE_5_CARRY_1_COMPACT_PK_KS_PBS",PARAM_MESSAGE_5_CARRY_2_COMPACT_PK_KS_PBS:62,"62":"PARAM_MESSAGE_5_CARRY_2_COMPACT_PK_KS_PBS",PARAM_MESSAGE_5_CARRY_3_COMPACT_PK_KS_PBS:63,"63":"PARAM_MESSAGE_5_CARRY_3_COMPACT_PK_KS_PBS",PARAM_MESSAGE_6_CARRY_1_COMPACT_PK_KS_PBS:64,"64":"PARAM_MESSAGE_6_CARRY_1_COMPACT_PK_KS_PBS",PARAM_MESSAGE_6_CARRY_2_COMPACT_PK_KS_PBS:65,"65":"PARAM_MESSAGE_6_CARRY_2_COMPACT_PK_KS_PBS",PARAM_MESSAGE_7_CARRY_1_COMPACT_PK_KS_PBS:66,"66":"PARAM_MESSAGE_7_CARRY_1_COMPACT_PK_KS_PBS",PARAM_MESSAGE_1_CARRY_1_COMPACT_PK_PBS_KS:67,"67":"PARAM_MESSAGE_1_CARRY_1_COMPACT_PK_PBS_KS",PARAM_MESSAGE_1_CARRY_2_COMPACT_PK_PBS_KS:68,"68":"PARAM_MESSAGE_1_CARRY_2_COMPACT_PK_PBS_KS",PARAM_MESSAGE_1_CARRY_3_COMPACT_PK_PBS_KS:69,"69":"PARAM_MESSAGE_1_CARRY_3_COMPACT_PK_PBS_KS",PARAM_MESSAGE_1_CARRY_4_COMPACT_PK_PBS_KS:70,"70":"PARAM_MESSAGE_1_CARRY_4_COMPACT_PK_PBS_KS",PARAM_MESSAGE_1_CARRY_5_COMPACT_PK_PBS_KS:71,"71":"PARAM_MESSAGE_1_CARRY_5_COMPACT_PK_PBS_KS",PARAM_MESSAGE_1_CARRY_6_COMPACT_PK_PBS_KS:72,"72":"PARAM_MESSAGE_1_CARRY_6_COMPACT_PK_PBS_KS",PARAM_MESSAGE_1_CARRY_7_COMPACT_PK_PBS_KS:73,"73":"PARAM_MESSAGE_1_CARRY_7_COMPACT_PK_PBS_KS",PARAM_MESSAGE_2_CARRY_1_COMPACT_PK_PBS_KS:74,"74":"PARAM_MESSAGE_2_CARRY_1_COMPACT_PK_PBS_KS",PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_PBS_KS:75,"75":"PARAM_MESSAGE_2_CARRY_2_COMPACT_PK_PBS_KS",PARAM_MESSAGE_2_CARRY_3_COMPACT_PK_PBS_KS:76,"76":"PARAM_MESSAGE_2_CARRY_3_COMPACT_PK_PBS_KS",PARAM_MESSAGE_2_CARRY_4_COMPACT_PK_PBS_KS:77,"77":"PARAM_MESSAGE_2_CARRY_4_COMPACT_PK_PBS_KS",PARAM_MESSAGE_2_CARRY_5_COMPACT_PK_PBS_KS:78,"78":"PARAM_MESSAGE_2_CARRY_5_COMPACT_PK_PBS_KS",PARAM_MESSAGE_2_CARRY_6_COMPACT_PK_PBS_KS:79,"79":"PARAM_MESSAGE_2_CARRY_6_COMPACT_PK_PBS_KS",PARAM_MESSAGE_3_CARRY_1_COMPACT_PK_PBS_KS:80,"80":"PARAM_MESSAGE_3_CARRY_1_COMPACT_PK_PBS_KS",PARAM_MESSAGE_3_CARRY_2_COMPACT_PK_PBS_KS:81,"81":"PARAM_MESSAGE_3_CARRY_2_COMPACT_PK_PBS_KS",PARAM_MESSAGE_3_CARRY_3_COMPACT_PK_PBS_KS:82,"82":"PARAM_MESSAGE_3_CARRY_3_COMPACT_PK_PBS_KS",PARAM_MESSAGE_3_CARRY_4_COMPACT_PK_PBS_KS:83,"83":"PARAM_MESSAGE_3_CARRY_4_COMPACT_PK_PBS_KS",PARAM_MESSAGE_3_CARRY_5_COMPACT_PK_PBS_KS:84,"84":"PARAM_MESSAGE_3_CARRY_5_COMPACT_PK_PBS_KS",PARAM_MESSAGE_4_CARRY_1_COMPACT_PK_PBS_KS:85,"85":"PARAM_MESSAGE_4_CARRY_1_COMPACT_PK_PBS_KS",PARAM_MESSAGE_4_CARRY_2_COMPACT_PK_PBS_KS:86,"86":"PARAM_MESSAGE_4_CARRY_2_COMPACT_PK_PBS_KS",PARAM_MESSAGE_4_CARRY_3_COMPACT_PK_PBS_KS:87,"87":"PARAM_MESSAGE_4_CARRY_3_COMPACT_PK_PBS_KS",PARAM_MESSAGE_4_CARRY_4_COMPACT_PK_PBS_KS:88,"88":"PARAM_MESSAGE_4_CARRY_4_COMPACT_PK_PBS_KS",PARAM_MESSAGE_5_CARRY_1_COMPACT_PK_PBS_KS:89,"89":"PARAM_MESSAGE_5_CARRY_1_COMPACT_PK_PBS_KS",PARAM_MESSAGE_5_CARRY_2_COMPACT_PK_PBS_KS:90,"90":"PARAM_MESSAGE_5_CARRY_2_COMPACT_PK_PBS_KS",PARAM_MESSAGE_5_CARRY_3_COMPACT_PK_PBS_KS:91,"91":"PARAM_MESSAGE_5_CARRY_3_COMPACT_PK_PBS_KS",PARAM_MESSAGE_6_CARRY_1_COMPACT_PK_PBS_KS:92,"92":"PARAM_MESSAGE_6_CARRY_1_COMPACT_PK_PBS_KS",PARAM_MESSAGE_6_CARRY_2_COMPACT_PK_PBS_KS:93,"93":"PARAM_MESSAGE_6_CARRY_2_COMPACT_PK_PBS_KS",PARAM_MESSAGE_7_CARRY_1_COMPACT_PK_PBS_KS:94,"94":"PARAM_MESSAGE_7_CARRY_1_COMPACT_PK_PBS_KS",PARAM_MESSAGE_1_CARRY_0:95,"95":"PARAM_MESSAGE_1_CARRY_0",PARAM_MESSAGE_1_CARRY_1:96,"96":"PARAM_MESSAGE_1_CARRY_1",PARAM_MESSAGE_2_CARRY_0:97,"97":"PARAM_MESSAGE_2_CARRY_0",PARAM_MESSAGE_1_CARRY_2:98,"98":"PARAM_MESSAGE_1_CARRY_2",PARAM_MESSAGE_2_CARRY_1:99,"99":"PARAM_MESSAGE_2_CARRY_1",PARAM_MESSAGE_3_CARRY_0:100,"100":"PARAM_MESSAGE_3_CARRY_0",PARAM_MESSAGE_1_CARRY_3:101,"101":"PARAM_MESSAGE_1_CARRY_3",PARAM_MESSAGE_2_CARRY_2:102,"102":"PARAM_MESSAGE_2_CARRY_2",PARAM_MESSAGE_3_CARRY_1:103,"103":"PARAM_MESSAGE_3_CARRY_1",PARAM_MESSAGE_4_CARRY_0:104,"104":"PARAM_MESSAGE_4_CARRY_0",PARAM_MESSAGE_1_CARRY_4:105,"105":"PARAM_MESSAGE_1_CARRY_4",PARAM_MESSAGE_2_CARRY_3:106,"106":"PARAM_MESSAGE_2_CARRY_3",PARAM_MESSAGE_3_CARRY_2:107,"107":"PARAM_MESSAGE_3_CARRY_2",PARAM_MESSAGE_4_CARRY_1:108,"108":"PARAM_MESSAGE_4_CARRY_1",PARAM_MESSAGE_5_CARRY_0:109,"109":"PARAM_MESSAGE_5_CARRY_0",PARAM_MESSAGE_1_CARRY_5:110,"110":"PARAM_MESSAGE_1_CARRY_5",PARAM_MESSAGE_2_CARRY_4:111,"111":"PARAM_MESSAGE_2_CARRY_4",PARAM_MESSAGE_3_CARRY_3:112,"112":"PARAM_MESSAGE_3_CARRY_3",PARAM_MESSAGE_4_CARRY_2:113,"113":"PARAM_MESSAGE_4_CARRY_2",PARAM_MESSAGE_5_CARRY_1:114,"114":"PARAM_MESSAGE_5_CARRY_1",PARAM_MESSAGE_6_CARRY_0:115,"115":"PARAM_MESSAGE_6_CARRY_0",PARAM_MESSAGE_1_CARRY_6:116,"116":"PARAM_MESSAGE_1_CARRY_6",PARAM_MESSAGE_2_CARRY_5:117,"117":"PARAM_MESSAGE_2_CARRY_5",PARAM_MESSAGE_3_CARRY_4:118,"118":"PARAM_MESSAGE_3_CARRY_4",PARAM_MESSAGE_4_CARRY_3:119,"119":"PARAM_MESSAGE_4_CARRY_3",PARAM_MESSAGE_5_CARRY_2:120,"120":"PARAM_MESSAGE_5_CARRY_2",PARAM_MESSAGE_6_CARRY_1:121,"121":"PARAM_MESSAGE_6_CARRY_1",PARAM_MESSAGE_7_CARRY_0:122,"122":"PARAM_MESSAGE_7_CARRY_0",PARAM_MESSAGE_1_CARRY_7:123,"123":"PARAM_MESSAGE_1_CARRY_7",PARAM_MESSAGE_2_CARRY_6:124,"124":"PARAM_MESSAGE_2_CARRY_6",PARAM_MESSAGE_3_CARRY_5:125,"125":"PARAM_MESSAGE_3_CARRY_5",PARAM_MESSAGE_4_CARRY_4:126,"126":"PARAM_MESSAGE_4_CARRY_4",PARAM_MESSAGE_5_CARRY_3:127,"127":"PARAM_MESSAGE_5_CARRY_3",PARAM_MESSAGE_6_CARRY_2:128,"128":"PARAM_MESSAGE_6_CARRY_2",PARAM_MESSAGE_7_CARRY_1:129,"129":"PARAM_MESSAGE_7_CARRY_1",PARAM_MESSAGE_8_CARRY_0:130,"130":"PARAM_MESSAGE_8_CARRY_0",PARAM_SMALL_MESSAGE_1_CARRY_1:131,"131":"PARAM_SMALL_MESSAGE_1_CARRY_1",PARAM_SMALL_MESSAGE_2_CARRY_2:132,"132":"PARAM_SMALL_MESSAGE_2_CARRY_2",PARAM_SMALL_MESSAGE_3_CARRY_3:133,"133":"PARAM_SMALL_MESSAGE_3_CARRY_3",PARAM_SMALL_MESSAGE_4_CARRY_4:134,"134":"PARAM_SMALL_MESSAGE_4_CARRY_4", });
298
+ /**
299
+ */
142
300
  export const BooleanParameterSet = Object.freeze({ Default:0,"0":"Default",TfheLib:1,"1":"TfheLib", });
143
301
  /**
144
302
  */
@@ -653,7 +811,15 @@ export class BooleanPublicKey {
653
811
  }
654
812
  /**
655
813
  */
656
- export class Shortint {
814
+ export class CompactFheUint128 {
815
+
816
+ static __wrap(ptr) {
817
+ ptr = ptr >>> 0;
818
+ const obj = Object.create(CompactFheUint128.prototype);
819
+ obj.__wbg_ptr = ptr;
820
+
821
+ return obj;
822
+ }
657
823
 
658
824
  __destroy_into_raw() {
659
825
  const ptr = this.__wbg_ptr;
@@ -664,237 +830,3629 @@ export class Shortint {
664
830
 
665
831
  free() {
666
832
  const ptr = this.__destroy_into_raw();
667
- wasm.__wbg_shortint_free(ptr);
833
+ wasm.__wbg_compactfheuint128_free(ptr);
668
834
  }
669
835
  /**
670
- * @param {number} message_bits
671
- * @param {number} carry_bits
672
- * @returns {ShortintParameters}
836
+ * @param {any} value
837
+ * @param {TfheCompactPublicKey} client_key
838
+ * @returns {CompactFheUint128}
673
839
  */
674
- static get_parameters(message_bits, carry_bits) {
840
+ static encrypt_with_compact_public_key(value, client_key) {
675
841
  try {
676
842
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
677
- wasm.shortint_get_parameters(retptr, message_bits, carry_bits);
843
+ _assertClass(client_key, TfheCompactPublicKey);
844
+ wasm.compactfheuint128_encrypt_with_compact_public_key(retptr, addHeapObject(value), client_key.__wbg_ptr);
678
845
  var r0 = getInt32Memory0()[retptr / 4 + 0];
679
846
  var r1 = getInt32Memory0()[retptr / 4 + 1];
680
847
  var r2 = getInt32Memory0()[retptr / 4 + 2];
681
848
  if (r2) {
682
849
  throw takeObject(r1);
683
850
  }
684
- return ShortintParameters.__wrap(r0);
851
+ return CompactFheUint128.__wrap(r0);
685
852
  } finally {
686
853
  wasm.__wbindgen_add_to_stack_pointer(16);
687
854
  }
688
855
  }
689
856
  /**
690
- * @param {number} message_bits
691
- * @param {number} carry_bits
692
- * @returns {ShortintParameters}
857
+ * @returns {FheUint128}
693
858
  */
694
- static get_parameters_small(message_bits, carry_bits) {
859
+ expand() {
695
860
  try {
696
861
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
697
- wasm.shortint_get_parameters_small(retptr, message_bits, carry_bits);
862
+ wasm.compactfheuint128_expand(retptr, this.__wbg_ptr);
698
863
  var r0 = getInt32Memory0()[retptr / 4 + 0];
699
864
  var r1 = getInt32Memory0()[retptr / 4 + 1];
700
865
  var r2 = getInt32Memory0()[retptr / 4 + 2];
701
866
  if (r2) {
702
867
  throw takeObject(r1);
703
868
  }
704
- return ShortintParameters.__wrap(r0);
869
+ return FheUint128.__wrap(r0);
705
870
  } finally {
706
871
  wasm.__wbindgen_add_to_stack_pointer(16);
707
872
  }
708
873
  }
709
874
  /**
710
- * @param {number} lwe_dimension
711
- * @param {number} glwe_dimension
712
- * @param {number} polynomial_size
713
- * @param {number} lwe_modular_std_dev
714
- * @param {number} glwe_modular_std_dev
715
- * @param {number} pbs_base_log
716
- * @param {number} pbs_level
717
- * @param {number} ks_base_log
718
- * @param {number} ks_level
719
- * @param {number} pfks_level
720
- * @param {number} pfks_base_log
721
- * @param {number} pfks_modular_std_dev
722
- * @param {number} cbs_level
723
- * @param {number} cbs_base_log
724
- * @param {number} message_modulus
725
- * @param {number} carry_modulus
726
- * @param {number} modulus_power_of_2_exponent
727
- * @returns {ShortintParameters}
875
+ * @returns {Uint8Array}
728
876
  */
729
- static new_parameters(lwe_dimension, glwe_dimension, polynomial_size, lwe_modular_std_dev, glwe_modular_std_dev, pbs_base_log, pbs_level, ks_base_log, ks_level, pfks_level, pfks_base_log, pfks_modular_std_dev, cbs_level, cbs_base_log, message_modulus, carry_modulus, modulus_power_of_2_exponent) {
730
- const ret = wasm.shortint_new_parameters(lwe_dimension, glwe_dimension, polynomial_size, lwe_modular_std_dev, glwe_modular_std_dev, pbs_base_log, pbs_level, ks_base_log, ks_level, pfks_level, pfks_base_log, pfks_modular_std_dev, cbs_level, cbs_base_log, message_modulus, carry_modulus, modulus_power_of_2_exponent);
731
- return ShortintParameters.__wrap(ret);
877
+ serialize() {
878
+ try {
879
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
880
+ wasm.compactfheuint128_serialize(retptr, this.__wbg_ptr);
881
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
882
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
883
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
884
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
885
+ if (r3) {
886
+ throw takeObject(r2);
887
+ }
888
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
889
+ wasm.__wbindgen_free(r0, r1 * 1);
890
+ return v1;
891
+ } finally {
892
+ wasm.__wbindgen_add_to_stack_pointer(16);
893
+ }
732
894
  }
733
895
  /**
734
- * @param {bigint} seed_high_bytes
735
- * @param {bigint} seed_low_bytes
736
- * @param {ShortintParameters} parameters
737
- * @returns {ShortintClientKey}
896
+ * @param {Uint8Array} buffer
897
+ * @returns {CompactFheUint128}
738
898
  */
739
- static new_client_key_from_seed_and_parameters(seed_high_bytes, seed_low_bytes, parameters) {
899
+ static deserialize(buffer) {
740
900
  try {
741
901
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
742
- _assertClass(parameters, ShortintParameters);
743
- wasm.shortint_new_client_key_from_seed_and_parameters(retptr, seed_high_bytes, seed_low_bytes, parameters.__wbg_ptr);
902
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
903
+ const len0 = WASM_VECTOR_LEN;
904
+ wasm.compactfheuint128_deserialize(retptr, ptr0, len0);
744
905
  var r0 = getInt32Memory0()[retptr / 4 + 0];
745
906
  var r1 = getInt32Memory0()[retptr / 4 + 1];
746
907
  var r2 = getInt32Memory0()[retptr / 4 + 2];
747
908
  if (r2) {
748
909
  throw takeObject(r1);
749
910
  }
750
- return ShortintClientKey.__wrap(r0);
911
+ return CompactFheUint128.__wrap(r0);
751
912
  } finally {
752
913
  wasm.__wbindgen_add_to_stack_pointer(16);
753
914
  }
754
915
  }
755
- /**
756
- * @param {ShortintParameters} parameters
757
- * @returns {ShortintClientKey}
758
- */
759
- static new_client_key(parameters) {
760
- _assertClass(parameters, ShortintParameters);
761
- const ret = wasm.shortint_new_client_key(parameters.__wbg_ptr);
762
- return ShortintClientKey.__wrap(ret);
916
+ }
917
+ /**
918
+ */
919
+ export class CompactFheUint128List {
920
+
921
+ static __wrap(ptr) {
922
+ ptr = ptr >>> 0;
923
+ const obj = Object.create(CompactFheUint128List.prototype);
924
+ obj.__wbg_ptr = ptr;
925
+
926
+ return obj;
927
+ }
928
+
929
+ __destroy_into_raw() {
930
+ const ptr = this.__wbg_ptr;
931
+ this.__wbg_ptr = 0;
932
+
933
+ return ptr;
934
+ }
935
+
936
+ free() {
937
+ const ptr = this.__destroy_into_raw();
938
+ wasm.__wbg_compactfheuint128list_free(ptr);
763
939
  }
764
940
  /**
765
- * @param {ShortintClientKey} client_key
766
- * @returns {ShortintPublicKey}
941
+ * @param {any[]} values
942
+ * @param {TfheCompactPublicKey} public_key
943
+ * @returns {CompactFheUint128List}
767
944
  */
768
- static new_public_key(client_key) {
769
- _assertClass(client_key, ShortintClientKey);
770
- const ret = wasm.shortint_new_public_key(client_key.__wbg_ptr);
771
- return ShortintPublicKey.__wrap(ret);
945
+ static encrypt_with_compact_public_key(values, public_key) {
946
+ try {
947
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
948
+ const ptr0 = passArrayJsValueToWasm0(values, wasm.__wbindgen_malloc);
949
+ const len0 = WASM_VECTOR_LEN;
950
+ _assertClass(public_key, TfheCompactPublicKey);
951
+ wasm.compactfheuint128list_encrypt_with_compact_public_key(retptr, ptr0, len0, public_key.__wbg_ptr);
952
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
953
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
954
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
955
+ if (r2) {
956
+ throw takeObject(r1);
957
+ }
958
+ return CompactFheUint128List.__wrap(r0);
959
+ } finally {
960
+ wasm.__wbindgen_add_to_stack_pointer(16);
961
+ }
772
962
  }
773
963
  /**
774
- * @param {ShortintClientKey} client_key
775
- * @returns {ShortintPublicKey}
964
+ * @returns {any[]}
776
965
  */
777
- static new_public_key_small(client_key) {
778
- _assertClass(client_key, ShortintClientKey);
779
- const ret = wasm.shortint_new_public_key_small(client_key.__wbg_ptr);
780
- return ShortintPublicKey.__wrap(ret);
966
+ expand() {
967
+ try {
968
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
969
+ wasm.compactfheuint128list_expand(retptr, this.__wbg_ptr);
970
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
971
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
972
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
973
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
974
+ if (r3) {
975
+ throw takeObject(r2);
976
+ }
977
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
978
+ wasm.__wbindgen_free(r0, r1 * 4);
979
+ return v1;
980
+ } finally {
981
+ wasm.__wbindgen_add_to_stack_pointer(16);
982
+ }
781
983
  }
782
984
  /**
783
- * @param {ShortintClientKey} client_key
784
- * @returns {ShortintCompressedPublicKey}
985
+ * @returns {Uint8Array}
785
986
  */
786
- static new_compressed_public_key(client_key) {
787
- _assertClass(client_key, ShortintClientKey);
788
- const ret = wasm.shortint_new_compressed_public_key(client_key.__wbg_ptr);
789
- return ShortintCompressedPublicKey.__wrap(ret);
987
+ serialize() {
988
+ try {
989
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
990
+ wasm.compactfheuint128list_serialize(retptr, this.__wbg_ptr);
991
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
992
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
993
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
994
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
995
+ if (r3) {
996
+ throw takeObject(r2);
997
+ }
998
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
999
+ wasm.__wbindgen_free(r0, r1 * 1);
1000
+ return v1;
1001
+ } finally {
1002
+ wasm.__wbindgen_add_to_stack_pointer(16);
1003
+ }
790
1004
  }
791
1005
  /**
792
- * @param {ShortintClientKey} client_key
793
- * @returns {ShortintCompressedPublicKey}
1006
+ * @param {Uint8Array} buffer
1007
+ * @returns {CompactFheUint128List}
794
1008
  */
795
- static new_compressed_public_key_small(client_key) {
796
- _assertClass(client_key, ShortintClientKey);
797
- const ret = wasm.shortint_new_compressed_public_key_small(client_key.__wbg_ptr);
798
- return ShortintCompressedPublicKey.__wrap(ret);
1009
+ static deserialize(buffer) {
1010
+ try {
1011
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1012
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1013
+ const len0 = WASM_VECTOR_LEN;
1014
+ wasm.compactfheuint128list_deserialize(retptr, ptr0, len0);
1015
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1016
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1017
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1018
+ if (r2) {
1019
+ throw takeObject(r1);
1020
+ }
1021
+ return CompactFheUint128List.__wrap(r0);
1022
+ } finally {
1023
+ wasm.__wbindgen_add_to_stack_pointer(16);
1024
+ }
1025
+ }
1026
+ }
1027
+ /**
1028
+ */
1029
+ export class CompactFheUint16 {
1030
+
1031
+ static __wrap(ptr) {
1032
+ ptr = ptr >>> 0;
1033
+ const obj = Object.create(CompactFheUint16.prototype);
1034
+ obj.__wbg_ptr = ptr;
1035
+
1036
+ return obj;
1037
+ }
1038
+
1039
+ __destroy_into_raw() {
1040
+ const ptr = this.__wbg_ptr;
1041
+ this.__wbg_ptr = 0;
1042
+
1043
+ return ptr;
1044
+ }
1045
+
1046
+ free() {
1047
+ const ptr = this.__destroy_into_raw();
1048
+ wasm.__wbg_compactfheuint16_free(ptr);
799
1049
  }
800
1050
  /**
801
- * @param {ShortintClientKey} client_key
802
- * @returns {ShortintCompressedServerKey}
1051
+ * @param {number} value
1052
+ * @param {TfheCompactPublicKey} client_key
1053
+ * @returns {CompactFheUint16}
803
1054
  */
804
- static new_compressed_server_key(client_key) {
805
- _assertClass(client_key, ShortintClientKey);
806
- const ret = wasm.shortint_new_compressed_server_key(client_key.__wbg_ptr);
807
- return ShortintCompressedServerKey.__wrap(ret);
1055
+ static encrypt_with_compact_public_key(value, client_key) {
1056
+ try {
1057
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1058
+ _assertClass(client_key, TfheCompactPublicKey);
1059
+ wasm.compactfheuint16_encrypt_with_compact_public_key(retptr, value, client_key.__wbg_ptr);
1060
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1061
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1062
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1063
+ if (r2) {
1064
+ throw takeObject(r1);
1065
+ }
1066
+ return CompactFheUint16.__wrap(r0);
1067
+ } finally {
1068
+ wasm.__wbindgen_add_to_stack_pointer(16);
1069
+ }
808
1070
  }
809
1071
  /**
810
- * @param {ShortintClientKey} client_key
811
- * @param {bigint} message
812
- * @returns {ShortintCiphertext}
1072
+ * @returns {FheUint16}
813
1073
  */
814
- static encrypt(client_key, message) {
815
- _assertClass(client_key, ShortintClientKey);
816
- const ret = wasm.shortint_encrypt(client_key.__wbg_ptr, message);
817
- return ShortintCiphertext.__wrap(ret);
1074
+ expand() {
1075
+ try {
1076
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1077
+ wasm.compactfheuint16_expand(retptr, this.__wbg_ptr);
1078
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1079
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1080
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1081
+ if (r2) {
1082
+ throw takeObject(r1);
1083
+ }
1084
+ return FheUint16.__wrap(r0);
1085
+ } finally {
1086
+ wasm.__wbindgen_add_to_stack_pointer(16);
1087
+ }
818
1088
  }
819
1089
  /**
820
- * @param {ShortintClientKey} client_key
821
- * @param {bigint} message
822
- * @returns {ShortintCiphertext}
1090
+ * @returns {Uint8Array}
823
1091
  */
824
- static encrypt_small(client_key, message) {
825
- _assertClass(client_key, ShortintClientKey);
826
- const ret = wasm.shortint_encrypt_small(client_key.__wbg_ptr, message);
827
- return ShortintCiphertext.__wrap(ret);
1092
+ serialize() {
1093
+ try {
1094
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1095
+ wasm.compactfheuint16_serialize(retptr, this.__wbg_ptr);
1096
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1097
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1098
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1099
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1100
+ if (r3) {
1101
+ throw takeObject(r2);
1102
+ }
1103
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1104
+ wasm.__wbindgen_free(r0, r1 * 1);
1105
+ return v1;
1106
+ } finally {
1107
+ wasm.__wbindgen_add_to_stack_pointer(16);
1108
+ }
828
1109
  }
829
1110
  /**
830
- * @param {ShortintClientKey} client_key
831
- * @param {bigint} message
832
- * @returns {ShortintCompressedCiphertext}
1111
+ * @param {Uint8Array} buffer
1112
+ * @returns {CompactFheUint16}
833
1113
  */
834
- static encrypt_compressed(client_key, message) {
835
- _assertClass(client_key, ShortintClientKey);
836
- const ret = wasm.shortint_encrypt_compressed(client_key.__wbg_ptr, message);
837
- return ShortintCompressedCiphertext.__wrap(ret);
1114
+ static deserialize(buffer) {
1115
+ try {
1116
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1117
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1118
+ const len0 = WASM_VECTOR_LEN;
1119
+ wasm.compactfheuint16_deserialize(retptr, ptr0, len0);
1120
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1121
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1122
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1123
+ if (r2) {
1124
+ throw takeObject(r1);
1125
+ }
1126
+ return CompactFheUint16.__wrap(r0);
1127
+ } finally {
1128
+ wasm.__wbindgen_add_to_stack_pointer(16);
1129
+ }
1130
+ }
1131
+ }
1132
+ /**
1133
+ */
1134
+ export class CompactFheUint16List {
1135
+
1136
+ static __wrap(ptr) {
1137
+ ptr = ptr >>> 0;
1138
+ const obj = Object.create(CompactFheUint16List.prototype);
1139
+ obj.__wbg_ptr = ptr;
1140
+
1141
+ return obj;
1142
+ }
1143
+
1144
+ __destroy_into_raw() {
1145
+ const ptr = this.__wbg_ptr;
1146
+ this.__wbg_ptr = 0;
1147
+
1148
+ return ptr;
1149
+ }
1150
+
1151
+ free() {
1152
+ const ptr = this.__destroy_into_raw();
1153
+ wasm.__wbg_compactfheuint16list_free(ptr);
838
1154
  }
839
1155
  /**
840
- * @param {ShortintClientKey} client_key
841
- * @param {bigint} message
842
- * @returns {ShortintCompressedCiphertext}
1156
+ * @param {Uint16Array} values
1157
+ * @param {TfheCompactPublicKey} public_key
1158
+ * @returns {CompactFheUint16List}
843
1159
  */
844
- static encrypt_compressed_small(client_key, message) {
845
- _assertClass(client_key, ShortintClientKey);
846
- const ret = wasm.shortint_encrypt_compressed_small(client_key.__wbg_ptr, message);
847
- return ShortintCompressedCiphertext.__wrap(ret);
1160
+ static encrypt_with_compact_public_key(values, public_key) {
1161
+ try {
1162
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1163
+ const ptr0 = passArray16ToWasm0(values, wasm.__wbindgen_malloc);
1164
+ const len0 = WASM_VECTOR_LEN;
1165
+ _assertClass(public_key, TfheCompactPublicKey);
1166
+ wasm.compactfheuint16list_encrypt_with_compact_public_key(retptr, ptr0, len0, public_key.__wbg_ptr);
1167
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1168
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1169
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1170
+ if (r2) {
1171
+ throw takeObject(r1);
1172
+ }
1173
+ return CompactFheUint16List.__wrap(r0);
1174
+ } finally {
1175
+ wasm.__wbindgen_add_to_stack_pointer(16);
1176
+ }
1177
+ }
1178
+ /**
1179
+ * @returns {any[]}
1180
+ */
1181
+ expand() {
1182
+ try {
1183
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1184
+ wasm.compactfheuint16list_expand(retptr, this.__wbg_ptr);
1185
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1186
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1187
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1188
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1189
+ if (r3) {
1190
+ throw takeObject(r2);
1191
+ }
1192
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1193
+ wasm.__wbindgen_free(r0, r1 * 4);
1194
+ return v1;
1195
+ } finally {
1196
+ wasm.__wbindgen_add_to_stack_pointer(16);
1197
+ }
1198
+ }
1199
+ /**
1200
+ * @returns {Uint8Array}
1201
+ */
1202
+ serialize() {
1203
+ try {
1204
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1205
+ wasm.compactfheuint16list_serialize(retptr, this.__wbg_ptr);
1206
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1207
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1208
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1209
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1210
+ if (r3) {
1211
+ throw takeObject(r2);
1212
+ }
1213
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1214
+ wasm.__wbindgen_free(r0, r1 * 1);
1215
+ return v1;
1216
+ } finally {
1217
+ wasm.__wbindgen_add_to_stack_pointer(16);
1218
+ }
1219
+ }
1220
+ /**
1221
+ * @param {Uint8Array} buffer
1222
+ * @returns {CompactFheUint16List}
1223
+ */
1224
+ static deserialize(buffer) {
1225
+ try {
1226
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1227
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1228
+ const len0 = WASM_VECTOR_LEN;
1229
+ wasm.compactfheuint16list_deserialize(retptr, ptr0, len0);
1230
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1231
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1232
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1233
+ if (r2) {
1234
+ throw takeObject(r1);
1235
+ }
1236
+ return CompactFheUint16List.__wrap(r0);
1237
+ } finally {
1238
+ wasm.__wbindgen_add_to_stack_pointer(16);
1239
+ }
1240
+ }
1241
+ }
1242
+ /**
1243
+ */
1244
+ export class CompactFheUint256 {
1245
+
1246
+ static __wrap(ptr) {
1247
+ ptr = ptr >>> 0;
1248
+ const obj = Object.create(CompactFheUint256.prototype);
1249
+ obj.__wbg_ptr = ptr;
1250
+
1251
+ return obj;
1252
+ }
1253
+
1254
+ __destroy_into_raw() {
1255
+ const ptr = this.__wbg_ptr;
1256
+ this.__wbg_ptr = 0;
1257
+
1258
+ return ptr;
1259
+ }
1260
+
1261
+ free() {
1262
+ const ptr = this.__destroy_into_raw();
1263
+ wasm.__wbg_compactfheuint256_free(ptr);
1264
+ }
1265
+ /**
1266
+ * @param {any} value
1267
+ * @param {TfheCompactPublicKey} client_key
1268
+ * @returns {CompactFheUint256}
1269
+ */
1270
+ static encrypt_with_compact_public_key(value, client_key) {
1271
+ try {
1272
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1273
+ _assertClass(client_key, TfheCompactPublicKey);
1274
+ wasm.compactfheuint256_encrypt_with_compact_public_key(retptr, addHeapObject(value), client_key.__wbg_ptr);
1275
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1276
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1277
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1278
+ if (r2) {
1279
+ throw takeObject(r1);
1280
+ }
1281
+ return CompactFheUint256.__wrap(r0);
1282
+ } finally {
1283
+ wasm.__wbindgen_add_to_stack_pointer(16);
1284
+ }
1285
+ }
1286
+ /**
1287
+ * @returns {FheUint256}
1288
+ */
1289
+ expand() {
1290
+ try {
1291
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1292
+ wasm.compactfheuint256_expand(retptr, this.__wbg_ptr);
1293
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1294
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1295
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1296
+ if (r2) {
1297
+ throw takeObject(r1);
1298
+ }
1299
+ return FheUint256.__wrap(r0);
1300
+ } finally {
1301
+ wasm.__wbindgen_add_to_stack_pointer(16);
1302
+ }
1303
+ }
1304
+ /**
1305
+ * @returns {Uint8Array}
1306
+ */
1307
+ serialize() {
1308
+ try {
1309
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1310
+ wasm.compactfheuint256_serialize(retptr, this.__wbg_ptr);
1311
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1312
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1313
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1314
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1315
+ if (r3) {
1316
+ throw takeObject(r2);
1317
+ }
1318
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1319
+ wasm.__wbindgen_free(r0, r1 * 1);
1320
+ return v1;
1321
+ } finally {
1322
+ wasm.__wbindgen_add_to_stack_pointer(16);
1323
+ }
1324
+ }
1325
+ /**
1326
+ * @param {Uint8Array} buffer
1327
+ * @returns {CompactFheUint256}
1328
+ */
1329
+ static deserialize(buffer) {
1330
+ try {
1331
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1332
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1333
+ const len0 = WASM_VECTOR_LEN;
1334
+ wasm.compactfheuint256_deserialize(retptr, ptr0, len0);
1335
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1336
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1337
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1338
+ if (r2) {
1339
+ throw takeObject(r1);
1340
+ }
1341
+ return CompactFheUint256.__wrap(r0);
1342
+ } finally {
1343
+ wasm.__wbindgen_add_to_stack_pointer(16);
1344
+ }
1345
+ }
1346
+ }
1347
+ /**
1348
+ */
1349
+ export class CompactFheUint256List {
1350
+
1351
+ static __wrap(ptr) {
1352
+ ptr = ptr >>> 0;
1353
+ const obj = Object.create(CompactFheUint256List.prototype);
1354
+ obj.__wbg_ptr = ptr;
1355
+
1356
+ return obj;
1357
+ }
1358
+
1359
+ __destroy_into_raw() {
1360
+ const ptr = this.__wbg_ptr;
1361
+ this.__wbg_ptr = 0;
1362
+
1363
+ return ptr;
1364
+ }
1365
+
1366
+ free() {
1367
+ const ptr = this.__destroy_into_raw();
1368
+ wasm.__wbg_compactfheuint256list_free(ptr);
1369
+ }
1370
+ /**
1371
+ * @param {any[]} values
1372
+ * @param {TfheCompactPublicKey} public_key
1373
+ * @returns {CompactFheUint256List}
1374
+ */
1375
+ static encrypt_with_compact_public_key(values, public_key) {
1376
+ try {
1377
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1378
+ const ptr0 = passArrayJsValueToWasm0(values, wasm.__wbindgen_malloc);
1379
+ const len0 = WASM_VECTOR_LEN;
1380
+ _assertClass(public_key, TfheCompactPublicKey);
1381
+ wasm.compactfheuint256list_encrypt_with_compact_public_key(retptr, ptr0, len0, public_key.__wbg_ptr);
1382
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1383
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1384
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1385
+ if (r2) {
1386
+ throw takeObject(r1);
1387
+ }
1388
+ return CompactFheUint256List.__wrap(r0);
1389
+ } finally {
1390
+ wasm.__wbindgen_add_to_stack_pointer(16);
1391
+ }
1392
+ }
1393
+ /**
1394
+ * @returns {any[]}
1395
+ */
1396
+ expand() {
1397
+ try {
1398
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1399
+ wasm.compactfheuint256list_expand(retptr, this.__wbg_ptr);
1400
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1401
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1402
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1403
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1404
+ if (r3) {
1405
+ throw takeObject(r2);
1406
+ }
1407
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1408
+ wasm.__wbindgen_free(r0, r1 * 4);
1409
+ return v1;
1410
+ } finally {
1411
+ wasm.__wbindgen_add_to_stack_pointer(16);
1412
+ }
1413
+ }
1414
+ /**
1415
+ * @returns {Uint8Array}
1416
+ */
1417
+ serialize() {
1418
+ try {
1419
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1420
+ wasm.compactfheuint256list_serialize(retptr, this.__wbg_ptr);
1421
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1422
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1423
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1424
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1425
+ if (r3) {
1426
+ throw takeObject(r2);
1427
+ }
1428
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1429
+ wasm.__wbindgen_free(r0, r1 * 1);
1430
+ return v1;
1431
+ } finally {
1432
+ wasm.__wbindgen_add_to_stack_pointer(16);
1433
+ }
1434
+ }
1435
+ /**
1436
+ * @param {Uint8Array} buffer
1437
+ * @returns {CompactFheUint256List}
1438
+ */
1439
+ static deserialize(buffer) {
1440
+ try {
1441
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1442
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1443
+ const len0 = WASM_VECTOR_LEN;
1444
+ wasm.compactfheuint256list_deserialize(retptr, ptr0, len0);
1445
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1446
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1447
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1448
+ if (r2) {
1449
+ throw takeObject(r1);
1450
+ }
1451
+ return CompactFheUint256List.__wrap(r0);
1452
+ } finally {
1453
+ wasm.__wbindgen_add_to_stack_pointer(16);
1454
+ }
1455
+ }
1456
+ }
1457
+ /**
1458
+ */
1459
+ export class CompactFheUint32 {
1460
+
1461
+ static __wrap(ptr) {
1462
+ ptr = ptr >>> 0;
1463
+ const obj = Object.create(CompactFheUint32.prototype);
1464
+ obj.__wbg_ptr = ptr;
1465
+
1466
+ return obj;
1467
+ }
1468
+
1469
+ __destroy_into_raw() {
1470
+ const ptr = this.__wbg_ptr;
1471
+ this.__wbg_ptr = 0;
1472
+
1473
+ return ptr;
1474
+ }
1475
+
1476
+ free() {
1477
+ const ptr = this.__destroy_into_raw();
1478
+ wasm.__wbg_compactfheuint32_free(ptr);
1479
+ }
1480
+ /**
1481
+ * @param {number} value
1482
+ * @param {TfheCompactPublicKey} client_key
1483
+ * @returns {CompactFheUint32}
1484
+ */
1485
+ static encrypt_with_compact_public_key(value, client_key) {
1486
+ try {
1487
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1488
+ _assertClass(client_key, TfheCompactPublicKey);
1489
+ wasm.compactfheuint32_encrypt_with_compact_public_key(retptr, value, client_key.__wbg_ptr);
1490
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1491
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1492
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1493
+ if (r2) {
1494
+ throw takeObject(r1);
1495
+ }
1496
+ return CompactFheUint32.__wrap(r0);
1497
+ } finally {
1498
+ wasm.__wbindgen_add_to_stack_pointer(16);
1499
+ }
1500
+ }
1501
+ /**
1502
+ * @returns {FheUint32}
1503
+ */
1504
+ expand() {
1505
+ try {
1506
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1507
+ wasm.compactfheuint32_expand(retptr, this.__wbg_ptr);
1508
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1509
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1510
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1511
+ if (r2) {
1512
+ throw takeObject(r1);
1513
+ }
1514
+ return FheUint32.__wrap(r0);
1515
+ } finally {
1516
+ wasm.__wbindgen_add_to_stack_pointer(16);
1517
+ }
1518
+ }
1519
+ /**
1520
+ * @returns {Uint8Array}
1521
+ */
1522
+ serialize() {
1523
+ try {
1524
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1525
+ wasm.compactfheuint32_serialize(retptr, this.__wbg_ptr);
1526
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1527
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1528
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1529
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1530
+ if (r3) {
1531
+ throw takeObject(r2);
1532
+ }
1533
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1534
+ wasm.__wbindgen_free(r0, r1 * 1);
1535
+ return v1;
1536
+ } finally {
1537
+ wasm.__wbindgen_add_to_stack_pointer(16);
1538
+ }
1539
+ }
1540
+ /**
1541
+ * @param {Uint8Array} buffer
1542
+ * @returns {CompactFheUint32}
1543
+ */
1544
+ static deserialize(buffer) {
1545
+ try {
1546
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1547
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1548
+ const len0 = WASM_VECTOR_LEN;
1549
+ wasm.compactfheuint32_deserialize(retptr, ptr0, len0);
1550
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1551
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1552
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1553
+ if (r2) {
1554
+ throw takeObject(r1);
1555
+ }
1556
+ return CompactFheUint32.__wrap(r0);
1557
+ } finally {
1558
+ wasm.__wbindgen_add_to_stack_pointer(16);
1559
+ }
1560
+ }
1561
+ }
1562
+ /**
1563
+ */
1564
+ export class CompactFheUint32List {
1565
+
1566
+ static __wrap(ptr) {
1567
+ ptr = ptr >>> 0;
1568
+ const obj = Object.create(CompactFheUint32List.prototype);
1569
+ obj.__wbg_ptr = ptr;
1570
+
1571
+ return obj;
1572
+ }
1573
+
1574
+ __destroy_into_raw() {
1575
+ const ptr = this.__wbg_ptr;
1576
+ this.__wbg_ptr = 0;
1577
+
1578
+ return ptr;
1579
+ }
1580
+
1581
+ free() {
1582
+ const ptr = this.__destroy_into_raw();
1583
+ wasm.__wbg_compactfheuint32list_free(ptr);
1584
+ }
1585
+ /**
1586
+ * @param {Uint32Array} values
1587
+ * @param {TfheCompactPublicKey} public_key
1588
+ * @returns {CompactFheUint32List}
1589
+ */
1590
+ static encrypt_with_compact_public_key(values, public_key) {
1591
+ try {
1592
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1593
+ const ptr0 = passArray32ToWasm0(values, wasm.__wbindgen_malloc);
1594
+ const len0 = WASM_VECTOR_LEN;
1595
+ _assertClass(public_key, TfheCompactPublicKey);
1596
+ wasm.compactfheuint32list_encrypt_with_compact_public_key(retptr, ptr0, len0, public_key.__wbg_ptr);
1597
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1598
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1599
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1600
+ if (r2) {
1601
+ throw takeObject(r1);
1602
+ }
1603
+ return CompactFheUint32List.__wrap(r0);
1604
+ } finally {
1605
+ wasm.__wbindgen_add_to_stack_pointer(16);
1606
+ }
1607
+ }
1608
+ /**
1609
+ * @returns {any[]}
1610
+ */
1611
+ expand() {
1612
+ try {
1613
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1614
+ wasm.compactfheuint32list_expand(retptr, this.__wbg_ptr);
1615
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1616
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1617
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1618
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1619
+ if (r3) {
1620
+ throw takeObject(r2);
1621
+ }
1622
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1623
+ wasm.__wbindgen_free(r0, r1 * 4);
1624
+ return v1;
1625
+ } finally {
1626
+ wasm.__wbindgen_add_to_stack_pointer(16);
1627
+ }
1628
+ }
1629
+ /**
1630
+ * @returns {Uint8Array}
1631
+ */
1632
+ serialize() {
1633
+ try {
1634
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1635
+ wasm.compactfheuint32list_serialize(retptr, this.__wbg_ptr);
1636
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1637
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1638
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1639
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1640
+ if (r3) {
1641
+ throw takeObject(r2);
1642
+ }
1643
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1644
+ wasm.__wbindgen_free(r0, r1 * 1);
1645
+ return v1;
1646
+ } finally {
1647
+ wasm.__wbindgen_add_to_stack_pointer(16);
1648
+ }
1649
+ }
1650
+ /**
1651
+ * @param {Uint8Array} buffer
1652
+ * @returns {CompactFheUint32List}
1653
+ */
1654
+ static deserialize(buffer) {
1655
+ try {
1656
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1657
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1658
+ const len0 = WASM_VECTOR_LEN;
1659
+ wasm.compactfheuint32list_deserialize(retptr, ptr0, len0);
1660
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1661
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1662
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1663
+ if (r2) {
1664
+ throw takeObject(r1);
1665
+ }
1666
+ return CompactFheUint32List.__wrap(r0);
1667
+ } finally {
1668
+ wasm.__wbindgen_add_to_stack_pointer(16);
1669
+ }
1670
+ }
1671
+ }
1672
+ /**
1673
+ */
1674
+ export class CompactFheUint64 {
1675
+
1676
+ static __wrap(ptr) {
1677
+ ptr = ptr >>> 0;
1678
+ const obj = Object.create(CompactFheUint64.prototype);
1679
+ obj.__wbg_ptr = ptr;
1680
+
1681
+ return obj;
1682
+ }
1683
+
1684
+ __destroy_into_raw() {
1685
+ const ptr = this.__wbg_ptr;
1686
+ this.__wbg_ptr = 0;
1687
+
1688
+ return ptr;
1689
+ }
1690
+
1691
+ free() {
1692
+ const ptr = this.__destroy_into_raw();
1693
+ wasm.__wbg_compactfheuint64_free(ptr);
1694
+ }
1695
+ /**
1696
+ * @param {bigint} value
1697
+ * @param {TfheCompactPublicKey} client_key
1698
+ * @returns {CompactFheUint64}
1699
+ */
1700
+ static encrypt_with_compact_public_key(value, client_key) {
1701
+ try {
1702
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1703
+ _assertClass(client_key, TfheCompactPublicKey);
1704
+ wasm.compactfheuint64_encrypt_with_compact_public_key(retptr, value, client_key.__wbg_ptr);
1705
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1706
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1707
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1708
+ if (r2) {
1709
+ throw takeObject(r1);
1710
+ }
1711
+ return CompactFheUint64.__wrap(r0);
1712
+ } finally {
1713
+ wasm.__wbindgen_add_to_stack_pointer(16);
1714
+ }
1715
+ }
1716
+ /**
1717
+ * @returns {FheUint64}
1718
+ */
1719
+ expand() {
1720
+ try {
1721
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1722
+ wasm.compactfheuint64_expand(retptr, this.__wbg_ptr);
1723
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1724
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1725
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1726
+ if (r2) {
1727
+ throw takeObject(r1);
1728
+ }
1729
+ return FheUint64.__wrap(r0);
1730
+ } finally {
1731
+ wasm.__wbindgen_add_to_stack_pointer(16);
1732
+ }
1733
+ }
1734
+ /**
1735
+ * @returns {Uint8Array}
1736
+ */
1737
+ serialize() {
1738
+ try {
1739
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1740
+ wasm.compactfheuint64_serialize(retptr, this.__wbg_ptr);
1741
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1742
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1743
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1744
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1745
+ if (r3) {
1746
+ throw takeObject(r2);
1747
+ }
1748
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1749
+ wasm.__wbindgen_free(r0, r1 * 1);
1750
+ return v1;
1751
+ } finally {
1752
+ wasm.__wbindgen_add_to_stack_pointer(16);
1753
+ }
1754
+ }
1755
+ /**
1756
+ * @param {Uint8Array} buffer
1757
+ * @returns {CompactFheUint64}
1758
+ */
1759
+ static deserialize(buffer) {
1760
+ try {
1761
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1762
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1763
+ const len0 = WASM_VECTOR_LEN;
1764
+ wasm.compactfheuint64_deserialize(retptr, ptr0, len0);
1765
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1766
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1767
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1768
+ if (r2) {
1769
+ throw takeObject(r1);
1770
+ }
1771
+ return CompactFheUint64.__wrap(r0);
1772
+ } finally {
1773
+ wasm.__wbindgen_add_to_stack_pointer(16);
1774
+ }
1775
+ }
1776
+ }
1777
+ /**
1778
+ */
1779
+ export class CompactFheUint64List {
1780
+
1781
+ static __wrap(ptr) {
1782
+ ptr = ptr >>> 0;
1783
+ const obj = Object.create(CompactFheUint64List.prototype);
1784
+ obj.__wbg_ptr = ptr;
1785
+
1786
+ return obj;
1787
+ }
1788
+
1789
+ __destroy_into_raw() {
1790
+ const ptr = this.__wbg_ptr;
1791
+ this.__wbg_ptr = 0;
1792
+
1793
+ return ptr;
1794
+ }
1795
+
1796
+ free() {
1797
+ const ptr = this.__destroy_into_raw();
1798
+ wasm.__wbg_compactfheuint64list_free(ptr);
1799
+ }
1800
+ /**
1801
+ * @param {BigUint64Array} values
1802
+ * @param {TfheCompactPublicKey} public_key
1803
+ * @returns {CompactFheUint64List}
1804
+ */
1805
+ static encrypt_with_compact_public_key(values, public_key) {
1806
+ try {
1807
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1808
+ const ptr0 = passArray64ToWasm0(values, wasm.__wbindgen_malloc);
1809
+ const len0 = WASM_VECTOR_LEN;
1810
+ _assertClass(public_key, TfheCompactPublicKey);
1811
+ wasm.compactfheuint64list_encrypt_with_compact_public_key(retptr, ptr0, len0, public_key.__wbg_ptr);
1812
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1813
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1814
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1815
+ if (r2) {
1816
+ throw takeObject(r1);
1817
+ }
1818
+ return CompactFheUint64List.__wrap(r0);
1819
+ } finally {
1820
+ wasm.__wbindgen_add_to_stack_pointer(16);
1821
+ }
1822
+ }
1823
+ /**
1824
+ * @returns {any[]}
1825
+ */
1826
+ expand() {
1827
+ try {
1828
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1829
+ wasm.compactfheuint64list_expand(retptr, this.__wbg_ptr);
1830
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1831
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1832
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1833
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1834
+ if (r3) {
1835
+ throw takeObject(r2);
1836
+ }
1837
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1838
+ wasm.__wbindgen_free(r0, r1 * 4);
1839
+ return v1;
1840
+ } finally {
1841
+ wasm.__wbindgen_add_to_stack_pointer(16);
1842
+ }
1843
+ }
1844
+ /**
1845
+ * @returns {Uint8Array}
1846
+ */
1847
+ serialize() {
1848
+ try {
1849
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1850
+ wasm.compactfheuint64list_serialize(retptr, this.__wbg_ptr);
1851
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1852
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1853
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1854
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1855
+ if (r3) {
1856
+ throw takeObject(r2);
1857
+ }
1858
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1859
+ wasm.__wbindgen_free(r0, r1 * 1);
1860
+ return v1;
1861
+ } finally {
1862
+ wasm.__wbindgen_add_to_stack_pointer(16);
1863
+ }
1864
+ }
1865
+ /**
1866
+ * @param {Uint8Array} buffer
1867
+ * @returns {CompactFheUint64List}
1868
+ */
1869
+ static deserialize(buffer) {
1870
+ try {
1871
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1872
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1873
+ const len0 = WASM_VECTOR_LEN;
1874
+ wasm.compactfheuint64list_deserialize(retptr, ptr0, len0);
1875
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1876
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1877
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1878
+ if (r2) {
1879
+ throw takeObject(r1);
1880
+ }
1881
+ return CompactFheUint64List.__wrap(r0);
1882
+ } finally {
1883
+ wasm.__wbindgen_add_to_stack_pointer(16);
1884
+ }
1885
+ }
1886
+ }
1887
+ /**
1888
+ */
1889
+ export class CompactFheUint8 {
1890
+
1891
+ static __wrap(ptr) {
1892
+ ptr = ptr >>> 0;
1893
+ const obj = Object.create(CompactFheUint8.prototype);
1894
+ obj.__wbg_ptr = ptr;
1895
+
1896
+ return obj;
1897
+ }
1898
+
1899
+ __destroy_into_raw() {
1900
+ const ptr = this.__wbg_ptr;
1901
+ this.__wbg_ptr = 0;
1902
+
1903
+ return ptr;
1904
+ }
1905
+
1906
+ free() {
1907
+ const ptr = this.__destroy_into_raw();
1908
+ wasm.__wbg_compactfheuint8_free(ptr);
1909
+ }
1910
+ /**
1911
+ * @param {number} value
1912
+ * @param {TfheCompactPublicKey} client_key
1913
+ * @returns {CompactFheUint8}
1914
+ */
1915
+ static encrypt_with_compact_public_key(value, client_key) {
1916
+ try {
1917
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1918
+ _assertClass(client_key, TfheCompactPublicKey);
1919
+ wasm.compactfheuint8_encrypt_with_compact_public_key(retptr, value, client_key.__wbg_ptr);
1920
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1921
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1922
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1923
+ if (r2) {
1924
+ throw takeObject(r1);
1925
+ }
1926
+ return CompactFheUint8.__wrap(r0);
1927
+ } finally {
1928
+ wasm.__wbindgen_add_to_stack_pointer(16);
1929
+ }
1930
+ }
1931
+ /**
1932
+ * @returns {FheUint8}
1933
+ */
1934
+ expand() {
1935
+ try {
1936
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1937
+ wasm.compactfheuint8_expand(retptr, this.__wbg_ptr);
1938
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1939
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1940
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1941
+ if (r2) {
1942
+ throw takeObject(r1);
1943
+ }
1944
+ return FheUint8.__wrap(r0);
1945
+ } finally {
1946
+ wasm.__wbindgen_add_to_stack_pointer(16);
1947
+ }
1948
+ }
1949
+ /**
1950
+ * @returns {Uint8Array}
1951
+ */
1952
+ serialize() {
1953
+ try {
1954
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1955
+ wasm.compactfheuint8_serialize(retptr, this.__wbg_ptr);
1956
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1957
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1958
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1959
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
1960
+ if (r3) {
1961
+ throw takeObject(r2);
1962
+ }
1963
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1964
+ wasm.__wbindgen_free(r0, r1 * 1);
1965
+ return v1;
1966
+ } finally {
1967
+ wasm.__wbindgen_add_to_stack_pointer(16);
1968
+ }
1969
+ }
1970
+ /**
1971
+ * @param {Uint8Array} buffer
1972
+ * @returns {CompactFheUint8}
1973
+ */
1974
+ static deserialize(buffer) {
1975
+ try {
1976
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1977
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1978
+ const len0 = WASM_VECTOR_LEN;
1979
+ wasm.compactfheuint8_deserialize(retptr, ptr0, len0);
1980
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
1981
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
1982
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
1983
+ if (r2) {
1984
+ throw takeObject(r1);
1985
+ }
1986
+ return CompactFheUint8.__wrap(r0);
1987
+ } finally {
1988
+ wasm.__wbindgen_add_to_stack_pointer(16);
1989
+ }
1990
+ }
1991
+ }
1992
+ /**
1993
+ */
1994
+ export class CompactFheUint8List {
1995
+
1996
+ static __wrap(ptr) {
1997
+ ptr = ptr >>> 0;
1998
+ const obj = Object.create(CompactFheUint8List.prototype);
1999
+ obj.__wbg_ptr = ptr;
2000
+
2001
+ return obj;
2002
+ }
2003
+
2004
+ __destroy_into_raw() {
2005
+ const ptr = this.__wbg_ptr;
2006
+ this.__wbg_ptr = 0;
2007
+
2008
+ return ptr;
2009
+ }
2010
+
2011
+ free() {
2012
+ const ptr = this.__destroy_into_raw();
2013
+ wasm.__wbg_compactfheuint8list_free(ptr);
2014
+ }
2015
+ /**
2016
+ * @param {Uint8Array} values
2017
+ * @param {TfheCompactPublicKey} public_key
2018
+ * @returns {CompactFheUint8List}
2019
+ */
2020
+ static encrypt_with_compact_public_key(values, public_key) {
2021
+ try {
2022
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2023
+ const ptr0 = passArray8ToWasm0(values, wasm.__wbindgen_malloc);
2024
+ const len0 = WASM_VECTOR_LEN;
2025
+ _assertClass(public_key, TfheCompactPublicKey);
2026
+ wasm.compactfheuint8list_encrypt_with_compact_public_key(retptr, ptr0, len0, public_key.__wbg_ptr);
2027
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2028
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2029
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2030
+ if (r2) {
2031
+ throw takeObject(r1);
2032
+ }
2033
+ return CompactFheUint8List.__wrap(r0);
2034
+ } finally {
2035
+ wasm.__wbindgen_add_to_stack_pointer(16);
2036
+ }
2037
+ }
2038
+ /**
2039
+ * @returns {any[]}
2040
+ */
2041
+ expand() {
2042
+ try {
2043
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2044
+ wasm.compactfheuint8list_expand(retptr, this.__wbg_ptr);
2045
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2046
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2047
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2048
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2049
+ if (r3) {
2050
+ throw takeObject(r2);
2051
+ }
2052
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
2053
+ wasm.__wbindgen_free(r0, r1 * 4);
2054
+ return v1;
2055
+ } finally {
2056
+ wasm.__wbindgen_add_to_stack_pointer(16);
2057
+ }
2058
+ }
2059
+ /**
2060
+ * @returns {Uint8Array}
2061
+ */
2062
+ serialize() {
2063
+ try {
2064
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2065
+ wasm.compactfheuint8list_serialize(retptr, this.__wbg_ptr);
2066
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2067
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2068
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2069
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2070
+ if (r3) {
2071
+ throw takeObject(r2);
2072
+ }
2073
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2074
+ wasm.__wbindgen_free(r0, r1 * 1);
2075
+ return v1;
2076
+ } finally {
2077
+ wasm.__wbindgen_add_to_stack_pointer(16);
2078
+ }
2079
+ }
2080
+ /**
2081
+ * @param {Uint8Array} buffer
2082
+ * @returns {CompactFheUint8List}
2083
+ */
2084
+ static deserialize(buffer) {
2085
+ try {
2086
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2087
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
2088
+ const len0 = WASM_VECTOR_LEN;
2089
+ wasm.compactfheuint8list_deserialize(retptr, ptr0, len0);
2090
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2091
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2092
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2093
+ if (r2) {
2094
+ throw takeObject(r1);
2095
+ }
2096
+ return CompactFheUint8List.__wrap(r0);
2097
+ } finally {
2098
+ wasm.__wbindgen_add_to_stack_pointer(16);
2099
+ }
2100
+ }
2101
+ }
2102
+ /**
2103
+ */
2104
+ export class CompressedFheUint128 {
2105
+
2106
+ static __wrap(ptr) {
2107
+ ptr = ptr >>> 0;
2108
+ const obj = Object.create(CompressedFheUint128.prototype);
2109
+ obj.__wbg_ptr = ptr;
2110
+
2111
+ return obj;
2112
+ }
2113
+
2114
+ __destroy_into_raw() {
2115
+ const ptr = this.__wbg_ptr;
2116
+ this.__wbg_ptr = 0;
2117
+
2118
+ return ptr;
2119
+ }
2120
+
2121
+ free() {
2122
+ const ptr = this.__destroy_into_raw();
2123
+ wasm.__wbg_compressedfheuint128_free(ptr);
2124
+ }
2125
+ /**
2126
+ * @param {any} value
2127
+ * @param {TfheClientKey} client_key
2128
+ * @returns {CompressedFheUint128}
2129
+ */
2130
+ static encrypt_with_client_key(value, client_key) {
2131
+ try {
2132
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2133
+ _assertClass(client_key, TfheClientKey);
2134
+ wasm.compressedfheuint128_encrypt_with_client_key(retptr, addHeapObject(value), client_key.__wbg_ptr);
2135
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2136
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2137
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2138
+ if (r2) {
2139
+ throw takeObject(r1);
2140
+ }
2141
+ return CompressedFheUint128.__wrap(r0);
2142
+ } finally {
2143
+ wasm.__wbindgen_add_to_stack_pointer(16);
2144
+ }
2145
+ }
2146
+ /**
2147
+ * @returns {FheUint128}
2148
+ */
2149
+ decompress() {
2150
+ try {
2151
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2152
+ wasm.compressedfheuint128_decompress(retptr, this.__wbg_ptr);
2153
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2154
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2155
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2156
+ if (r2) {
2157
+ throw takeObject(r1);
2158
+ }
2159
+ return FheUint128.__wrap(r0);
2160
+ } finally {
2161
+ wasm.__wbindgen_add_to_stack_pointer(16);
2162
+ }
2163
+ }
2164
+ /**
2165
+ * @returns {Uint8Array}
2166
+ */
2167
+ serialize() {
2168
+ try {
2169
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2170
+ wasm.compressedfheuint128_serialize(retptr, this.__wbg_ptr);
2171
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2172
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2173
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2174
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2175
+ if (r3) {
2176
+ throw takeObject(r2);
2177
+ }
2178
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2179
+ wasm.__wbindgen_free(r0, r1 * 1);
2180
+ return v1;
2181
+ } finally {
2182
+ wasm.__wbindgen_add_to_stack_pointer(16);
2183
+ }
2184
+ }
2185
+ /**
2186
+ * @param {Uint8Array} buffer
2187
+ * @returns {CompressedFheUint128}
2188
+ */
2189
+ static deserialize(buffer) {
2190
+ try {
2191
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2192
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
2193
+ const len0 = WASM_VECTOR_LEN;
2194
+ wasm.compressedfheuint128_deserialize(retptr, ptr0, len0);
2195
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2196
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2197
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2198
+ if (r2) {
2199
+ throw takeObject(r1);
2200
+ }
2201
+ return CompressedFheUint128.__wrap(r0);
2202
+ } finally {
2203
+ wasm.__wbindgen_add_to_stack_pointer(16);
2204
+ }
2205
+ }
2206
+ }
2207
+ /**
2208
+ */
2209
+ export class CompressedFheUint16 {
2210
+
2211
+ static __wrap(ptr) {
2212
+ ptr = ptr >>> 0;
2213
+ const obj = Object.create(CompressedFheUint16.prototype);
2214
+ obj.__wbg_ptr = ptr;
2215
+
2216
+ return obj;
2217
+ }
2218
+
2219
+ __destroy_into_raw() {
2220
+ const ptr = this.__wbg_ptr;
2221
+ this.__wbg_ptr = 0;
2222
+
2223
+ return ptr;
2224
+ }
2225
+
2226
+ free() {
2227
+ const ptr = this.__destroy_into_raw();
2228
+ wasm.__wbg_compressedfheuint16_free(ptr);
2229
+ }
2230
+ /**
2231
+ * @param {number} value
2232
+ * @param {TfheClientKey} client_key
2233
+ * @returns {CompressedFheUint16}
2234
+ */
2235
+ static encrypt_with_client_key(value, client_key) {
2236
+ try {
2237
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2238
+ _assertClass(client_key, TfheClientKey);
2239
+ wasm.compressedfheuint16_encrypt_with_client_key(retptr, value, client_key.__wbg_ptr);
2240
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2241
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2242
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2243
+ if (r2) {
2244
+ throw takeObject(r1);
2245
+ }
2246
+ return CompressedFheUint16.__wrap(r0);
2247
+ } finally {
2248
+ wasm.__wbindgen_add_to_stack_pointer(16);
2249
+ }
2250
+ }
2251
+ /**
2252
+ * @returns {FheUint16}
2253
+ */
2254
+ decompress() {
2255
+ try {
2256
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2257
+ wasm.compressedfheuint128_decompress(retptr, this.__wbg_ptr);
2258
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2259
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2260
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2261
+ if (r2) {
2262
+ throw takeObject(r1);
2263
+ }
2264
+ return FheUint16.__wrap(r0);
2265
+ } finally {
2266
+ wasm.__wbindgen_add_to_stack_pointer(16);
2267
+ }
2268
+ }
2269
+ /**
2270
+ * @returns {Uint8Array}
2271
+ */
2272
+ serialize() {
2273
+ try {
2274
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2275
+ wasm.compressedfheuint16_serialize(retptr, this.__wbg_ptr);
2276
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2277
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2278
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2279
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2280
+ if (r3) {
2281
+ throw takeObject(r2);
2282
+ }
2283
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2284
+ wasm.__wbindgen_free(r0, r1 * 1);
2285
+ return v1;
2286
+ } finally {
2287
+ wasm.__wbindgen_add_to_stack_pointer(16);
2288
+ }
2289
+ }
2290
+ /**
2291
+ * @param {Uint8Array} buffer
2292
+ * @returns {CompressedFheUint16}
2293
+ */
2294
+ static deserialize(buffer) {
2295
+ try {
2296
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2297
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
2298
+ const len0 = WASM_VECTOR_LEN;
2299
+ wasm.compressedfheuint16_deserialize(retptr, ptr0, len0);
2300
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2301
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2302
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2303
+ if (r2) {
2304
+ throw takeObject(r1);
2305
+ }
2306
+ return CompressedFheUint16.__wrap(r0);
2307
+ } finally {
2308
+ wasm.__wbindgen_add_to_stack_pointer(16);
2309
+ }
2310
+ }
2311
+ }
2312
+ /**
2313
+ */
2314
+ export class CompressedFheUint256 {
2315
+
2316
+ static __wrap(ptr) {
2317
+ ptr = ptr >>> 0;
2318
+ const obj = Object.create(CompressedFheUint256.prototype);
2319
+ obj.__wbg_ptr = ptr;
2320
+
2321
+ return obj;
2322
+ }
2323
+
2324
+ __destroy_into_raw() {
2325
+ const ptr = this.__wbg_ptr;
2326
+ this.__wbg_ptr = 0;
2327
+
2328
+ return ptr;
2329
+ }
2330
+
2331
+ free() {
2332
+ const ptr = this.__destroy_into_raw();
2333
+ wasm.__wbg_compressedfheuint256_free(ptr);
2334
+ }
2335
+ /**
2336
+ * @param {any} value
2337
+ * @param {TfheClientKey} client_key
2338
+ * @returns {CompressedFheUint256}
2339
+ */
2340
+ static encrypt_with_client_key(value, client_key) {
2341
+ try {
2342
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2343
+ _assertClass(client_key, TfheClientKey);
2344
+ wasm.compressedfheuint256_encrypt_with_client_key(retptr, addHeapObject(value), client_key.__wbg_ptr);
2345
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2346
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2347
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2348
+ if (r2) {
2349
+ throw takeObject(r1);
2350
+ }
2351
+ return CompressedFheUint256.__wrap(r0);
2352
+ } finally {
2353
+ wasm.__wbindgen_add_to_stack_pointer(16);
2354
+ }
2355
+ }
2356
+ /**
2357
+ * @returns {FheUint256}
2358
+ */
2359
+ decompress() {
2360
+ try {
2361
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2362
+ wasm.compressedfheuint128_decompress(retptr, this.__wbg_ptr);
2363
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2364
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2365
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2366
+ if (r2) {
2367
+ throw takeObject(r1);
2368
+ }
2369
+ return FheUint256.__wrap(r0);
2370
+ } finally {
2371
+ wasm.__wbindgen_add_to_stack_pointer(16);
2372
+ }
2373
+ }
2374
+ /**
2375
+ * @returns {Uint8Array}
2376
+ */
2377
+ serialize() {
2378
+ try {
2379
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2380
+ wasm.compressedfheuint256_serialize(retptr, this.__wbg_ptr);
2381
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2382
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2383
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2384
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2385
+ if (r3) {
2386
+ throw takeObject(r2);
2387
+ }
2388
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2389
+ wasm.__wbindgen_free(r0, r1 * 1);
2390
+ return v1;
2391
+ } finally {
2392
+ wasm.__wbindgen_add_to_stack_pointer(16);
2393
+ }
2394
+ }
2395
+ /**
2396
+ * @param {Uint8Array} buffer
2397
+ * @returns {CompressedFheUint256}
2398
+ */
2399
+ static deserialize(buffer) {
2400
+ try {
2401
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2402
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
2403
+ const len0 = WASM_VECTOR_LEN;
2404
+ wasm.compressedfheuint256_deserialize(retptr, ptr0, len0);
2405
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2406
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2407
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2408
+ if (r2) {
2409
+ throw takeObject(r1);
2410
+ }
2411
+ return CompressedFheUint256.__wrap(r0);
2412
+ } finally {
2413
+ wasm.__wbindgen_add_to_stack_pointer(16);
2414
+ }
2415
+ }
2416
+ }
2417
+ /**
2418
+ */
2419
+ export class CompressedFheUint32 {
2420
+
2421
+ static __wrap(ptr) {
2422
+ ptr = ptr >>> 0;
2423
+ const obj = Object.create(CompressedFheUint32.prototype);
2424
+ obj.__wbg_ptr = ptr;
2425
+
2426
+ return obj;
2427
+ }
2428
+
2429
+ __destroy_into_raw() {
2430
+ const ptr = this.__wbg_ptr;
2431
+ this.__wbg_ptr = 0;
2432
+
2433
+ return ptr;
2434
+ }
2435
+
2436
+ free() {
2437
+ const ptr = this.__destroy_into_raw();
2438
+ wasm.__wbg_compressedfheuint32_free(ptr);
2439
+ }
2440
+ /**
2441
+ * @param {number} value
2442
+ * @param {TfheClientKey} client_key
2443
+ * @returns {CompressedFheUint32}
2444
+ */
2445
+ static encrypt_with_client_key(value, client_key) {
2446
+ try {
2447
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2448
+ _assertClass(client_key, TfheClientKey);
2449
+ wasm.compressedfheuint32_encrypt_with_client_key(retptr, value, client_key.__wbg_ptr);
2450
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2451
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2452
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2453
+ if (r2) {
2454
+ throw takeObject(r1);
2455
+ }
2456
+ return CompressedFheUint32.__wrap(r0);
2457
+ } finally {
2458
+ wasm.__wbindgen_add_to_stack_pointer(16);
2459
+ }
2460
+ }
2461
+ /**
2462
+ * @returns {FheUint32}
2463
+ */
2464
+ decompress() {
2465
+ try {
2466
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2467
+ wasm.compressedfheuint128_decompress(retptr, this.__wbg_ptr);
2468
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2469
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2470
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2471
+ if (r2) {
2472
+ throw takeObject(r1);
2473
+ }
2474
+ return FheUint32.__wrap(r0);
2475
+ } finally {
2476
+ wasm.__wbindgen_add_to_stack_pointer(16);
2477
+ }
2478
+ }
2479
+ /**
2480
+ * @returns {Uint8Array}
2481
+ */
2482
+ serialize() {
2483
+ try {
2484
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2485
+ wasm.compressedfheuint32_serialize(retptr, this.__wbg_ptr);
2486
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2487
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2488
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2489
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2490
+ if (r3) {
2491
+ throw takeObject(r2);
2492
+ }
2493
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2494
+ wasm.__wbindgen_free(r0, r1 * 1);
2495
+ return v1;
2496
+ } finally {
2497
+ wasm.__wbindgen_add_to_stack_pointer(16);
2498
+ }
2499
+ }
2500
+ /**
2501
+ * @param {Uint8Array} buffer
2502
+ * @returns {CompressedFheUint32}
2503
+ */
2504
+ static deserialize(buffer) {
2505
+ try {
2506
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2507
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
2508
+ const len0 = WASM_VECTOR_LEN;
2509
+ wasm.compressedfheuint32_deserialize(retptr, ptr0, len0);
2510
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2511
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2512
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2513
+ if (r2) {
2514
+ throw takeObject(r1);
2515
+ }
2516
+ return CompressedFheUint32.__wrap(r0);
2517
+ } finally {
2518
+ wasm.__wbindgen_add_to_stack_pointer(16);
2519
+ }
2520
+ }
2521
+ }
2522
+ /**
2523
+ */
2524
+ export class CompressedFheUint64 {
2525
+
2526
+ static __wrap(ptr) {
2527
+ ptr = ptr >>> 0;
2528
+ const obj = Object.create(CompressedFheUint64.prototype);
2529
+ obj.__wbg_ptr = ptr;
2530
+
2531
+ return obj;
2532
+ }
2533
+
2534
+ __destroy_into_raw() {
2535
+ const ptr = this.__wbg_ptr;
2536
+ this.__wbg_ptr = 0;
2537
+
2538
+ return ptr;
2539
+ }
2540
+
2541
+ free() {
2542
+ const ptr = this.__destroy_into_raw();
2543
+ wasm.__wbg_compressedfheuint64_free(ptr);
2544
+ }
2545
+ /**
2546
+ * @param {bigint} value
2547
+ * @param {TfheClientKey} client_key
2548
+ * @returns {CompressedFheUint64}
2549
+ */
2550
+ static encrypt_with_client_key(value, client_key) {
2551
+ try {
2552
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2553
+ _assertClass(client_key, TfheClientKey);
2554
+ wasm.compressedfheuint64_encrypt_with_client_key(retptr, value, client_key.__wbg_ptr);
2555
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2556
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2557
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2558
+ if (r2) {
2559
+ throw takeObject(r1);
2560
+ }
2561
+ return CompressedFheUint64.__wrap(r0);
2562
+ } finally {
2563
+ wasm.__wbindgen_add_to_stack_pointer(16);
2564
+ }
2565
+ }
2566
+ /**
2567
+ * @returns {FheUint64}
2568
+ */
2569
+ decompress() {
2570
+ try {
2571
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2572
+ wasm.compressedfheuint128_decompress(retptr, this.__wbg_ptr);
2573
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2574
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2575
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2576
+ if (r2) {
2577
+ throw takeObject(r1);
2578
+ }
2579
+ return FheUint64.__wrap(r0);
2580
+ } finally {
2581
+ wasm.__wbindgen_add_to_stack_pointer(16);
2582
+ }
2583
+ }
2584
+ /**
2585
+ * @returns {Uint8Array}
2586
+ */
2587
+ serialize() {
2588
+ try {
2589
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2590
+ wasm.compressedfheuint64_serialize(retptr, this.__wbg_ptr);
2591
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2592
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2593
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2594
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2595
+ if (r3) {
2596
+ throw takeObject(r2);
2597
+ }
2598
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2599
+ wasm.__wbindgen_free(r0, r1 * 1);
2600
+ return v1;
2601
+ } finally {
2602
+ wasm.__wbindgen_add_to_stack_pointer(16);
2603
+ }
2604
+ }
2605
+ /**
2606
+ * @param {Uint8Array} buffer
2607
+ * @returns {CompressedFheUint64}
2608
+ */
2609
+ static deserialize(buffer) {
2610
+ try {
2611
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2612
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
2613
+ const len0 = WASM_VECTOR_LEN;
2614
+ wasm.compressedfheuint64_deserialize(retptr, ptr0, len0);
2615
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2616
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2617
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2618
+ if (r2) {
2619
+ throw takeObject(r1);
2620
+ }
2621
+ return CompressedFheUint64.__wrap(r0);
2622
+ } finally {
2623
+ wasm.__wbindgen_add_to_stack_pointer(16);
2624
+ }
2625
+ }
2626
+ }
2627
+ /**
2628
+ */
2629
+ export class CompressedFheUint8 {
2630
+
2631
+ static __wrap(ptr) {
2632
+ ptr = ptr >>> 0;
2633
+ const obj = Object.create(CompressedFheUint8.prototype);
2634
+ obj.__wbg_ptr = ptr;
2635
+
2636
+ return obj;
2637
+ }
2638
+
2639
+ __destroy_into_raw() {
2640
+ const ptr = this.__wbg_ptr;
2641
+ this.__wbg_ptr = 0;
2642
+
2643
+ return ptr;
2644
+ }
2645
+
2646
+ free() {
2647
+ const ptr = this.__destroy_into_raw();
2648
+ wasm.__wbg_compressedfheuint8_free(ptr);
2649
+ }
2650
+ /**
2651
+ * @param {number} value
2652
+ * @param {TfheClientKey} client_key
2653
+ * @returns {CompressedFheUint8}
2654
+ */
2655
+ static encrypt_with_client_key(value, client_key) {
2656
+ try {
2657
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2658
+ _assertClass(client_key, TfheClientKey);
2659
+ wasm.compressedfheuint8_encrypt_with_client_key(retptr, value, client_key.__wbg_ptr);
2660
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2661
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2662
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2663
+ if (r2) {
2664
+ throw takeObject(r1);
2665
+ }
2666
+ return CompressedFheUint8.__wrap(r0);
2667
+ } finally {
2668
+ wasm.__wbindgen_add_to_stack_pointer(16);
2669
+ }
2670
+ }
2671
+ /**
2672
+ * @returns {FheUint8}
2673
+ */
2674
+ decompress() {
2675
+ try {
2676
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2677
+ wasm.compressedfheuint128_decompress(retptr, this.__wbg_ptr);
2678
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2679
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2680
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2681
+ if (r2) {
2682
+ throw takeObject(r1);
2683
+ }
2684
+ return FheUint8.__wrap(r0);
2685
+ } finally {
2686
+ wasm.__wbindgen_add_to_stack_pointer(16);
2687
+ }
2688
+ }
2689
+ /**
2690
+ * @returns {Uint8Array}
2691
+ */
2692
+ serialize() {
2693
+ try {
2694
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2695
+ wasm.compressedfheuint8_serialize(retptr, this.__wbg_ptr);
2696
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2697
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2698
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2699
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2700
+ if (r3) {
2701
+ throw takeObject(r2);
2702
+ }
2703
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2704
+ wasm.__wbindgen_free(r0, r1 * 1);
2705
+ return v1;
2706
+ } finally {
2707
+ wasm.__wbindgen_add_to_stack_pointer(16);
2708
+ }
2709
+ }
2710
+ /**
2711
+ * @param {Uint8Array} buffer
2712
+ * @returns {CompressedFheUint8}
2713
+ */
2714
+ static deserialize(buffer) {
2715
+ try {
2716
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2717
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
2718
+ const len0 = WASM_VECTOR_LEN;
2719
+ wasm.compressedfheuint8_deserialize(retptr, ptr0, len0);
2720
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2721
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2722
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2723
+ if (r2) {
2724
+ throw takeObject(r1);
2725
+ }
2726
+ return CompressedFheUint8.__wrap(r0);
2727
+ } finally {
2728
+ wasm.__wbindgen_add_to_stack_pointer(16);
2729
+ }
2730
+ }
2731
+ }
2732
+ /**
2733
+ */
2734
+ export class FheUint128 {
2735
+
2736
+ static __wrap(ptr) {
2737
+ ptr = ptr >>> 0;
2738
+ const obj = Object.create(FheUint128.prototype);
2739
+ obj.__wbg_ptr = ptr;
2740
+
2741
+ return obj;
2742
+ }
2743
+
2744
+ __destroy_into_raw() {
2745
+ const ptr = this.__wbg_ptr;
2746
+ this.__wbg_ptr = 0;
2747
+
2748
+ return ptr;
2749
+ }
2750
+
2751
+ free() {
2752
+ const ptr = this.__destroy_into_raw();
2753
+ wasm.__wbg_fheuint128_free(ptr);
2754
+ }
2755
+ /**
2756
+ * @param {any} value
2757
+ * @param {TfheClientKey} client_key
2758
+ * @returns {FheUint128}
2759
+ */
2760
+ static encrypt_with_client_key(value, client_key) {
2761
+ try {
2762
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2763
+ _assertClass(client_key, TfheClientKey);
2764
+ wasm.fheuint128_encrypt_with_client_key(retptr, addHeapObject(value), client_key.__wbg_ptr);
2765
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2766
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2767
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2768
+ if (r2) {
2769
+ throw takeObject(r1);
2770
+ }
2771
+ return FheUint128.__wrap(r0);
2772
+ } finally {
2773
+ wasm.__wbindgen_add_to_stack_pointer(16);
2774
+ }
2775
+ }
2776
+ /**
2777
+ * @param {any} value
2778
+ * @param {TfhePublicKey} public_key
2779
+ * @returns {FheUint128}
2780
+ */
2781
+ static encrypt_with_public_key(value, public_key) {
2782
+ try {
2783
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2784
+ _assertClass(public_key, TfhePublicKey);
2785
+ wasm.fheuint128_encrypt_with_public_key(retptr, addHeapObject(value), public_key.__wbg_ptr);
2786
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2787
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2788
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2789
+ if (r2) {
2790
+ throw takeObject(r1);
2791
+ }
2792
+ return FheUint128.__wrap(r0);
2793
+ } finally {
2794
+ wasm.__wbindgen_add_to_stack_pointer(16);
2795
+ }
2796
+ }
2797
+ /**
2798
+ * @param {any} value
2799
+ * @param {TfheCompressedPublicKey} compressed_public_key
2800
+ * @returns {FheUint128}
2801
+ */
2802
+ static encrypt_with_compressed_public_key(value, compressed_public_key) {
2803
+ try {
2804
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2805
+ _assertClass(compressed_public_key, TfheCompressedPublicKey);
2806
+ wasm.fheuint128_encrypt_with_compressed_public_key(retptr, addHeapObject(value), compressed_public_key.__wbg_ptr);
2807
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2808
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2809
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2810
+ if (r2) {
2811
+ throw takeObject(r1);
2812
+ }
2813
+ return FheUint128.__wrap(r0);
2814
+ } finally {
2815
+ wasm.__wbindgen_add_to_stack_pointer(16);
2816
+ }
2817
+ }
2818
+ /**
2819
+ * @param {any} value
2820
+ * @param {TfheCompactPublicKey} compact_public_key
2821
+ * @returns {FheUint128}
2822
+ */
2823
+ static encrypt_with_compact_public_key(value, compact_public_key) {
2824
+ try {
2825
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2826
+ _assertClass(compact_public_key, TfheCompactPublicKey);
2827
+ wasm.fheuint128_encrypt_with_compact_public_key(retptr, addHeapObject(value), compact_public_key.__wbg_ptr);
2828
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2829
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2830
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2831
+ if (r2) {
2832
+ throw takeObject(r1);
2833
+ }
2834
+ return FheUint128.__wrap(r0);
2835
+ } finally {
2836
+ wasm.__wbindgen_add_to_stack_pointer(16);
2837
+ }
2838
+ }
2839
+ /**
2840
+ * @param {TfheClientKey} client_key
2841
+ * @returns {any}
2842
+ */
2843
+ decrypt(client_key) {
2844
+ try {
2845
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2846
+ _assertClass(client_key, TfheClientKey);
2847
+ wasm.fheuint128_decrypt(retptr, this.__wbg_ptr, client_key.__wbg_ptr);
2848
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2849
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2850
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2851
+ if (r2) {
2852
+ throw takeObject(r1);
2853
+ }
2854
+ return takeObject(r0);
2855
+ } finally {
2856
+ wasm.__wbindgen_add_to_stack_pointer(16);
2857
+ }
2858
+ }
2859
+ /**
2860
+ * @returns {Uint8Array}
2861
+ */
2862
+ serialize() {
2863
+ try {
2864
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2865
+ wasm.fheuint128_serialize(retptr, this.__wbg_ptr);
2866
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2867
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2868
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2869
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
2870
+ if (r3) {
2871
+ throw takeObject(r2);
2872
+ }
2873
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2874
+ wasm.__wbindgen_free(r0, r1 * 1);
2875
+ return v1;
2876
+ } finally {
2877
+ wasm.__wbindgen_add_to_stack_pointer(16);
2878
+ }
2879
+ }
2880
+ /**
2881
+ * @param {Uint8Array} buffer
2882
+ * @returns {FheUint128}
2883
+ */
2884
+ static deserialize(buffer) {
2885
+ try {
2886
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2887
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
2888
+ const len0 = WASM_VECTOR_LEN;
2889
+ wasm.fheuint128_deserialize(retptr, ptr0, len0);
2890
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2891
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2892
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2893
+ if (r2) {
2894
+ throw takeObject(r1);
2895
+ }
2896
+ return FheUint128.__wrap(r0);
2897
+ } finally {
2898
+ wasm.__wbindgen_add_to_stack_pointer(16);
2899
+ }
2900
+ }
2901
+ }
2902
+ /**
2903
+ */
2904
+ export class FheUint16 {
2905
+
2906
+ static __wrap(ptr) {
2907
+ ptr = ptr >>> 0;
2908
+ const obj = Object.create(FheUint16.prototype);
2909
+ obj.__wbg_ptr = ptr;
2910
+
2911
+ return obj;
2912
+ }
2913
+
2914
+ __destroy_into_raw() {
2915
+ const ptr = this.__wbg_ptr;
2916
+ this.__wbg_ptr = 0;
2917
+
2918
+ return ptr;
2919
+ }
2920
+
2921
+ free() {
2922
+ const ptr = this.__destroy_into_raw();
2923
+ wasm.__wbg_fheuint16_free(ptr);
2924
+ }
2925
+ /**
2926
+ * @param {number} value
2927
+ * @param {TfheClientKey} client_key
2928
+ * @returns {FheUint16}
2929
+ */
2930
+ static encrypt_with_client_key(value, client_key) {
2931
+ try {
2932
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2933
+ _assertClass(client_key, TfheClientKey);
2934
+ wasm.fheuint16_encrypt_with_client_key(retptr, value, client_key.__wbg_ptr);
2935
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2936
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2937
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2938
+ if (r2) {
2939
+ throw takeObject(r1);
2940
+ }
2941
+ return FheUint16.__wrap(r0);
2942
+ } finally {
2943
+ wasm.__wbindgen_add_to_stack_pointer(16);
2944
+ }
2945
+ }
2946
+ /**
2947
+ * @param {number} value
2948
+ * @param {TfhePublicKey} public_key
2949
+ * @returns {FheUint16}
2950
+ */
2951
+ static encrypt_with_public_key(value, public_key) {
2952
+ try {
2953
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2954
+ _assertClass(public_key, TfhePublicKey);
2955
+ wasm.fheuint16_encrypt_with_public_key(retptr, value, public_key.__wbg_ptr);
2956
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2957
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2958
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2959
+ if (r2) {
2960
+ throw takeObject(r1);
2961
+ }
2962
+ return FheUint16.__wrap(r0);
2963
+ } finally {
2964
+ wasm.__wbindgen_add_to_stack_pointer(16);
2965
+ }
2966
+ }
2967
+ /**
2968
+ * @param {number} value
2969
+ * @param {TfheCompressedPublicKey} compressed_public_key
2970
+ * @returns {FheUint16}
2971
+ */
2972
+ static encrypt_with_compressed_public_key(value, compressed_public_key) {
2973
+ try {
2974
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2975
+ _assertClass(compressed_public_key, TfheCompressedPublicKey);
2976
+ wasm.fheuint16_encrypt_with_compressed_public_key(retptr, value, compressed_public_key.__wbg_ptr);
2977
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2978
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2979
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2980
+ if (r2) {
2981
+ throw takeObject(r1);
2982
+ }
2983
+ return FheUint16.__wrap(r0);
2984
+ } finally {
2985
+ wasm.__wbindgen_add_to_stack_pointer(16);
2986
+ }
2987
+ }
2988
+ /**
2989
+ * @param {number} value
2990
+ * @param {TfheCompactPublicKey} compact_public_key
2991
+ * @returns {FheUint16}
2992
+ */
2993
+ static encrypt_with_compact_public_key(value, compact_public_key) {
2994
+ try {
2995
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2996
+ _assertClass(compact_public_key, TfheCompactPublicKey);
2997
+ wasm.fheuint16_encrypt_with_compact_public_key(retptr, value, compact_public_key.__wbg_ptr);
2998
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2999
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3000
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3001
+ if (r2) {
3002
+ throw takeObject(r1);
3003
+ }
3004
+ return FheUint16.__wrap(r0);
3005
+ } finally {
3006
+ wasm.__wbindgen_add_to_stack_pointer(16);
3007
+ }
3008
+ }
3009
+ /**
3010
+ * @param {TfheClientKey} client_key
3011
+ * @returns {number}
3012
+ */
3013
+ decrypt(client_key) {
3014
+ try {
3015
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3016
+ _assertClass(client_key, TfheClientKey);
3017
+ wasm.fheuint16_decrypt(retptr, this.__wbg_ptr, client_key.__wbg_ptr);
3018
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3019
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3020
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3021
+ if (r2) {
3022
+ throw takeObject(r1);
3023
+ }
3024
+ return r0;
3025
+ } finally {
3026
+ wasm.__wbindgen_add_to_stack_pointer(16);
3027
+ }
3028
+ }
3029
+ /**
3030
+ * @returns {Uint8Array}
3031
+ */
3032
+ serialize() {
3033
+ try {
3034
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3035
+ wasm.fheuint16_serialize(retptr, this.__wbg_ptr);
3036
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3037
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3038
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3039
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
3040
+ if (r3) {
3041
+ throw takeObject(r2);
3042
+ }
3043
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3044
+ wasm.__wbindgen_free(r0, r1 * 1);
3045
+ return v1;
3046
+ } finally {
3047
+ wasm.__wbindgen_add_to_stack_pointer(16);
3048
+ }
3049
+ }
3050
+ /**
3051
+ * @param {Uint8Array} buffer
3052
+ * @returns {FheUint16}
3053
+ */
3054
+ static deserialize(buffer) {
3055
+ try {
3056
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3057
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
3058
+ const len0 = WASM_VECTOR_LEN;
3059
+ wasm.fheuint16_deserialize(retptr, ptr0, len0);
3060
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3061
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3062
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3063
+ if (r2) {
3064
+ throw takeObject(r1);
3065
+ }
3066
+ return FheUint16.__wrap(r0);
3067
+ } finally {
3068
+ wasm.__wbindgen_add_to_stack_pointer(16);
3069
+ }
3070
+ }
3071
+ }
3072
+ /**
3073
+ */
3074
+ export class FheUint256 {
3075
+
3076
+ static __wrap(ptr) {
3077
+ ptr = ptr >>> 0;
3078
+ const obj = Object.create(FheUint256.prototype);
3079
+ obj.__wbg_ptr = ptr;
3080
+
3081
+ return obj;
3082
+ }
3083
+
3084
+ __destroy_into_raw() {
3085
+ const ptr = this.__wbg_ptr;
3086
+ this.__wbg_ptr = 0;
3087
+
3088
+ return ptr;
3089
+ }
3090
+
3091
+ free() {
3092
+ const ptr = this.__destroy_into_raw();
3093
+ wasm.__wbg_fheuint256_free(ptr);
3094
+ }
3095
+ /**
3096
+ * @param {any} value
3097
+ * @param {TfheClientKey} client_key
3098
+ * @returns {FheUint256}
3099
+ */
3100
+ static encrypt_with_client_key(value, client_key) {
3101
+ try {
3102
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3103
+ _assertClass(client_key, TfheClientKey);
3104
+ wasm.fheuint256_encrypt_with_client_key(retptr, addHeapObject(value), client_key.__wbg_ptr);
3105
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3106
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3107
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3108
+ if (r2) {
3109
+ throw takeObject(r1);
3110
+ }
3111
+ return FheUint256.__wrap(r0);
3112
+ } finally {
3113
+ wasm.__wbindgen_add_to_stack_pointer(16);
3114
+ }
3115
+ }
3116
+ /**
3117
+ * @param {any} value
3118
+ * @param {TfhePublicKey} public_key
3119
+ * @returns {FheUint256}
3120
+ */
3121
+ static encrypt_with_public_key(value, public_key) {
3122
+ try {
3123
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3124
+ _assertClass(public_key, TfhePublicKey);
3125
+ wasm.fheuint256_encrypt_with_public_key(retptr, addHeapObject(value), public_key.__wbg_ptr);
3126
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3127
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3128
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3129
+ if (r2) {
3130
+ throw takeObject(r1);
3131
+ }
3132
+ return FheUint256.__wrap(r0);
3133
+ } finally {
3134
+ wasm.__wbindgen_add_to_stack_pointer(16);
3135
+ }
3136
+ }
3137
+ /**
3138
+ * @param {any} value
3139
+ * @param {TfheCompressedPublicKey} compressed_public_key
3140
+ * @returns {FheUint256}
3141
+ */
3142
+ static encrypt_with_compressed_public_key(value, compressed_public_key) {
3143
+ try {
3144
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3145
+ _assertClass(compressed_public_key, TfheCompressedPublicKey);
3146
+ wasm.fheuint256_encrypt_with_compressed_public_key(retptr, addHeapObject(value), compressed_public_key.__wbg_ptr);
3147
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3148
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3149
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3150
+ if (r2) {
3151
+ throw takeObject(r1);
3152
+ }
3153
+ return FheUint256.__wrap(r0);
3154
+ } finally {
3155
+ wasm.__wbindgen_add_to_stack_pointer(16);
3156
+ }
3157
+ }
3158
+ /**
3159
+ * @param {any} value
3160
+ * @param {TfheCompactPublicKey} compact_public_key
3161
+ * @returns {FheUint256}
3162
+ */
3163
+ static encrypt_with_compact_public_key(value, compact_public_key) {
3164
+ try {
3165
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3166
+ _assertClass(compact_public_key, TfheCompactPublicKey);
3167
+ wasm.fheuint256_encrypt_with_compact_public_key(retptr, addHeapObject(value), compact_public_key.__wbg_ptr);
3168
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3169
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3170
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3171
+ if (r2) {
3172
+ throw takeObject(r1);
3173
+ }
3174
+ return FheUint256.__wrap(r0);
3175
+ } finally {
3176
+ wasm.__wbindgen_add_to_stack_pointer(16);
3177
+ }
3178
+ }
3179
+ /**
3180
+ * @param {TfheClientKey} client_key
3181
+ * @returns {any}
3182
+ */
3183
+ decrypt(client_key) {
3184
+ try {
3185
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3186
+ _assertClass(client_key, TfheClientKey);
3187
+ wasm.fheuint256_decrypt(retptr, this.__wbg_ptr, client_key.__wbg_ptr);
3188
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3189
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3190
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3191
+ if (r2) {
3192
+ throw takeObject(r1);
3193
+ }
3194
+ return takeObject(r0);
3195
+ } finally {
3196
+ wasm.__wbindgen_add_to_stack_pointer(16);
3197
+ }
3198
+ }
3199
+ /**
3200
+ * @returns {Uint8Array}
3201
+ */
3202
+ serialize() {
3203
+ try {
3204
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3205
+ wasm.fheuint256_serialize(retptr, this.__wbg_ptr);
3206
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3207
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3208
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3209
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
3210
+ if (r3) {
3211
+ throw takeObject(r2);
3212
+ }
3213
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3214
+ wasm.__wbindgen_free(r0, r1 * 1);
3215
+ return v1;
3216
+ } finally {
3217
+ wasm.__wbindgen_add_to_stack_pointer(16);
3218
+ }
3219
+ }
3220
+ /**
3221
+ * @param {Uint8Array} buffer
3222
+ * @returns {FheUint256}
3223
+ */
3224
+ static deserialize(buffer) {
3225
+ try {
3226
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3227
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
3228
+ const len0 = WASM_VECTOR_LEN;
3229
+ wasm.fheuint256_deserialize(retptr, ptr0, len0);
3230
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3231
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3232
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3233
+ if (r2) {
3234
+ throw takeObject(r1);
3235
+ }
3236
+ return FheUint256.__wrap(r0);
3237
+ } finally {
3238
+ wasm.__wbindgen_add_to_stack_pointer(16);
3239
+ }
3240
+ }
3241
+ }
3242
+ /**
3243
+ */
3244
+ export class FheUint32 {
3245
+
3246
+ static __wrap(ptr) {
3247
+ ptr = ptr >>> 0;
3248
+ const obj = Object.create(FheUint32.prototype);
3249
+ obj.__wbg_ptr = ptr;
3250
+
3251
+ return obj;
3252
+ }
3253
+
3254
+ __destroy_into_raw() {
3255
+ const ptr = this.__wbg_ptr;
3256
+ this.__wbg_ptr = 0;
3257
+
3258
+ return ptr;
3259
+ }
3260
+
3261
+ free() {
3262
+ const ptr = this.__destroy_into_raw();
3263
+ wasm.__wbg_fheuint32_free(ptr);
3264
+ }
3265
+ /**
3266
+ * @param {number} value
3267
+ * @param {TfheClientKey} client_key
3268
+ * @returns {FheUint32}
3269
+ */
3270
+ static encrypt_with_client_key(value, client_key) {
3271
+ try {
3272
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3273
+ _assertClass(client_key, TfheClientKey);
3274
+ wasm.fheuint32_encrypt_with_client_key(retptr, value, client_key.__wbg_ptr);
3275
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3276
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3277
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3278
+ if (r2) {
3279
+ throw takeObject(r1);
3280
+ }
3281
+ return FheUint32.__wrap(r0);
3282
+ } finally {
3283
+ wasm.__wbindgen_add_to_stack_pointer(16);
3284
+ }
3285
+ }
3286
+ /**
3287
+ * @param {number} value
3288
+ * @param {TfhePublicKey} public_key
3289
+ * @returns {FheUint32}
3290
+ */
3291
+ static encrypt_with_public_key(value, public_key) {
3292
+ try {
3293
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3294
+ _assertClass(public_key, TfhePublicKey);
3295
+ wasm.fheuint32_encrypt_with_public_key(retptr, value, public_key.__wbg_ptr);
3296
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3297
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3298
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3299
+ if (r2) {
3300
+ throw takeObject(r1);
3301
+ }
3302
+ return FheUint32.__wrap(r0);
3303
+ } finally {
3304
+ wasm.__wbindgen_add_to_stack_pointer(16);
3305
+ }
3306
+ }
3307
+ /**
3308
+ * @param {number} value
3309
+ * @param {TfheCompressedPublicKey} compressed_public_key
3310
+ * @returns {FheUint32}
3311
+ */
3312
+ static encrypt_with_compressed_public_key(value, compressed_public_key) {
3313
+ try {
3314
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3315
+ _assertClass(compressed_public_key, TfheCompressedPublicKey);
3316
+ wasm.fheuint32_encrypt_with_compressed_public_key(retptr, value, compressed_public_key.__wbg_ptr);
3317
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3318
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3319
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3320
+ if (r2) {
3321
+ throw takeObject(r1);
3322
+ }
3323
+ return FheUint32.__wrap(r0);
3324
+ } finally {
3325
+ wasm.__wbindgen_add_to_stack_pointer(16);
3326
+ }
3327
+ }
3328
+ /**
3329
+ * @param {number} value
3330
+ * @param {TfheCompactPublicKey} compact_public_key
3331
+ * @returns {FheUint32}
3332
+ */
3333
+ static encrypt_with_compact_public_key(value, compact_public_key) {
3334
+ try {
3335
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3336
+ _assertClass(compact_public_key, TfheCompactPublicKey);
3337
+ wasm.fheuint32_encrypt_with_compact_public_key(retptr, value, compact_public_key.__wbg_ptr);
3338
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3339
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3340
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3341
+ if (r2) {
3342
+ throw takeObject(r1);
3343
+ }
3344
+ return FheUint32.__wrap(r0);
3345
+ } finally {
3346
+ wasm.__wbindgen_add_to_stack_pointer(16);
3347
+ }
3348
+ }
3349
+ /**
3350
+ * @param {TfheClientKey} client_key
3351
+ * @returns {number}
3352
+ */
3353
+ decrypt(client_key) {
3354
+ try {
3355
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3356
+ _assertClass(client_key, TfheClientKey);
3357
+ wasm.fheuint32_decrypt(retptr, this.__wbg_ptr, client_key.__wbg_ptr);
3358
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3359
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3360
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3361
+ if (r2) {
3362
+ throw takeObject(r1);
3363
+ }
3364
+ return r0 >>> 0;
3365
+ } finally {
3366
+ wasm.__wbindgen_add_to_stack_pointer(16);
3367
+ }
3368
+ }
3369
+ /**
3370
+ * @returns {Uint8Array}
3371
+ */
3372
+ serialize() {
3373
+ try {
3374
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3375
+ wasm.fheuint32_serialize(retptr, this.__wbg_ptr);
3376
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3377
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3378
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3379
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
3380
+ if (r3) {
3381
+ throw takeObject(r2);
3382
+ }
3383
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3384
+ wasm.__wbindgen_free(r0, r1 * 1);
3385
+ return v1;
3386
+ } finally {
3387
+ wasm.__wbindgen_add_to_stack_pointer(16);
3388
+ }
3389
+ }
3390
+ /**
3391
+ * @param {Uint8Array} buffer
3392
+ * @returns {FheUint32}
3393
+ */
3394
+ static deserialize(buffer) {
3395
+ try {
3396
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3397
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
3398
+ const len0 = WASM_VECTOR_LEN;
3399
+ wasm.fheuint32_deserialize(retptr, ptr0, len0);
3400
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3401
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3402
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3403
+ if (r2) {
3404
+ throw takeObject(r1);
3405
+ }
3406
+ return FheUint32.__wrap(r0);
3407
+ } finally {
3408
+ wasm.__wbindgen_add_to_stack_pointer(16);
3409
+ }
3410
+ }
3411
+ }
3412
+ /**
3413
+ */
3414
+ export class FheUint64 {
3415
+
3416
+ static __wrap(ptr) {
3417
+ ptr = ptr >>> 0;
3418
+ const obj = Object.create(FheUint64.prototype);
3419
+ obj.__wbg_ptr = ptr;
3420
+
3421
+ return obj;
3422
+ }
3423
+
3424
+ __destroy_into_raw() {
3425
+ const ptr = this.__wbg_ptr;
3426
+ this.__wbg_ptr = 0;
3427
+
3428
+ return ptr;
3429
+ }
3430
+
3431
+ free() {
3432
+ const ptr = this.__destroy_into_raw();
3433
+ wasm.__wbg_fheuint64_free(ptr);
3434
+ }
3435
+ /**
3436
+ * @param {bigint} value
3437
+ * @param {TfheClientKey} client_key
3438
+ * @returns {FheUint64}
3439
+ */
3440
+ static encrypt_with_client_key(value, client_key) {
3441
+ try {
3442
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3443
+ _assertClass(client_key, TfheClientKey);
3444
+ wasm.fheuint64_encrypt_with_client_key(retptr, value, client_key.__wbg_ptr);
3445
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3446
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3447
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3448
+ if (r2) {
3449
+ throw takeObject(r1);
3450
+ }
3451
+ return FheUint64.__wrap(r0);
3452
+ } finally {
3453
+ wasm.__wbindgen_add_to_stack_pointer(16);
3454
+ }
3455
+ }
3456
+ /**
3457
+ * @param {bigint} value
3458
+ * @param {TfhePublicKey} public_key
3459
+ * @returns {FheUint64}
3460
+ */
3461
+ static encrypt_with_public_key(value, public_key) {
3462
+ try {
3463
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3464
+ _assertClass(public_key, TfhePublicKey);
3465
+ wasm.fheuint64_encrypt_with_public_key(retptr, value, public_key.__wbg_ptr);
3466
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3467
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3468
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3469
+ if (r2) {
3470
+ throw takeObject(r1);
3471
+ }
3472
+ return FheUint64.__wrap(r0);
3473
+ } finally {
3474
+ wasm.__wbindgen_add_to_stack_pointer(16);
3475
+ }
3476
+ }
3477
+ /**
3478
+ * @param {bigint} value
3479
+ * @param {TfheCompressedPublicKey} compressed_public_key
3480
+ * @returns {FheUint64}
3481
+ */
3482
+ static encrypt_with_compressed_public_key(value, compressed_public_key) {
3483
+ try {
3484
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3485
+ _assertClass(compressed_public_key, TfheCompressedPublicKey);
3486
+ wasm.fheuint64_encrypt_with_compressed_public_key(retptr, value, compressed_public_key.__wbg_ptr);
3487
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3488
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3489
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3490
+ if (r2) {
3491
+ throw takeObject(r1);
3492
+ }
3493
+ return FheUint64.__wrap(r0);
3494
+ } finally {
3495
+ wasm.__wbindgen_add_to_stack_pointer(16);
3496
+ }
3497
+ }
3498
+ /**
3499
+ * @param {bigint} value
3500
+ * @param {TfheCompactPublicKey} compact_public_key
3501
+ * @returns {FheUint64}
3502
+ */
3503
+ static encrypt_with_compact_public_key(value, compact_public_key) {
3504
+ try {
3505
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3506
+ _assertClass(compact_public_key, TfheCompactPublicKey);
3507
+ wasm.fheuint64_encrypt_with_compact_public_key(retptr, value, compact_public_key.__wbg_ptr);
3508
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3509
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3510
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3511
+ if (r2) {
3512
+ throw takeObject(r1);
3513
+ }
3514
+ return FheUint64.__wrap(r0);
3515
+ } finally {
3516
+ wasm.__wbindgen_add_to_stack_pointer(16);
3517
+ }
3518
+ }
3519
+ /**
3520
+ * @param {TfheClientKey} client_key
3521
+ * @returns {bigint}
3522
+ */
3523
+ decrypt(client_key) {
3524
+ try {
3525
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3526
+ _assertClass(client_key, TfheClientKey);
3527
+ wasm.fheuint64_decrypt(retptr, this.__wbg_ptr, client_key.__wbg_ptr);
3528
+ var r0 = getBigInt64Memory0()[retptr / 8 + 0];
3529
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3530
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
3531
+ if (r3) {
3532
+ throw takeObject(r2);
3533
+ }
3534
+ return BigInt.asUintN(64, r0);
3535
+ } finally {
3536
+ wasm.__wbindgen_add_to_stack_pointer(16);
3537
+ }
3538
+ }
3539
+ /**
3540
+ * @returns {Uint8Array}
3541
+ */
3542
+ serialize() {
3543
+ try {
3544
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3545
+ wasm.fheuint64_serialize(retptr, this.__wbg_ptr);
3546
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3547
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3548
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3549
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
3550
+ if (r3) {
3551
+ throw takeObject(r2);
3552
+ }
3553
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3554
+ wasm.__wbindgen_free(r0, r1 * 1);
3555
+ return v1;
3556
+ } finally {
3557
+ wasm.__wbindgen_add_to_stack_pointer(16);
3558
+ }
3559
+ }
3560
+ /**
3561
+ * @param {Uint8Array} buffer
3562
+ * @returns {FheUint64}
3563
+ */
3564
+ static deserialize(buffer) {
3565
+ try {
3566
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3567
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
3568
+ const len0 = WASM_VECTOR_LEN;
3569
+ wasm.fheuint64_deserialize(retptr, ptr0, len0);
3570
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3571
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3572
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3573
+ if (r2) {
3574
+ throw takeObject(r1);
3575
+ }
3576
+ return FheUint64.__wrap(r0);
3577
+ } finally {
3578
+ wasm.__wbindgen_add_to_stack_pointer(16);
3579
+ }
3580
+ }
3581
+ }
3582
+ /**
3583
+ */
3584
+ export class FheUint8 {
3585
+
3586
+ static __wrap(ptr) {
3587
+ ptr = ptr >>> 0;
3588
+ const obj = Object.create(FheUint8.prototype);
3589
+ obj.__wbg_ptr = ptr;
3590
+
3591
+ return obj;
3592
+ }
3593
+
3594
+ __destroy_into_raw() {
3595
+ const ptr = this.__wbg_ptr;
3596
+ this.__wbg_ptr = 0;
3597
+
3598
+ return ptr;
3599
+ }
3600
+
3601
+ free() {
3602
+ const ptr = this.__destroy_into_raw();
3603
+ wasm.__wbg_fheuint8_free(ptr);
3604
+ }
3605
+ /**
3606
+ * @param {number} value
3607
+ * @param {TfheClientKey} client_key
3608
+ * @returns {FheUint8}
3609
+ */
3610
+ static encrypt_with_client_key(value, client_key) {
3611
+ try {
3612
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3613
+ _assertClass(client_key, TfheClientKey);
3614
+ wasm.fheuint8_encrypt_with_client_key(retptr, value, client_key.__wbg_ptr);
3615
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3616
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3617
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3618
+ if (r2) {
3619
+ throw takeObject(r1);
3620
+ }
3621
+ return FheUint8.__wrap(r0);
3622
+ } finally {
3623
+ wasm.__wbindgen_add_to_stack_pointer(16);
3624
+ }
3625
+ }
3626
+ /**
3627
+ * @param {number} value
3628
+ * @param {TfhePublicKey} public_key
3629
+ * @returns {FheUint8}
3630
+ */
3631
+ static encrypt_with_public_key(value, public_key) {
3632
+ try {
3633
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3634
+ _assertClass(public_key, TfhePublicKey);
3635
+ wasm.fheuint8_encrypt_with_public_key(retptr, value, public_key.__wbg_ptr);
3636
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3637
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3638
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3639
+ if (r2) {
3640
+ throw takeObject(r1);
3641
+ }
3642
+ return FheUint8.__wrap(r0);
3643
+ } finally {
3644
+ wasm.__wbindgen_add_to_stack_pointer(16);
3645
+ }
3646
+ }
3647
+ /**
3648
+ * @param {number} value
3649
+ * @param {TfheCompressedPublicKey} compressed_public_key
3650
+ * @returns {FheUint8}
3651
+ */
3652
+ static encrypt_with_compressed_public_key(value, compressed_public_key) {
3653
+ try {
3654
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3655
+ _assertClass(compressed_public_key, TfheCompressedPublicKey);
3656
+ wasm.fheuint8_encrypt_with_compressed_public_key(retptr, value, compressed_public_key.__wbg_ptr);
3657
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3658
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3659
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3660
+ if (r2) {
3661
+ throw takeObject(r1);
3662
+ }
3663
+ return FheUint8.__wrap(r0);
3664
+ } finally {
3665
+ wasm.__wbindgen_add_to_stack_pointer(16);
3666
+ }
3667
+ }
3668
+ /**
3669
+ * @param {number} value
3670
+ * @param {TfheCompactPublicKey} compact_public_key
3671
+ * @returns {FheUint8}
3672
+ */
3673
+ static encrypt_with_compact_public_key(value, compact_public_key) {
3674
+ try {
3675
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3676
+ _assertClass(compact_public_key, TfheCompactPublicKey);
3677
+ wasm.fheuint8_encrypt_with_compact_public_key(retptr, value, compact_public_key.__wbg_ptr);
3678
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3679
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3680
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3681
+ if (r2) {
3682
+ throw takeObject(r1);
3683
+ }
3684
+ return FheUint8.__wrap(r0);
3685
+ } finally {
3686
+ wasm.__wbindgen_add_to_stack_pointer(16);
3687
+ }
3688
+ }
3689
+ /**
3690
+ * @param {TfheClientKey} client_key
3691
+ * @returns {number}
3692
+ */
3693
+ decrypt(client_key) {
3694
+ try {
3695
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3696
+ _assertClass(client_key, TfheClientKey);
3697
+ wasm.fheuint8_decrypt(retptr, this.__wbg_ptr, client_key.__wbg_ptr);
3698
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3699
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3700
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3701
+ if (r2) {
3702
+ throw takeObject(r1);
3703
+ }
3704
+ return r0;
3705
+ } finally {
3706
+ wasm.__wbindgen_add_to_stack_pointer(16);
3707
+ }
3708
+ }
3709
+ /**
3710
+ * @returns {Uint8Array}
3711
+ */
3712
+ serialize() {
3713
+ try {
3714
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3715
+ wasm.fheuint8_serialize(retptr, this.__wbg_ptr);
3716
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3717
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3718
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3719
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
3720
+ if (r3) {
3721
+ throw takeObject(r2);
3722
+ }
3723
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3724
+ wasm.__wbindgen_free(r0, r1 * 1);
3725
+ return v1;
3726
+ } finally {
3727
+ wasm.__wbindgen_add_to_stack_pointer(16);
3728
+ }
3729
+ }
3730
+ /**
3731
+ * @param {Uint8Array} buffer
3732
+ * @returns {FheUint8}
3733
+ */
3734
+ static deserialize(buffer) {
3735
+ try {
3736
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3737
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
3738
+ const len0 = WASM_VECTOR_LEN;
3739
+ wasm.fheuint8_deserialize(retptr, ptr0, len0);
3740
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3741
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3742
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3743
+ if (r2) {
3744
+ throw takeObject(r1);
3745
+ }
3746
+ return FheUint8.__wrap(r0);
3747
+ } finally {
3748
+ wasm.__wbindgen_add_to_stack_pointer(16);
3749
+ }
3750
+ }
3751
+ }
3752
+ /**
3753
+ */
3754
+ export class Shortint {
3755
+
3756
+ __destroy_into_raw() {
3757
+ const ptr = this.__wbg_ptr;
3758
+ this.__wbg_ptr = 0;
3759
+
3760
+ return ptr;
3761
+ }
3762
+
3763
+ free() {
3764
+ const ptr = this.__destroy_into_raw();
3765
+ wasm.__wbg_shortint_free(ptr);
3766
+ }
3767
+ /**
3768
+ * @param {number} message_bits
3769
+ * @param {number} carry_bits
3770
+ * @returns {ShortintParameters}
3771
+ */
3772
+ static get_parameters(message_bits, carry_bits) {
3773
+ try {
3774
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3775
+ wasm.shortint_get_parameters(retptr, message_bits, carry_bits);
3776
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3777
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3778
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3779
+ if (r2) {
3780
+ throw takeObject(r1);
3781
+ }
3782
+ return ShortintParameters.__wrap(r0);
3783
+ } finally {
3784
+ wasm.__wbindgen_add_to_stack_pointer(16);
3785
+ }
3786
+ }
3787
+ /**
3788
+ * @param {number} message_bits
3789
+ * @param {number} carry_bits
3790
+ * @returns {ShortintParameters}
3791
+ */
3792
+ static get_parameters_small(message_bits, carry_bits) {
3793
+ try {
3794
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3795
+ wasm.shortint_get_parameters_small(retptr, message_bits, carry_bits);
3796
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3797
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3798
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3799
+ if (r2) {
3800
+ throw takeObject(r1);
3801
+ }
3802
+ return ShortintParameters.__wrap(r0);
3803
+ } finally {
3804
+ wasm.__wbindgen_add_to_stack_pointer(16);
3805
+ }
3806
+ }
3807
+ /**
3808
+ * @param {number} lwe_dimension
3809
+ * @param {number} glwe_dimension
3810
+ * @param {number} polynomial_size
3811
+ * @param {number} lwe_modular_std_dev
3812
+ * @param {number} glwe_modular_std_dev
3813
+ * @param {number} pbs_base_log
3814
+ * @param {number} pbs_level
3815
+ * @param {number} ks_base_log
3816
+ * @param {number} ks_level
3817
+ * @param {number} message_modulus
3818
+ * @param {number} carry_modulus
3819
+ * @param {number} modulus_power_of_2_exponent
3820
+ * @param {number} encryption_key_choice
3821
+ * @returns {ShortintParameters}
3822
+ */
3823
+ static new_parameters(lwe_dimension, glwe_dimension, polynomial_size, lwe_modular_std_dev, glwe_modular_std_dev, pbs_base_log, pbs_level, ks_base_log, ks_level, message_modulus, carry_modulus, modulus_power_of_2_exponent, encryption_key_choice) {
3824
+ const ret = wasm.shortint_new_parameters(lwe_dimension, glwe_dimension, polynomial_size, lwe_modular_std_dev, glwe_modular_std_dev, pbs_base_log, pbs_level, ks_base_log, ks_level, message_modulus, carry_modulus, modulus_power_of_2_exponent, encryption_key_choice);
3825
+ return ShortintParameters.__wrap(ret);
3826
+ }
3827
+ /**
3828
+ * @param {bigint} seed_high_bytes
3829
+ * @param {bigint} seed_low_bytes
3830
+ * @param {ShortintParameters} parameters
3831
+ * @returns {ShortintClientKey}
3832
+ */
3833
+ static new_client_key_from_seed_and_parameters(seed_high_bytes, seed_low_bytes, parameters) {
3834
+ try {
3835
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3836
+ _assertClass(parameters, ShortintParameters);
3837
+ wasm.shortint_new_client_key_from_seed_and_parameters(retptr, seed_high_bytes, seed_low_bytes, parameters.__wbg_ptr);
3838
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3839
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3840
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3841
+ if (r2) {
3842
+ throw takeObject(r1);
3843
+ }
3844
+ return ShortintClientKey.__wrap(r0);
3845
+ } finally {
3846
+ wasm.__wbindgen_add_to_stack_pointer(16);
3847
+ }
3848
+ }
3849
+ /**
3850
+ * @param {ShortintParameters} parameters
3851
+ * @returns {ShortintClientKey}
3852
+ */
3853
+ static new_client_key(parameters) {
3854
+ _assertClass(parameters, ShortintParameters);
3855
+ const ret = wasm.shortint_new_client_key(parameters.__wbg_ptr);
3856
+ return ShortintClientKey.__wrap(ret);
3857
+ }
3858
+ /**
3859
+ * @param {ShortintClientKey} client_key
3860
+ * @returns {ShortintPublicKey}
3861
+ */
3862
+ static new_public_key(client_key) {
3863
+ _assertClass(client_key, ShortintClientKey);
3864
+ const ret = wasm.shortint_new_public_key(client_key.__wbg_ptr);
3865
+ return ShortintPublicKey.__wrap(ret);
3866
+ }
3867
+ /**
3868
+ * @param {ShortintClientKey} client_key
3869
+ * @returns {ShortintCompressedPublicKey}
3870
+ */
3871
+ static new_compressed_public_key(client_key) {
3872
+ _assertClass(client_key, ShortintClientKey);
3873
+ const ret = wasm.shortint_new_compressed_public_key(client_key.__wbg_ptr);
3874
+ return ShortintCompressedPublicKey.__wrap(ret);
3875
+ }
3876
+ /**
3877
+ * @param {ShortintClientKey} client_key
3878
+ * @returns {ShortintCompressedServerKey}
3879
+ */
3880
+ static new_compressed_server_key(client_key) {
3881
+ _assertClass(client_key, ShortintClientKey);
3882
+ const ret = wasm.shortint_new_compressed_server_key(client_key.__wbg_ptr);
3883
+ return ShortintCompressedServerKey.__wrap(ret);
3884
+ }
3885
+ /**
3886
+ * @param {ShortintClientKey} client_key
3887
+ * @param {bigint} message
3888
+ * @returns {ShortintCiphertext}
3889
+ */
3890
+ static encrypt(client_key, message) {
3891
+ _assertClass(client_key, ShortintClientKey);
3892
+ const ret = wasm.shortint_encrypt(client_key.__wbg_ptr, message);
3893
+ return ShortintCiphertext.__wrap(ret);
3894
+ }
3895
+ /**
3896
+ * @param {ShortintClientKey} client_key
3897
+ * @param {bigint} message
3898
+ * @returns {ShortintCompressedCiphertext}
3899
+ */
3900
+ static encrypt_compressed(client_key, message) {
3901
+ _assertClass(client_key, ShortintClientKey);
3902
+ const ret = wasm.shortint_encrypt_compressed(client_key.__wbg_ptr, message);
3903
+ return ShortintCompressedCiphertext.__wrap(ret);
3904
+ }
3905
+ /**
3906
+ * @param {ShortintCompressedCiphertext} compressed_ciphertext
3907
+ * @returns {ShortintCiphertext}
3908
+ */
3909
+ static decompress_ciphertext(compressed_ciphertext) {
3910
+ _assertClass(compressed_ciphertext, ShortintCompressedCiphertext);
3911
+ const ret = wasm.shortint_decompress_ciphertext(compressed_ciphertext.__wbg_ptr);
3912
+ return ShortintCiphertext.__wrap(ret);
3913
+ }
3914
+ /**
3915
+ * @param {ShortintPublicKey} public_key
3916
+ * @param {bigint} message
3917
+ * @returns {ShortintCiphertext}
3918
+ */
3919
+ static encrypt_with_public_key(public_key, message) {
3920
+ _assertClass(public_key, ShortintPublicKey);
3921
+ const ret = wasm.shortint_encrypt_with_public_key(public_key.__wbg_ptr, message);
3922
+ return ShortintCiphertext.__wrap(ret);
3923
+ }
3924
+ /**
3925
+ * @param {ShortintCompressedPublicKey} public_key
3926
+ * @param {bigint} message
3927
+ * @returns {ShortintCiphertext}
3928
+ */
3929
+ static encrypt_with_compressed_public_key(public_key, message) {
3930
+ _assertClass(public_key, ShortintCompressedPublicKey);
3931
+ const ret = wasm.shortint_encrypt_with_compressed_public_key(public_key.__wbg_ptr, message);
3932
+ return ShortintCiphertext.__wrap(ret);
3933
+ }
3934
+ /**
3935
+ * @param {ShortintClientKey} client_key
3936
+ * @param {ShortintCiphertext} ct
3937
+ * @returns {bigint}
3938
+ */
3939
+ static decrypt(client_key, ct) {
3940
+ _assertClass(client_key, ShortintClientKey);
3941
+ _assertClass(ct, ShortintCiphertext);
3942
+ const ret = wasm.shortint_decrypt(client_key.__wbg_ptr, ct.__wbg_ptr);
3943
+ return BigInt.asUintN(64, ret);
3944
+ }
3945
+ /**
3946
+ * @param {ShortintCiphertext} ciphertext
3947
+ * @returns {Uint8Array}
3948
+ */
3949
+ static serialize_ciphertext(ciphertext) {
3950
+ try {
3951
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3952
+ _assertClass(ciphertext, ShortintCiphertext);
3953
+ wasm.shortint_serialize_ciphertext(retptr, ciphertext.__wbg_ptr);
3954
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3955
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3956
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3957
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
3958
+ if (r3) {
3959
+ throw takeObject(r2);
3960
+ }
3961
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3962
+ wasm.__wbindgen_free(r0, r1 * 1);
3963
+ return v1;
3964
+ } finally {
3965
+ wasm.__wbindgen_add_to_stack_pointer(16);
3966
+ }
3967
+ }
3968
+ /**
3969
+ * @param {Uint8Array} buffer
3970
+ * @returns {ShortintCiphertext}
3971
+ */
3972
+ static deserialize_ciphertext(buffer) {
3973
+ try {
3974
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3975
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
3976
+ const len0 = WASM_VECTOR_LEN;
3977
+ wasm.shortint_deserialize_ciphertext(retptr, ptr0, len0);
3978
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3979
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3980
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3981
+ if (r2) {
3982
+ throw takeObject(r1);
3983
+ }
3984
+ return ShortintCiphertext.__wrap(r0);
3985
+ } finally {
3986
+ wasm.__wbindgen_add_to_stack_pointer(16);
3987
+ }
3988
+ }
3989
+ /**
3990
+ * @param {ShortintCompressedCiphertext} ciphertext
3991
+ * @returns {Uint8Array}
3992
+ */
3993
+ static serialize_compressed_ciphertext(ciphertext) {
3994
+ try {
3995
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3996
+ _assertClass(ciphertext, ShortintCompressedCiphertext);
3997
+ wasm.shortint_serialize_compressed_ciphertext(retptr, ciphertext.__wbg_ptr);
3998
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3999
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4000
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4001
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
4002
+ if (r3) {
4003
+ throw takeObject(r2);
4004
+ }
4005
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4006
+ wasm.__wbindgen_free(r0, r1 * 1);
4007
+ return v1;
4008
+ } finally {
4009
+ wasm.__wbindgen_add_to_stack_pointer(16);
4010
+ }
4011
+ }
4012
+ /**
4013
+ * @param {Uint8Array} buffer
4014
+ * @returns {ShortintCompressedCiphertext}
4015
+ */
4016
+ static deserialize_compressed_ciphertext(buffer) {
4017
+ try {
4018
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4019
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
4020
+ const len0 = WASM_VECTOR_LEN;
4021
+ wasm.shortint_deserialize_compressed_ciphertext(retptr, ptr0, len0);
4022
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4023
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4024
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4025
+ if (r2) {
4026
+ throw takeObject(r1);
4027
+ }
4028
+ return ShortintCompressedCiphertext.__wrap(r0);
4029
+ } finally {
4030
+ wasm.__wbindgen_add_to_stack_pointer(16);
4031
+ }
4032
+ }
4033
+ /**
4034
+ * @param {ShortintClientKey} client_key
4035
+ * @returns {Uint8Array}
4036
+ */
4037
+ static serialize_client_key(client_key) {
4038
+ try {
4039
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4040
+ _assertClass(client_key, ShortintClientKey);
4041
+ wasm.shortint_serialize_client_key(retptr, client_key.__wbg_ptr);
4042
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4043
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4044
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4045
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
4046
+ if (r3) {
4047
+ throw takeObject(r2);
4048
+ }
4049
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4050
+ wasm.__wbindgen_free(r0, r1 * 1);
4051
+ return v1;
4052
+ } finally {
4053
+ wasm.__wbindgen_add_to_stack_pointer(16);
4054
+ }
4055
+ }
4056
+ /**
4057
+ * @param {Uint8Array} buffer
4058
+ * @returns {ShortintClientKey}
4059
+ */
4060
+ static deserialize_client_key(buffer) {
4061
+ try {
4062
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4063
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
4064
+ const len0 = WASM_VECTOR_LEN;
4065
+ wasm.shortint_deserialize_client_key(retptr, ptr0, len0);
4066
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4067
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4068
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4069
+ if (r2) {
4070
+ throw takeObject(r1);
4071
+ }
4072
+ return ShortintClientKey.__wrap(r0);
4073
+ } finally {
4074
+ wasm.__wbindgen_add_to_stack_pointer(16);
4075
+ }
4076
+ }
4077
+ /**
4078
+ * @param {ShortintPublicKey} public_key
4079
+ * @returns {Uint8Array}
4080
+ */
4081
+ static serialize_public_key(public_key) {
4082
+ try {
4083
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4084
+ _assertClass(public_key, ShortintPublicKey);
4085
+ wasm.shortint_serialize_public_key(retptr, public_key.__wbg_ptr);
4086
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4087
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4088
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4089
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
4090
+ if (r3) {
4091
+ throw takeObject(r2);
4092
+ }
4093
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4094
+ wasm.__wbindgen_free(r0, r1 * 1);
4095
+ return v1;
4096
+ } finally {
4097
+ wasm.__wbindgen_add_to_stack_pointer(16);
4098
+ }
4099
+ }
4100
+ /**
4101
+ * @param {Uint8Array} buffer
4102
+ * @returns {ShortintPublicKey}
4103
+ */
4104
+ static deserialize_public_key(buffer) {
4105
+ try {
4106
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4107
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
4108
+ const len0 = WASM_VECTOR_LEN;
4109
+ wasm.shortint_deserialize_public_key(retptr, ptr0, len0);
4110
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4111
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4112
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4113
+ if (r2) {
4114
+ throw takeObject(r1);
4115
+ }
4116
+ return ShortintPublicKey.__wrap(r0);
4117
+ } finally {
4118
+ wasm.__wbindgen_add_to_stack_pointer(16);
4119
+ }
4120
+ }
4121
+ /**
4122
+ * @param {ShortintCompressedPublicKey} public_key
4123
+ * @returns {Uint8Array}
4124
+ */
4125
+ static serialize_compressed_public_key(public_key) {
4126
+ try {
4127
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4128
+ _assertClass(public_key, ShortintCompressedPublicKey);
4129
+ wasm.shortint_serialize_compressed_public_key(retptr, public_key.__wbg_ptr);
4130
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4131
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4132
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4133
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
4134
+ if (r3) {
4135
+ throw takeObject(r2);
4136
+ }
4137
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4138
+ wasm.__wbindgen_free(r0, r1 * 1);
4139
+ return v1;
4140
+ } finally {
4141
+ wasm.__wbindgen_add_to_stack_pointer(16);
4142
+ }
4143
+ }
4144
+ /**
4145
+ * @param {Uint8Array} buffer
4146
+ * @returns {ShortintCompressedPublicKey}
4147
+ */
4148
+ static deserialize_compressed_public_key(buffer) {
4149
+ try {
4150
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4151
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
4152
+ const len0 = WASM_VECTOR_LEN;
4153
+ wasm.shortint_deserialize_compressed_public_key(retptr, ptr0, len0);
4154
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4155
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4156
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4157
+ if (r2) {
4158
+ throw takeObject(r1);
4159
+ }
4160
+ return ShortintCompressedPublicKey.__wrap(r0);
4161
+ } finally {
4162
+ wasm.__wbindgen_add_to_stack_pointer(16);
4163
+ }
4164
+ }
4165
+ /**
4166
+ * @param {ShortintCompressedServerKey} server_key
4167
+ * @returns {Uint8Array}
4168
+ */
4169
+ static serialize_compressed_server_key(server_key) {
4170
+ try {
4171
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4172
+ _assertClass(server_key, ShortintCompressedServerKey);
4173
+ wasm.shortint_serialize_compressed_server_key(retptr, server_key.__wbg_ptr);
4174
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4175
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4176
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4177
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
4178
+ if (r3) {
4179
+ throw takeObject(r2);
4180
+ }
4181
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4182
+ wasm.__wbindgen_free(r0, r1 * 1);
4183
+ return v1;
4184
+ } finally {
4185
+ wasm.__wbindgen_add_to_stack_pointer(16);
4186
+ }
4187
+ }
4188
+ /**
4189
+ * @param {Uint8Array} buffer
4190
+ * @returns {ShortintCompressedServerKey}
4191
+ */
4192
+ static deserialize_compressed_server_key(buffer) {
4193
+ try {
4194
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4195
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
4196
+ const len0 = WASM_VECTOR_LEN;
4197
+ wasm.shortint_deserialize_compressed_server_key(retptr, ptr0, len0);
4198
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4199
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4200
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4201
+ if (r2) {
4202
+ throw takeObject(r1);
4203
+ }
4204
+ return ShortintCompressedServerKey.__wrap(r0);
4205
+ } finally {
4206
+ wasm.__wbindgen_add_to_stack_pointer(16);
4207
+ }
4208
+ }
4209
+ }
4210
+ /**
4211
+ */
4212
+ export class ShortintCiphertext {
4213
+
4214
+ static __wrap(ptr) {
4215
+ ptr = ptr >>> 0;
4216
+ const obj = Object.create(ShortintCiphertext.prototype);
4217
+ obj.__wbg_ptr = ptr;
4218
+
4219
+ return obj;
4220
+ }
4221
+
4222
+ __destroy_into_raw() {
4223
+ const ptr = this.__wbg_ptr;
4224
+ this.__wbg_ptr = 0;
4225
+
4226
+ return ptr;
4227
+ }
4228
+
4229
+ free() {
4230
+ const ptr = this.__destroy_into_raw();
4231
+ wasm.__wbg_shortintciphertext_free(ptr);
4232
+ }
4233
+ }
4234
+ /**
4235
+ */
4236
+ export class ShortintClientKey {
4237
+
4238
+ static __wrap(ptr) {
4239
+ ptr = ptr >>> 0;
4240
+ const obj = Object.create(ShortintClientKey.prototype);
4241
+ obj.__wbg_ptr = ptr;
4242
+
4243
+ return obj;
4244
+ }
4245
+
4246
+ __destroy_into_raw() {
4247
+ const ptr = this.__wbg_ptr;
4248
+ this.__wbg_ptr = 0;
4249
+
4250
+ return ptr;
4251
+ }
4252
+
4253
+ free() {
4254
+ const ptr = this.__destroy_into_raw();
4255
+ wasm.__wbg_shortintclientkey_free(ptr);
4256
+ }
4257
+ }
4258
+ /**
4259
+ */
4260
+ export class ShortintCompressedCiphertext {
4261
+
4262
+ static __wrap(ptr) {
4263
+ ptr = ptr >>> 0;
4264
+ const obj = Object.create(ShortintCompressedCiphertext.prototype);
4265
+ obj.__wbg_ptr = ptr;
4266
+
4267
+ return obj;
4268
+ }
4269
+
4270
+ __destroy_into_raw() {
4271
+ const ptr = this.__wbg_ptr;
4272
+ this.__wbg_ptr = 0;
4273
+
4274
+ return ptr;
4275
+ }
4276
+
4277
+ free() {
4278
+ const ptr = this.__destroy_into_raw();
4279
+ wasm.__wbg_shortintcompressedciphertext_free(ptr);
4280
+ }
4281
+ }
4282
+ /**
4283
+ */
4284
+ export class ShortintCompressedPublicKey {
4285
+
4286
+ static __wrap(ptr) {
4287
+ ptr = ptr >>> 0;
4288
+ const obj = Object.create(ShortintCompressedPublicKey.prototype);
4289
+ obj.__wbg_ptr = ptr;
4290
+
4291
+ return obj;
4292
+ }
4293
+
4294
+ __destroy_into_raw() {
4295
+ const ptr = this.__wbg_ptr;
4296
+ this.__wbg_ptr = 0;
4297
+
4298
+ return ptr;
4299
+ }
4300
+
4301
+ free() {
4302
+ const ptr = this.__destroy_into_raw();
4303
+ wasm.__wbg_shortintcompressedpublickey_free(ptr);
4304
+ }
4305
+ }
4306
+ /**
4307
+ */
4308
+ export class ShortintCompressedServerKey {
4309
+
4310
+ static __wrap(ptr) {
4311
+ ptr = ptr >>> 0;
4312
+ const obj = Object.create(ShortintCompressedServerKey.prototype);
4313
+ obj.__wbg_ptr = ptr;
4314
+
4315
+ return obj;
4316
+ }
4317
+
4318
+ __destroy_into_raw() {
4319
+ const ptr = this.__wbg_ptr;
4320
+ this.__wbg_ptr = 0;
4321
+
4322
+ return ptr;
4323
+ }
4324
+
4325
+ free() {
4326
+ const ptr = this.__destroy_into_raw();
4327
+ wasm.__wbg_shortintcompressedserverkey_free(ptr);
4328
+ }
4329
+ }
4330
+ /**
4331
+ */
4332
+ export class ShortintParameters {
4333
+
4334
+ static __wrap(ptr) {
4335
+ ptr = ptr >>> 0;
4336
+ const obj = Object.create(ShortintParameters.prototype);
4337
+ obj.__wbg_ptr = ptr;
4338
+
4339
+ return obj;
4340
+ }
4341
+
4342
+ __destroy_into_raw() {
4343
+ const ptr = this.__wbg_ptr;
4344
+ this.__wbg_ptr = 0;
4345
+
4346
+ return ptr;
848
4347
  }
849
- /**
850
- * @param {ShortintCompressedCiphertext} compressed_ciphertext
851
- * @returns {ShortintCiphertext}
852
- */
853
- static decompress_ciphertext(compressed_ciphertext) {
854
- _assertClass(compressed_ciphertext, ShortintCompressedCiphertext);
855
- const ret = wasm.shortint_decompress_ciphertext(compressed_ciphertext.__wbg_ptr);
856
- return ShortintCiphertext.__wrap(ret);
4348
+
4349
+ free() {
4350
+ const ptr = this.__destroy_into_raw();
4351
+ wasm.__wbg_shortintparameters_free(ptr);
857
4352
  }
858
4353
  /**
859
- * @param {ShortintPublicKey} public_key
860
- * @param {bigint} message
861
- * @returns {ShortintCiphertext}
4354
+ * @param {number} name
862
4355
  */
863
- static encrypt_with_public_key(public_key, message) {
864
- _assertClass(public_key, ShortintPublicKey);
865
- const ret = wasm.shortint_encrypt_with_public_key(public_key.__wbg_ptr, message);
866
- return ShortintCiphertext.__wrap(ret);
4356
+ constructor(name) {
4357
+ const ret = wasm.shortintparameters_new(name);
4358
+ return ShortintParameters.__wrap(ret);
4359
+ }
4360
+ }
4361
+ /**
4362
+ */
4363
+ export class ShortintPublicKey {
4364
+
4365
+ static __wrap(ptr) {
4366
+ ptr = ptr >>> 0;
4367
+ const obj = Object.create(ShortintPublicKey.prototype);
4368
+ obj.__wbg_ptr = ptr;
4369
+
4370
+ return obj;
4371
+ }
4372
+
4373
+ __destroy_into_raw() {
4374
+ const ptr = this.__wbg_ptr;
4375
+ this.__wbg_ptr = 0;
4376
+
4377
+ return ptr;
4378
+ }
4379
+
4380
+ free() {
4381
+ const ptr = this.__destroy_into_raw();
4382
+ wasm.__wbg_shortintpublickey_free(ptr);
4383
+ }
4384
+ }
4385
+ /**
4386
+ */
4387
+ export class TfheClientKey {
4388
+
4389
+ static __wrap(ptr) {
4390
+ ptr = ptr >>> 0;
4391
+ const obj = Object.create(TfheClientKey.prototype);
4392
+ obj.__wbg_ptr = ptr;
4393
+
4394
+ return obj;
4395
+ }
4396
+
4397
+ __destroy_into_raw() {
4398
+ const ptr = this.__wbg_ptr;
4399
+ this.__wbg_ptr = 0;
4400
+
4401
+ return ptr;
4402
+ }
4403
+
4404
+ free() {
4405
+ const ptr = this.__destroy_into_raw();
4406
+ wasm.__wbg_tfheclientkey_free(ptr);
867
4407
  }
868
4408
  /**
869
- * @param {ShortintCompressedPublicKey} public_key
870
- * @param {bigint} message
871
- * @returns {ShortintCiphertext}
4409
+ * @param {TfheConfig} config
4410
+ * @returns {TfheClientKey}
872
4411
  */
873
- static encrypt_with_compressed_public_key(public_key, message) {
874
- _assertClass(public_key, ShortintCompressedPublicKey);
875
- const ret = wasm.shortint_encrypt_with_compressed_public_key(public_key.__wbg_ptr, message);
876
- return ShortintCiphertext.__wrap(ret);
4412
+ static generate(config) {
4413
+ try {
4414
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4415
+ _assertClass(config, TfheConfig);
4416
+ wasm.tfheclientkey_generate(retptr, config.__wbg_ptr);
4417
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4418
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4419
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4420
+ if (r2) {
4421
+ throw takeObject(r1);
4422
+ }
4423
+ return TfheClientKey.__wrap(r0);
4424
+ } finally {
4425
+ wasm.__wbindgen_add_to_stack_pointer(16);
4426
+ }
877
4427
  }
878
4428
  /**
879
- * @param {ShortintClientKey} client_key
880
- * @param {ShortintCiphertext} ct
881
- * @returns {bigint}
4429
+ * @param {TfheConfig} config
4430
+ * @param {any} seed
4431
+ * @returns {TfheClientKey}
882
4432
  */
883
- static decrypt(client_key, ct) {
884
- _assertClass(client_key, ShortintClientKey);
885
- _assertClass(ct, ShortintCiphertext);
886
- const ret = wasm.shortint_decrypt(client_key.__wbg_ptr, ct.__wbg_ptr);
887
- return BigInt.asUintN(64, ret);
4433
+ static generate_with_seed(config, seed) {
4434
+ try {
4435
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4436
+ _assertClass(config, TfheConfig);
4437
+ wasm.tfheclientkey_generate_with_seed(retptr, config.__wbg_ptr, addHeapObject(seed));
4438
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4439
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4440
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4441
+ if (r2) {
4442
+ throw takeObject(r1);
4443
+ }
4444
+ return TfheClientKey.__wrap(r0);
4445
+ } finally {
4446
+ wasm.__wbindgen_add_to_stack_pointer(16);
4447
+ }
888
4448
  }
889
4449
  /**
890
- * @param {ShortintCiphertext} ciphertext
891
4450
  * @returns {Uint8Array}
892
4451
  */
893
- static serialize_ciphertext(ciphertext) {
4452
+ serialize() {
894
4453
  try {
895
4454
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
896
- _assertClass(ciphertext, ShortintCiphertext);
897
- wasm.shortint_serialize_ciphertext(retptr, ciphertext.__wbg_ptr);
4455
+ wasm.tfheclientkey_serialize(retptr, this.__wbg_ptr);
898
4456
  var r0 = getInt32Memory0()[retptr / 4 + 0];
899
4457
  var r1 = getInt32Memory0()[retptr / 4 + 1];
900
4458
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -911,34 +4469,76 @@ export class Shortint {
911
4469
  }
912
4470
  /**
913
4471
  * @param {Uint8Array} buffer
914
- * @returns {ShortintCiphertext}
4472
+ * @returns {TfheClientKey}
915
4473
  */
916
- static deserialize_ciphertext(buffer) {
4474
+ static deserialize(buffer) {
917
4475
  try {
918
4476
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
919
4477
  const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
920
4478
  const len0 = WASM_VECTOR_LEN;
921
- wasm.shortint_deserialize_ciphertext(retptr, ptr0, len0);
4479
+ wasm.tfheclientkey_deserialize(retptr, ptr0, len0);
922
4480
  var r0 = getInt32Memory0()[retptr / 4 + 0];
923
4481
  var r1 = getInt32Memory0()[retptr / 4 + 1];
924
4482
  var r2 = getInt32Memory0()[retptr / 4 + 2];
925
4483
  if (r2) {
926
4484
  throw takeObject(r1);
927
4485
  }
928
- return ShortintCiphertext.__wrap(r0);
4486
+ return TfheClientKey.__wrap(r0);
4487
+ } finally {
4488
+ wasm.__wbindgen_add_to_stack_pointer(16);
4489
+ }
4490
+ }
4491
+ }
4492
+ /**
4493
+ */
4494
+ export class TfheCompactPublicKey {
4495
+
4496
+ static __wrap(ptr) {
4497
+ ptr = ptr >>> 0;
4498
+ const obj = Object.create(TfheCompactPublicKey.prototype);
4499
+ obj.__wbg_ptr = ptr;
4500
+
4501
+ return obj;
4502
+ }
4503
+
4504
+ __destroy_into_raw() {
4505
+ const ptr = this.__wbg_ptr;
4506
+ this.__wbg_ptr = 0;
4507
+
4508
+ return ptr;
4509
+ }
4510
+
4511
+ free() {
4512
+ const ptr = this.__destroy_into_raw();
4513
+ wasm.__wbg_tfhecompactpublickey_free(ptr);
4514
+ }
4515
+ /**
4516
+ * @param {TfheClientKey} client_key
4517
+ * @returns {TfheCompactPublicKey}
4518
+ */
4519
+ static new(client_key) {
4520
+ try {
4521
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4522
+ _assertClass(client_key, TfheClientKey);
4523
+ wasm.tfhecompactpublickey_new(retptr, client_key.__wbg_ptr);
4524
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4525
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4526
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4527
+ if (r2) {
4528
+ throw takeObject(r1);
4529
+ }
4530
+ return TfheCompactPublicKey.__wrap(r0);
929
4531
  } finally {
930
4532
  wasm.__wbindgen_add_to_stack_pointer(16);
931
4533
  }
932
4534
  }
933
4535
  /**
934
- * @param {ShortintCompressedCiphertext} ciphertext
935
4536
  * @returns {Uint8Array}
936
4537
  */
937
- static serialize_compressed_ciphertext(ciphertext) {
4538
+ serialize() {
938
4539
  try {
939
4540
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
940
- _assertClass(ciphertext, ShortintCompressedCiphertext);
941
- wasm.shortint_serialize_compressed_ciphertext(retptr, ciphertext.__wbg_ptr);
4541
+ wasm.tfhecompactpublickey_serialize(retptr, this.__wbg_ptr);
942
4542
  var r0 = getInt32Memory0()[retptr / 4 + 0];
943
4543
  var r1 = getInt32Memory0()[retptr / 4 + 1];
944
4544
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -955,34 +4555,76 @@ export class Shortint {
955
4555
  }
956
4556
  /**
957
4557
  * @param {Uint8Array} buffer
958
- * @returns {ShortintCompressedCiphertext}
4558
+ * @returns {TfheCompactPublicKey}
959
4559
  */
960
- static deserialize_compressed_ciphertext(buffer) {
4560
+ static deserialize(buffer) {
961
4561
  try {
962
4562
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
963
4563
  const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
964
4564
  const len0 = WASM_VECTOR_LEN;
965
- wasm.shortint_deserialize_compressed_ciphertext(retptr, ptr0, len0);
4565
+ wasm.tfhecompactpublickey_deserialize(retptr, ptr0, len0);
966
4566
  var r0 = getInt32Memory0()[retptr / 4 + 0];
967
4567
  var r1 = getInt32Memory0()[retptr / 4 + 1];
968
4568
  var r2 = getInt32Memory0()[retptr / 4 + 2];
969
4569
  if (r2) {
970
4570
  throw takeObject(r1);
971
4571
  }
972
- return ShortintCompressedCiphertext.__wrap(r0);
4572
+ return TfheCompactPublicKey.__wrap(r0);
4573
+ } finally {
4574
+ wasm.__wbindgen_add_to_stack_pointer(16);
4575
+ }
4576
+ }
4577
+ }
4578
+ /**
4579
+ */
4580
+ export class TfheCompressedCompactPublicKey {
4581
+
4582
+ static __wrap(ptr) {
4583
+ ptr = ptr >>> 0;
4584
+ const obj = Object.create(TfheCompressedCompactPublicKey.prototype);
4585
+ obj.__wbg_ptr = ptr;
4586
+
4587
+ return obj;
4588
+ }
4589
+
4590
+ __destroy_into_raw() {
4591
+ const ptr = this.__wbg_ptr;
4592
+ this.__wbg_ptr = 0;
4593
+
4594
+ return ptr;
4595
+ }
4596
+
4597
+ free() {
4598
+ const ptr = this.__destroy_into_raw();
4599
+ wasm.__wbg_tfhecompressedcompactpublickey_free(ptr);
4600
+ }
4601
+ /**
4602
+ * @param {TfheClientKey} client_key
4603
+ * @returns {TfheCompressedCompactPublicKey}
4604
+ */
4605
+ static new(client_key) {
4606
+ try {
4607
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4608
+ _assertClass(client_key, TfheClientKey);
4609
+ wasm.tfhecompressedcompactpublickey_new(retptr, client_key.__wbg_ptr);
4610
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4611
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4612
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4613
+ if (r2) {
4614
+ throw takeObject(r1);
4615
+ }
4616
+ return TfheCompressedCompactPublicKey.__wrap(r0);
973
4617
  } finally {
974
4618
  wasm.__wbindgen_add_to_stack_pointer(16);
975
4619
  }
976
4620
  }
977
4621
  /**
978
- * @param {ShortintClientKey} client_key
979
4622
  * @returns {Uint8Array}
980
4623
  */
981
- static serialize_client_key(client_key) {
4624
+ serialize() {
982
4625
  try {
983
4626
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
984
- _assertClass(client_key, ShortintClientKey);
985
- wasm.shortint_serialize_client_key(retptr, client_key.__wbg_ptr);
4627
+ wasm.tfhecompressedcompactpublickey_serialize(retptr, this.__wbg_ptr);
986
4628
  var r0 = getInt32Memory0()[retptr / 4 + 0];
987
4629
  var r1 = getInt32Memory0()[retptr / 4 + 1];
988
4630
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -999,34 +4641,112 @@ export class Shortint {
999
4641
  }
1000
4642
  /**
1001
4643
  * @param {Uint8Array} buffer
1002
- * @returns {ShortintClientKey}
4644
+ * @returns {TfheCompressedCompactPublicKey}
1003
4645
  */
1004
- static deserialize_client_key(buffer) {
4646
+ static deserialize(buffer) {
1005
4647
  try {
1006
4648
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1007
4649
  const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1008
4650
  const len0 = WASM_VECTOR_LEN;
1009
- wasm.shortint_deserialize_client_key(retptr, ptr0, len0);
4651
+ wasm.tfhecompressedcompactpublickey_deserialize(retptr, ptr0, len0);
4652
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4653
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4654
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4655
+ if (r2) {
4656
+ throw takeObject(r1);
4657
+ }
4658
+ return TfheCompressedCompactPublicKey.__wrap(r0);
4659
+ } finally {
4660
+ wasm.__wbindgen_add_to_stack_pointer(16);
4661
+ }
4662
+ }
4663
+ /**
4664
+ * @returns {TfheCompactPublicKey}
4665
+ */
4666
+ decompress() {
4667
+ try {
4668
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4669
+ wasm.tfhecompressedcompactpublickey_decompress(retptr, this.__wbg_ptr);
4670
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4671
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4672
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4673
+ if (r2) {
4674
+ throw takeObject(r1);
4675
+ }
4676
+ return TfheCompactPublicKey.__wrap(r0);
4677
+ } finally {
4678
+ wasm.__wbindgen_add_to_stack_pointer(16);
4679
+ }
4680
+ }
4681
+ }
4682
+ /**
4683
+ */
4684
+ export class TfheCompressedPublicKey {
4685
+
4686
+ static __wrap(ptr) {
4687
+ ptr = ptr >>> 0;
4688
+ const obj = Object.create(TfheCompressedPublicKey.prototype);
4689
+ obj.__wbg_ptr = ptr;
4690
+
4691
+ return obj;
4692
+ }
4693
+
4694
+ __destroy_into_raw() {
4695
+ const ptr = this.__wbg_ptr;
4696
+ this.__wbg_ptr = 0;
4697
+
4698
+ return ptr;
4699
+ }
4700
+
4701
+ free() {
4702
+ const ptr = this.__destroy_into_raw();
4703
+ wasm.__wbg_tfhecompressedpublickey_free(ptr);
4704
+ }
4705
+ /**
4706
+ * @param {TfheClientKey} client_key
4707
+ * @returns {TfheCompressedPublicKey}
4708
+ */
4709
+ static new(client_key) {
4710
+ try {
4711
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4712
+ _assertClass(client_key, TfheClientKey);
4713
+ wasm.tfhecompressedpublickey_new(retptr, client_key.__wbg_ptr);
4714
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4715
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4716
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4717
+ if (r2) {
4718
+ throw takeObject(r1);
4719
+ }
4720
+ return TfheCompressedPublicKey.__wrap(r0);
4721
+ } finally {
4722
+ wasm.__wbindgen_add_to_stack_pointer(16);
4723
+ }
4724
+ }
4725
+ /**
4726
+ * @returns {TfhePublicKey}
4727
+ */
4728
+ decompress() {
4729
+ try {
4730
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4731
+ wasm.tfhecompressedpublickey_decompress(retptr, this.__wbg_ptr);
1010
4732
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1011
4733
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1012
4734
  var r2 = getInt32Memory0()[retptr / 4 + 2];
1013
4735
  if (r2) {
1014
4736
  throw takeObject(r1);
1015
4737
  }
1016
- return ShortintClientKey.__wrap(r0);
4738
+ return TfhePublicKey.__wrap(r0);
1017
4739
  } finally {
1018
4740
  wasm.__wbindgen_add_to_stack_pointer(16);
1019
4741
  }
1020
4742
  }
1021
4743
  /**
1022
- * @param {ShortintPublicKey} public_key
1023
4744
  * @returns {Uint8Array}
1024
4745
  */
1025
- static serialize_public_key(public_key) {
4746
+ serialize() {
1026
4747
  try {
1027
4748
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1028
- _assertClass(public_key, ShortintPublicKey);
1029
- wasm.shortint_serialize_public_key(retptr, public_key.__wbg_ptr);
4749
+ wasm.tfhecompressedpublickey_serialize(retptr, this.__wbg_ptr);
1030
4750
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1031
4751
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1032
4752
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1043,78 +4763,76 @@ export class Shortint {
1043
4763
  }
1044
4764
  /**
1045
4765
  * @param {Uint8Array} buffer
1046
- * @returns {ShortintPublicKey}
4766
+ * @returns {TfheCompressedPublicKey}
1047
4767
  */
1048
- static deserialize_public_key(buffer) {
4768
+ static deserialize(buffer) {
1049
4769
  try {
1050
4770
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1051
4771
  const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1052
4772
  const len0 = WASM_VECTOR_LEN;
1053
- wasm.shortint_deserialize_public_key(retptr, ptr0, len0);
4773
+ wasm.tfhecompressedpublickey_deserialize(retptr, ptr0, len0);
1054
4774
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1055
4775
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1056
4776
  var r2 = getInt32Memory0()[retptr / 4 + 2];
1057
4777
  if (r2) {
1058
4778
  throw takeObject(r1);
1059
4779
  }
1060
- return ShortintPublicKey.__wrap(r0);
4780
+ return TfheCompressedPublicKey.__wrap(r0);
1061
4781
  } finally {
1062
4782
  wasm.__wbindgen_add_to_stack_pointer(16);
1063
4783
  }
1064
4784
  }
1065
- /**
1066
- * @param {ShortintCompressedPublicKey} public_key
1067
- * @returns {Uint8Array}
1068
- */
1069
- static serialize_compressed_public_key(public_key) {
1070
- try {
1071
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1072
- _assertClass(public_key, ShortintCompressedPublicKey);
1073
- wasm.shortint_serialize_compressed_public_key(retptr, public_key.__wbg_ptr);
1074
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1075
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1076
- var r2 = getInt32Memory0()[retptr / 4 + 2];
1077
- var r3 = getInt32Memory0()[retptr / 4 + 3];
1078
- if (r3) {
1079
- throw takeObject(r2);
1080
- }
1081
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
1082
- wasm.__wbindgen_free(r0, r1 * 1);
1083
- return v1;
1084
- } finally {
1085
- wasm.__wbindgen_add_to_stack_pointer(16);
1086
- }
4785
+ }
4786
+ /**
4787
+ */
4788
+ export class TfheCompressedServerKey {
4789
+
4790
+ static __wrap(ptr) {
4791
+ ptr = ptr >>> 0;
4792
+ const obj = Object.create(TfheCompressedServerKey.prototype);
4793
+ obj.__wbg_ptr = ptr;
4794
+
4795
+ return obj;
4796
+ }
4797
+
4798
+ __destroy_into_raw() {
4799
+ const ptr = this.__wbg_ptr;
4800
+ this.__wbg_ptr = 0;
4801
+
4802
+ return ptr;
4803
+ }
4804
+
4805
+ free() {
4806
+ const ptr = this.__destroy_into_raw();
4807
+ wasm.__wbg_tfhecompressedserverkey_free(ptr);
1087
4808
  }
1088
4809
  /**
1089
- * @param {Uint8Array} buffer
1090
- * @returns {ShortintCompressedPublicKey}
4810
+ * @param {TfheClientKey} client_key
4811
+ * @returns {TfheCompressedServerKey}
1091
4812
  */
1092
- static deserialize_compressed_public_key(buffer) {
4813
+ static new(client_key) {
1093
4814
  try {
1094
4815
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1095
- const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1096
- const len0 = WASM_VECTOR_LEN;
1097
- wasm.shortint_deserialize_compressed_public_key(retptr, ptr0, len0);
4816
+ _assertClass(client_key, TfheClientKey);
4817
+ wasm.tfhecompressedserverkey_new(retptr, client_key.__wbg_ptr);
1098
4818
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1099
4819
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1100
4820
  var r2 = getInt32Memory0()[retptr / 4 + 2];
1101
4821
  if (r2) {
1102
4822
  throw takeObject(r1);
1103
4823
  }
1104
- return ShortintCompressedPublicKey.__wrap(r0);
4824
+ return TfheCompressedServerKey.__wrap(r0);
1105
4825
  } finally {
1106
4826
  wasm.__wbindgen_add_to_stack_pointer(16);
1107
4827
  }
1108
4828
  }
1109
4829
  /**
1110
- * @param {ShortintCompressedServerKey} server_key
1111
4830
  * @returns {Uint8Array}
1112
4831
  */
1113
- static serialize_compressed_server_key(server_key) {
4832
+ serialize() {
1114
4833
  try {
1115
4834
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1116
- _assertClass(server_key, ShortintCompressedServerKey);
1117
- wasm.shortint_serialize_compressed_server_key(retptr, server_key.__wbg_ptr);
4835
+ wasm.tfhecompressedserverkey_serialize(retptr, this.__wbg_ptr);
1118
4836
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1119
4837
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1120
4838
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1131,21 +4849,21 @@ export class Shortint {
1131
4849
  }
1132
4850
  /**
1133
4851
  * @param {Uint8Array} buffer
1134
- * @returns {ShortintCompressedServerKey}
4852
+ * @returns {TfheCompressedServerKey}
1135
4853
  */
1136
- static deserialize_compressed_server_key(buffer) {
4854
+ static deserialize(buffer) {
1137
4855
  try {
1138
4856
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1139
4857
  const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
1140
4858
  const len0 = WASM_VECTOR_LEN;
1141
- wasm.shortint_deserialize_compressed_server_key(retptr, ptr0, len0);
4859
+ wasm.tfhecompressedserverkey_deserialize(retptr, ptr0, len0);
1142
4860
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1143
4861
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1144
4862
  var r2 = getInt32Memory0()[retptr / 4 + 2];
1145
4863
  if (r2) {
1146
4864
  throw takeObject(r1);
1147
4865
  }
1148
- return ShortintCompressedServerKey.__wrap(r0);
4866
+ return TfheCompressedServerKey.__wrap(r0);
1149
4867
  } finally {
1150
4868
  wasm.__wbindgen_add_to_stack_pointer(16);
1151
4869
  }
@@ -1153,11 +4871,11 @@ export class Shortint {
1153
4871
  }
1154
4872
  /**
1155
4873
  */
1156
- export class ShortintCiphertext {
4874
+ export class TfheConfig {
1157
4875
 
1158
4876
  static __wrap(ptr) {
1159
4877
  ptr = ptr >>> 0;
1160
- const obj = Object.create(ShortintCiphertext.prototype);
4878
+ const obj = Object.create(TfheConfig.prototype);
1161
4879
  obj.__wbg_ptr = ptr;
1162
4880
 
1163
4881
  return obj;
@@ -1172,16 +4890,16 @@ export class ShortintCiphertext {
1172
4890
 
1173
4891
  free() {
1174
4892
  const ptr = this.__destroy_into_raw();
1175
- wasm.__wbg_shortintciphertext_free(ptr);
4893
+ wasm.__wbg_tfheconfig_free(ptr);
1176
4894
  }
1177
4895
  }
1178
4896
  /**
1179
4897
  */
1180
- export class ShortintClientKey {
4898
+ export class TfheConfigBuilder {
1181
4899
 
1182
4900
  static __wrap(ptr) {
1183
4901
  ptr = ptr >>> 0;
1184
- const obj = Object.create(ShortintClientKey.prototype);
4902
+ const obj = Object.create(TfheConfigBuilder.prototype);
1185
4903
  obj.__wbg_ptr = ptr;
1186
4904
 
1187
4905
  return obj;
@@ -1196,64 +4914,58 @@ export class ShortintClientKey {
1196
4914
 
1197
4915
  free() {
1198
4916
  const ptr = this.__destroy_into_raw();
1199
- wasm.__wbg_shortintclientkey_free(ptr);
1200
- }
1201
- }
1202
- /**
1203
- */
1204
- export class ShortintCompressedCiphertext {
1205
-
1206
- static __wrap(ptr) {
1207
- ptr = ptr >>> 0;
1208
- const obj = Object.create(ShortintCompressedCiphertext.prototype);
1209
- obj.__wbg_ptr = ptr;
1210
-
1211
- return obj;
4917
+ wasm.__wbg_tfheconfigbuilder_free(ptr);
1212
4918
  }
1213
-
1214
- __destroy_into_raw() {
1215
- const ptr = this.__wbg_ptr;
1216
- this.__wbg_ptr = 0;
1217
-
1218
- return ptr;
4919
+ /**
4920
+ * @returns {TfheConfigBuilder}
4921
+ */
4922
+ static all_disabled() {
4923
+ const ret = wasm.tfheconfigbuilder_all_disabled();
4924
+ return TfheConfigBuilder.__wrap(ret);
1219
4925
  }
1220
-
1221
- free() {
4926
+ /**
4927
+ * @returns {TfheConfigBuilder}
4928
+ */
4929
+ enable_default_integers() {
1222
4930
  const ptr = this.__destroy_into_raw();
1223
- wasm.__wbg_shortintcompressedciphertext_free(ptr);
4931
+ const ret = wasm.tfheconfigbuilder_enable_default_integers(ptr);
4932
+ return TfheConfigBuilder.__wrap(ret);
1224
4933
  }
1225
- }
1226
- /**
1227
- */
1228
- export class ShortintCompressedPublicKey {
1229
-
1230
- static __wrap(ptr) {
1231
- ptr = ptr >>> 0;
1232
- const obj = Object.create(ShortintCompressedPublicKey.prototype);
1233
- obj.__wbg_ptr = ptr;
1234
-
1235
- return obj;
4934
+ /**
4935
+ * @returns {TfheConfigBuilder}
4936
+ */
4937
+ enable_default_integers_small() {
4938
+ const ptr = this.__destroy_into_raw();
4939
+ const ret = wasm.tfheconfigbuilder_enable_default_integers_small(ptr);
4940
+ return TfheConfigBuilder.__wrap(ret);
1236
4941
  }
1237
-
1238
- __destroy_into_raw() {
1239
- const ptr = this.__wbg_ptr;
1240
- this.__wbg_ptr = 0;
1241
-
1242
- return ptr;
4942
+ /**
4943
+ * @param {ShortintParameters} block_parameters
4944
+ * @returns {TfheConfigBuilder}
4945
+ */
4946
+ enable_custom_integers(block_parameters) {
4947
+ const ptr = this.__destroy_into_raw();
4948
+ _assertClass(block_parameters, ShortintParameters);
4949
+ var ptr0 = block_parameters.__destroy_into_raw();
4950
+ const ret = wasm.tfheconfigbuilder_enable_custom_integers(ptr, ptr0);
4951
+ return TfheConfigBuilder.__wrap(ret);
1243
4952
  }
1244
-
1245
- free() {
4953
+ /**
4954
+ * @returns {TfheConfig}
4955
+ */
4956
+ build() {
1246
4957
  const ptr = this.__destroy_into_raw();
1247
- wasm.__wbg_shortintcompressedpublickey_free(ptr);
4958
+ const ret = wasm.tfheconfigbuilder_build(ptr);
4959
+ return TfheConfig.__wrap(ret);
1248
4960
  }
1249
4961
  }
1250
4962
  /**
1251
4963
  */
1252
- export class ShortintCompressedServerKey {
4964
+ export class TfhePublicKey {
1253
4965
 
1254
4966
  static __wrap(ptr) {
1255
4967
  ptr = ptr >>> 0;
1256
- const obj = Object.create(ShortintCompressedServerKey.prototype);
4968
+ const obj = Object.create(TfhePublicKey.prototype);
1257
4969
  obj.__wbg_ptr = ptr;
1258
4970
 
1259
4971
  return obj;
@@ -1268,44 +4980,74 @@ export class ShortintCompressedServerKey {
1268
4980
 
1269
4981
  free() {
1270
4982
  const ptr = this.__destroy_into_raw();
1271
- wasm.__wbg_shortintcompressedserverkey_free(ptr);
4983
+ wasm.__wbg_tfhepublickey_free(ptr);
1272
4984
  }
1273
- }
1274
- /**
1275
- */
1276
- export class ShortintParameters {
1277
-
1278
- static __wrap(ptr) {
1279
- ptr = ptr >>> 0;
1280
- const obj = Object.create(ShortintParameters.prototype);
1281
- obj.__wbg_ptr = ptr;
1282
-
1283
- return obj;
4985
+ /**
4986
+ * @param {TfheClientKey} client_key
4987
+ * @returns {TfhePublicKey}
4988
+ */
4989
+ static new(client_key) {
4990
+ try {
4991
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4992
+ _assertClass(client_key, TfheClientKey);
4993
+ wasm.tfhepublickey_new(retptr, client_key.__wbg_ptr);
4994
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4995
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4996
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
4997
+ if (r2) {
4998
+ throw takeObject(r1);
4999
+ }
5000
+ return TfhePublicKey.__wrap(r0);
5001
+ } finally {
5002
+ wasm.__wbindgen_add_to_stack_pointer(16);
5003
+ }
1284
5004
  }
1285
-
1286
- __destroy_into_raw() {
1287
- const ptr = this.__wbg_ptr;
1288
- this.__wbg_ptr = 0;
1289
-
1290
- return ptr;
5005
+ /**
5006
+ * @returns {Uint8Array}
5007
+ */
5008
+ serialize() {
5009
+ try {
5010
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5011
+ wasm.tfhepublickey_serialize(retptr, this.__wbg_ptr);
5012
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
5013
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
5014
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
5015
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
5016
+ if (r3) {
5017
+ throw takeObject(r2);
5018
+ }
5019
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
5020
+ wasm.__wbindgen_free(r0, r1 * 1);
5021
+ return v1;
5022
+ } finally {
5023
+ wasm.__wbindgen_add_to_stack_pointer(16);
5024
+ }
1291
5025
  }
1292
-
1293
- free() {
1294
- const ptr = this.__destroy_into_raw();
1295
- wasm.__wbg_shortintparameters_free(ptr);
5026
+ /**
5027
+ * @param {Uint8Array} buffer
5028
+ * @returns {TfhePublicKey}
5029
+ */
5030
+ static deserialize(buffer) {
5031
+ try {
5032
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5033
+ const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
5034
+ const len0 = WASM_VECTOR_LEN;
5035
+ wasm.tfhepublickey_deserialize(retptr, ptr0, len0);
5036
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
5037
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
5038
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
5039
+ if (r2) {
5040
+ throw takeObject(r1);
5041
+ }
5042
+ return TfhePublicKey.__wrap(r0);
5043
+ } finally {
5044
+ wasm.__wbindgen_add_to_stack_pointer(16);
5045
+ }
1296
5046
  }
1297
5047
  }
1298
5048
  /**
1299
5049
  */
1300
- export class ShortintPublicKey {
1301
-
1302
- static __wrap(ptr) {
1303
- ptr = ptr >>> 0;
1304
- const obj = Object.create(ShortintPublicKey.prototype);
1305
- obj.__wbg_ptr = ptr;
1306
-
1307
- return obj;
1308
- }
5050
+ export class tfhe {
1309
5051
 
1310
5052
  __destroy_into_raw() {
1311
5053
  const ptr = this.__wbg_ptr;
@@ -1316,7 +5058,7 @@ export class ShortintPublicKey {
1316
5058
 
1317
5059
  free() {
1318
5060
  const ptr = this.__destroy_into_raw();
1319
- wasm.__wbg_shortintpublickey_free(ptr);
5061
+ wasm.__wbg_tfhe_free(ptr);
1320
5062
  }
1321
5063
  }
1322
5064
 
@@ -1354,10 +5096,73 @@ async function __wbg_load(module, imports) {
1354
5096
  function __wbg_get_imports() {
1355
5097
  const imports = {};
1356
5098
  imports.wbg = {};
5099
+ imports.wbg.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
5100
+ const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
5101
+ return addHeapObject(ret);
5102
+ };
1357
5103
  imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
1358
5104
  const ret = new Error(getStringFromWasm0(arg0, arg1));
1359
5105
  return addHeapObject(ret);
1360
5106
  };
5107
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
5108
+ const ret = BigInt.asUintN(64, arg0);
5109
+ return addHeapObject(ret);
5110
+ };
5111
+ imports.wbg.__wbindgen_shr = function(arg0, arg1) {
5112
+ const ret = getObject(arg0) >> getObject(arg1);
5113
+ return addHeapObject(ret);
5114
+ };
5115
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
5116
+ takeObject(arg0);
5117
+ };
5118
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
5119
+ const ret = getObject(arg0) === getObject(arg1);
5120
+ return ret;
5121
+ };
5122
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
5123
+ const ret = getObject(arg0);
5124
+ return addHeapObject(ret);
5125
+ };
5126
+ imports.wbg.__wbindgen_bigint_from_str = function(arg0, arg1) {
5127
+ const ret = BigInt(getStringFromWasm0(arg0, arg1));
5128
+ return addHeapObject(ret);
5129
+ };
5130
+ imports.wbg.__wbindgen_bit_and = function(arg0, arg1) {
5131
+ const ret = getObject(arg0) & getObject(arg1);
5132
+ return addHeapObject(ret);
5133
+ };
5134
+ imports.wbg.__wbindgen_shl = function(arg0, arg1) {
5135
+ const ret = getObject(arg0) << getObject(arg1);
5136
+ return addHeapObject(ret);
5137
+ };
5138
+ imports.wbg.__wbindgen_add = function(arg0, arg1) {
5139
+ const ret = getObject(arg0) + getObject(arg1);
5140
+ return addHeapObject(ret);
5141
+ };
5142
+ imports.wbg.__wbg_fheuint128_new = function(arg0) {
5143
+ const ret = FheUint128.__wrap(arg0);
5144
+ return addHeapObject(ret);
5145
+ };
5146
+ imports.wbg.__wbg_fheuint256_new = function(arg0) {
5147
+ const ret = FheUint256.__wrap(arg0);
5148
+ return addHeapObject(ret);
5149
+ };
5150
+ imports.wbg.__wbg_fheuint8_new = function(arg0) {
5151
+ const ret = FheUint8.__wrap(arg0);
5152
+ return addHeapObject(ret);
5153
+ };
5154
+ imports.wbg.__wbg_fheuint16_new = function(arg0) {
5155
+ const ret = FheUint16.__wrap(arg0);
5156
+ return addHeapObject(ret);
5157
+ };
5158
+ imports.wbg.__wbg_fheuint32_new = function(arg0) {
5159
+ const ret = FheUint32.__wrap(arg0);
5160
+ return addHeapObject(ret);
5161
+ };
5162
+ imports.wbg.__wbg_fheuint64_new = function(arg0) {
5163
+ const ret = FheUint64.__wrap(arg0);
5164
+ return addHeapObject(ret);
5165
+ };
1361
5166
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
1362
5167
  const ret = new Error();
1363
5168
  return addHeapObject(ret);
@@ -1380,9 +5185,6 @@ function __wbg_get_imports() {
1380
5185
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1381
5186
  }
1382
5187
  };
1383
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1384
- takeObject(arg0);
1385
- };
1386
5188
  imports.wbg.__wbg_crypto_c48a774b022d20ac = function(arg0) {
1387
5189
  const ret = getObject(arg0).crypto;
1388
5190
  return addHeapObject(ret);
@@ -1438,10 +5240,6 @@ function __wbg_get_imports() {
1438
5240
  const ret = getObject(arg0).call(getObject(arg1));
1439
5241
  return addHeapObject(ret);
1440
5242
  }, arguments) };
1441
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
1442
- const ret = getObject(arg0);
1443
- return addHeapObject(ret);
1444
- };
1445
5243
  imports.wbg.__wbg_self_1ff1d729e9aae938 = function() { return handleError(function () {
1446
5244
  const ret = self.self;
1447
5245
  return addHeapObject(ret);
@@ -1489,6 +5287,19 @@ function __wbg_get_imports() {
1489
5287
  const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1490
5288
  return addHeapObject(ret);
1491
5289
  };
5290
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
5291
+ const v = getObject(arg1);
5292
+ const ret = typeof(v) === 'bigint' ? v : undefined;
5293
+ getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? BigInt(0) : ret;
5294
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
5295
+ };
5296
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
5297
+ const ret = debugString(getObject(arg1));
5298
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5299
+ const len1 = WASM_VECTOR_LEN;
5300
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
5301
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
5302
+ };
1492
5303
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
1493
5304
  throw new Error(getStringFromWasm0(arg0, arg1));
1494
5305
  };
@@ -1507,7 +5318,11 @@ function __wbg_init_memory(imports, maybe_memory) {
1507
5318
  function __wbg_finalize_init(instance, module) {
1508
5319
  wasm = instance.exports;
1509
5320
  __wbg_init.__wbindgen_wasm_module = module;
5321
+ cachedBigInt64Memory0 = null;
5322
+ cachedBigUint64Memory0 = null;
1510
5323
  cachedInt32Memory0 = null;
5324
+ cachedUint16Memory0 = null;
5325
+ cachedUint32Memory0 = null;
1511
5326
  cachedUint8Memory0 = null;
1512
5327
 
1513
5328