@enclave-e3/wasm 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/e3_wasm.d.ts +24 -2
- package/dist/node/e3_wasm.js +360 -356
- package/dist/node/e3_wasm_bg.wasm +0 -0
- package/dist/node/e3_wasm_bg.wasm.d.ts +1 -0
- package/dist/web/e3_wasm.d.ts +56 -32
- package/dist/web/e3_wasm.js +372 -347
- package/dist/web/e3_wasm_base64.js +1 -1
- package/package.json +1 -1
package/dist/web/e3_wasm.js
CHANGED
|
@@ -1,150 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* @ts-self-types="./e3_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
-
let cachedUint8ArrayMemory0 = null;
|
|
4
|
-
|
|
5
|
-
function getUint8ArrayMemory0() {
|
|
6
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
7
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
8
|
-
}
|
|
9
|
-
return cachedUint8ArrayMemory0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
13
|
-
|
|
14
|
-
cachedTextDecoder.decode();
|
|
15
|
-
|
|
16
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
17
|
-
let numBytesDecoded = 0;
|
|
18
|
-
function decodeText(ptr, len) {
|
|
19
|
-
numBytesDecoded += len;
|
|
20
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
21
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
22
|
-
cachedTextDecoder.decode();
|
|
23
|
-
numBytesDecoded = len;
|
|
24
|
-
}
|
|
25
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function getStringFromWasm0(ptr, len) {
|
|
29
|
-
ptr = ptr >>> 0;
|
|
30
|
-
return decodeText(ptr, len);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let WASM_VECTOR_LEN = 0;
|
|
34
|
-
|
|
35
|
-
const cachedTextEncoder = new TextEncoder();
|
|
36
|
-
|
|
37
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
38
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
39
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
40
|
-
view.set(buf);
|
|
41
|
-
return {
|
|
42
|
-
read: arg.length,
|
|
43
|
-
written: buf.length
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
49
|
-
|
|
50
|
-
if (realloc === undefined) {
|
|
51
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
52
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
53
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
54
|
-
WASM_VECTOR_LEN = buf.length;
|
|
55
|
-
return ptr;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
let len = arg.length;
|
|
59
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
60
|
-
|
|
61
|
-
const mem = getUint8ArrayMemory0();
|
|
62
|
-
|
|
63
|
-
let offset = 0;
|
|
64
|
-
|
|
65
|
-
for (; offset < len; offset++) {
|
|
66
|
-
const code = arg.charCodeAt(offset);
|
|
67
|
-
if (code > 0x7F) break;
|
|
68
|
-
mem[ptr + offset] = code;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (offset !== len) {
|
|
72
|
-
if (offset !== 0) {
|
|
73
|
-
arg = arg.slice(offset);
|
|
74
|
-
}
|
|
75
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
76
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
77
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
78
|
-
|
|
79
|
-
offset += ret.written;
|
|
80
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
WASM_VECTOR_LEN = offset;
|
|
84
|
-
return ptr;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
let cachedDataViewMemory0 = null;
|
|
88
|
-
|
|
89
|
-
function getDataViewMemory0() {
|
|
90
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
91
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
92
|
-
}
|
|
93
|
-
return cachedDataViewMemory0;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function addToExternrefTable0(obj) {
|
|
97
|
-
const idx = wasm.__externref_table_alloc();
|
|
98
|
-
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
99
|
-
return idx;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function handleError(f, args) {
|
|
103
|
-
try {
|
|
104
|
-
return f.apply(this, args);
|
|
105
|
-
} catch (e) {
|
|
106
|
-
const idx = addToExternrefTable0(e);
|
|
107
|
-
wasm.__wbindgen_exn_store(idx);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
112
|
-
ptr = ptr >>> 0;
|
|
113
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function isLikeNone(x) {
|
|
117
|
-
return x === undefined || x === null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
121
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
122
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
123
|
-
WASM_VECTOR_LEN = arg.length;
|
|
124
|
-
return ptr;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
let cachedBigUint64ArrayMemory0 = null;
|
|
128
|
-
|
|
129
|
-
function getBigUint64ArrayMemory0() {
|
|
130
|
-
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
|
|
131
|
-
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
132
|
-
}
|
|
133
|
-
return cachedBigUint64ArrayMemory0;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function passArray64ToWasm0(arg, malloc) {
|
|
137
|
-
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
138
|
-
getBigUint64ArrayMemory0().set(arg, ptr / 8);
|
|
139
|
-
WASM_VECTOR_LEN = arg.length;
|
|
140
|
-
return ptr;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function takeFromExternrefTable0(idx) {
|
|
144
|
-
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
145
|
-
wasm.__externref_table_dealloc(idx);
|
|
146
|
-
return value;
|
|
147
|
-
}
|
|
148
3
|
/**
|
|
149
4
|
* A function to encrypt a u64 value using BFV and default params.
|
|
150
5
|
*
|
|
@@ -225,16 +80,6 @@ export function bfv_encrypt_vector(data, public_key, degree, plaintext_modulus,
|
|
|
225
80
|
return v4;
|
|
226
81
|
}
|
|
227
82
|
|
|
228
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
229
|
-
ptr = ptr >>> 0;
|
|
230
|
-
const mem = getDataViewMemory0();
|
|
231
|
-
const result = [];
|
|
232
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
233
|
-
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
234
|
-
}
|
|
235
|
-
wasm.__externref_drop_slice(ptr, len);
|
|
236
|
-
return result;
|
|
237
|
-
}
|
|
238
83
|
/**
|
|
239
84
|
* A function to encrypt a u64 value using BFV and default params and
|
|
240
85
|
* generate circuit inputs for Greco
|
|
@@ -317,11 +162,44 @@ export function bfv_verifiable_encrypt_vector(data, public_key, degree, plaintex
|
|
|
317
162
|
return v4;
|
|
318
163
|
}
|
|
319
164
|
|
|
165
|
+
/**
|
|
166
|
+
* A function to compute the public key commitment for a given public key.
|
|
167
|
+
*
|
|
168
|
+
* # Arguments
|
|
169
|
+
*
|
|
170
|
+
* * `public_key` - The public key to compute the commitment for
|
|
171
|
+
*
|
|
172
|
+
* # Returns
|
|
173
|
+
* Returns a `Result<Vec<u8>, JsValue>` containing the commitment and any errors.
|
|
174
|
+
*
|
|
175
|
+
* # Panics
|
|
176
|
+
*
|
|
177
|
+
* Panics if the public key cannot be computed
|
|
178
|
+
* @param {Uint8Array} public_key
|
|
179
|
+
* @param {number} degree
|
|
180
|
+
* @param {bigint} plaintext_modulus
|
|
181
|
+
* @param {BigUint64Array} moduli
|
|
182
|
+
* @returns {Uint8Array}
|
|
183
|
+
*/
|
|
184
|
+
export function compute_pk_commitment(public_key, degree, plaintext_modulus, moduli) {
|
|
185
|
+
const ptr0 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
|
|
186
|
+
const len0 = WASM_VECTOR_LEN;
|
|
187
|
+
const ptr1 = passArray64ToWasm0(moduli, wasm.__wbindgen_malloc);
|
|
188
|
+
const len1 = WASM_VECTOR_LEN;
|
|
189
|
+
const ret = wasm.compute_pk_commitment(ptr0, len0, degree, plaintext_modulus, ptr1, len1);
|
|
190
|
+
if (ret[3]) {
|
|
191
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
192
|
+
}
|
|
193
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
194
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
195
|
+
return v3;
|
|
196
|
+
}
|
|
197
|
+
|
|
320
198
|
/**
|
|
321
199
|
* Retrieves a BFV parameter set by name.
|
|
322
200
|
*
|
|
323
201
|
* # Parameters
|
|
324
|
-
* * `name` - Parameter set identifier (e.g., "
|
|
202
|
+
* * `name` - Parameter set identifier (e.g., "SECURE_THRESHOLD_BFV_8192")
|
|
325
203
|
*
|
|
326
204
|
* # Returns
|
|
327
205
|
* A JavaScript object with the following structure:
|
|
@@ -354,7 +232,7 @@ export function get_bfv_params(name) {
|
|
|
354
232
|
*
|
|
355
233
|
* # Returns
|
|
356
234
|
* Array of parameter set names that can be passed to `get_bfv_params()`.
|
|
357
|
-
* Includes both production-ready sets (e.g., "
|
|
235
|
+
* Includes both production-ready sets (e.g., "SECURE_THRESHOLD_BFV_8192") and
|
|
358
236
|
* insecure sets for testing (prefixed with "INSECURE_").
|
|
359
237
|
* @returns {string[]}
|
|
360
238
|
*/
|
|
@@ -365,220 +243,371 @@ export function get_bfv_params_list() {
|
|
|
365
243
|
return v1;
|
|
366
244
|
}
|
|
367
245
|
|
|
368
|
-
|
|
246
|
+
function __wbg_get_imports() {
|
|
247
|
+
const import0 = {
|
|
248
|
+
__proto__: null,
|
|
249
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
250
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
251
|
+
return ret;
|
|
252
|
+
},
|
|
253
|
+
__wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
|
|
254
|
+
const ret = String(arg1);
|
|
255
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
256
|
+
const len1 = WASM_VECTOR_LEN;
|
|
257
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
258
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
259
|
+
},
|
|
260
|
+
__wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
|
|
261
|
+
const ret = typeof(arg0) === 'function';
|
|
262
|
+
return ret;
|
|
263
|
+
},
|
|
264
|
+
__wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
|
|
265
|
+
const val = arg0;
|
|
266
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
267
|
+
return ret;
|
|
268
|
+
},
|
|
269
|
+
__wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
|
|
270
|
+
const ret = typeof(arg0) === 'string';
|
|
271
|
+
return ret;
|
|
272
|
+
},
|
|
273
|
+
__wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
|
|
274
|
+
const ret = arg0 === undefined;
|
|
275
|
+
return ret;
|
|
276
|
+
},
|
|
277
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
278
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
279
|
+
},
|
|
280
|
+
__wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
|
|
281
|
+
const ret = arg0.call(arg1);
|
|
282
|
+
return ret;
|
|
283
|
+
}, arguments); },
|
|
284
|
+
__wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
|
|
285
|
+
const ret = arg0.call(arg1, arg2);
|
|
286
|
+
return ret;
|
|
287
|
+
}, arguments); },
|
|
288
|
+
__wbg_crypto_86f2631e91b51511: function(arg0) {
|
|
289
|
+
const ret = arg0.crypto;
|
|
290
|
+
return ret;
|
|
291
|
+
},
|
|
292
|
+
__wbg_getRandomValues_b3f15fcbfabb0f8b: function() { return handleError(function (arg0, arg1) {
|
|
293
|
+
arg0.getRandomValues(arg1);
|
|
294
|
+
}, arguments); },
|
|
295
|
+
__wbg_length_32ed9a279acd054c: function(arg0) {
|
|
296
|
+
const ret = arg0.length;
|
|
297
|
+
return ret;
|
|
298
|
+
},
|
|
299
|
+
__wbg_msCrypto_d562bbe83e0d4b91: function(arg0) {
|
|
300
|
+
const ret = arg0.msCrypto;
|
|
301
|
+
return ret;
|
|
302
|
+
},
|
|
303
|
+
__wbg_new_361308b2356cecd0: function() {
|
|
304
|
+
const ret = new Object();
|
|
305
|
+
return ret;
|
|
306
|
+
},
|
|
307
|
+
__wbg_new_3eb36ae241fe6f44: function() {
|
|
308
|
+
const ret = new Array();
|
|
309
|
+
return ret;
|
|
310
|
+
},
|
|
311
|
+
__wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
|
|
312
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
313
|
+
return ret;
|
|
314
|
+
},
|
|
315
|
+
__wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
|
|
316
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
317
|
+
return ret;
|
|
318
|
+
},
|
|
319
|
+
__wbg_node_e1f24f89a7336c2e: function(arg0) {
|
|
320
|
+
const ret = arg0.node;
|
|
321
|
+
return ret;
|
|
322
|
+
},
|
|
323
|
+
__wbg_process_3975fd6c72f520aa: function(arg0) {
|
|
324
|
+
const ret = arg0.process;
|
|
325
|
+
return ret;
|
|
326
|
+
},
|
|
327
|
+
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
328
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
329
|
+
},
|
|
330
|
+
__wbg_randomFillSync_f8c153b79f285817: function() { return handleError(function (arg0, arg1) {
|
|
331
|
+
arg0.randomFillSync(arg1);
|
|
332
|
+
}, arguments); },
|
|
333
|
+
__wbg_require_b74f47fc2d022fd6: function() { return handleError(function () {
|
|
334
|
+
const ret = module.require;
|
|
335
|
+
return ret;
|
|
336
|
+
}, arguments); },
|
|
337
|
+
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
338
|
+
arg0[arg1] = arg2;
|
|
339
|
+
},
|
|
340
|
+
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
341
|
+
arg0[arg1 >>> 0] = arg2;
|
|
342
|
+
},
|
|
343
|
+
__wbg_static_accessor_GLOBAL_12837167ad935116: function() {
|
|
344
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
345
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
346
|
+
},
|
|
347
|
+
__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
|
|
348
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
349
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
350
|
+
},
|
|
351
|
+
__wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
|
|
352
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
353
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
354
|
+
},
|
|
355
|
+
__wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
|
|
356
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
357
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
358
|
+
},
|
|
359
|
+
__wbg_subarray_a96e1fef17ed23cb: function(arg0, arg1, arg2) {
|
|
360
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
361
|
+
return ret;
|
|
362
|
+
},
|
|
363
|
+
__wbg_versions_4e31226f5e8dc909: function(arg0) {
|
|
364
|
+
const ret = arg0.versions;
|
|
365
|
+
return ret;
|
|
366
|
+
},
|
|
367
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
368
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
369
|
+
const ret = arg0;
|
|
370
|
+
return ret;
|
|
371
|
+
},
|
|
372
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
373
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
374
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
375
|
+
return ret;
|
|
376
|
+
},
|
|
377
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
378
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
379
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
380
|
+
return ret;
|
|
381
|
+
},
|
|
382
|
+
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
383
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
384
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
385
|
+
return ret;
|
|
386
|
+
},
|
|
387
|
+
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
388
|
+
var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
|
|
389
|
+
wasm.__wbindgen_free(arg0, arg1 * 1, 1);
|
|
390
|
+
// Cast intrinsic for `Vector(U8) -> Externref`.
|
|
391
|
+
const ret = v0;
|
|
392
|
+
return ret;
|
|
393
|
+
},
|
|
394
|
+
__wbindgen_init_externref_table: function() {
|
|
395
|
+
const table = wasm.__wbindgen_externrefs;
|
|
396
|
+
const offset = table.grow(4);
|
|
397
|
+
table.set(0, undefined);
|
|
398
|
+
table.set(offset + 0, undefined);
|
|
399
|
+
table.set(offset + 1, null);
|
|
400
|
+
table.set(offset + 2, true);
|
|
401
|
+
table.set(offset + 3, false);
|
|
402
|
+
},
|
|
403
|
+
};
|
|
404
|
+
return {
|
|
405
|
+
__proto__: null,
|
|
406
|
+
"./e3_wasm_bg.js": import0,
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function addToExternrefTable0(obj) {
|
|
411
|
+
const idx = wasm.__externref_table_alloc();
|
|
412
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
413
|
+
return idx;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
417
|
+
ptr = ptr >>> 0;
|
|
418
|
+
const mem = getDataViewMemory0();
|
|
419
|
+
const result = [];
|
|
420
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
421
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
422
|
+
}
|
|
423
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
424
|
+
return result;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
428
|
+
ptr = ptr >>> 0;
|
|
429
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
let cachedBigUint64ArrayMemory0 = null;
|
|
433
|
+
function getBigUint64ArrayMemory0() {
|
|
434
|
+
if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
|
|
435
|
+
cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
|
|
436
|
+
}
|
|
437
|
+
return cachedBigUint64ArrayMemory0;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
let cachedDataViewMemory0 = null;
|
|
441
|
+
function getDataViewMemory0() {
|
|
442
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
443
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
444
|
+
}
|
|
445
|
+
return cachedDataViewMemory0;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function getStringFromWasm0(ptr, len) {
|
|
449
|
+
ptr = ptr >>> 0;
|
|
450
|
+
return decodeText(ptr, len);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
let cachedUint8ArrayMemory0 = null;
|
|
454
|
+
function getUint8ArrayMemory0() {
|
|
455
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
456
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
457
|
+
}
|
|
458
|
+
return cachedUint8ArrayMemory0;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
function handleError(f, args) {
|
|
462
|
+
try {
|
|
463
|
+
return f.apply(this, args);
|
|
464
|
+
} catch (e) {
|
|
465
|
+
const idx = addToExternrefTable0(e);
|
|
466
|
+
wasm.__wbindgen_exn_store(idx);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function isLikeNone(x) {
|
|
471
|
+
return x === undefined || x === null;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
function passArray64ToWasm0(arg, malloc) {
|
|
475
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
476
|
+
getBigUint64ArrayMemory0().set(arg, ptr / 8);
|
|
477
|
+
WASM_VECTOR_LEN = arg.length;
|
|
478
|
+
return ptr;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
482
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
483
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
484
|
+
WASM_VECTOR_LEN = arg.length;
|
|
485
|
+
return ptr;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
489
|
+
if (realloc === undefined) {
|
|
490
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
491
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
492
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
493
|
+
WASM_VECTOR_LEN = buf.length;
|
|
494
|
+
return ptr;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
let len = arg.length;
|
|
498
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
499
|
+
|
|
500
|
+
const mem = getUint8ArrayMemory0();
|
|
501
|
+
|
|
502
|
+
let offset = 0;
|
|
503
|
+
|
|
504
|
+
for (; offset < len; offset++) {
|
|
505
|
+
const code = arg.charCodeAt(offset);
|
|
506
|
+
if (code > 0x7F) break;
|
|
507
|
+
mem[ptr + offset] = code;
|
|
508
|
+
}
|
|
509
|
+
if (offset !== len) {
|
|
510
|
+
if (offset !== 0) {
|
|
511
|
+
arg = arg.slice(offset);
|
|
512
|
+
}
|
|
513
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
514
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
515
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
516
|
+
|
|
517
|
+
offset += ret.written;
|
|
518
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
WASM_VECTOR_LEN = offset;
|
|
522
|
+
return ptr;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function takeFromExternrefTable0(idx) {
|
|
526
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
527
|
+
wasm.__externref_table_dealloc(idx);
|
|
528
|
+
return value;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
532
|
+
cachedTextDecoder.decode();
|
|
533
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
534
|
+
let numBytesDecoded = 0;
|
|
535
|
+
function decodeText(ptr, len) {
|
|
536
|
+
numBytesDecoded += len;
|
|
537
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
538
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
539
|
+
cachedTextDecoder.decode();
|
|
540
|
+
numBytesDecoded = len;
|
|
541
|
+
}
|
|
542
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
const cachedTextEncoder = new TextEncoder();
|
|
546
|
+
|
|
547
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
548
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
549
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
550
|
+
view.set(buf);
|
|
551
|
+
return {
|
|
552
|
+
read: arg.length,
|
|
553
|
+
written: buf.length
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
let WASM_VECTOR_LEN = 0;
|
|
559
|
+
|
|
560
|
+
let wasmModule, wasm;
|
|
561
|
+
function __wbg_finalize_init(instance, module) {
|
|
562
|
+
wasm = instance.exports;
|
|
563
|
+
wasmModule = module;
|
|
564
|
+
cachedBigUint64ArrayMemory0 = null;
|
|
565
|
+
cachedDataViewMemory0 = null;
|
|
566
|
+
cachedUint8ArrayMemory0 = null;
|
|
567
|
+
wasm.__wbindgen_start();
|
|
568
|
+
return wasm;
|
|
569
|
+
}
|
|
369
570
|
|
|
370
571
|
async function __wbg_load(module, imports) {
|
|
371
572
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
372
573
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
373
574
|
try {
|
|
374
575
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
375
|
-
|
|
376
576
|
} catch (e) {
|
|
377
|
-
const validResponse = module.ok &&
|
|
577
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
378
578
|
|
|
379
579
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
380
580
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
381
581
|
|
|
382
|
-
} else {
|
|
383
|
-
throw e;
|
|
384
|
-
}
|
|
582
|
+
} else { throw e; }
|
|
385
583
|
}
|
|
386
584
|
}
|
|
387
585
|
|
|
388
586
|
const bytes = await module.arrayBuffer();
|
|
389
587
|
return await WebAssembly.instantiate(bytes, imports);
|
|
390
|
-
|
|
391
588
|
} else {
|
|
392
589
|
const instance = await WebAssembly.instantiate(module, imports);
|
|
393
590
|
|
|
394
591
|
if (instance instanceof WebAssembly.Instance) {
|
|
395
592
|
return { instance, module };
|
|
396
|
-
|
|
397
593
|
} else {
|
|
398
594
|
return instance;
|
|
399
595
|
}
|
|
400
596
|
}
|
|
401
|
-
}
|
|
402
597
|
|
|
403
|
-
function
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
};
|
|
410
|
-
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
|
411
|
-
const ret = String(arg1);
|
|
412
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
413
|
-
const len1 = WASM_VECTOR_LEN;
|
|
414
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
415
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
416
|
-
};
|
|
417
|
-
imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
|
|
418
|
-
const ret = typeof(arg0) === 'function';
|
|
419
|
-
return ret;
|
|
420
|
-
};
|
|
421
|
-
imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
|
|
422
|
-
const val = arg0;
|
|
423
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
424
|
-
return ret;
|
|
425
|
-
};
|
|
426
|
-
imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
|
|
427
|
-
const ret = typeof(arg0) === 'string';
|
|
428
|
-
return ret;
|
|
429
|
-
};
|
|
430
|
-
imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
|
|
431
|
-
const ret = arg0 === undefined;
|
|
432
|
-
return ret;
|
|
433
|
-
};
|
|
434
|
-
imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
|
|
435
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
436
|
-
};
|
|
437
|
-
imports.wbg.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
|
|
438
|
-
const ret = arg0.call(arg1, arg2);
|
|
439
|
-
return ret;
|
|
440
|
-
}, arguments) };
|
|
441
|
-
imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
|
|
442
|
-
const ret = arg0.call(arg1);
|
|
443
|
-
return ret;
|
|
444
|
-
}, arguments) };
|
|
445
|
-
imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
|
|
446
|
-
const ret = arg0.crypto;
|
|
447
|
-
return ret;
|
|
448
|
-
};
|
|
449
|
-
imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
|
|
450
|
-
arg0.getRandomValues(arg1);
|
|
451
|
-
}, arguments) };
|
|
452
|
-
imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
|
|
453
|
-
const ret = arg0.length;
|
|
454
|
-
return ret;
|
|
455
|
-
};
|
|
456
|
-
imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
|
|
457
|
-
const ret = arg0.msCrypto;
|
|
458
|
-
return ret;
|
|
459
|
-
};
|
|
460
|
-
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
461
|
-
const ret = new Object();
|
|
462
|
-
return ret;
|
|
463
|
-
};
|
|
464
|
-
imports.wbg.__wbg_new_e17d9f43105b08be = function() {
|
|
465
|
-
const ret = new Array();
|
|
466
|
-
return ret;
|
|
467
|
-
};
|
|
468
|
-
imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
|
|
469
|
-
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
470
|
-
return ret;
|
|
471
|
-
};
|
|
472
|
-
imports.wbg.__wbg_new_with_length_01aa0dc35aa13543 = function(arg0) {
|
|
473
|
-
const ret = new Uint8Array(arg0 >>> 0);
|
|
474
|
-
return ret;
|
|
475
|
-
};
|
|
476
|
-
imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
|
|
477
|
-
const ret = arg0.node;
|
|
478
|
-
return ret;
|
|
479
|
-
};
|
|
480
|
-
imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
|
|
481
|
-
const ret = arg0.process;
|
|
482
|
-
return ret;
|
|
483
|
-
};
|
|
484
|
-
imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
|
|
485
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
486
|
-
};
|
|
487
|
-
imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
|
|
488
|
-
arg0.randomFillSync(arg1);
|
|
489
|
-
}, arguments) };
|
|
490
|
-
imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
|
|
491
|
-
const ret = module.require;
|
|
492
|
-
return ret;
|
|
493
|
-
}, arguments) };
|
|
494
|
-
imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
495
|
-
arg0[arg1] = arg2;
|
|
496
|
-
};
|
|
497
|
-
imports.wbg.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
|
|
498
|
-
arg0[arg1 >>> 0] = arg2;
|
|
499
|
-
};
|
|
500
|
-
imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
|
|
501
|
-
const ret = typeof global === 'undefined' ? null : global;
|
|
502
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
503
|
-
};
|
|
504
|
-
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
|
|
505
|
-
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
506
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
507
|
-
};
|
|
508
|
-
imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
|
|
509
|
-
const ret = typeof self === 'undefined' ? null : self;
|
|
510
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
511
|
-
};
|
|
512
|
-
imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
|
|
513
|
-
const ret = typeof window === 'undefined' ? null : window;
|
|
514
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
515
|
-
};
|
|
516
|
-
imports.wbg.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
|
|
517
|
-
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
518
|
-
return ret;
|
|
519
|
-
};
|
|
520
|
-
imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
|
|
521
|
-
const ret = arg0.versions;
|
|
522
|
-
return ret;
|
|
523
|
-
};
|
|
524
|
-
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
525
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
526
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
527
|
-
return ret;
|
|
528
|
-
};
|
|
529
|
-
imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
|
|
530
|
-
// Cast intrinsic for `U64 -> Externref`.
|
|
531
|
-
const ret = BigInt.asUintN(64, arg0);
|
|
532
|
-
return ret;
|
|
533
|
-
};
|
|
534
|
-
imports.wbg.__wbindgen_cast_77bc3e92745e9a35 = function(arg0, arg1) {
|
|
535
|
-
var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
|
|
536
|
-
wasm.__wbindgen_free(arg0, arg1 * 1, 1);
|
|
537
|
-
// Cast intrinsic for `Vector(U8) -> Externref`.
|
|
538
|
-
const ret = v0;
|
|
539
|
-
return ret;
|
|
540
|
-
};
|
|
541
|
-
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
542
|
-
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
543
|
-
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
544
|
-
return ret;
|
|
545
|
-
};
|
|
546
|
-
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
547
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
548
|
-
const ret = arg0;
|
|
549
|
-
return ret;
|
|
550
|
-
};
|
|
551
|
-
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
552
|
-
const table = wasm.__wbindgen_externrefs;
|
|
553
|
-
const offset = table.grow(4);
|
|
554
|
-
table.set(0, undefined);
|
|
555
|
-
table.set(offset + 0, undefined);
|
|
556
|
-
table.set(offset + 1, null);
|
|
557
|
-
table.set(offset + 2, true);
|
|
558
|
-
table.set(offset + 3, false);
|
|
559
|
-
;
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
return imports;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
function __wbg_finalize_init(instance, module) {
|
|
566
|
-
wasm = instance.exports;
|
|
567
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
|
568
|
-
cachedBigUint64ArrayMemory0 = null;
|
|
569
|
-
cachedDataViewMemory0 = null;
|
|
570
|
-
cachedUint8ArrayMemory0 = null;
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
wasm.__wbindgen_start();
|
|
574
|
-
return wasm;
|
|
598
|
+
function expectedResponseType(type) {
|
|
599
|
+
switch (type) {
|
|
600
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
601
|
+
}
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
575
604
|
}
|
|
576
605
|
|
|
577
606
|
function initSync(module) {
|
|
578
607
|
if (wasm !== undefined) return wasm;
|
|
579
608
|
|
|
580
609
|
|
|
581
|
-
if (
|
|
610
|
+
if (module !== undefined) {
|
|
582
611
|
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
583
612
|
({module} = module)
|
|
584
613
|
} else {
|
|
@@ -587,13 +616,10 @@ function initSync(module) {
|
|
|
587
616
|
}
|
|
588
617
|
|
|
589
618
|
const imports = __wbg_get_imports();
|
|
590
|
-
|
|
591
619
|
if (!(module instanceof WebAssembly.Module)) {
|
|
592
620
|
module = new WebAssembly.Module(module);
|
|
593
621
|
}
|
|
594
|
-
|
|
595
622
|
const instance = new WebAssembly.Instance(module, imports);
|
|
596
|
-
|
|
597
623
|
return __wbg_finalize_init(instance, module);
|
|
598
624
|
}
|
|
599
625
|
|
|
@@ -601,7 +627,7 @@ async function __wbg_init(module_or_path) {
|
|
|
601
627
|
if (wasm !== undefined) return wasm;
|
|
602
628
|
|
|
603
629
|
|
|
604
|
-
if (
|
|
630
|
+
if (module_or_path !== undefined) {
|
|
605
631
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
606
632
|
({module_or_path} = module_or_path)
|
|
607
633
|
} else {
|
|
@@ -609,7 +635,7 @@ async function __wbg_init(module_or_path) {
|
|
|
609
635
|
}
|
|
610
636
|
}
|
|
611
637
|
|
|
612
|
-
if (
|
|
638
|
+
if (module_or_path === undefined) {
|
|
613
639
|
/* wasm URL disabled: load via @enclave-e3/wasm/init */
|
|
614
640
|
}
|
|
615
641
|
const imports = __wbg_get_imports();
|
|
@@ -623,5 +649,4 @@ async function __wbg_init(module_or_path) {
|
|
|
623
649
|
return __wbg_finalize_init(instance, module);
|
|
624
650
|
}
|
|
625
651
|
|
|
626
|
-
export { initSync };
|
|
627
|
-
export default __wbg_init;
|
|
652
|
+
export { initSync, __wbg_init as default };
|