@vollcrypt/files-wasm 0.9.0 → 0.9.1
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/CHANGELOG.md +49 -0
- package/LICENSE +16 -0
- package/LICENSE-COMMERCIAL.md +71 -0
- package/LICENSE-GPL +674 -0
- package/README.md +891 -0
- package/package.json +17 -2
- package/pkg/LICENSE +16 -0
- package/pkg/LICENSE-COMMERCIAL.md +71 -0
- package/pkg/LICENSE-GPL +674 -0
- package/pkg/README.md +891 -0
- package/pkg/vollcrypt_files_wasm.d.ts +275 -0
- package/pkg/vollcrypt_files_wasm.js +2000 -0
- package/pkg/vollcrypt_files_wasm_bg.wasm +0 -0
- package/pkg/vollcrypt_files_wasm_bg.wasm.d.ts +99 -0
|
@@ -0,0 +1,2000 @@
|
|
|
1
|
+
/* @ts-self-types="./vollcrypt_files_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
export class GroupManifest {
|
|
4
|
+
static __wrap(ptr) {
|
|
5
|
+
const obj = Object.create(GroupManifest.prototype);
|
|
6
|
+
obj.__wbg_ptr = ptr;
|
|
7
|
+
GroupManifestFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
8
|
+
return obj;
|
|
9
|
+
}
|
|
10
|
+
__destroy_into_raw() {
|
|
11
|
+
const ptr = this.__wbg_ptr;
|
|
12
|
+
this.__wbg_ptr = 0;
|
|
13
|
+
GroupManifestFinalization.unregister(this);
|
|
14
|
+
return ptr;
|
|
15
|
+
}
|
|
16
|
+
free() {
|
|
17
|
+
const ptr = this.__destroy_into_raw();
|
|
18
|
+
wasm.__wbg_groupmanifest_free(ptr, 0);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @param {Uint8Array} new_member_id
|
|
22
|
+
* @param {any} new_member_pk
|
|
23
|
+
* @param {Uint8Array} current_gk
|
|
24
|
+
* @param {Uint8Array} _admin_pk
|
|
25
|
+
* @param {Uint8Array} admin_sk
|
|
26
|
+
* @param {number} _timestamp
|
|
27
|
+
*/
|
|
28
|
+
addMember(new_member_id, new_member_pk, current_gk, _admin_pk, admin_sk, _timestamp) {
|
|
29
|
+
const ptr0 = passArray8ToWasm0(new_member_id, wasm.__wbindgen_malloc);
|
|
30
|
+
const len0 = WASM_VECTOR_LEN;
|
|
31
|
+
const ptr1 = passArray8ToWasm0(current_gk, wasm.__wbindgen_malloc);
|
|
32
|
+
const len1 = WASM_VECTOR_LEN;
|
|
33
|
+
const ptr2 = passArray8ToWasm0(_admin_pk, wasm.__wbindgen_malloc);
|
|
34
|
+
const len2 = WASM_VECTOR_LEN;
|
|
35
|
+
const ptr3 = passArray8ToWasm0(admin_sk, wasm.__wbindgen_malloc);
|
|
36
|
+
const len3 = WASM_VECTOR_LEN;
|
|
37
|
+
const ret = wasm.groupmanifest_addMember(this.__wbg_ptr, ptr0, len0, new_member_pk, ptr1, len1, ptr2, len2, ptr3, len3, _timestamp);
|
|
38
|
+
if (ret[1]) {
|
|
39
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @returns {number}
|
|
44
|
+
*/
|
|
45
|
+
currentGkVersion() {
|
|
46
|
+
const ret = wasm.groupmanifest_currentGkVersion(this.__wbg_ptr);
|
|
47
|
+
return ret >>> 0;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @returns {any}
|
|
51
|
+
*/
|
|
52
|
+
currentMembers() {
|
|
53
|
+
const ret = wasm.groupmanifest_currentMembers(this.__wbg_ptr);
|
|
54
|
+
if (ret[2]) {
|
|
55
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
56
|
+
}
|
|
57
|
+
return takeFromExternrefTable0(ret[0]);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @param {Uint8Array} member_id
|
|
61
|
+
* @returns {any}
|
|
62
|
+
*/
|
|
63
|
+
findMemberWrap(member_id) {
|
|
64
|
+
const ptr0 = passArray8ToWasm0(member_id, wasm.__wbindgen_malloc);
|
|
65
|
+
const len0 = WASM_VECTOR_LEN;
|
|
66
|
+
const ret = wasm.groupmanifest_findMemberWrap(this.__wbg_ptr, ptr0, len0);
|
|
67
|
+
if (ret[2]) {
|
|
68
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
69
|
+
}
|
|
70
|
+
return takeFromExternrefTable0(ret[0]);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @param {Uint8Array} member_id
|
|
74
|
+
* @param {number} gk_version
|
|
75
|
+
* @returns {any}
|
|
76
|
+
*/
|
|
77
|
+
findMemberWrapForVersion(member_id, gk_version) {
|
|
78
|
+
const ptr0 = passArray8ToWasm0(member_id, wasm.__wbindgen_malloc);
|
|
79
|
+
const len0 = WASM_VECTOR_LEN;
|
|
80
|
+
const ret = wasm.groupmanifest_findMemberWrapForVersion(this.__wbg_ptr, ptr0, len0, gk_version);
|
|
81
|
+
if (ret[2]) {
|
|
82
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
83
|
+
}
|
|
84
|
+
return takeFromExternrefTable0(ret[0]);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @param {Uint8Array} group_id
|
|
88
|
+
* @param {Uint8Array} initial_gk
|
|
89
|
+
* @param {Uint8Array} founder_member_id
|
|
90
|
+
* @param {any} founder_recipient_pk
|
|
91
|
+
* @param {Uint8Array} founder_ed25519_pk
|
|
92
|
+
* @param {Uint8Array} founder_ed25519_sk
|
|
93
|
+
* @param {number} _timestamp
|
|
94
|
+
* @returns {GroupManifest}
|
|
95
|
+
*/
|
|
96
|
+
static genesis(group_id, initial_gk, founder_member_id, founder_recipient_pk, founder_ed25519_pk, founder_ed25519_sk, _timestamp) {
|
|
97
|
+
const ptr0 = passArray8ToWasm0(group_id, wasm.__wbindgen_malloc);
|
|
98
|
+
const len0 = WASM_VECTOR_LEN;
|
|
99
|
+
const ptr1 = passArray8ToWasm0(initial_gk, wasm.__wbindgen_malloc);
|
|
100
|
+
const len1 = WASM_VECTOR_LEN;
|
|
101
|
+
const ptr2 = passArray8ToWasm0(founder_member_id, wasm.__wbindgen_malloc);
|
|
102
|
+
const len2 = WASM_VECTOR_LEN;
|
|
103
|
+
const ptr3 = passArray8ToWasm0(founder_ed25519_pk, wasm.__wbindgen_malloc);
|
|
104
|
+
const len3 = WASM_VECTOR_LEN;
|
|
105
|
+
const ptr4 = passArray8ToWasm0(founder_ed25519_sk, wasm.__wbindgen_malloc);
|
|
106
|
+
const len4 = WASM_VECTOR_LEN;
|
|
107
|
+
const ret = wasm.groupmanifest_genesis(ptr0, len0, ptr1, len1, ptr2, len2, founder_recipient_pk, ptr3, len3, ptr4, len4, _timestamp);
|
|
108
|
+
if (ret[2]) {
|
|
109
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
110
|
+
}
|
|
111
|
+
return GroupManifest.__wrap(ret[0]);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @param {number} gk_version
|
|
115
|
+
* @returns {boolean}
|
|
116
|
+
*/
|
|
117
|
+
isVersionShredded(gk_version) {
|
|
118
|
+
const ret = wasm.groupmanifest_isVersionShredded(this.__wbg_ptr, gk_version);
|
|
119
|
+
return ret !== 0;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @param {Uint8Array} bytes
|
|
123
|
+
* @returns {GroupManifest}
|
|
124
|
+
*/
|
|
125
|
+
static parse(bytes) {
|
|
126
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
127
|
+
const len0 = WASM_VECTOR_LEN;
|
|
128
|
+
const ret = wasm.groupmanifest_parse(ptr0, len0);
|
|
129
|
+
if (ret[2]) {
|
|
130
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
131
|
+
}
|
|
132
|
+
return GroupManifest.__wrap(ret[0]);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @param {Uint8Array} removed_member_id
|
|
136
|
+
* @param {Uint8Array} _admin_pk
|
|
137
|
+
* @param {Uint8Array} admin_sk
|
|
138
|
+
* @param {number} _timestamp
|
|
139
|
+
*/
|
|
140
|
+
removeMember(removed_member_id, _admin_pk, admin_sk, _timestamp) {
|
|
141
|
+
const ptr0 = passArray8ToWasm0(removed_member_id, wasm.__wbindgen_malloc);
|
|
142
|
+
const len0 = WASM_VECTOR_LEN;
|
|
143
|
+
const ptr1 = passArray8ToWasm0(_admin_pk, wasm.__wbindgen_malloc);
|
|
144
|
+
const len1 = WASM_VECTOR_LEN;
|
|
145
|
+
const ptr2 = passArray8ToWasm0(admin_sk, wasm.__wbindgen_malloc);
|
|
146
|
+
const len2 = WASM_VECTOR_LEN;
|
|
147
|
+
const ret = wasm.groupmanifest_removeMember(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, _timestamp);
|
|
148
|
+
if (ret[1]) {
|
|
149
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* @param {Uint8Array} new_gk
|
|
154
|
+
* @param {Uint8Array} _admin_pk
|
|
155
|
+
* @param {Uint8Array} admin_sk
|
|
156
|
+
* @param {number} timestamp
|
|
157
|
+
* @returns {number}
|
|
158
|
+
*/
|
|
159
|
+
rotateGroupKey(new_gk, _admin_pk, admin_sk, timestamp) {
|
|
160
|
+
const ptr0 = passArray8ToWasm0(new_gk, wasm.__wbindgen_malloc);
|
|
161
|
+
const len0 = WASM_VECTOR_LEN;
|
|
162
|
+
const ptr1 = passArray8ToWasm0(_admin_pk, wasm.__wbindgen_malloc);
|
|
163
|
+
const len1 = WASM_VECTOR_LEN;
|
|
164
|
+
const ptr2 = passArray8ToWasm0(admin_sk, wasm.__wbindgen_malloc);
|
|
165
|
+
const len2 = WASM_VECTOR_LEN;
|
|
166
|
+
const ret = wasm.groupmanifest_rotateGroupKey(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, timestamp);
|
|
167
|
+
if (ret[2]) {
|
|
168
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
169
|
+
}
|
|
170
|
+
return ret[0] >>> 0;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* @param {number} version_to_shred
|
|
174
|
+
* @param {string} reason
|
|
175
|
+
* @param {Uint8Array} _admin_pk
|
|
176
|
+
* @param {Uint8Array} admin_sk
|
|
177
|
+
* @param {number} timestamp
|
|
178
|
+
*/
|
|
179
|
+
shredGroupKey(version_to_shred, reason, _admin_pk, admin_sk, timestamp) {
|
|
180
|
+
const ptr0 = passStringToWasm0(reason, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
181
|
+
const len0 = WASM_VECTOR_LEN;
|
|
182
|
+
const ptr1 = passArray8ToWasm0(_admin_pk, wasm.__wbindgen_malloc);
|
|
183
|
+
const len1 = WASM_VECTOR_LEN;
|
|
184
|
+
const ptr2 = passArray8ToWasm0(admin_sk, wasm.__wbindgen_malloc);
|
|
185
|
+
const len2 = WASM_VECTOR_LEN;
|
|
186
|
+
const ret = wasm.groupmanifest_shredGroupKey(this.__wbg_ptr, version_to_shred, ptr0, len0, ptr1, len1, ptr2, len2, timestamp);
|
|
187
|
+
if (ret[1]) {
|
|
188
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
verify() {
|
|
192
|
+
const ret = wasm.groupmanifest_verify(this.__wbg_ptr);
|
|
193
|
+
if (ret[1]) {
|
|
194
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* @returns {Uint8Array}
|
|
199
|
+
*/
|
|
200
|
+
write() {
|
|
201
|
+
const ret = wasm.groupmanifest_write(this.__wbg_ptr);
|
|
202
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
203
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
204
|
+
return v1;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (Symbol.dispose) GroupManifest.prototype[Symbol.dispose] = GroupManifest.prototype.free;
|
|
208
|
+
|
|
209
|
+
export class HeaderClass {
|
|
210
|
+
__destroy_into_raw() {
|
|
211
|
+
const ptr = this.__wbg_ptr;
|
|
212
|
+
this.__wbg_ptr = 0;
|
|
213
|
+
HeaderClassFinalization.unregister(this);
|
|
214
|
+
return ptr;
|
|
215
|
+
}
|
|
216
|
+
free() {
|
|
217
|
+
const ptr = this.__destroy_into_raw();
|
|
218
|
+
wasm.__wbg_headerclass_free(ptr, 0);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @param {Uint8Array} bytes
|
|
222
|
+
* @returns {any}
|
|
223
|
+
*/
|
|
224
|
+
static parse(bytes) {
|
|
225
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
226
|
+
const len0 = WASM_VECTOR_LEN;
|
|
227
|
+
const ret = wasm.headerclass_parse(ptr0, len0);
|
|
228
|
+
if (ret[2]) {
|
|
229
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
230
|
+
}
|
|
231
|
+
return takeFromExternrefTable0(ret[0]);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* @param {any} header
|
|
235
|
+
* @returns {Uint8Array}
|
|
236
|
+
*/
|
|
237
|
+
static write(header) {
|
|
238
|
+
const ret = wasm.headerclass_write(header);
|
|
239
|
+
if (ret[3]) {
|
|
240
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
241
|
+
}
|
|
242
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
243
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
244
|
+
return v1;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (Symbol.dispose) HeaderClass.prototype[Symbol.dispose] = HeaderClass.prototype.free;
|
|
248
|
+
|
|
249
|
+
export class KeyLog {
|
|
250
|
+
static __wrap(ptr) {
|
|
251
|
+
const obj = Object.create(KeyLog.prototype);
|
|
252
|
+
obj.__wbg_ptr = ptr;
|
|
253
|
+
KeyLogFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
254
|
+
return obj;
|
|
255
|
+
}
|
|
256
|
+
__destroy_into_raw() {
|
|
257
|
+
const ptr = this.__wbg_ptr;
|
|
258
|
+
this.__wbg_ptr = 0;
|
|
259
|
+
KeyLogFinalization.unregister(this);
|
|
260
|
+
return ptr;
|
|
261
|
+
}
|
|
262
|
+
free() {
|
|
263
|
+
const ptr = this.__destroy_into_raw();
|
|
264
|
+
wasm.__wbg_keylog_free(ptr, 0);
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* @param {Uint8Array} authority_pubkey
|
|
268
|
+
* @returns {KeyLog}
|
|
269
|
+
*/
|
|
270
|
+
static create(authority_pubkey) {
|
|
271
|
+
const ptr0 = passArray8ToWasm0(authority_pubkey, wasm.__wbindgen_malloc);
|
|
272
|
+
const len0 = WASM_VECTOR_LEN;
|
|
273
|
+
const ret = wasm.keylog_create(ptr0, len0);
|
|
274
|
+
if (ret[2]) {
|
|
275
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
276
|
+
}
|
|
277
|
+
return KeyLog.__wrap(ret[0]);
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* @param {Uint8Array} device_id
|
|
281
|
+
* @param {number} timestamp
|
|
282
|
+
* @returns {boolean}
|
|
283
|
+
*/
|
|
284
|
+
deviceWasActiveAt(device_id, timestamp) {
|
|
285
|
+
const ptr0 = passArray8ToWasm0(device_id, wasm.__wbindgen_malloc);
|
|
286
|
+
const len0 = WASM_VECTOR_LEN;
|
|
287
|
+
const ret = wasm.keylog_deviceWasActiveAt(this.__wbg_ptr, ptr0, len0, timestamp);
|
|
288
|
+
if (ret[2]) {
|
|
289
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
290
|
+
}
|
|
291
|
+
return ret[0] !== 0;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* @param {Uint8Array} hash
|
|
295
|
+
* @returns {any}
|
|
296
|
+
*/
|
|
297
|
+
lookupByEntryHash(hash) {
|
|
298
|
+
const ptr0 = passArray8ToWasm0(hash, wasm.__wbindgen_malloc);
|
|
299
|
+
const len0 = WASM_VECTOR_LEN;
|
|
300
|
+
const ret = wasm.keylog_lookupByEntryHash(this.__wbg_ptr, ptr0, len0);
|
|
301
|
+
if (ret[2]) {
|
|
302
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
303
|
+
}
|
|
304
|
+
return takeFromExternrefTable0(ret[0]);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* @param {Uint8Array} bytes
|
|
308
|
+
* @returns {KeyLog}
|
|
309
|
+
*/
|
|
310
|
+
static parse(bytes) {
|
|
311
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
312
|
+
const len0 = WASM_VECTOR_LEN;
|
|
313
|
+
const ret = wasm.keylog_parse(ptr0, len0);
|
|
314
|
+
if (ret[2]) {
|
|
315
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
316
|
+
}
|
|
317
|
+
return KeyLog.__wrap(ret[0]);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* @param {Uint8Array} user_id
|
|
321
|
+
* @param {Uint8Array} device_id
|
|
322
|
+
* @param {Uint8Array} device_pk
|
|
323
|
+
* @param {string} human_label
|
|
324
|
+
* @param {Uint8Array} authority_sk
|
|
325
|
+
* @param {number} timestamp
|
|
326
|
+
* @returns {Uint8Array}
|
|
327
|
+
*/
|
|
328
|
+
registerDevice(user_id, device_id, device_pk, human_label, authority_sk, timestamp) {
|
|
329
|
+
const ptr0 = passArray8ToWasm0(user_id, wasm.__wbindgen_malloc);
|
|
330
|
+
const len0 = WASM_VECTOR_LEN;
|
|
331
|
+
const ptr1 = passArray8ToWasm0(device_id, wasm.__wbindgen_malloc);
|
|
332
|
+
const len1 = WASM_VECTOR_LEN;
|
|
333
|
+
const ptr2 = passArray8ToWasm0(device_pk, wasm.__wbindgen_malloc);
|
|
334
|
+
const len2 = WASM_VECTOR_LEN;
|
|
335
|
+
const ptr3 = passStringToWasm0(human_label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
336
|
+
const len3 = WASM_VECTOR_LEN;
|
|
337
|
+
const ptr4 = passArray8ToWasm0(authority_sk, wasm.__wbindgen_malloc);
|
|
338
|
+
const len4 = WASM_VECTOR_LEN;
|
|
339
|
+
const ret = wasm.keylog_registerDevice(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, timestamp);
|
|
340
|
+
if (ret[3]) {
|
|
341
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
342
|
+
}
|
|
343
|
+
var v6 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
344
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
345
|
+
return v6;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* @param {Uint8Array} device_id
|
|
349
|
+
* @param {Uint8Array} authority_sk
|
|
350
|
+
* @param {number} timestamp
|
|
351
|
+
*/
|
|
352
|
+
revokeDevice(device_id, authority_sk, timestamp) {
|
|
353
|
+
const ptr0 = passArray8ToWasm0(device_id, wasm.__wbindgen_malloc);
|
|
354
|
+
const len0 = WASM_VECTOR_LEN;
|
|
355
|
+
const ptr1 = passArray8ToWasm0(authority_sk, wasm.__wbindgen_malloc);
|
|
356
|
+
const len1 = WASM_VECTOR_LEN;
|
|
357
|
+
const ret = wasm.keylog_revokeDevice(this.__wbg_ptr, ptr0, len0, ptr1, len1, timestamp);
|
|
358
|
+
if (ret[1]) {
|
|
359
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* @param {Uint8Array} device_id
|
|
364
|
+
* @returns {any}
|
|
365
|
+
*/
|
|
366
|
+
userForDevice(device_id) {
|
|
367
|
+
const ptr0 = passArray8ToWasm0(device_id, wasm.__wbindgen_malloc);
|
|
368
|
+
const len0 = WASM_VECTOR_LEN;
|
|
369
|
+
const ret = wasm.keylog_userForDevice(this.__wbg_ptr, ptr0, len0);
|
|
370
|
+
if (ret[2]) {
|
|
371
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
372
|
+
}
|
|
373
|
+
return takeFromExternrefTable0(ret[0]);
|
|
374
|
+
}
|
|
375
|
+
verify() {
|
|
376
|
+
const ret = wasm.keylog_verify(this.__wbg_ptr);
|
|
377
|
+
if (ret[1]) {
|
|
378
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* @returns {Uint8Array}
|
|
383
|
+
*/
|
|
384
|
+
write() {
|
|
385
|
+
const ret = wasm.keylog_write(this.__wbg_ptr);
|
|
386
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
387
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
388
|
+
return v1;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
if (Symbol.dispose) KeyLog.prototype[Symbol.dispose] = KeyLog.prototype.free;
|
|
392
|
+
|
|
393
|
+
export class WasmBufferPool {
|
|
394
|
+
__destroy_into_raw() {
|
|
395
|
+
const ptr = this.__wbg_ptr;
|
|
396
|
+
this.__wbg_ptr = 0;
|
|
397
|
+
WasmBufferPoolFinalization.unregister(this);
|
|
398
|
+
return ptr;
|
|
399
|
+
}
|
|
400
|
+
free() {
|
|
401
|
+
const ptr = this.__destroy_into_raw();
|
|
402
|
+
wasm.__wbg_wasmbufferpool_free(ptr, 0);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* @param {number} chunk_size
|
|
406
|
+
* @param {number} pool_size
|
|
407
|
+
*/
|
|
408
|
+
constructor(chunk_size, pool_size) {
|
|
409
|
+
const ret = wasm.wasmbufferpool_new(chunk_size, pool_size);
|
|
410
|
+
this.__wbg_ptr = ret;
|
|
411
|
+
WasmBufferPoolFinalization.register(this, this.__wbg_ptr, this);
|
|
412
|
+
return this;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* @returns {WasmPooledBuffer}
|
|
416
|
+
*/
|
|
417
|
+
rent() {
|
|
418
|
+
const ret = wasm.wasmbufferpool_rent(this.__wbg_ptr);
|
|
419
|
+
return WasmPooledBuffer.__wrap(ret);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* @param {WasmPooledBuffer} buffer
|
|
423
|
+
*/
|
|
424
|
+
returnBuffer(buffer) {
|
|
425
|
+
_assertClass(buffer, WasmPooledBuffer);
|
|
426
|
+
var ptr0 = buffer.__destroy_into_raw();
|
|
427
|
+
wasm.wasmbufferpool_returnBuffer(this.__wbg_ptr, ptr0);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
if (Symbol.dispose) WasmBufferPool.prototype[Symbol.dispose] = WasmBufferPool.prototype.free;
|
|
431
|
+
|
|
432
|
+
export class WasmPooledBuffer {
|
|
433
|
+
static __wrap(ptr) {
|
|
434
|
+
const obj = Object.create(WasmPooledBuffer.prototype);
|
|
435
|
+
obj.__wbg_ptr = ptr;
|
|
436
|
+
WasmPooledBufferFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
437
|
+
return obj;
|
|
438
|
+
}
|
|
439
|
+
__destroy_into_raw() {
|
|
440
|
+
const ptr = this.__wbg_ptr;
|
|
441
|
+
this.__wbg_ptr = 0;
|
|
442
|
+
WasmPooledBufferFinalization.unregister(this);
|
|
443
|
+
return ptr;
|
|
444
|
+
}
|
|
445
|
+
free() {
|
|
446
|
+
const ptr = this.__destroy_into_raw();
|
|
447
|
+
wasm.__wbg_wasmpooledbuffer_free(ptr, 0);
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* @returns {number}
|
|
451
|
+
*/
|
|
452
|
+
ciphertextPtr() {
|
|
453
|
+
const ret = wasm.wasmpooledbuffer_ciphertextPtr(this.__wbg_ptr);
|
|
454
|
+
return ret >>> 0;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* @returns {number}
|
|
458
|
+
*/
|
|
459
|
+
dataPtr() {
|
|
460
|
+
const ret = wasm.wasmpooledbuffer_dataPtr(this.__wbg_ptr);
|
|
461
|
+
return ret >>> 0;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* @param {number} len
|
|
465
|
+
* @returns {Uint8Array}
|
|
466
|
+
*/
|
|
467
|
+
getCiphertext(len) {
|
|
468
|
+
const ret = wasm.wasmpooledbuffer_getCiphertext(this.__wbg_ptr, len);
|
|
469
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
470
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
471
|
+
return v1;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* @param {number} len
|
|
475
|
+
* @returns {Uint8Array}
|
|
476
|
+
*/
|
|
477
|
+
getEnvelope(len) {
|
|
478
|
+
const ret = wasm.wasmpooledbuffer_getEnvelope(this.__wbg_ptr, len);
|
|
479
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
480
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
481
|
+
return v1;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* @returns {number}
|
|
485
|
+
*/
|
|
486
|
+
getIndex() {
|
|
487
|
+
const ret = wasm.wasmpooledbuffer_getIndex(this.__wbg_ptr);
|
|
488
|
+
return ret >>> 0;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* @returns {Uint8Array}
|
|
492
|
+
*/
|
|
493
|
+
getIv() {
|
|
494
|
+
const ret = wasm.wasmpooledbuffer_getIv(this.__wbg_ptr);
|
|
495
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
496
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
497
|
+
return v1;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* @param {number} len
|
|
501
|
+
* @returns {Uint8Array}
|
|
502
|
+
*/
|
|
503
|
+
getPlaintext(len) {
|
|
504
|
+
const ret = wasm.wasmpooledbuffer_getPlaintext(this.__wbg_ptr, len);
|
|
505
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
506
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
507
|
+
return v1;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* @param {number} chunk_size
|
|
511
|
+
*/
|
|
512
|
+
constructor(chunk_size) {
|
|
513
|
+
const ret = wasm.wasmpooledbuffer_new(chunk_size);
|
|
514
|
+
this.__wbg_ptr = ret;
|
|
515
|
+
WasmPooledBufferFinalization.register(this, this.__wbg_ptr, this);
|
|
516
|
+
return this;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* @returns {number}
|
|
520
|
+
*/
|
|
521
|
+
plaintextPtr() {
|
|
522
|
+
const ret = wasm.wasmpooledbuffer_plaintextPtr(this.__wbg_ptr);
|
|
523
|
+
return ret >>> 0;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* @param {number} index
|
|
527
|
+
*/
|
|
528
|
+
setIndex(index) {
|
|
529
|
+
wasm.wasmpooledbuffer_setIndex(this.__wbg_ptr, index);
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* @param {Uint8Array} iv
|
|
533
|
+
*/
|
|
534
|
+
setIv(iv) {
|
|
535
|
+
const ptr0 = passArray8ToWasm0(iv, wasm.__wbindgen_malloc);
|
|
536
|
+
const len0 = WASM_VECTOR_LEN;
|
|
537
|
+
wasm.wasmpooledbuffer_setIv(this.__wbg_ptr, ptr0, len0);
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* @param {number} len
|
|
541
|
+
* @returns {number}
|
|
542
|
+
*/
|
|
543
|
+
tagPtr(len) {
|
|
544
|
+
const ret = wasm.wasmpooledbuffer_tagPtr(this.__wbg_ptr, len);
|
|
545
|
+
return ret >>> 0;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
if (Symbol.dispose) WasmPooledBuffer.prototype[Symbol.dispose] = WasmPooledBuffer.prototype.free;
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* @param {any} envelope
|
|
552
|
+
* @returns {Uint8Array}
|
|
553
|
+
*/
|
|
554
|
+
export function chunkLeafHash(envelope) {
|
|
555
|
+
const ret = wasm.chunkLeafHash(envelope);
|
|
556
|
+
if (ret[3]) {
|
|
557
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
558
|
+
}
|
|
559
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
560
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
561
|
+
return v1;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* @param {Uint8Array} header_bytes
|
|
566
|
+
* @returns {Uint8Array}
|
|
567
|
+
*/
|
|
568
|
+
export function cryptoShredHeader(header_bytes) {
|
|
569
|
+
const ptr0 = passArray8ToWasm0(header_bytes, wasm.__wbindgen_malloc);
|
|
570
|
+
const len0 = WASM_VECTOR_LEN;
|
|
571
|
+
const ret = wasm.cryptoShredHeader(ptr0, len0);
|
|
572
|
+
if (ret[3]) {
|
|
573
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
574
|
+
}
|
|
575
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
576
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
577
|
+
return v2;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* @param {string} s
|
|
582
|
+
* @returns {any}
|
|
583
|
+
*/
|
|
584
|
+
export function decodeShare(s) {
|
|
585
|
+
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
586
|
+
const len0 = WASM_VECTOR_LEN;
|
|
587
|
+
const ret = wasm.decodeShare(ptr0, len0);
|
|
588
|
+
if (ret[2]) {
|
|
589
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
590
|
+
}
|
|
591
|
+
return takeFromExternrefTable0(ret[0]);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* @param {Uint8Array} dek
|
|
596
|
+
* @param {Uint8Array} file_id
|
|
597
|
+
* @param {number} chunk_index
|
|
598
|
+
* @param {any} envelope
|
|
599
|
+
* @returns {Uint8Array}
|
|
600
|
+
*/
|
|
601
|
+
export function decryptChunk(dek, file_id, chunk_index, envelope) {
|
|
602
|
+
const ptr0 = passArray8ToWasm0(dek, wasm.__wbindgen_malloc);
|
|
603
|
+
const len0 = WASM_VECTOR_LEN;
|
|
604
|
+
const ptr1 = passArray8ToWasm0(file_id, wasm.__wbindgen_malloc);
|
|
605
|
+
const len1 = WASM_VECTOR_LEN;
|
|
606
|
+
const ret = wasm.decryptChunk(ptr0, len0, ptr1, len1, chunk_index, envelope);
|
|
607
|
+
if (ret[3]) {
|
|
608
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
609
|
+
}
|
|
610
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
611
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
612
|
+
return v3;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* @param {Uint8Array} ciphertext
|
|
617
|
+
* @param {Uint8Array} dek
|
|
618
|
+
* @param {any} policy
|
|
619
|
+
* @returns {Promise<any>}
|
|
620
|
+
*/
|
|
621
|
+
export function decryptFilePipelinedAsync(ciphertext, dek, policy) {
|
|
622
|
+
const ptr0 = passArray8ToWasm0(ciphertext, wasm.__wbindgen_malloc);
|
|
623
|
+
const len0 = WASM_VECTOR_LEN;
|
|
624
|
+
const ptr1 = passArray8ToWasm0(dek, wasm.__wbindgen_malloc);
|
|
625
|
+
const len1 = WASM_VECTOR_LEN;
|
|
626
|
+
const ret = wasm.decryptFilePipelinedAsync(ptr0, len0, ptr1, len1, policy);
|
|
627
|
+
return ret;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* @returns {any}
|
|
632
|
+
*/
|
|
633
|
+
export function ed25519KeypairGenerate() {
|
|
634
|
+
const ret = wasm.ed25519KeypairGenerate();
|
|
635
|
+
if (ret[2]) {
|
|
636
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
637
|
+
}
|
|
638
|
+
return takeFromExternrefTable0(ret[0]);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* @param {Uint8Array} sk
|
|
643
|
+
* @param {Uint8Array} message
|
|
644
|
+
* @returns {Uint8Array}
|
|
645
|
+
*/
|
|
646
|
+
export function ed25519Sign(sk, message) {
|
|
647
|
+
const ptr0 = passArray8ToWasm0(sk, wasm.__wbindgen_malloc);
|
|
648
|
+
const len0 = WASM_VECTOR_LEN;
|
|
649
|
+
const ptr1 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
|
|
650
|
+
const len1 = WASM_VECTOR_LEN;
|
|
651
|
+
const ret = wasm.ed25519Sign(ptr0, len0, ptr1, len1);
|
|
652
|
+
if (ret[3]) {
|
|
653
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
654
|
+
}
|
|
655
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
656
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
657
|
+
return v3;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* @param {Uint8Array} pk
|
|
662
|
+
* @param {Uint8Array} message
|
|
663
|
+
* @param {Uint8Array} signature
|
|
664
|
+
* @returns {boolean}
|
|
665
|
+
*/
|
|
666
|
+
export function ed25519Verify(pk, message, signature) {
|
|
667
|
+
const ptr0 = passArray8ToWasm0(pk, wasm.__wbindgen_malloc);
|
|
668
|
+
const len0 = WASM_VECTOR_LEN;
|
|
669
|
+
const ptr1 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);
|
|
670
|
+
const len1 = WASM_VECTOR_LEN;
|
|
671
|
+
const ptr2 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
672
|
+
const len2 = WASM_VECTOR_LEN;
|
|
673
|
+
const ret = wasm.ed25519Verify(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
674
|
+
if (ret[2]) {
|
|
675
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
676
|
+
}
|
|
677
|
+
return ret[0] !== 0;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* @param {any} share
|
|
682
|
+
* @returns {string}
|
|
683
|
+
*/
|
|
684
|
+
export function encodeShare(share) {
|
|
685
|
+
let deferred2_0;
|
|
686
|
+
let deferred2_1;
|
|
687
|
+
try {
|
|
688
|
+
const ret = wasm.encodeShare(share);
|
|
689
|
+
var ptr1 = ret[0];
|
|
690
|
+
var len1 = ret[1];
|
|
691
|
+
if (ret[3]) {
|
|
692
|
+
ptr1 = 0; len1 = 0;
|
|
693
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
694
|
+
}
|
|
695
|
+
deferred2_0 = ptr1;
|
|
696
|
+
deferred2_1 = len1;
|
|
697
|
+
return getStringFromWasm0(ptr1, len1);
|
|
698
|
+
} finally {
|
|
699
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* @param {Uint8Array} dek
|
|
705
|
+
* @param {Uint8Array} file_id
|
|
706
|
+
* @param {number} chunk_index
|
|
707
|
+
* @param {Uint8Array} plaintext
|
|
708
|
+
* @returns {any}
|
|
709
|
+
*/
|
|
710
|
+
export function encryptChunk(dek, file_id, chunk_index, plaintext) {
|
|
711
|
+
const ptr0 = passArray8ToWasm0(dek, wasm.__wbindgen_malloc);
|
|
712
|
+
const len0 = WASM_VECTOR_LEN;
|
|
713
|
+
const ptr1 = passArray8ToWasm0(file_id, wasm.__wbindgen_malloc);
|
|
714
|
+
const len1 = WASM_VECTOR_LEN;
|
|
715
|
+
const ptr2 = passArray8ToWasm0(plaintext, wasm.__wbindgen_malloc);
|
|
716
|
+
const len2 = WASM_VECTOR_LEN;
|
|
717
|
+
const ret = wasm.encryptChunk(ptr0, len0, ptr1, len1, chunk_index, ptr2, len2);
|
|
718
|
+
if (ret[2]) {
|
|
719
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
720
|
+
}
|
|
721
|
+
return takeFromExternrefTable0(ret[0]);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* @param {Uint8Array} plaintext
|
|
726
|
+
* @param {Uint8Array} dek
|
|
727
|
+
* @param {Uint8Array} file_id
|
|
728
|
+
* @param {number} chunk_size
|
|
729
|
+
* @param {any} wraps
|
|
730
|
+
* @param {number} mode_val
|
|
731
|
+
* @param {any} sign_info_val
|
|
732
|
+
* @param {any} write_mode_val
|
|
733
|
+
* @returns {Promise<any>}
|
|
734
|
+
*/
|
|
735
|
+
export function encryptFilePipelinedAsync(plaintext, dek, file_id, chunk_size, wraps, mode_val, sign_info_val, write_mode_val) {
|
|
736
|
+
const ptr0 = passArray8ToWasm0(plaintext, wasm.__wbindgen_malloc);
|
|
737
|
+
const len0 = WASM_VECTOR_LEN;
|
|
738
|
+
const ptr1 = passArray8ToWasm0(dek, wasm.__wbindgen_malloc);
|
|
739
|
+
const len1 = WASM_VECTOR_LEN;
|
|
740
|
+
const ptr2 = passArray8ToWasm0(file_id, wasm.__wbindgen_malloc);
|
|
741
|
+
const len2 = WASM_VECTOR_LEN;
|
|
742
|
+
const ret = wasm.encryptFilePipelinedAsync(ptr0, len0, ptr1, len1, ptr2, len2, chunk_size, wraps, mode_val, sign_info_val, write_mode_val);
|
|
743
|
+
return ret;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* @returns {Uint8Array}
|
|
748
|
+
*/
|
|
749
|
+
export function generateDek() {
|
|
750
|
+
const ret = wasm.generateDek();
|
|
751
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
752
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
753
|
+
return v1;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* @returns {Uint8Array}
|
|
758
|
+
*/
|
|
759
|
+
export function generateFileId() {
|
|
760
|
+
const ret = wasm.generateFileId();
|
|
761
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
762
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
763
|
+
return v1;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* @returns {Uint8Array}
|
|
768
|
+
*/
|
|
769
|
+
export function generateGk() {
|
|
770
|
+
const ret = wasm.generateGk();
|
|
771
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
772
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
773
|
+
return v1;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* @returns {any}
|
|
778
|
+
*/
|
|
779
|
+
export function generateRecipientKeypair() {
|
|
780
|
+
const ret = wasm.generateRecipientKeypair();
|
|
781
|
+
if (ret[2]) {
|
|
782
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
783
|
+
}
|
|
784
|
+
return takeFromExternrefTable0(ret[0]);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* @returns {Uint8Array}
|
|
789
|
+
*/
|
|
790
|
+
export function generateSalt() {
|
|
791
|
+
const ret = wasm.generateSalt();
|
|
792
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
793
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
794
|
+
return v1;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* @param {number} ptr
|
|
799
|
+
* @param {number} len
|
|
800
|
+
* @returns {Uint8Array}
|
|
801
|
+
*/
|
|
802
|
+
export function getWasmMemoryView(ptr, len) {
|
|
803
|
+
const ret = wasm.getWasmMemoryView(ptr, len);
|
|
804
|
+
return ret;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* @returns {any}
|
|
809
|
+
*/
|
|
810
|
+
export function hybridKeypairGenerate() {
|
|
811
|
+
const ret = wasm.hybridKeypairGenerate();
|
|
812
|
+
if (ret[2]) {
|
|
813
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
814
|
+
}
|
|
815
|
+
return takeFromExternrefTable0(ret[0]);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* @param {Uint8Array} sk
|
|
820
|
+
* @param {Uint8Array} pk
|
|
821
|
+
* @param {string} domain
|
|
822
|
+
* @param {Uint8Array} context
|
|
823
|
+
* @param {Uint8Array} payload
|
|
824
|
+
* @returns {Uint8Array}
|
|
825
|
+
*/
|
|
826
|
+
export function hybridSign(sk, pk, domain, context, payload) {
|
|
827
|
+
const ptr0 = passArray8ToWasm0(sk, wasm.__wbindgen_malloc);
|
|
828
|
+
const len0 = WASM_VECTOR_LEN;
|
|
829
|
+
const ptr1 = passArray8ToWasm0(pk, wasm.__wbindgen_malloc);
|
|
830
|
+
const len1 = WASM_VECTOR_LEN;
|
|
831
|
+
const ptr2 = passStringToWasm0(domain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
832
|
+
const len2 = WASM_VECTOR_LEN;
|
|
833
|
+
const ptr3 = passArray8ToWasm0(context, wasm.__wbindgen_malloc);
|
|
834
|
+
const len3 = WASM_VECTOR_LEN;
|
|
835
|
+
const ptr4 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
|
|
836
|
+
const len4 = WASM_VECTOR_LEN;
|
|
837
|
+
const ret = wasm.hybridSign(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
838
|
+
if (ret[3]) {
|
|
839
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
840
|
+
}
|
|
841
|
+
var v6 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
842
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
843
|
+
return v6;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* @param {Uint8Array} pk
|
|
848
|
+
* @param {string} domain
|
|
849
|
+
* @param {Uint8Array} context
|
|
850
|
+
* @param {Uint8Array} payload
|
|
851
|
+
* @param {Uint8Array} signature
|
|
852
|
+
* @returns {boolean}
|
|
853
|
+
*/
|
|
854
|
+
export function hybridVerify(pk, domain, context, payload, signature) {
|
|
855
|
+
const ptr0 = passArray8ToWasm0(pk, wasm.__wbindgen_malloc);
|
|
856
|
+
const len0 = WASM_VECTOR_LEN;
|
|
857
|
+
const ptr1 = passStringToWasm0(domain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
858
|
+
const len1 = WASM_VECTOR_LEN;
|
|
859
|
+
const ptr2 = passArray8ToWasm0(context, wasm.__wbindgen_malloc);
|
|
860
|
+
const len2 = WASM_VECTOR_LEN;
|
|
861
|
+
const ptr3 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
|
|
862
|
+
const len3 = WASM_VECTOR_LEN;
|
|
863
|
+
const ptr4 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
864
|
+
const len4 = WASM_VECTOR_LEN;
|
|
865
|
+
const ret = wasm.hybridVerify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
866
|
+
if (ret[2]) {
|
|
867
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
868
|
+
}
|
|
869
|
+
return ret[0] !== 0;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* @param {Uint8Array} container_bytes
|
|
874
|
+
* @returns {any}
|
|
875
|
+
*/
|
|
876
|
+
export function inspectSealedContainer(container_bytes) {
|
|
877
|
+
const ptr0 = passArray8ToWasm0(container_bytes, wasm.__wbindgen_malloc);
|
|
878
|
+
const len0 = WASM_VECTOR_LEN;
|
|
879
|
+
const ret = wasm.inspectSealedContainer(ptr0, len0);
|
|
880
|
+
if (ret[2]) {
|
|
881
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
882
|
+
}
|
|
883
|
+
return takeFromExternrefTable0(ret[0]);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* @param {any} header_obj
|
|
888
|
+
* @returns {boolean}
|
|
889
|
+
*/
|
|
890
|
+
export function isSealed(header_obj) {
|
|
891
|
+
const ret = wasm.isSealed(header_obj);
|
|
892
|
+
if (ret[2]) {
|
|
893
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
894
|
+
}
|
|
895
|
+
return ret[0] !== 0;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* @param {any} leaves
|
|
900
|
+
* @param {number} leaf_index
|
|
901
|
+
* @returns {any}
|
|
902
|
+
*/
|
|
903
|
+
export function merkleProof(leaves, leaf_index) {
|
|
904
|
+
const ret = wasm.merkleProof(leaves, leaf_index);
|
|
905
|
+
if (ret[2]) {
|
|
906
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
907
|
+
}
|
|
908
|
+
return takeFromExternrefTable0(ret[0]);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* @param {any} leaves
|
|
913
|
+
* @returns {Uint8Array}
|
|
914
|
+
*/
|
|
915
|
+
export function merkleRoot(leaves) {
|
|
916
|
+
const ret = wasm.merkleRoot(leaves);
|
|
917
|
+
if (ret[3]) {
|
|
918
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
919
|
+
}
|
|
920
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
921
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
922
|
+
return v1;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* @param {any} header
|
|
927
|
+
* @param {KeyLog} key_log
|
|
928
|
+
* @param {Uint8Array | null} [sealed_gk]
|
|
929
|
+
* @returns {any}
|
|
930
|
+
*/
|
|
931
|
+
export function resolveSender(header, key_log, sealed_gk) {
|
|
932
|
+
_assertClass(key_log, KeyLog);
|
|
933
|
+
var ptr0 = isLikeNone(sealed_gk) ? 0 : passArray8ToWasm0(sealed_gk, wasm.__wbindgen_malloc);
|
|
934
|
+
var len0 = WASM_VECTOR_LEN;
|
|
935
|
+
const ret = wasm.resolveSender(header, key_log.__wbg_ptr, ptr0, len0);
|
|
936
|
+
if (ret[2]) {
|
|
937
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
938
|
+
}
|
|
939
|
+
return takeFromExternrefTable0(ret[0]);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* @param {Uint8Array} header_bytes
|
|
944
|
+
* @param {Uint8Array} old_gk
|
|
945
|
+
* @param {Uint8Array} new_gk
|
|
946
|
+
* @param {number} new_gk_version
|
|
947
|
+
* @returns {any}
|
|
948
|
+
*/
|
|
949
|
+
export function rewrapDekInHeader(header_bytes, old_gk, new_gk, new_gk_version) {
|
|
950
|
+
const ptr0 = passArray8ToWasm0(header_bytes, wasm.__wbindgen_malloc);
|
|
951
|
+
const len0 = WASM_VECTOR_LEN;
|
|
952
|
+
const ptr1 = passArray8ToWasm0(old_gk, wasm.__wbindgen_malloc);
|
|
953
|
+
const len1 = WASM_VECTOR_LEN;
|
|
954
|
+
const ptr2 = passArray8ToWasm0(new_gk, wasm.__wbindgen_malloc);
|
|
955
|
+
const len2 = WASM_VECTOR_LEN;
|
|
956
|
+
const ret = wasm.rewrapDekInHeader(ptr0, len0, ptr1, len1, ptr2, len2, new_gk_version);
|
|
957
|
+
if (ret[2]) {
|
|
958
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
959
|
+
}
|
|
960
|
+
return takeFromExternrefTable0(ret[0]);
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* @param {Uint8Array} container_bytes
|
|
965
|
+
* @param {any} options
|
|
966
|
+
* @returns {Uint8Array}
|
|
967
|
+
*/
|
|
968
|
+
export function sealContainer(container_bytes, options) {
|
|
969
|
+
const ptr0 = passArray8ToWasm0(container_bytes, wasm.__wbindgen_malloc);
|
|
970
|
+
const len0 = WASM_VECTOR_LEN;
|
|
971
|
+
const ret = wasm.sealContainer(ptr0, len0, options);
|
|
972
|
+
if (ret[3]) {
|
|
973
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
974
|
+
}
|
|
975
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
976
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
977
|
+
return v2;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* @param {any} header
|
|
982
|
+
* @param {Uint8Array} signer_pk
|
|
983
|
+
* @param {Uint8Array} signer_sk
|
|
984
|
+
* @param {Uint8Array} key_log_id
|
|
985
|
+
* @param {number} timestamp
|
|
986
|
+
* @returns {any}
|
|
987
|
+
*/
|
|
988
|
+
export function signHeaderPlain(header, signer_pk, signer_sk, key_log_id, timestamp) {
|
|
989
|
+
const ptr0 = passArray8ToWasm0(signer_pk, wasm.__wbindgen_malloc);
|
|
990
|
+
const len0 = WASM_VECTOR_LEN;
|
|
991
|
+
const ptr1 = passArray8ToWasm0(signer_sk, wasm.__wbindgen_malloc);
|
|
992
|
+
const len1 = WASM_VECTOR_LEN;
|
|
993
|
+
const ptr2 = passArray8ToWasm0(key_log_id, wasm.__wbindgen_malloc);
|
|
994
|
+
const len2 = WASM_VECTOR_LEN;
|
|
995
|
+
const ret = wasm.signHeaderPlain(header, ptr0, len0, ptr1, len1, ptr2, len2, timestamp);
|
|
996
|
+
if (ret[2]) {
|
|
997
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
998
|
+
}
|
|
999
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* @param {any} header
|
|
1004
|
+
* @param {Uint8Array} signer_pk
|
|
1005
|
+
* @param {Uint8Array} signer_sk
|
|
1006
|
+
* @param {Uint8Array} key_log_id
|
|
1007
|
+
* @param {number} timestamp
|
|
1008
|
+
* @param {Uint8Array} sealed_group_id
|
|
1009
|
+
* @param {number} sealed_gk_version
|
|
1010
|
+
* @param {Uint8Array} sealed_gk
|
|
1011
|
+
* @returns {any}
|
|
1012
|
+
*/
|
|
1013
|
+
export function signHeaderSealed(header, signer_pk, signer_sk, key_log_id, timestamp, sealed_group_id, sealed_gk_version, sealed_gk) {
|
|
1014
|
+
const ptr0 = passArray8ToWasm0(signer_pk, wasm.__wbindgen_malloc);
|
|
1015
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1016
|
+
const ptr1 = passArray8ToWasm0(signer_sk, wasm.__wbindgen_malloc);
|
|
1017
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1018
|
+
const ptr2 = passArray8ToWasm0(key_log_id, wasm.__wbindgen_malloc);
|
|
1019
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1020
|
+
const ptr3 = passArray8ToWasm0(sealed_group_id, wasm.__wbindgen_malloc);
|
|
1021
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1022
|
+
const ptr4 = passArray8ToWasm0(sealed_gk, wasm.__wbindgen_malloc);
|
|
1023
|
+
const len4 = WASM_VECTOR_LEN;
|
|
1024
|
+
const ret = wasm.signHeaderSealed(header, ptr0, len0, ptr1, len1, ptr2, len2, timestamp, ptr3, len3, sealed_gk_version, ptr4, len4);
|
|
1025
|
+
if (ret[2]) {
|
|
1026
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1027
|
+
}
|
|
1028
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* @param {any} wrap
|
|
1033
|
+
* @param {Uint8Array} gk
|
|
1034
|
+
* @returns {Uint8Array}
|
|
1035
|
+
*/
|
|
1036
|
+
export function unwrapDekWithGroupKey(wrap, gk) {
|
|
1037
|
+
const ptr0 = passArray8ToWasm0(gk, wasm.__wbindgen_malloc);
|
|
1038
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1039
|
+
const ret = wasm.unwrapDekWithGroupKey(wrap, ptr0, len0);
|
|
1040
|
+
if (ret[3]) {
|
|
1041
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1042
|
+
}
|
|
1043
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1044
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1045
|
+
return v2;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* @param {any} wrap
|
|
1050
|
+
* @param {string} password
|
|
1051
|
+
* @returns {Uint8Array}
|
|
1052
|
+
*/
|
|
1053
|
+
export function unwrapDekWithPassword(wrap, password) {
|
|
1054
|
+
const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1055
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1056
|
+
const ret = wasm.unwrapDekWithPassword(wrap, ptr0, len0);
|
|
1057
|
+
if (ret[3]) {
|
|
1058
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1059
|
+
}
|
|
1060
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1061
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1062
|
+
return v2;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
* @param {any} wrap
|
|
1067
|
+
* @param {Uint8Array} file_id
|
|
1068
|
+
* @param {any} shares
|
|
1069
|
+
* @param {number} cipher_suite_id
|
|
1070
|
+
* @returns {Uint8Array}
|
|
1071
|
+
*/
|
|
1072
|
+
export function unwrapDekWithThresholdShares(wrap, file_id, shares, cipher_suite_id) {
|
|
1073
|
+
const ptr0 = passArray8ToWasm0(file_id, wasm.__wbindgen_malloc);
|
|
1074
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1075
|
+
const ret = wasm.unwrapDekWithThresholdShares(wrap, ptr0, len0, shares, cipher_suite_id);
|
|
1076
|
+
if (ret[3]) {
|
|
1077
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1078
|
+
}
|
|
1079
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1080
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1081
|
+
return v2;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* @param {any} wrap
|
|
1086
|
+
* @param {any} recipient_sk
|
|
1087
|
+
* @returns {Uint8Array}
|
|
1088
|
+
*/
|
|
1089
|
+
export function unwrapKeyWithRecipientKey(wrap, recipient_sk) {
|
|
1090
|
+
const ret = wasm.unwrapKeyWithRecipientKey(wrap, recipient_sk);
|
|
1091
|
+
if (ret[3]) {
|
|
1092
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1093
|
+
}
|
|
1094
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1095
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1096
|
+
return v1;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* @param {Uint8Array} container_bytes
|
|
1101
|
+
* @param {any} policy
|
|
1102
|
+
* @returns {string}
|
|
1103
|
+
*/
|
|
1104
|
+
export function verifyContainer(container_bytes, policy) {
|
|
1105
|
+
let deferred3_0;
|
|
1106
|
+
let deferred3_1;
|
|
1107
|
+
try {
|
|
1108
|
+
const ptr0 = passArray8ToWasm0(container_bytes, wasm.__wbindgen_malloc);
|
|
1109
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1110
|
+
const ret = wasm.verifyContainer(ptr0, len0, policy);
|
|
1111
|
+
var ptr2 = ret[0];
|
|
1112
|
+
var len2 = ret[1];
|
|
1113
|
+
if (ret[3]) {
|
|
1114
|
+
ptr2 = 0; len2 = 0;
|
|
1115
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1116
|
+
}
|
|
1117
|
+
deferred3_0 = ptr2;
|
|
1118
|
+
deferred3_1 = len2;
|
|
1119
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1120
|
+
} finally {
|
|
1121
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* @param {any} header
|
|
1127
|
+
* @returns {Uint8Array}
|
|
1128
|
+
*/
|
|
1129
|
+
export function verifyHeaderSignaturePlain(header) {
|
|
1130
|
+
const ret = wasm.verifyHeaderSignaturePlain(header);
|
|
1131
|
+
if (ret[3]) {
|
|
1132
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1133
|
+
}
|
|
1134
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1135
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1136
|
+
return v1;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* @param {any} header
|
|
1141
|
+
* @param {Uint8Array} sealed_gk
|
|
1142
|
+
* @param {KeyLog} key_log
|
|
1143
|
+
* @returns {Uint8Array}
|
|
1144
|
+
*/
|
|
1145
|
+
export function verifyHeaderSignatureSealed(header, sealed_gk, key_log) {
|
|
1146
|
+
const ptr0 = passArray8ToWasm0(sealed_gk, wasm.__wbindgen_malloc);
|
|
1147
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1148
|
+
_assertClass(key_log, KeyLog);
|
|
1149
|
+
const ret = wasm.verifyHeaderSignatureSealed(header, ptr0, len0, key_log.__wbg_ptr);
|
|
1150
|
+
if (ret[3]) {
|
|
1151
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1152
|
+
}
|
|
1153
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1154
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1155
|
+
return v2;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* @param {Uint8Array} leaf
|
|
1160
|
+
* @param {number} leaf_index
|
|
1161
|
+
* @param {number} total_leaves
|
|
1162
|
+
* @param {any} proof
|
|
1163
|
+
* @param {Uint8Array} expected_root
|
|
1164
|
+
* @returns {boolean}
|
|
1165
|
+
*/
|
|
1166
|
+
export function verifyMerkleProof(leaf, leaf_index, total_leaves, proof, expected_root) {
|
|
1167
|
+
const ptr0 = passArray8ToWasm0(leaf, wasm.__wbindgen_malloc);
|
|
1168
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1169
|
+
const ptr1 = passArray8ToWasm0(expected_root, wasm.__wbindgen_malloc);
|
|
1170
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1171
|
+
const ret = wasm.verifyMerkleProof(ptr0, len0, leaf_index, total_leaves, proof, ptr1, len1);
|
|
1172
|
+
if (ret[2]) {
|
|
1173
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1174
|
+
}
|
|
1175
|
+
return ret[0] !== 0;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* @param {Uint8Array} dek
|
|
1180
|
+
* @param {Uint8Array} group_id
|
|
1181
|
+
* @param {number} gk_version
|
|
1182
|
+
* @param {Uint8Array} gk
|
|
1183
|
+
* @returns {any}
|
|
1184
|
+
*/
|
|
1185
|
+
export function wrapDekForGroup(dek, group_id, gk_version, gk) {
|
|
1186
|
+
const ptr0 = passArray8ToWasm0(dek, wasm.__wbindgen_malloc);
|
|
1187
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1188
|
+
const ptr1 = passArray8ToWasm0(group_id, wasm.__wbindgen_malloc);
|
|
1189
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1190
|
+
const ptr2 = passArray8ToWasm0(gk, wasm.__wbindgen_malloc);
|
|
1191
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1192
|
+
const ret = wasm.wrapDekForGroup(ptr0, len0, ptr1, len1, gk_version, ptr2, len2);
|
|
1193
|
+
if (ret[2]) {
|
|
1194
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1195
|
+
}
|
|
1196
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* @param {Uint8Array} dek
|
|
1201
|
+
* @param {string} password
|
|
1202
|
+
* @param {any} kdf
|
|
1203
|
+
* @returns {any}
|
|
1204
|
+
*/
|
|
1205
|
+
export function wrapDekWithPassword(dek, password, kdf) {
|
|
1206
|
+
const ptr0 = passArray8ToWasm0(dek, wasm.__wbindgen_malloc);
|
|
1207
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1208
|
+
const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1209
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1210
|
+
const ret = wasm.wrapDekWithPassword(ptr0, len0, ptr1, len1, kdf);
|
|
1211
|
+
if (ret[2]) {
|
|
1212
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1213
|
+
}
|
|
1214
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* @param {Uint8Array} dek
|
|
1219
|
+
* @param {Uint8Array} file_id
|
|
1220
|
+
* @param {number} t
|
|
1221
|
+
* @param {number} n
|
|
1222
|
+
* @param {number} cipher_suite_id
|
|
1223
|
+
* @returns {any}
|
|
1224
|
+
*/
|
|
1225
|
+
export function wrapDekWithThreshold(dek, file_id, t, n, cipher_suite_id) {
|
|
1226
|
+
const ptr0 = passArray8ToWasm0(dek, wasm.__wbindgen_malloc);
|
|
1227
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1228
|
+
const ptr1 = passArray8ToWasm0(file_id, wasm.__wbindgen_malloc);
|
|
1229
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1230
|
+
const ret = wasm.wrapDekWithThreshold(ptr0, len0, ptr1, len1, t, n, cipher_suite_id);
|
|
1231
|
+
if (ret[2]) {
|
|
1232
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1233
|
+
}
|
|
1234
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* @param {Uint8Array} key
|
|
1239
|
+
* @param {Uint8Array} recipient_id
|
|
1240
|
+
* @param {number} gk_version
|
|
1241
|
+
* @param {any} recipient_pk
|
|
1242
|
+
* @returns {any}
|
|
1243
|
+
*/
|
|
1244
|
+
export function wrapKeyToRecipient(key, recipient_id, gk_version, recipient_pk) {
|
|
1245
|
+
const ptr0 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
|
|
1246
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1247
|
+
const ptr1 = passArray8ToWasm0(recipient_id, wasm.__wbindgen_malloc);
|
|
1248
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1249
|
+
const ret = wasm.wrapKeyToRecipient(ptr0, len0, ptr1, len1, gk_version, recipient_pk);
|
|
1250
|
+
if (ret[2]) {
|
|
1251
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1252
|
+
}
|
|
1253
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1254
|
+
}
|
|
1255
|
+
function __wbg_get_imports() {
|
|
1256
|
+
const import0 = {
|
|
1257
|
+
__proto__: null,
|
|
1258
|
+
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
1259
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1260
|
+
return ret;
|
|
1261
|
+
},
|
|
1262
|
+
__wbg_Number_6b506e6536831eaa: function(arg0) {
|
|
1263
|
+
const ret = Number(arg0);
|
|
1264
|
+
return ret;
|
|
1265
|
+
},
|
|
1266
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
1267
|
+
const ret = String(arg1);
|
|
1268
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1269
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1270
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1271
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1272
|
+
},
|
|
1273
|
+
__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d: function(arg0, arg1) {
|
|
1274
|
+
const v = arg1;
|
|
1275
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
1276
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
1277
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1278
|
+
},
|
|
1279
|
+
__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9: function(arg0) {
|
|
1280
|
+
const v = arg0;
|
|
1281
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
1282
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
1283
|
+
},
|
|
1284
|
+
__wbg___wbindgen_debug_string_0accd80f45e5faa2: function(arg0, arg1) {
|
|
1285
|
+
const ret = debugString(arg1);
|
|
1286
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1287
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1288
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1289
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1290
|
+
},
|
|
1291
|
+
__wbg___wbindgen_in_70a403a56e771704: function(arg0, arg1) {
|
|
1292
|
+
const ret = arg0 in arg1;
|
|
1293
|
+
return ret;
|
|
1294
|
+
},
|
|
1295
|
+
__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9: function(arg0) {
|
|
1296
|
+
const ret = typeof(arg0) === 'bigint';
|
|
1297
|
+
return ret;
|
|
1298
|
+
},
|
|
1299
|
+
__wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
|
|
1300
|
+
const ret = typeof(arg0) === 'function';
|
|
1301
|
+
return ret;
|
|
1302
|
+
},
|
|
1303
|
+
__wbg___wbindgen_is_null_87c3bfe968c6a5ad: function(arg0) {
|
|
1304
|
+
const ret = arg0 === null;
|
|
1305
|
+
return ret;
|
|
1306
|
+
},
|
|
1307
|
+
__wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
|
|
1308
|
+
const val = arg0;
|
|
1309
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1310
|
+
return ret;
|
|
1311
|
+
},
|
|
1312
|
+
__wbg___wbindgen_is_string_c236cabd84a4d769: function(arg0) {
|
|
1313
|
+
const ret = typeof(arg0) === 'string';
|
|
1314
|
+
return ret;
|
|
1315
|
+
},
|
|
1316
|
+
__wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
|
|
1317
|
+
const ret = arg0 === undefined;
|
|
1318
|
+
return ret;
|
|
1319
|
+
},
|
|
1320
|
+
__wbg___wbindgen_jsval_eq_1068e624fa87f6ab: function(arg0, arg1) {
|
|
1321
|
+
const ret = arg0 === arg1;
|
|
1322
|
+
return ret;
|
|
1323
|
+
},
|
|
1324
|
+
__wbg___wbindgen_jsval_loose_eq_2c56564c75129511: function(arg0, arg1) {
|
|
1325
|
+
const ret = arg0 == arg1;
|
|
1326
|
+
return ret;
|
|
1327
|
+
},
|
|
1328
|
+
__wbg___wbindgen_memory_fbc4c3e30b409f08: function() {
|
|
1329
|
+
const ret = wasm.memory;
|
|
1330
|
+
return ret;
|
|
1331
|
+
},
|
|
1332
|
+
__wbg___wbindgen_number_get_9bb1761122181af2: function(arg0, arg1) {
|
|
1333
|
+
const obj = arg1;
|
|
1334
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1335
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1336
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1337
|
+
},
|
|
1338
|
+
__wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
|
|
1339
|
+
const obj = arg1;
|
|
1340
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1341
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1342
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1343
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1344
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1345
|
+
},
|
|
1346
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
1347
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1348
|
+
},
|
|
1349
|
+
__wbg__wbg_cb_unref_61db23ac97f16c31: function(arg0) {
|
|
1350
|
+
arg0._wbg_cb_unref();
|
|
1351
|
+
},
|
|
1352
|
+
__wbg_buffer_a1f116eb4fdb1531: function(arg0) {
|
|
1353
|
+
const ret = arg0.buffer;
|
|
1354
|
+
return ret;
|
|
1355
|
+
},
|
|
1356
|
+
__wbg_call_6e37a87ff352da3d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1357
|
+
const ret = arg0.call(arg1, arg2, arg3, arg4);
|
|
1358
|
+
return ret;
|
|
1359
|
+
}, arguments); },
|
|
1360
|
+
__wbg_call_8a89609d89f6608a: function() { return handleError(function (arg0, arg1) {
|
|
1361
|
+
const ret = arg0.call(arg1);
|
|
1362
|
+
return ret;
|
|
1363
|
+
}, arguments); },
|
|
1364
|
+
__wbg_call_9c758de292015997: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1365
|
+
const ret = arg0.call(arg1, arg2);
|
|
1366
|
+
return ret;
|
|
1367
|
+
}, arguments); },
|
|
1368
|
+
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
1369
|
+
const ret = arg0.crypto;
|
|
1370
|
+
return ret;
|
|
1371
|
+
},
|
|
1372
|
+
__wbg_decrypt_56695800d5827d60: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1373
|
+
const ret = arg0.decrypt(arg1, arg2, getArrayU8FromWasm0(arg3, arg4));
|
|
1374
|
+
return ret;
|
|
1375
|
+
}, arguments); },
|
|
1376
|
+
__wbg_done_60cf307fcc680536: function(arg0) {
|
|
1377
|
+
const ret = arg0.done;
|
|
1378
|
+
return ret;
|
|
1379
|
+
},
|
|
1380
|
+
__wbg_encrypt_eed21533d5581df1: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1381
|
+
const ret = arg0.encrypt(arg1, arg2, getArrayU8FromWasm0(arg3, arg4));
|
|
1382
|
+
return ret;
|
|
1383
|
+
}, arguments); },
|
|
1384
|
+
__wbg_getRandomValues_76dfc69825c9c552: function() { return handleError(function (arg0, arg1) {
|
|
1385
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
1386
|
+
}, arguments); },
|
|
1387
|
+
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
1388
|
+
arg0.getRandomValues(arg1);
|
|
1389
|
+
}, arguments); },
|
|
1390
|
+
__wbg_get_1f8f054ddbaa7db2: function() { return handleError(function (arg0, arg1) {
|
|
1391
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1392
|
+
return ret;
|
|
1393
|
+
}, arguments); },
|
|
1394
|
+
__wbg_get_de6a0f7d4d18a304: function() { return handleError(function (arg0, arg1) {
|
|
1395
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1396
|
+
return ret;
|
|
1397
|
+
}, arguments); },
|
|
1398
|
+
__wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
|
|
1399
|
+
const ret = arg0[arg1 >>> 0];
|
|
1400
|
+
return ret;
|
|
1401
|
+
},
|
|
1402
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
1403
|
+
const ret = arg0[arg1];
|
|
1404
|
+
return ret;
|
|
1405
|
+
},
|
|
1406
|
+
__wbg_importKey_2211368866ee5859: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
|
1407
|
+
const ret = arg0.importKey(getStringFromWasm0(arg1, arg2), arg3, arg4, arg5 !== 0, arg6);
|
|
1408
|
+
return ret;
|
|
1409
|
+
}, arguments); },
|
|
1410
|
+
__wbg_instanceof_ArrayBuffer_8f49811467741499: function(arg0) {
|
|
1411
|
+
let result;
|
|
1412
|
+
try {
|
|
1413
|
+
result = arg0 instanceof ArrayBuffer;
|
|
1414
|
+
} catch (_) {
|
|
1415
|
+
result = false;
|
|
1416
|
+
}
|
|
1417
|
+
const ret = result;
|
|
1418
|
+
return ret;
|
|
1419
|
+
},
|
|
1420
|
+
__wbg_instanceof_Memory_4a1ccdf34cc1269b: function(arg0) {
|
|
1421
|
+
let result;
|
|
1422
|
+
try {
|
|
1423
|
+
result = arg0 instanceof WebAssembly.Memory;
|
|
1424
|
+
} catch (_) {
|
|
1425
|
+
result = false;
|
|
1426
|
+
}
|
|
1427
|
+
const ret = result;
|
|
1428
|
+
return ret;
|
|
1429
|
+
},
|
|
1430
|
+
__wbg_instanceof_Promise_d0db99486956c8e8: function(arg0) {
|
|
1431
|
+
let result;
|
|
1432
|
+
try {
|
|
1433
|
+
result = arg0 instanceof Promise;
|
|
1434
|
+
} catch (_) {
|
|
1435
|
+
result = false;
|
|
1436
|
+
}
|
|
1437
|
+
const ret = result;
|
|
1438
|
+
return ret;
|
|
1439
|
+
},
|
|
1440
|
+
__wbg_instanceof_Uint8Array_86f30649f63ef9c2: function(arg0) {
|
|
1441
|
+
let result;
|
|
1442
|
+
try {
|
|
1443
|
+
result = arg0 instanceof Uint8Array;
|
|
1444
|
+
} catch (_) {
|
|
1445
|
+
result = false;
|
|
1446
|
+
}
|
|
1447
|
+
const ret = result;
|
|
1448
|
+
return ret;
|
|
1449
|
+
},
|
|
1450
|
+
__wbg_isArray_67c2c9c4313f4448: function(arg0) {
|
|
1451
|
+
const ret = Array.isArray(arg0);
|
|
1452
|
+
return ret;
|
|
1453
|
+
},
|
|
1454
|
+
__wbg_isSafeInteger_66acec27e09e99a7: function(arg0) {
|
|
1455
|
+
const ret = Number.isSafeInteger(arg0);
|
|
1456
|
+
return ret;
|
|
1457
|
+
},
|
|
1458
|
+
__wbg_iterator_8732428d309e270e: function() {
|
|
1459
|
+
const ret = Symbol.iterator;
|
|
1460
|
+
return ret;
|
|
1461
|
+
},
|
|
1462
|
+
__wbg_length_4a591ecaa01354d9: function(arg0) {
|
|
1463
|
+
const ret = arg0.length;
|
|
1464
|
+
return ret;
|
|
1465
|
+
},
|
|
1466
|
+
__wbg_length_66f1a4b2e9026940: function(arg0) {
|
|
1467
|
+
const ret = arg0.length;
|
|
1468
|
+
return ret;
|
|
1469
|
+
},
|
|
1470
|
+
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
1471
|
+
const ret = arg0.msCrypto;
|
|
1472
|
+
return ret;
|
|
1473
|
+
},
|
|
1474
|
+
__wbg_new_578aeef4b6b94378: function(arg0) {
|
|
1475
|
+
const ret = new Uint8Array(arg0);
|
|
1476
|
+
return ret;
|
|
1477
|
+
},
|
|
1478
|
+
__wbg_new_ce1ab61c1c2b300d: function() {
|
|
1479
|
+
const ret = new Object();
|
|
1480
|
+
return ret;
|
|
1481
|
+
},
|
|
1482
|
+
__wbg_new_d90091b82fdf5b91: function() {
|
|
1483
|
+
const ret = new Array();
|
|
1484
|
+
return ret;
|
|
1485
|
+
},
|
|
1486
|
+
__wbg_new_from_slice_18fa1f71286d66b8: function(arg0, arg1) {
|
|
1487
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
1488
|
+
return ret;
|
|
1489
|
+
},
|
|
1490
|
+
__wbg_new_typed_bf31d18f92484486: function(arg0, arg1) {
|
|
1491
|
+
try {
|
|
1492
|
+
var state0 = {a: arg0, b: arg1};
|
|
1493
|
+
var cb0 = (arg0, arg1) => {
|
|
1494
|
+
const a = state0.a;
|
|
1495
|
+
state0.a = 0;
|
|
1496
|
+
try {
|
|
1497
|
+
return wasm_bindgen__convert__closures_____invoke__h340851764cb2bc00(a, state0.b, arg0, arg1);
|
|
1498
|
+
} finally {
|
|
1499
|
+
state0.a = a;
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
const ret = new Promise(cb0);
|
|
1503
|
+
return ret;
|
|
1504
|
+
} finally {
|
|
1505
|
+
state0.a = 0;
|
|
1506
|
+
}
|
|
1507
|
+
},
|
|
1508
|
+
__wbg_new_with_byte_offset_and_length_d836f26d916dd9ad: function(arg0, arg1, arg2) {
|
|
1509
|
+
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
|
1510
|
+
return ret;
|
|
1511
|
+
},
|
|
1512
|
+
__wbg_new_with_length_36a4998e27b014c5: function(arg0) {
|
|
1513
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
1514
|
+
return ret;
|
|
1515
|
+
},
|
|
1516
|
+
__wbg_next_9e03acdf51c4960d: function(arg0) {
|
|
1517
|
+
const ret = arg0.next;
|
|
1518
|
+
return ret;
|
|
1519
|
+
},
|
|
1520
|
+
__wbg_next_eb8ca7351fa27906: function() { return handleError(function (arg0) {
|
|
1521
|
+
const ret = arg0.next();
|
|
1522
|
+
return ret;
|
|
1523
|
+
}, arguments); },
|
|
1524
|
+
__wbg_node_84ea875411254db1: function(arg0) {
|
|
1525
|
+
const ret = arg0.node;
|
|
1526
|
+
return ret;
|
|
1527
|
+
},
|
|
1528
|
+
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
1529
|
+
const ret = arg0.process;
|
|
1530
|
+
return ret;
|
|
1531
|
+
},
|
|
1532
|
+
__wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
|
|
1533
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1534
|
+
},
|
|
1535
|
+
__wbg_push_a6822215aa43e71c: function(arg0, arg1) {
|
|
1536
|
+
const ret = arg0.push(arg1);
|
|
1537
|
+
return ret;
|
|
1538
|
+
},
|
|
1539
|
+
__wbg_queueMicrotask_35c611f4a14830b2: function(arg0) {
|
|
1540
|
+
queueMicrotask(arg0);
|
|
1541
|
+
},
|
|
1542
|
+
__wbg_queueMicrotask_404ed0a58e0b63cc: function(arg0) {
|
|
1543
|
+
const ret = arg0.queueMicrotask;
|
|
1544
|
+
return ret;
|
|
1545
|
+
},
|
|
1546
|
+
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
1547
|
+
arg0.randomFillSync(arg1);
|
|
1548
|
+
}, arguments); },
|
|
1549
|
+
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
1550
|
+
const ret = module.require;
|
|
1551
|
+
return ret;
|
|
1552
|
+
}, arguments); },
|
|
1553
|
+
__wbg_resolve_25a7e548d5881dca: function(arg0) {
|
|
1554
|
+
const ret = Promise.resolve(arg0);
|
|
1555
|
+
return ret;
|
|
1556
|
+
},
|
|
1557
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
1558
|
+
arg0[arg1] = arg2;
|
|
1559
|
+
},
|
|
1560
|
+
__wbg_set_6e30c9374c26414c: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1561
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1562
|
+
return ret;
|
|
1563
|
+
}, arguments); },
|
|
1564
|
+
__wbg_set_c775d84916be79ea: function(arg0, arg1, arg2) {
|
|
1565
|
+
arg0.set(arg1, arg2 >>> 0);
|
|
1566
|
+
},
|
|
1567
|
+
__wbg_set_dca99999bba88a9a: function(arg0, arg1, arg2) {
|
|
1568
|
+
arg0[arg1 >>> 0] = arg2;
|
|
1569
|
+
},
|
|
1570
|
+
__wbg_slice_c87a896d40083a6c: function(arg0, arg1, arg2) {
|
|
1571
|
+
const ret = arg0.slice(arg1 >>> 0, arg2 >>> 0);
|
|
1572
|
+
return ret;
|
|
1573
|
+
},
|
|
1574
|
+
__wbg_static_accessor_GLOBAL_9d53f2689e622ca1: function() {
|
|
1575
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1576
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1577
|
+
},
|
|
1578
|
+
__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a: function() {
|
|
1579
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1580
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1581
|
+
},
|
|
1582
|
+
__wbg_static_accessor_SELF_4c59f6c7ea29a144: function() {
|
|
1583
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1584
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1585
|
+
},
|
|
1586
|
+
__wbg_static_accessor_WINDOW_e70ae9f2eb052253: function() {
|
|
1587
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1588
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1589
|
+
},
|
|
1590
|
+
__wbg_subarray_4aa221f6a4f5ab22: function(arg0, arg1, arg2) {
|
|
1591
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
1592
|
+
return ret;
|
|
1593
|
+
},
|
|
1594
|
+
__wbg_subtle_99cc9e2c28f0a5f8: function(arg0) {
|
|
1595
|
+
const ret = arg0.subtle;
|
|
1596
|
+
return ret;
|
|
1597
|
+
},
|
|
1598
|
+
__wbg_then_18f476d590e58992: function(arg0, arg1, arg2) {
|
|
1599
|
+
const ret = arg0.then(arg1, arg2);
|
|
1600
|
+
return ret;
|
|
1601
|
+
},
|
|
1602
|
+
__wbg_then_ac7b025999b52837: function(arg0, arg1) {
|
|
1603
|
+
const ret = arg0.then(arg1);
|
|
1604
|
+
return ret;
|
|
1605
|
+
},
|
|
1606
|
+
__wbg_value_f3625092ee4b37f4: function(arg0) {
|
|
1607
|
+
const ret = arg0.value;
|
|
1608
|
+
return ret;
|
|
1609
|
+
},
|
|
1610
|
+
__wbg_versions_276b2795b1c6a219: function(arg0) {
|
|
1611
|
+
const ret = arg0.versions;
|
|
1612
|
+
return ret;
|
|
1613
|
+
},
|
|
1614
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1615
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 149, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1616
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h5359ba2451a7ff25);
|
|
1617
|
+
return ret;
|
|
1618
|
+
},
|
|
1619
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
1620
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
1621
|
+
const ret = arg0;
|
|
1622
|
+
return ret;
|
|
1623
|
+
},
|
|
1624
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1625
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
1626
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
1627
|
+
return ret;
|
|
1628
|
+
},
|
|
1629
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1630
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1631
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1632
|
+
return ret;
|
|
1633
|
+
},
|
|
1634
|
+
__wbindgen_cast_0000000000000005: function(arg0) {
|
|
1635
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
1636
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1637
|
+
return ret;
|
|
1638
|
+
},
|
|
1639
|
+
__wbindgen_init_externref_table: function() {
|
|
1640
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1641
|
+
const offset = table.grow(4);
|
|
1642
|
+
table.set(0, undefined);
|
|
1643
|
+
table.set(offset + 0, undefined);
|
|
1644
|
+
table.set(offset + 1, null);
|
|
1645
|
+
table.set(offset + 2, true);
|
|
1646
|
+
table.set(offset + 3, false);
|
|
1647
|
+
},
|
|
1648
|
+
};
|
|
1649
|
+
return {
|
|
1650
|
+
__proto__: null,
|
|
1651
|
+
"./vollcrypt_files_wasm_bg.js": import0,
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
function wasm_bindgen__convert__closures_____invoke__h5359ba2451a7ff25(arg0, arg1, arg2) {
|
|
1656
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h5359ba2451a7ff25(arg0, arg1, arg2);
|
|
1657
|
+
if (ret[1]) {
|
|
1658
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
function wasm_bindgen__convert__closures_____invoke__h340851764cb2bc00(arg0, arg1, arg2, arg3) {
|
|
1663
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h340851764cb2bc00(arg0, arg1, arg2, arg3);
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
const GroupManifestFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1667
|
+
? { register: () => {}, unregister: () => {} }
|
|
1668
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_groupmanifest_free(ptr, 1));
|
|
1669
|
+
const HeaderClassFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1670
|
+
? { register: () => {}, unregister: () => {} }
|
|
1671
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_headerclass_free(ptr, 1));
|
|
1672
|
+
const KeyLogFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1673
|
+
? { register: () => {}, unregister: () => {} }
|
|
1674
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_keylog_free(ptr, 1));
|
|
1675
|
+
const WasmBufferPoolFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1676
|
+
? { register: () => {}, unregister: () => {} }
|
|
1677
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmbufferpool_free(ptr, 1));
|
|
1678
|
+
const WasmPooledBufferFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1679
|
+
? { register: () => {}, unregister: () => {} }
|
|
1680
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpooledbuffer_free(ptr, 1));
|
|
1681
|
+
|
|
1682
|
+
function addToExternrefTable0(obj) {
|
|
1683
|
+
const idx = wasm.__externref_table_alloc();
|
|
1684
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
1685
|
+
return idx;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
function _assertClass(instance, klass) {
|
|
1689
|
+
if (!(instance instanceof klass)) {
|
|
1690
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
1695
|
+
? { register: () => {}, unregister: () => {} }
|
|
1696
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
1697
|
+
|
|
1698
|
+
function debugString(val) {
|
|
1699
|
+
// primitive types
|
|
1700
|
+
const type = typeof val;
|
|
1701
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
1702
|
+
return `${val}`;
|
|
1703
|
+
}
|
|
1704
|
+
if (type == 'string') {
|
|
1705
|
+
return `"${val}"`;
|
|
1706
|
+
}
|
|
1707
|
+
if (type == 'symbol') {
|
|
1708
|
+
const description = val.description;
|
|
1709
|
+
if (description == null) {
|
|
1710
|
+
return 'Symbol';
|
|
1711
|
+
} else {
|
|
1712
|
+
return `Symbol(${description})`;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
if (type == 'function') {
|
|
1716
|
+
const name = val.name;
|
|
1717
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
1718
|
+
return `Function(${name})`;
|
|
1719
|
+
} else {
|
|
1720
|
+
return 'Function';
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
// objects
|
|
1724
|
+
if (Array.isArray(val)) {
|
|
1725
|
+
const length = val.length;
|
|
1726
|
+
let debug = '[';
|
|
1727
|
+
if (length > 0) {
|
|
1728
|
+
debug += debugString(val[0]);
|
|
1729
|
+
}
|
|
1730
|
+
for(let i = 1; i < length; i++) {
|
|
1731
|
+
debug += ', ' + debugString(val[i]);
|
|
1732
|
+
}
|
|
1733
|
+
debug += ']';
|
|
1734
|
+
return debug;
|
|
1735
|
+
}
|
|
1736
|
+
// Test for built-in
|
|
1737
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
1738
|
+
let className;
|
|
1739
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
1740
|
+
className = builtInMatches[1];
|
|
1741
|
+
} else {
|
|
1742
|
+
// Failed to match the standard '[object ClassName]'
|
|
1743
|
+
return toString.call(val);
|
|
1744
|
+
}
|
|
1745
|
+
if (className == 'Object') {
|
|
1746
|
+
// we're a user defined class or Object
|
|
1747
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
1748
|
+
// easier than looping through ownProperties of `val`.
|
|
1749
|
+
try {
|
|
1750
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
1751
|
+
} catch (_) {
|
|
1752
|
+
return 'Object';
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
// errors
|
|
1756
|
+
if (val instanceof Error) {
|
|
1757
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
1758
|
+
}
|
|
1759
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
1760
|
+
return className;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1764
|
+
ptr = ptr >>> 0;
|
|
1765
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
let cachedDataViewMemory0 = null;
|
|
1769
|
+
function getDataViewMemory0() {
|
|
1770
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
1771
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
1772
|
+
}
|
|
1773
|
+
return cachedDataViewMemory0;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
function getStringFromWasm0(ptr, len) {
|
|
1777
|
+
return decodeText(ptr >>> 0, len);
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
let cachedUint8ArrayMemory0 = null;
|
|
1781
|
+
function getUint8ArrayMemory0() {
|
|
1782
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
1783
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
1784
|
+
}
|
|
1785
|
+
return cachedUint8ArrayMemory0;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
function handleError(f, args) {
|
|
1789
|
+
try {
|
|
1790
|
+
return f.apply(this, args);
|
|
1791
|
+
} catch (e) {
|
|
1792
|
+
const idx = addToExternrefTable0(e);
|
|
1793
|
+
wasm.__wbindgen_exn_store(idx);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
function isLikeNone(x) {
|
|
1798
|
+
return x === undefined || x === null;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
1802
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
1803
|
+
const real = (...args) => {
|
|
1804
|
+
|
|
1805
|
+
// First up with a closure we increment the internal reference
|
|
1806
|
+
// count. This ensures that the Rust closure environment won't
|
|
1807
|
+
// be deallocated while we're invoking it.
|
|
1808
|
+
state.cnt++;
|
|
1809
|
+
const a = state.a;
|
|
1810
|
+
state.a = 0;
|
|
1811
|
+
try {
|
|
1812
|
+
return f(a, state.b, ...args);
|
|
1813
|
+
} finally {
|
|
1814
|
+
state.a = a;
|
|
1815
|
+
real._wbg_cb_unref();
|
|
1816
|
+
}
|
|
1817
|
+
};
|
|
1818
|
+
real._wbg_cb_unref = () => {
|
|
1819
|
+
if (--state.cnt === 0) {
|
|
1820
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
1821
|
+
state.a = 0;
|
|
1822
|
+
CLOSURE_DTORS.unregister(state);
|
|
1823
|
+
}
|
|
1824
|
+
};
|
|
1825
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
1826
|
+
return real;
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1830
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1831
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1832
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1833
|
+
return ptr;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
1837
|
+
if (realloc === undefined) {
|
|
1838
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1839
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
1840
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
1841
|
+
WASM_VECTOR_LEN = buf.length;
|
|
1842
|
+
return ptr;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
let len = arg.length;
|
|
1846
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
1847
|
+
|
|
1848
|
+
const mem = getUint8ArrayMemory0();
|
|
1849
|
+
|
|
1850
|
+
let offset = 0;
|
|
1851
|
+
|
|
1852
|
+
for (; offset < len; offset++) {
|
|
1853
|
+
const code = arg.charCodeAt(offset);
|
|
1854
|
+
if (code > 0x7F) break;
|
|
1855
|
+
mem[ptr + offset] = code;
|
|
1856
|
+
}
|
|
1857
|
+
if (offset !== len) {
|
|
1858
|
+
if (offset !== 0) {
|
|
1859
|
+
arg = arg.slice(offset);
|
|
1860
|
+
}
|
|
1861
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1862
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1863
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1864
|
+
|
|
1865
|
+
offset += ret.written;
|
|
1866
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
WASM_VECTOR_LEN = offset;
|
|
1870
|
+
return ptr;
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
function takeFromExternrefTable0(idx) {
|
|
1874
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1875
|
+
wasm.__externref_table_dealloc(idx);
|
|
1876
|
+
return value;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1880
|
+
cachedTextDecoder.decode();
|
|
1881
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
1882
|
+
let numBytesDecoded = 0;
|
|
1883
|
+
function decodeText(ptr, len) {
|
|
1884
|
+
numBytesDecoded += len;
|
|
1885
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
1886
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1887
|
+
cachedTextDecoder.decode();
|
|
1888
|
+
numBytesDecoded = len;
|
|
1889
|
+
}
|
|
1890
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
const cachedTextEncoder = new TextEncoder();
|
|
1894
|
+
|
|
1895
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1896
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1897
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1898
|
+
view.set(buf);
|
|
1899
|
+
return {
|
|
1900
|
+
read: arg.length,
|
|
1901
|
+
written: buf.length
|
|
1902
|
+
};
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
let WASM_VECTOR_LEN = 0;
|
|
1907
|
+
|
|
1908
|
+
let wasmModule, wasmInstance, wasm;
|
|
1909
|
+
function __wbg_finalize_init(instance, module) {
|
|
1910
|
+
wasmInstance = instance;
|
|
1911
|
+
wasm = instance.exports;
|
|
1912
|
+
wasmModule = module;
|
|
1913
|
+
cachedDataViewMemory0 = null;
|
|
1914
|
+
cachedUint8ArrayMemory0 = null;
|
|
1915
|
+
wasm.__wbindgen_start();
|
|
1916
|
+
return wasm;
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
async function __wbg_load(module, imports) {
|
|
1920
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1921
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1922
|
+
try {
|
|
1923
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1924
|
+
} catch (e) {
|
|
1925
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
1926
|
+
|
|
1927
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1928
|
+
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);
|
|
1929
|
+
|
|
1930
|
+
} else { throw e; }
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
const bytes = await module.arrayBuffer();
|
|
1935
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1936
|
+
} else {
|
|
1937
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1938
|
+
|
|
1939
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1940
|
+
return { instance, module };
|
|
1941
|
+
} else {
|
|
1942
|
+
return instance;
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
function expectedResponseType(type) {
|
|
1947
|
+
switch (type) {
|
|
1948
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
1949
|
+
}
|
|
1950
|
+
return false;
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
function initSync(module) {
|
|
1955
|
+
if (wasm !== undefined) return wasm;
|
|
1956
|
+
|
|
1957
|
+
|
|
1958
|
+
if (module !== undefined) {
|
|
1959
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1960
|
+
({module} = module)
|
|
1961
|
+
} else {
|
|
1962
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
const imports = __wbg_get_imports();
|
|
1967
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1968
|
+
module = new WebAssembly.Module(module);
|
|
1969
|
+
}
|
|
1970
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1971
|
+
return __wbg_finalize_init(instance, module);
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
async function __wbg_init(module_or_path) {
|
|
1975
|
+
if (wasm !== undefined) return wasm;
|
|
1976
|
+
|
|
1977
|
+
|
|
1978
|
+
if (module_or_path !== undefined) {
|
|
1979
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1980
|
+
({module_or_path} = module_or_path)
|
|
1981
|
+
} else {
|
|
1982
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
if (module_or_path === undefined) {
|
|
1987
|
+
module_or_path = new URL('vollcrypt_files_wasm_bg.wasm', import.meta.url);
|
|
1988
|
+
}
|
|
1989
|
+
const imports = __wbg_get_imports();
|
|
1990
|
+
|
|
1991
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1992
|
+
module_or_path = fetch(module_or_path);
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1996
|
+
|
|
1997
|
+
return __wbg_finalize_init(instance, module);
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
export { initSync, __wbg_init as default };
|