@bitwarden/sdk-internal 0.2.0-main.335 → 0.2.0-main.336

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.
@@ -1,5026 +0,0 @@
1
- let wasm;
2
- export function __wbg_set_wasm(val) {
3
- wasm = val;
4
- }
5
-
6
- const heap = new Array(128).fill(undefined);
7
-
8
- heap.push(undefined, null, true, false);
9
-
10
- function getObject(idx) {
11
- return heap[idx];
12
- }
13
-
14
- let WASM_VECTOR_LEN = 0;
15
-
16
- let cachedUint8ArrayMemory0 = null;
17
-
18
- function getUint8ArrayMemory0() {
19
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
20
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
21
- }
22
- return cachedUint8ArrayMemory0;
23
- }
24
-
25
- const lTextEncoder =
26
- typeof TextEncoder === "undefined" ? (0, module.require)("util").TextEncoder : TextEncoder;
27
-
28
- let cachedTextEncoder = new lTextEncoder("utf-8");
29
-
30
- const encodeString =
31
- typeof cachedTextEncoder.encodeInto === "function"
32
- ? function (arg, view) {
33
- return cachedTextEncoder.encodeInto(arg, view);
34
- }
35
- : function (arg, view) {
36
- const buf = cachedTextEncoder.encode(arg);
37
- view.set(buf);
38
- return {
39
- read: arg.length,
40
- written: buf.length,
41
- };
42
- };
43
-
44
- function passStringToWasm0(arg, malloc, realloc) {
45
- if (realloc === undefined) {
46
- const buf = cachedTextEncoder.encode(arg);
47
- const ptr = malloc(buf.length, 1) >>> 0;
48
- getUint8ArrayMemory0()
49
- .subarray(ptr, ptr + buf.length)
50
- .set(buf);
51
- WASM_VECTOR_LEN = buf.length;
52
- return ptr;
53
- }
54
-
55
- let len = arg.length;
56
- let ptr = malloc(len, 1) >>> 0;
57
-
58
- const mem = getUint8ArrayMemory0();
59
-
60
- let offset = 0;
61
-
62
- for (; offset < len; offset++) {
63
- const code = arg.charCodeAt(offset);
64
- if (code > 0x7f) break;
65
- mem[ptr + offset] = code;
66
- }
67
-
68
- if (offset !== len) {
69
- if (offset !== 0) {
70
- arg = arg.slice(offset);
71
- }
72
- ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
73
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
74
- const ret = encodeString(arg, view);
75
-
76
- offset += ret.written;
77
- ptr = realloc(ptr, len, offset, 1) >>> 0;
78
- }
79
-
80
- WASM_VECTOR_LEN = offset;
81
- return ptr;
82
- }
83
-
84
- let cachedDataViewMemory0 = null;
85
-
86
- function getDataViewMemory0() {
87
- if (
88
- cachedDataViewMemory0 === null ||
89
- cachedDataViewMemory0.buffer.detached === true ||
90
- (cachedDataViewMemory0.buffer.detached === undefined &&
91
- cachedDataViewMemory0.buffer !== wasm.memory.buffer)
92
- ) {
93
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
94
- }
95
- return cachedDataViewMemory0;
96
- }
97
-
98
- let heap_next = heap.length;
99
-
100
- function addHeapObject(obj) {
101
- if (heap_next === heap.length) heap.push(heap.length + 1);
102
- const idx = heap_next;
103
- heap_next = heap[idx];
104
-
105
- heap[idx] = obj;
106
- return idx;
107
- }
108
-
109
- function handleError(f, args) {
110
- try {
111
- return f.apply(this, args);
112
- } catch (e) {
113
- wasm.__wbindgen_exn_store(addHeapObject(e));
114
- }
115
- }
116
-
117
- const lTextDecoder =
118
- typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
119
-
120
- let cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
121
-
122
- cachedTextDecoder.decode();
123
-
124
- function getStringFromWasm0(ptr, len) {
125
- ptr = ptr >>> 0;
126
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
127
- }
128
-
129
- function isLikeNone(x) {
130
- return x === undefined || x === null;
131
- }
132
-
133
- function dropObject(idx) {
134
- if (idx < 132) return;
135
- heap[idx] = heap_next;
136
- heap_next = idx;
137
- }
138
-
139
- function takeObject(idx) {
140
- const ret = getObject(idx);
141
- dropObject(idx);
142
- return ret;
143
- }
144
-
145
- function getArrayU8FromWasm0(ptr, len) {
146
- ptr = ptr >>> 0;
147
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
148
- }
149
-
150
- const CLOSURE_DTORS =
151
- typeof FinalizationRegistry === "undefined"
152
- ? { register: () => {}, unregister: () => {} }
153
- : new FinalizationRegistry((state) => {
154
- wasm.__wbindgen_export_4.get(state.dtor)(state.a, state.b);
155
- });
156
-
157
- function makeMutClosure(arg0, arg1, dtor, f) {
158
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
159
- const real = (...args) => {
160
- // First up with a closure we increment the internal reference
161
- // count. This ensures that the Rust closure environment won't
162
- // be deallocated while we're invoking it.
163
- state.cnt++;
164
- const a = state.a;
165
- state.a = 0;
166
- try {
167
- return f(a, state.b, ...args);
168
- } finally {
169
- if (--state.cnt === 0) {
170
- wasm.__wbindgen_export_4.get(state.dtor)(a, state.b);
171
- CLOSURE_DTORS.unregister(state);
172
- } else {
173
- state.a = a;
174
- }
175
- }
176
- };
177
- real.original = state;
178
- CLOSURE_DTORS.register(real, state, state);
179
- return real;
180
- }
181
-
182
- function debugString(val) {
183
- // primitive types
184
- const type = typeof val;
185
- if (type == "number" || type == "boolean" || val == null) {
186
- return `${val}`;
187
- }
188
- if (type == "string") {
189
- return `"${val}"`;
190
- }
191
- if (type == "symbol") {
192
- const description = val.description;
193
- if (description == null) {
194
- return "Symbol";
195
- } else {
196
- return `Symbol(${description})`;
197
- }
198
- }
199
- if (type == "function") {
200
- const name = val.name;
201
- if (typeof name == "string" && name.length > 0) {
202
- return `Function(${name})`;
203
- } else {
204
- return "Function";
205
- }
206
- }
207
- // objects
208
- if (Array.isArray(val)) {
209
- const length = val.length;
210
- let debug = "[";
211
- if (length > 0) {
212
- debug += debugString(val[0]);
213
- }
214
- for (let i = 1; i < length; i++) {
215
- debug += ", " + debugString(val[i]);
216
- }
217
- debug += "]";
218
- return debug;
219
- }
220
- // Test for built-in
221
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
222
- let className;
223
- if (builtInMatches && builtInMatches.length > 1) {
224
- className = builtInMatches[1];
225
- } else {
226
- // Failed to match the standard '[object ClassName]'
227
- return toString.call(val);
228
- }
229
- if (className == "Object") {
230
- // we're a user defined class or Object
231
- // JSON.stringify avoids problems with cycles, and is generally much
232
- // easier than looping through ownProperties of `val`.
233
- try {
234
- return "Object(" + JSON.stringify(val) + ")";
235
- } catch (_) {
236
- return "Object";
237
- }
238
- }
239
- // errors
240
- if (val instanceof Error) {
241
- return `${val.name}: ${val.message}\n${val.stack}`;
242
- }
243
- // TODO we could test for more things here, like `Set`s and `Map`s.
244
- return className;
245
- }
246
- /**
247
- * @param {LogLevel} level
248
- */
249
- export function set_log_level(level) {
250
- wasm.set_log_level(level);
251
- }
252
-
253
- /**
254
- * @param {LogLevel | null} [log_level]
255
- */
256
- export function init_sdk(log_level) {
257
- wasm.init_sdk(isLikeNone(log_level) ? 5 : log_level);
258
- }
259
-
260
- function passArray8ToWasm0(arg, malloc) {
261
- const ptr = malloc(arg.length * 1, 1) >>> 0;
262
- getUint8ArrayMemory0().set(arg, ptr / 1);
263
- WASM_VECTOR_LEN = arg.length;
264
- return ptr;
265
- }
266
- /**
267
- * Generate a new SSH key pair
268
- *
269
- * # Arguments
270
- * - `key_algorithm` - The algorithm to use for the key pair
271
- *
272
- * # Returns
273
- * - `Ok(SshKey)` if the key was successfully generated
274
- * - `Err(KeyGenerationError)` if the key could not be generated
275
- * @param {KeyAlgorithm} key_algorithm
276
- * @returns {SshKeyView}
277
- */
278
- export function generate_ssh_key(key_algorithm) {
279
- try {
280
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
281
- wasm.generate_ssh_key(retptr, addHeapObject(key_algorithm));
282
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
283
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
284
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
285
- if (r2) {
286
- throw takeObject(r1);
287
- }
288
- return takeObject(r0);
289
- } finally {
290
- wasm.__wbindgen_add_to_stack_pointer(16);
291
- }
292
- }
293
-
294
- /**
295
- * Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
296
- * to an OpenSSH private key with public key and fingerprint
297
- *
298
- * # Arguments
299
- * - `imported_key` - The private key to convert
300
- * - `password` - The password to use for decrypting the key
301
- *
302
- * # Returns
303
- * - `Ok(SshKey)` if the key was successfully coneverted
304
- * - `Err(PasswordRequired)` if the key is encrypted and no password was provided
305
- * - `Err(WrongPassword)` if the password provided is incorrect
306
- * - `Err(ParsingError)` if the key could not be parsed
307
- * - `Err(UnsupportedKeyType)` if the key type is not supported
308
- * @param {string} imported_key
309
- * @param {string | null} [password]
310
- * @returns {SshKeyView}
311
- */
312
- export function import_ssh_key(imported_key, password) {
313
- try {
314
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
315
- const ptr0 = passStringToWasm0(imported_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
316
- const len0 = WASM_VECTOR_LEN;
317
- var ptr1 = isLikeNone(password)
318
- ? 0
319
- : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
320
- var len1 = WASM_VECTOR_LEN;
321
- wasm.import_ssh_key(retptr, ptr0, len0, ptr1, len1);
322
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
323
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
324
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
325
- if (r2) {
326
- throw takeObject(r1);
327
- }
328
- return takeObject(r0);
329
- } finally {
330
- wasm.__wbindgen_add_to_stack_pointer(16);
331
- }
332
- }
333
-
334
- let stack_pointer = 128;
335
-
336
- function addBorrowedObject(obj) {
337
- if (stack_pointer == 1) throw new Error("out of js stack");
338
- heap[--stack_pointer] = obj;
339
- return stack_pointer;
340
- }
341
- /**
342
- * @param {any} error
343
- * @returns {boolean}
344
- */
345
- export function isTestError(error) {
346
- try {
347
- const ret = wasm.isTestError(addBorrowedObject(error));
348
- return ret !== 0;
349
- } finally {
350
- heap[stack_pointer++] = undefined;
351
- }
352
- }
353
-
354
- /**
355
- * @param {any} error
356
- * @returns {boolean}
357
- */
358
- export function isCollectionDecryptError(error) {
359
- try {
360
- const ret = wasm.isCollectionDecryptError(addBorrowedObject(error));
361
- return ret !== 0;
362
- } finally {
363
- heap[stack_pointer++] = undefined;
364
- }
365
- }
366
-
367
- /**
368
- * @param {any} error
369
- * @returns {boolean}
370
- */
371
- export function isMasterPasswordError(error) {
372
- try {
373
- const ret = wasm.isMasterPasswordError(addBorrowedObject(error));
374
- return ret !== 0;
375
- } finally {
376
- heap[stack_pointer++] = undefined;
377
- }
378
- }
379
-
380
- /**
381
- * @param {any} error
382
- * @returns {boolean}
383
- */
384
- export function isDeriveKeyConnectorError(error) {
385
- try {
386
- const ret = wasm.isDeriveKeyConnectorError(addBorrowedObject(error));
387
- return ret !== 0;
388
- } finally {
389
- heap[stack_pointer++] = undefined;
390
- }
391
- }
392
-
393
- /**
394
- * @param {any} error
395
- * @returns {boolean}
396
- */
397
- export function isEnrollAdminPasswordResetError(error) {
398
- try {
399
- const ret = wasm.isEnrollAdminPasswordResetError(addBorrowedObject(error));
400
- return ret !== 0;
401
- } finally {
402
- heap[stack_pointer++] = undefined;
403
- }
404
- }
405
-
406
- /**
407
- * @param {any} error
408
- * @returns {boolean}
409
- */
410
- export function isCryptoClientError(error) {
411
- try {
412
- const ret = wasm.isCryptoClientError(addBorrowedObject(error));
413
- return ret !== 0;
414
- } finally {
415
- heap[stack_pointer++] = undefined;
416
- }
417
- }
418
-
419
- /**
420
- * @param {any} error
421
- * @returns {boolean}
422
- */
423
- export function isStatefulCryptoError(error) {
424
- try {
425
- const ret = wasm.isStatefulCryptoError(addBorrowedObject(error));
426
- return ret !== 0;
427
- } finally {
428
- heap[stack_pointer++] = undefined;
429
- }
430
- }
431
-
432
- /**
433
- * @param {any} error
434
- * @returns {boolean}
435
- */
436
- export function isEncryptionSettingsError(error) {
437
- try {
438
- const ret = wasm.isEncryptionSettingsError(addBorrowedObject(error));
439
- return ret !== 0;
440
- } finally {
441
- heap[stack_pointer++] = undefined;
442
- }
443
- }
444
-
445
- /**
446
- * @param {any} error
447
- * @returns {boolean}
448
- */
449
- export function isCryptoError(error) {
450
- try {
451
- const ret = wasm.isCryptoError(addBorrowedObject(error));
452
- return ret !== 0;
453
- } finally {
454
- heap[stack_pointer++] = undefined;
455
- }
456
- }
457
-
458
- function passArrayJsValueToWasm0(array, malloc) {
459
- const ptr = malloc(array.length * 4, 4) >>> 0;
460
- const mem = getDataViewMemory0();
461
- for (let i = 0; i < array.length; i++) {
462
- mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
463
- }
464
- WASM_VECTOR_LEN = array.length;
465
- return ptr;
466
- }
467
-
468
- function getArrayJsValueFromWasm0(ptr, len) {
469
- ptr = ptr >>> 0;
470
- const mem = getDataViewMemory0();
471
- const result = [];
472
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
473
- result.push(takeObject(mem.getUint32(i, true)));
474
- }
475
- return result;
476
- }
477
- /**
478
- * @param {any} error
479
- * @returns {boolean}
480
- */
481
- export function isExportError(error) {
482
- try {
483
- const ret = wasm.isExportError(addBorrowedObject(error));
484
- return ret !== 0;
485
- } finally {
486
- heap[stack_pointer++] = undefined;
487
- }
488
- }
489
-
490
- /**
491
- * @param {any} error
492
- * @returns {boolean}
493
- */
494
- export function isUsernameError(error) {
495
- try {
496
- const ret = wasm.isUsernameError(addBorrowedObject(error));
497
- return ret !== 0;
498
- } finally {
499
- heap[stack_pointer++] = undefined;
500
- }
501
- }
502
-
503
- /**
504
- * @param {any} error
505
- * @returns {boolean}
506
- */
507
- export function isPasswordError(error) {
508
- try {
509
- const ret = wasm.isPasswordError(addBorrowedObject(error));
510
- return ret !== 0;
511
- } finally {
512
- heap[stack_pointer++] = undefined;
513
- }
514
- }
515
-
516
- function _assertClass(instance, klass) {
517
- if (!(instance instanceof klass)) {
518
- throw new Error(`expected instance of ${klass.name}`);
519
- }
520
- }
521
- /**
522
- * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
523
- * @param {IpcClient} ipc_client
524
- * @param {DiscoverResponse} response
525
- * @returns {Promise<void>}
526
- */
527
- export function ipcRegisterDiscoverHandler(ipc_client, response) {
528
- _assertClass(ipc_client, IpcClient);
529
- const ret = wasm.ipcRegisterDiscoverHandler(ipc_client.__wbg_ptr, addHeapObject(response));
530
- return takeObject(ret);
531
- }
532
-
533
- /**
534
- * Sends a DiscoverRequest to the specified destination and returns the response.
535
- * @param {IpcClient} ipc_client
536
- * @param {Endpoint} destination
537
- * @param {AbortSignal | null} [abort_signal]
538
- * @returns {Promise<DiscoverResponse>}
539
- */
540
- export function ipcRequestDiscover(ipc_client, destination, abort_signal) {
541
- _assertClass(ipc_client, IpcClient);
542
- const ret = wasm.ipcRequestDiscover(
543
- ipc_client.__wbg_ptr,
544
- addHeapObject(destination),
545
- isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
546
- );
547
- return takeObject(ret);
548
- }
549
-
550
- /**
551
- * @param {any} error
552
- * @returns {boolean}
553
- */
554
- export function isChannelError(error) {
555
- try {
556
- const ret = wasm.isChannelError(addBorrowedObject(error));
557
- return ret !== 0;
558
- } finally {
559
- heap[stack_pointer++] = undefined;
560
- }
561
- }
562
-
563
- /**
564
- * @param {any} error
565
- * @returns {boolean}
566
- */
567
- export function isDeserializeError(error) {
568
- try {
569
- const ret = wasm.isDeserializeError(addBorrowedObject(error));
570
- return ret !== 0;
571
- } finally {
572
- heap[stack_pointer++] = undefined;
573
- }
574
- }
575
-
576
- /**
577
- * @param {any} error
578
- * @returns {boolean}
579
- */
580
- export function isRequestError(error) {
581
- try {
582
- const ret = wasm.isRequestError(addBorrowedObject(error));
583
- return ret !== 0;
584
- } finally {
585
- heap[stack_pointer++] = undefined;
586
- }
587
- }
588
-
589
- /**
590
- * @param {any} error
591
- * @returns {boolean}
592
- */
593
- export function isTypedReceiveError(error) {
594
- try {
595
- const ret = wasm.isTypedReceiveError(addBorrowedObject(error));
596
- return ret !== 0;
597
- } finally {
598
- heap[stack_pointer++] = undefined;
599
- }
600
- }
601
-
602
- /**
603
- * @param {any} error
604
- * @returns {boolean}
605
- */
606
- export function isReceiveError(error) {
607
- try {
608
- const ret = wasm.isReceiveError(addBorrowedObject(error));
609
- return ret !== 0;
610
- } finally {
611
- heap[stack_pointer++] = undefined;
612
- }
613
- }
614
-
615
- /**
616
- * @param {any} error
617
- * @returns {boolean}
618
- */
619
- export function isSubscribeError(error) {
620
- try {
621
- const ret = wasm.isSubscribeError(addBorrowedObject(error));
622
- return ret !== 0;
623
- } finally {
624
- heap[stack_pointer++] = undefined;
625
- }
626
- }
627
-
628
- /**
629
- * @param {any} error
630
- * @returns {boolean}
631
- */
632
- export function isSshKeyExportError(error) {
633
- try {
634
- const ret = wasm.isSshKeyExportError(addBorrowedObject(error));
635
- return ret !== 0;
636
- } finally {
637
- heap[stack_pointer++] = undefined;
638
- }
639
- }
640
-
641
- /**
642
- * @param {any} error
643
- * @returns {boolean}
644
- */
645
- export function isSshKeyImportError(error) {
646
- try {
647
- const ret = wasm.isSshKeyImportError(addBorrowedObject(error));
648
- return ret !== 0;
649
- } finally {
650
- heap[stack_pointer++] = undefined;
651
- }
652
- }
653
-
654
- /**
655
- * @param {any} error
656
- * @returns {boolean}
657
- */
658
- export function isKeyGenerationError(error) {
659
- try {
660
- const ret = wasm.isKeyGenerationError(addBorrowedObject(error));
661
- return ret !== 0;
662
- } finally {
663
- heap[stack_pointer++] = undefined;
664
- }
665
- }
666
-
667
- /**
668
- * @param {any} error
669
- * @returns {boolean}
670
- */
671
- export function isDatabaseError(error) {
672
- try {
673
- const ret = wasm.isDatabaseError(addBorrowedObject(error));
674
- return ret !== 0;
675
- } finally {
676
- heap[stack_pointer++] = undefined;
677
- }
678
- }
679
-
680
- /**
681
- * @param {any} error
682
- * @returns {boolean}
683
- */
684
- export function isStateRegistryError(error) {
685
- try {
686
- const ret = wasm.isStateRegistryError(addBorrowedObject(error));
687
- return ret !== 0;
688
- } finally {
689
- heap[stack_pointer++] = undefined;
690
- }
691
- }
692
-
693
- /**
694
- * @param {any} error
695
- * @returns {boolean}
696
- */
697
- export function isCallError(error) {
698
- try {
699
- const ret = wasm.isCallError(addBorrowedObject(error));
700
- return ret !== 0;
701
- } finally {
702
- heap[stack_pointer++] = undefined;
703
- }
704
- }
705
-
706
- /**
707
- * @param {any} error
708
- * @returns {boolean}
709
- */
710
- export function isDecryptError(error) {
711
- try {
712
- const ret = wasm.isDecryptError(addBorrowedObject(error));
713
- return ret !== 0;
714
- } finally {
715
- heap[stack_pointer++] = undefined;
716
- }
717
- }
718
-
719
- /**
720
- * @param {any} error
721
- * @returns {boolean}
722
- */
723
- export function isEncryptError(error) {
724
- try {
725
- const ret = wasm.isEncryptError(addBorrowedObject(error));
726
- return ret !== 0;
727
- } finally {
728
- heap[stack_pointer++] = undefined;
729
- }
730
- }
731
-
732
- /**
733
- * @param {any} error
734
- * @returns {boolean}
735
- */
736
- export function isTotpError(error) {
737
- try {
738
- const ret = wasm.isTotpError(addBorrowedObject(error));
739
- return ret !== 0;
740
- } finally {
741
- heap[stack_pointer++] = undefined;
742
- }
743
- }
744
-
745
- /**
746
- * @param {any} error
747
- * @returns {boolean}
748
- */
749
- export function isGetFolderError(error) {
750
- try {
751
- const ret = wasm.isGetFolderError(addBorrowedObject(error));
752
- return ret !== 0;
753
- } finally {
754
- heap[stack_pointer++] = undefined;
755
- }
756
- }
757
-
758
- /**
759
- * @param {any} error
760
- * @returns {boolean}
761
- */
762
- export function isEditFolderError(error) {
763
- try {
764
- const ret = wasm.isEditFolderError(addBorrowedObject(error));
765
- return ret !== 0;
766
- } finally {
767
- heap[stack_pointer++] = undefined;
768
- }
769
- }
770
-
771
- /**
772
- * @param {any} error
773
- * @returns {boolean}
774
- */
775
- export function isCreateFolderError(error) {
776
- try {
777
- const ret = wasm.isCreateFolderError(addBorrowedObject(error));
778
- return ret !== 0;
779
- } finally {
780
- heap[stack_pointer++] = undefined;
781
- }
782
- }
783
-
784
- /**
785
- * @param {any} error
786
- * @returns {boolean}
787
- */
788
- export function isCipherError(error) {
789
- try {
790
- const ret = wasm.isCipherError(addBorrowedObject(error));
791
- return ret !== 0;
792
- } finally {
793
- heap[stack_pointer++] = undefined;
794
- }
795
- }
796
-
797
- /**
798
- * @param {any} error
799
- * @returns {boolean}
800
- */
801
- export function isDecryptFileError(error) {
802
- try {
803
- const ret = wasm.isDecryptFileError(addBorrowedObject(error));
804
- return ret !== 0;
805
- } finally {
806
- heap[stack_pointer++] = undefined;
807
- }
808
- }
809
-
810
- /**
811
- * @param {any} error
812
- * @returns {boolean}
813
- */
814
- export function isEncryptFileError(error) {
815
- try {
816
- const ret = wasm.isEncryptFileError(addBorrowedObject(error));
817
- return ret !== 0;
818
- } finally {
819
- heap[stack_pointer++] = undefined;
820
- }
821
- }
822
-
823
- function __wbg_adapter_54(arg0, arg1, arg2) {
824
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb3d7232059e1cc02(
825
- arg0,
826
- arg1,
827
- addHeapObject(arg2),
828
- );
829
- }
830
-
831
- function __wbg_adapter_57(arg0, arg1, arg2) {
832
- try {
833
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
834
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbddb05d650eb93e1(
835
- retptr,
836
- arg0,
837
- arg1,
838
- addHeapObject(arg2),
839
- );
840
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
841
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
842
- if (r1) {
843
- throw takeObject(r0);
844
- }
845
- } finally {
846
- wasm.__wbindgen_add_to_stack_pointer(16);
847
- }
848
- }
849
-
850
- function __wbg_adapter_60(arg0, arg1) {
851
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h091423ccfc08366e(
852
- arg0,
853
- arg1,
854
- );
855
- }
856
-
857
- function __wbg_adapter_341(arg0, arg1, arg2, arg3) {
858
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h54a8613170fef18e(
859
- arg0,
860
- arg1,
861
- addHeapObject(arg2),
862
- addHeapObject(arg3),
863
- );
864
- }
865
-
866
- /**
867
- * @enum {300 | 301 | 302 | 303 | 304 | 305}
868
- */
869
- export const CardLinkedIdType = Object.freeze({
870
- CardholderName: 300,
871
- 300: "CardholderName",
872
- ExpMonth: 301,
873
- 301: "ExpMonth",
874
- ExpYear: 302,
875
- 302: "ExpYear",
876
- Code: 303,
877
- 303: "Code",
878
- Brand: 304,
879
- 304: "Brand",
880
- Number: 305,
881
- 305: "Number",
882
- });
883
- /**
884
- * @enum {0 | 1}
885
- */
886
- export const CipherRepromptType = Object.freeze({
887
- None: 0,
888
- 0: "None",
889
- Password: 1,
890
- 1: "Password",
891
- });
892
- /**
893
- * @enum {1 | 2 | 3 | 4 | 5}
894
- */
895
- export const CipherType = Object.freeze({
896
- Login: 1,
897
- 1: "Login",
898
- SecureNote: 2,
899
- 2: "SecureNote",
900
- Card: 3,
901
- 3: "Card",
902
- Identity: 4,
903
- 4: "Identity",
904
- SshKey: 5,
905
- 5: "SshKey",
906
- });
907
- /**
908
- * Represents the type of a [FieldView].
909
- * @enum {0 | 1 | 2 | 3}
910
- */
911
- export const FieldType = Object.freeze({
912
- /**
913
- * Text field
914
- */
915
- Text: 0,
916
- 0: "Text",
917
- /**
918
- * Hidden text field
919
- */
920
- Hidden: 1,
921
- 1: "Hidden",
922
- /**
923
- * Boolean field
924
- */
925
- Boolean: 2,
926
- 2: "Boolean",
927
- /**
928
- * Linked field
929
- */
930
- Linked: 3,
931
- 3: "Linked",
932
- });
933
- /**
934
- * @enum {400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418}
935
- */
936
- export const IdentityLinkedIdType = Object.freeze({
937
- Title: 400,
938
- 400: "Title",
939
- MiddleName: 401,
940
- 401: "MiddleName",
941
- Address1: 402,
942
- 402: "Address1",
943
- Address2: 403,
944
- 403: "Address2",
945
- Address3: 404,
946
- 404: "Address3",
947
- City: 405,
948
- 405: "City",
949
- State: 406,
950
- 406: "State",
951
- PostalCode: 407,
952
- 407: "PostalCode",
953
- Country: 408,
954
- 408: "Country",
955
- Company: 409,
956
- 409: "Company",
957
- Email: 410,
958
- 410: "Email",
959
- Phone: 411,
960
- 411: "Phone",
961
- Ssn: 412,
962
- 412: "Ssn",
963
- Username: 413,
964
- 413: "Username",
965
- PassportNumber: 414,
966
- 414: "PassportNumber",
967
- LicenseNumber: 415,
968
- 415: "LicenseNumber",
969
- FirstName: 416,
970
- 416: "FirstName",
971
- LastName: 417,
972
- 417: "LastName",
973
- FullName: 418,
974
- 418: "FullName",
975
- });
976
- /**
977
- * @enum {0 | 1 | 2 | 3 | 4}
978
- */
979
- export const LogLevel = Object.freeze({
980
- Trace: 0,
981
- 0: "Trace",
982
- Debug: 1,
983
- 1: "Debug",
984
- Info: 2,
985
- 2: "Info",
986
- Warn: 3,
987
- 3: "Warn",
988
- Error: 4,
989
- 4: "Error",
990
- });
991
- /**
992
- * @enum {100 | 101}
993
- */
994
- export const LoginLinkedIdType = Object.freeze({
995
- Username: 100,
996
- 100: "Username",
997
- Password: 101,
998
- 101: "Password",
999
- });
1000
- /**
1001
- * @enum {0}
1002
- */
1003
- export const SecureNoteType = Object.freeze({
1004
- Generic: 0,
1005
- 0: "Generic",
1006
- });
1007
- /**
1008
- * @enum {0 | 1 | 2 | 3 | 4 | 5}
1009
- */
1010
- export const UriMatchType = Object.freeze({
1011
- Domain: 0,
1012
- 0: "Domain",
1013
- Host: 1,
1014
- 1: "Host",
1015
- StartsWith: 2,
1016
- 2: "StartsWith",
1017
- Exact: 3,
1018
- 3: "Exact",
1019
- RegularExpression: 4,
1020
- 4: "RegularExpression",
1021
- Never: 5,
1022
- 5: "Never",
1023
- });
1024
-
1025
- const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
1026
-
1027
- const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
1028
-
1029
- const AttachmentsClientFinalization =
1030
- typeof FinalizationRegistry === "undefined"
1031
- ? { register: () => {}, unregister: () => {} }
1032
- : new FinalizationRegistry((ptr) => wasm.__wbg_attachmentsclient_free(ptr >>> 0, 1));
1033
-
1034
- export class AttachmentsClient {
1035
- static __wrap(ptr) {
1036
- ptr = ptr >>> 0;
1037
- const obj = Object.create(AttachmentsClient.prototype);
1038
- obj.__wbg_ptr = ptr;
1039
- AttachmentsClientFinalization.register(obj, obj.__wbg_ptr, obj);
1040
- return obj;
1041
- }
1042
-
1043
- __destroy_into_raw() {
1044
- const ptr = this.__wbg_ptr;
1045
- this.__wbg_ptr = 0;
1046
- AttachmentsClientFinalization.unregister(this);
1047
- return ptr;
1048
- }
1049
-
1050
- free() {
1051
- const ptr = this.__destroy_into_raw();
1052
- wasm.__wbg_attachmentsclient_free(ptr, 0);
1053
- }
1054
- /**
1055
- * @param {Cipher} cipher
1056
- * @param {AttachmentView} attachment
1057
- * @param {Uint8Array} encrypted_buffer
1058
- * @returns {Uint8Array}
1059
- */
1060
- decrypt_buffer(cipher, attachment, encrypted_buffer) {
1061
- try {
1062
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1063
- const ptr0 = passArray8ToWasm0(encrypted_buffer, wasm.__wbindgen_malloc);
1064
- const len0 = WASM_VECTOR_LEN;
1065
- wasm.attachmentsclient_decrypt_buffer(
1066
- retptr,
1067
- this.__wbg_ptr,
1068
- addHeapObject(cipher),
1069
- addHeapObject(attachment),
1070
- ptr0,
1071
- len0,
1072
- );
1073
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1074
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1075
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1076
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1077
- if (r3) {
1078
- throw takeObject(r2);
1079
- }
1080
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
1081
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1082
- return v2;
1083
- } finally {
1084
- wasm.__wbindgen_add_to_stack_pointer(16);
1085
- }
1086
- }
1087
- }
1088
-
1089
- const AuthClientFinalization =
1090
- typeof FinalizationRegistry === "undefined"
1091
- ? { register: () => {}, unregister: () => {} }
1092
- : new FinalizationRegistry((ptr) => wasm.__wbg_authclient_free(ptr >>> 0, 1));
1093
- /**
1094
- * Subclient containing auth functionality.
1095
- */
1096
- export class AuthClient {
1097
- static __wrap(ptr) {
1098
- ptr = ptr >>> 0;
1099
- const obj = Object.create(AuthClient.prototype);
1100
- obj.__wbg_ptr = ptr;
1101
- AuthClientFinalization.register(obj, obj.__wbg_ptr, obj);
1102
- return obj;
1103
- }
1104
-
1105
- __destroy_into_raw() {
1106
- const ptr = this.__wbg_ptr;
1107
- this.__wbg_ptr = 0;
1108
- AuthClientFinalization.unregister(this);
1109
- return ptr;
1110
- }
1111
-
1112
- free() {
1113
- const ptr = this.__destroy_into_raw();
1114
- wasm.__wbg_authclient_free(ptr, 0);
1115
- }
1116
- /**
1117
- * Client for send access functionality
1118
- * @returns {SendAccessClient}
1119
- */
1120
- send_access() {
1121
- const ret = wasm.authclient_send_access(this.__wbg_ptr);
1122
- return SendAccessClient.__wrap(ret);
1123
- }
1124
- }
1125
-
1126
- const BitwardenClientFinalization =
1127
- typeof FinalizationRegistry === "undefined"
1128
- ? { register: () => {}, unregister: () => {} }
1129
- : new FinalizationRegistry((ptr) => wasm.__wbg_bitwardenclient_free(ptr >>> 0, 1));
1130
- /**
1131
- * The main entry point for the Bitwarden SDK in WebAssembly environments
1132
- */
1133
- export class BitwardenClient {
1134
- __destroy_into_raw() {
1135
- const ptr = this.__wbg_ptr;
1136
- this.__wbg_ptr = 0;
1137
- BitwardenClientFinalization.unregister(this);
1138
- return ptr;
1139
- }
1140
-
1141
- free() {
1142
- const ptr = this.__destroy_into_raw();
1143
- wasm.__wbg_bitwardenclient_free(ptr, 0);
1144
- }
1145
- /**
1146
- * Initialize a new instance of the SDK client
1147
- * @param {any} token_provider
1148
- * @param {ClientSettings | null} [settings]
1149
- */
1150
- constructor(token_provider, settings) {
1151
- const ret = wasm.bitwardenclient_new(
1152
- addHeapObject(token_provider),
1153
- isLikeNone(settings) ? 0 : addHeapObject(settings),
1154
- );
1155
- this.__wbg_ptr = ret >>> 0;
1156
- BitwardenClientFinalization.register(this, this.__wbg_ptr, this);
1157
- return this;
1158
- }
1159
- /**
1160
- * Test method, echoes back the input
1161
- * @param {string} msg
1162
- * @returns {string}
1163
- */
1164
- echo(msg) {
1165
- let deferred2_0;
1166
- let deferred2_1;
1167
- try {
1168
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1169
- const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1170
- const len0 = WASM_VECTOR_LEN;
1171
- wasm.bitwardenclient_echo(retptr, this.__wbg_ptr, ptr0, len0);
1172
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1173
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1174
- deferred2_0 = r0;
1175
- deferred2_1 = r1;
1176
- return getStringFromWasm0(r0, r1);
1177
- } finally {
1178
- wasm.__wbindgen_add_to_stack_pointer(16);
1179
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1180
- }
1181
- }
1182
- /**
1183
- * Returns the current SDK version
1184
- * @returns {string}
1185
- */
1186
- version() {
1187
- let deferred1_0;
1188
- let deferred1_1;
1189
- try {
1190
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1191
- wasm.bitwardenclient_version(retptr, this.__wbg_ptr);
1192
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1193
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1194
- deferred1_0 = r0;
1195
- deferred1_1 = r1;
1196
- return getStringFromWasm0(r0, r1);
1197
- } finally {
1198
- wasm.__wbindgen_add_to_stack_pointer(16);
1199
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1200
- }
1201
- }
1202
- /**
1203
- * Test method, always throws an error
1204
- * @param {string} msg
1205
- */
1206
- throw(msg) {
1207
- try {
1208
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1209
- const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1210
- const len0 = WASM_VECTOR_LEN;
1211
- wasm.bitwardenclient_throw(retptr, this.__wbg_ptr, ptr0, len0);
1212
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1213
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1214
- if (r1) {
1215
- throw takeObject(r0);
1216
- }
1217
- } finally {
1218
- wasm.__wbindgen_add_to_stack_pointer(16);
1219
- }
1220
- }
1221
- /**
1222
- * Test method, calls http endpoint
1223
- * @param {string} url
1224
- * @returns {Promise<string>}
1225
- */
1226
- http_get(url) {
1227
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1228
- const len0 = WASM_VECTOR_LEN;
1229
- const ret = wasm.bitwardenclient_http_get(this.__wbg_ptr, ptr0, len0);
1230
- return takeObject(ret);
1231
- }
1232
- /**
1233
- * Auth related operations.
1234
- * @returns {AuthClient}
1235
- */
1236
- auth() {
1237
- const ret = wasm.bitwardenclient_auth(this.__wbg_ptr);
1238
- return AuthClient.__wrap(ret);
1239
- }
1240
- /**
1241
- * Crypto related operations.
1242
- * @returns {CryptoClient}
1243
- */
1244
- crypto() {
1245
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
1246
- return CryptoClient.__wrap(ret);
1247
- }
1248
- /**
1249
- * Vault item related operations.
1250
- * @returns {VaultClient}
1251
- */
1252
- vault() {
1253
- const ret = wasm.bitwardenclient_vault(this.__wbg_ptr);
1254
- return VaultClient.__wrap(ret);
1255
- }
1256
- /**
1257
- * Constructs a specific client for platform-specific functionality
1258
- * @returns {PlatformClient}
1259
- */
1260
- platform() {
1261
- const ret = wasm.bitwardenclient_platform(this.__wbg_ptr);
1262
- return PlatformClient.__wrap(ret);
1263
- }
1264
- /**
1265
- * Constructs a specific client for generating passwords and passphrases
1266
- * @returns {GeneratorClient}
1267
- */
1268
- generator() {
1269
- const ret = wasm.bitwardenclient_generator(this.__wbg_ptr);
1270
- return GeneratorClient.__wrap(ret);
1271
- }
1272
- /**
1273
- * Exporter related operations.
1274
- * @returns {ExporterClient}
1275
- */
1276
- exporters() {
1277
- const ret = wasm.bitwardenclient_exporters(this.__wbg_ptr);
1278
- return ExporterClient.__wrap(ret);
1279
- }
1280
- }
1281
-
1282
- const CiphersClientFinalization =
1283
- typeof FinalizationRegistry === "undefined"
1284
- ? { register: () => {}, unregister: () => {} }
1285
- : new FinalizationRegistry((ptr) => wasm.__wbg_ciphersclient_free(ptr >>> 0, 1));
1286
-
1287
- export class CiphersClient {
1288
- static __wrap(ptr) {
1289
- ptr = ptr >>> 0;
1290
- const obj = Object.create(CiphersClient.prototype);
1291
- obj.__wbg_ptr = ptr;
1292
- CiphersClientFinalization.register(obj, obj.__wbg_ptr, obj);
1293
- return obj;
1294
- }
1295
-
1296
- __destroy_into_raw() {
1297
- const ptr = this.__wbg_ptr;
1298
- this.__wbg_ptr = 0;
1299
- CiphersClientFinalization.unregister(this);
1300
- return ptr;
1301
- }
1302
-
1303
- free() {
1304
- const ptr = this.__destroy_into_raw();
1305
- wasm.__wbg_ciphersclient_free(ptr, 0);
1306
- }
1307
- /**
1308
- * @param {CipherView} cipher_view
1309
- * @returns {EncryptionContext}
1310
- */
1311
- encrypt(cipher_view) {
1312
- try {
1313
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1314
- wasm.ciphersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
1315
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1316
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1317
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1318
- if (r2) {
1319
- throw takeObject(r1);
1320
- }
1321
- return takeObject(r0);
1322
- } finally {
1323
- wasm.__wbindgen_add_to_stack_pointer(16);
1324
- }
1325
- }
1326
- /**
1327
- * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1328
- * keys in the Web client.
1329
- *
1330
- * Until key rotation is fully implemented in the SDK, this method must be provided the new
1331
- * symmetric key in base64 format. See PM-23084
1332
- *
1333
- * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1334
- * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1335
- * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1336
- * key directly.
1337
- * @param {CipherView} cipher_view
1338
- * @param {B64} new_key
1339
- * @returns {EncryptionContext}
1340
- */
1341
- encrypt_cipher_for_rotation(cipher_view, new_key) {
1342
- try {
1343
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1344
- wasm.ciphersclient_encrypt_cipher_for_rotation(
1345
- retptr,
1346
- this.__wbg_ptr,
1347
- addHeapObject(cipher_view),
1348
- addHeapObject(new_key),
1349
- );
1350
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1351
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1352
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1353
- if (r2) {
1354
- throw takeObject(r1);
1355
- }
1356
- return takeObject(r0);
1357
- } finally {
1358
- wasm.__wbindgen_add_to_stack_pointer(16);
1359
- }
1360
- }
1361
- /**
1362
- * @param {Cipher} cipher
1363
- * @returns {CipherView}
1364
- */
1365
- decrypt(cipher) {
1366
- try {
1367
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1368
- wasm.ciphersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
1369
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1370
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1371
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1372
- if (r2) {
1373
- throw takeObject(r1);
1374
- }
1375
- return takeObject(r0);
1376
- } finally {
1377
- wasm.__wbindgen_add_to_stack_pointer(16);
1378
- }
1379
- }
1380
- /**
1381
- * @param {Cipher[]} ciphers
1382
- * @returns {CipherListView[]}
1383
- */
1384
- decrypt_list(ciphers) {
1385
- try {
1386
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1387
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1388
- const len0 = WASM_VECTOR_LEN;
1389
- wasm.ciphersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1390
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1391
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1392
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1393
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1394
- if (r3) {
1395
- throw takeObject(r2);
1396
- }
1397
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1398
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1399
- return v2;
1400
- } finally {
1401
- wasm.__wbindgen_add_to_stack_pointer(16);
1402
- }
1403
- }
1404
- /**
1405
- * Decrypt cipher list with failures
1406
- * Returns both successfully decrypted ciphers and any that failed to decrypt
1407
- * @param {Cipher[]} ciphers
1408
- * @returns {DecryptCipherListResult}
1409
- */
1410
- decrypt_list_with_failures(ciphers) {
1411
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1412
- const len0 = WASM_VECTOR_LEN;
1413
- const ret = wasm.ciphersclient_decrypt_list_with_failures(this.__wbg_ptr, ptr0, len0);
1414
- return takeObject(ret);
1415
- }
1416
- /**
1417
- * @param {CipherView} cipher_view
1418
- * @returns {Fido2CredentialView[]}
1419
- */
1420
- decrypt_fido2_credentials(cipher_view) {
1421
- try {
1422
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1423
- wasm.ciphersclient_decrypt_fido2_credentials(
1424
- retptr,
1425
- this.__wbg_ptr,
1426
- addHeapObject(cipher_view),
1427
- );
1428
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1429
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1430
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1431
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1432
- if (r3) {
1433
- throw takeObject(r2);
1434
- }
1435
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1436
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1437
- return v1;
1438
- } finally {
1439
- wasm.__wbindgen_add_to_stack_pointer(16);
1440
- }
1441
- }
1442
- /**
1443
- * Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
1444
- * Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
1445
- * TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
1446
- * encrypting the rest of the CipherView.
1447
- * TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
1448
- * @param {CipherView} cipher_view
1449
- * @param {Fido2CredentialFullView[]} fido2_credentials
1450
- * @returns {CipherView}
1451
- */
1452
- set_fido2_credentials(cipher_view, fido2_credentials) {
1453
- try {
1454
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1455
- const ptr0 = passArrayJsValueToWasm0(fido2_credentials, wasm.__wbindgen_malloc);
1456
- const len0 = WASM_VECTOR_LEN;
1457
- wasm.ciphersclient_set_fido2_credentials(
1458
- retptr,
1459
- this.__wbg_ptr,
1460
- addHeapObject(cipher_view),
1461
- ptr0,
1462
- len0,
1463
- );
1464
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1465
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1466
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1467
- if (r2) {
1468
- throw takeObject(r1);
1469
- }
1470
- return takeObject(r0);
1471
- } finally {
1472
- wasm.__wbindgen_add_to_stack_pointer(16);
1473
- }
1474
- }
1475
- /**
1476
- * @param {CipherView} cipher_view
1477
- * @param {OrganizationId} organization_id
1478
- * @returns {CipherView}
1479
- */
1480
- move_to_organization(cipher_view, organization_id) {
1481
- try {
1482
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1483
- wasm.ciphersclient_move_to_organization(
1484
- retptr,
1485
- this.__wbg_ptr,
1486
- addHeapObject(cipher_view),
1487
- addHeapObject(organization_id),
1488
- );
1489
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1490
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1491
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1492
- if (r2) {
1493
- throw takeObject(r1);
1494
- }
1495
- return takeObject(r0);
1496
- } finally {
1497
- wasm.__wbindgen_add_to_stack_pointer(16);
1498
- }
1499
- }
1500
- /**
1501
- * @param {CipherView} cipher_view
1502
- * @returns {string}
1503
- */
1504
- decrypt_fido2_private_key(cipher_view) {
1505
- let deferred2_0;
1506
- let deferred2_1;
1507
- try {
1508
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1509
- wasm.ciphersclient_decrypt_fido2_private_key(
1510
- retptr,
1511
- this.__wbg_ptr,
1512
- addHeapObject(cipher_view),
1513
- );
1514
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1515
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1516
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1517
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1518
- var ptr1 = r0;
1519
- var len1 = r1;
1520
- if (r3) {
1521
- ptr1 = 0;
1522
- len1 = 0;
1523
- throw takeObject(r2);
1524
- }
1525
- deferred2_0 = ptr1;
1526
- deferred2_1 = len1;
1527
- return getStringFromWasm0(ptr1, len1);
1528
- } finally {
1529
- wasm.__wbindgen_add_to_stack_pointer(16);
1530
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1531
- }
1532
- }
1533
- }
1534
-
1535
- const CollectionViewNodeItemFinalization =
1536
- typeof FinalizationRegistry === "undefined"
1537
- ? { register: () => {}, unregister: () => {} }
1538
- : new FinalizationRegistry((ptr) => wasm.__wbg_collectionviewnodeitem_free(ptr >>> 0, 1));
1539
-
1540
- export class CollectionViewNodeItem {
1541
- static __wrap(ptr) {
1542
- ptr = ptr >>> 0;
1543
- const obj = Object.create(CollectionViewNodeItem.prototype);
1544
- obj.__wbg_ptr = ptr;
1545
- CollectionViewNodeItemFinalization.register(obj, obj.__wbg_ptr, obj);
1546
- return obj;
1547
- }
1548
-
1549
- __destroy_into_raw() {
1550
- const ptr = this.__wbg_ptr;
1551
- this.__wbg_ptr = 0;
1552
- CollectionViewNodeItemFinalization.unregister(this);
1553
- return ptr;
1554
- }
1555
-
1556
- free() {
1557
- const ptr = this.__destroy_into_raw();
1558
- wasm.__wbg_collectionviewnodeitem_free(ptr, 0);
1559
- }
1560
- /**
1561
- * @returns {CollectionView}
1562
- */
1563
- get_item() {
1564
- const ret = wasm.collectionviewnodeitem_get_item(this.__wbg_ptr);
1565
- return takeObject(ret);
1566
- }
1567
- /**
1568
- * @returns {CollectionView | undefined}
1569
- */
1570
- get_parent() {
1571
- const ret = wasm.collectionviewnodeitem_get_parent(this.__wbg_ptr);
1572
- return takeObject(ret);
1573
- }
1574
- /**
1575
- * @returns {CollectionView[]}
1576
- */
1577
- get_children() {
1578
- try {
1579
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1580
- wasm.collectionviewnodeitem_get_children(retptr, this.__wbg_ptr);
1581
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1582
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1583
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1584
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1585
- return v1;
1586
- } finally {
1587
- wasm.__wbindgen_add_to_stack_pointer(16);
1588
- }
1589
- }
1590
- /**
1591
- * @returns {AncestorMap}
1592
- */
1593
- get_ancestors() {
1594
- const ret = wasm.collectionviewnodeitem_get_ancestors(this.__wbg_ptr);
1595
- return takeObject(ret);
1596
- }
1597
- }
1598
-
1599
- const CollectionViewTreeFinalization =
1600
- typeof FinalizationRegistry === "undefined"
1601
- ? { register: () => {}, unregister: () => {} }
1602
- : new FinalizationRegistry((ptr) => wasm.__wbg_collectionviewtree_free(ptr >>> 0, 1));
1603
-
1604
- export class CollectionViewTree {
1605
- static __wrap(ptr) {
1606
- ptr = ptr >>> 0;
1607
- const obj = Object.create(CollectionViewTree.prototype);
1608
- obj.__wbg_ptr = ptr;
1609
- CollectionViewTreeFinalization.register(obj, obj.__wbg_ptr, obj);
1610
- return obj;
1611
- }
1612
-
1613
- __destroy_into_raw() {
1614
- const ptr = this.__wbg_ptr;
1615
- this.__wbg_ptr = 0;
1616
- CollectionViewTreeFinalization.unregister(this);
1617
- return ptr;
1618
- }
1619
-
1620
- free() {
1621
- const ptr = this.__destroy_into_raw();
1622
- wasm.__wbg_collectionviewtree_free(ptr, 0);
1623
- }
1624
- /**
1625
- * @param {CollectionView} collection_view
1626
- * @returns {CollectionViewNodeItem | undefined}
1627
- */
1628
- get_item_for_view(collection_view) {
1629
- const ret = wasm.collectionviewtree_get_item_for_view(
1630
- this.__wbg_ptr,
1631
- addHeapObject(collection_view),
1632
- );
1633
- return ret === 0 ? undefined : CollectionViewNodeItem.__wrap(ret);
1634
- }
1635
- /**
1636
- * @returns {CollectionViewNodeItem[]}
1637
- */
1638
- get_root_items() {
1639
- try {
1640
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1641
- wasm.collectionviewtree_get_root_items(retptr, this.__wbg_ptr);
1642
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1643
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1644
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1645
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1646
- return v1;
1647
- } finally {
1648
- wasm.__wbindgen_add_to_stack_pointer(16);
1649
- }
1650
- }
1651
- /**
1652
- * @returns {CollectionViewNodeItem[]}
1653
- */
1654
- get_flat_items() {
1655
- try {
1656
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1657
- wasm.collectionviewtree_get_flat_items(retptr, this.__wbg_ptr);
1658
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1659
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1660
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1661
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1662
- return v1;
1663
- } finally {
1664
- wasm.__wbindgen_add_to_stack_pointer(16);
1665
- }
1666
- }
1667
- }
1668
-
1669
- const CollectionsClientFinalization =
1670
- typeof FinalizationRegistry === "undefined"
1671
- ? { register: () => {}, unregister: () => {} }
1672
- : new FinalizationRegistry((ptr) => wasm.__wbg_collectionsclient_free(ptr >>> 0, 1));
1673
-
1674
- export class CollectionsClient {
1675
- static __wrap(ptr) {
1676
- ptr = ptr >>> 0;
1677
- const obj = Object.create(CollectionsClient.prototype);
1678
- obj.__wbg_ptr = ptr;
1679
- CollectionsClientFinalization.register(obj, obj.__wbg_ptr, obj);
1680
- return obj;
1681
- }
1682
-
1683
- __destroy_into_raw() {
1684
- const ptr = this.__wbg_ptr;
1685
- this.__wbg_ptr = 0;
1686
- CollectionsClientFinalization.unregister(this);
1687
- return ptr;
1688
- }
1689
-
1690
- free() {
1691
- const ptr = this.__destroy_into_raw();
1692
- wasm.__wbg_collectionsclient_free(ptr, 0);
1693
- }
1694
- /**
1695
- * @param {Collection} collection
1696
- * @returns {CollectionView}
1697
- */
1698
- decrypt(collection) {
1699
- try {
1700
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1701
- wasm.collectionsclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(collection));
1702
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1703
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1704
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1705
- if (r2) {
1706
- throw takeObject(r1);
1707
- }
1708
- return takeObject(r0);
1709
- } finally {
1710
- wasm.__wbindgen_add_to_stack_pointer(16);
1711
- }
1712
- }
1713
- /**
1714
- * @param {Collection[]} collections
1715
- * @returns {CollectionView[]}
1716
- */
1717
- decrypt_list(collections) {
1718
- try {
1719
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1720
- const ptr0 = passArrayJsValueToWasm0(collections, wasm.__wbindgen_malloc);
1721
- const len0 = WASM_VECTOR_LEN;
1722
- wasm.collectionsclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1723
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1724
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1725
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1726
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1727
- if (r3) {
1728
- throw takeObject(r2);
1729
- }
1730
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1731
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1732
- return v2;
1733
- } finally {
1734
- wasm.__wbindgen_add_to_stack_pointer(16);
1735
- }
1736
- }
1737
- /**
1738
- *
1739
- * Returns the vector of CollectionView objects in a tree structure based on its implemented
1740
- * path().
1741
- * @param {CollectionView[]} collections
1742
- * @returns {CollectionViewTree}
1743
- */
1744
- get_collection_tree(collections) {
1745
- const ptr0 = passArrayJsValueToWasm0(collections, wasm.__wbindgen_malloc);
1746
- const len0 = WASM_VECTOR_LEN;
1747
- const ret = wasm.collectionsclient_get_collection_tree(this.__wbg_ptr, ptr0, len0);
1748
- return CollectionViewTree.__wrap(ret);
1749
- }
1750
- }
1751
-
1752
- const CryptoClientFinalization =
1753
- typeof FinalizationRegistry === "undefined"
1754
- ? { register: () => {}, unregister: () => {} }
1755
- : new FinalizationRegistry((ptr) => wasm.__wbg_cryptoclient_free(ptr >>> 0, 1));
1756
- /**
1757
- * A client for the crypto operations.
1758
- */
1759
- export class CryptoClient {
1760
- static __wrap(ptr) {
1761
- ptr = ptr >>> 0;
1762
- const obj = Object.create(CryptoClient.prototype);
1763
- obj.__wbg_ptr = ptr;
1764
- CryptoClientFinalization.register(obj, obj.__wbg_ptr, obj);
1765
- return obj;
1766
- }
1767
-
1768
- __destroy_into_raw() {
1769
- const ptr = this.__wbg_ptr;
1770
- this.__wbg_ptr = 0;
1771
- CryptoClientFinalization.unregister(this);
1772
- return ptr;
1773
- }
1774
-
1775
- free() {
1776
- const ptr = this.__destroy_into_raw();
1777
- wasm.__wbg_cryptoclient_free(ptr, 0);
1778
- }
1779
- /**
1780
- * Initialization method for the user crypto. Needs to be called before any other crypto
1781
- * operations.
1782
- * @param {InitUserCryptoRequest} req
1783
- * @returns {Promise<void>}
1784
- */
1785
- initialize_user_crypto(req) {
1786
- const ret = wasm.cryptoclient_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
1787
- return takeObject(ret);
1788
- }
1789
- /**
1790
- * Initialization method for the organization crypto. Needs to be called after
1791
- * `initialize_user_crypto` but before any other crypto operations.
1792
- * @param {InitOrgCryptoRequest} req
1793
- * @returns {Promise<void>}
1794
- */
1795
- initialize_org_crypto(req) {
1796
- const ret = wasm.cryptoclient_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
1797
- return takeObject(ret);
1798
- }
1799
- /**
1800
- * Generates a new key pair and encrypts the private key with the provided user key.
1801
- * Crypto initialization not required.
1802
- * @param {B64} user_key
1803
- * @returns {MakeKeyPairResponse}
1804
- */
1805
- make_key_pair(user_key) {
1806
- try {
1807
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1808
- wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, addHeapObject(user_key));
1809
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1810
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1811
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1812
- if (r2) {
1813
- throw takeObject(r1);
1814
- }
1815
- return takeObject(r0);
1816
- } finally {
1817
- wasm.__wbindgen_add_to_stack_pointer(16);
1818
- }
1819
- }
1820
- /**
1821
- * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1822
- * key. Returns if the private key is decryptable and if it is a valid matching key.
1823
- * Crypto initialization not required.
1824
- * @param {VerifyAsymmetricKeysRequest} request
1825
- * @returns {VerifyAsymmetricKeysResponse}
1826
- */
1827
- verify_asymmetric_keys(request) {
1828
- try {
1829
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1830
- wasm.cryptoclient_verify_asymmetric_keys(retptr, this.__wbg_ptr, addHeapObject(request));
1831
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1832
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1833
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1834
- if (r2) {
1835
- throw takeObject(r1);
1836
- }
1837
- return takeObject(r0);
1838
- } finally {
1839
- wasm.__wbindgen_add_to_stack_pointer(16);
1840
- }
1841
- }
1842
- /**
1843
- * Makes a new signing key pair and signs the public key for the user
1844
- * @returns {UserCryptoV2KeysResponse}
1845
- */
1846
- make_keys_for_user_crypto_v2() {
1847
- try {
1848
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1849
- wasm.cryptoclient_make_keys_for_user_crypto_v2(retptr, this.__wbg_ptr);
1850
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1851
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1852
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1853
- if (r2) {
1854
- throw takeObject(r1);
1855
- }
1856
- return takeObject(r0);
1857
- } finally {
1858
- wasm.__wbindgen_add_to_stack_pointer(16);
1859
- }
1860
- }
1861
- /**
1862
- * Creates a rotated set of account keys for the current state
1863
- * @returns {UserCryptoV2KeysResponse}
1864
- */
1865
- get_v2_rotated_account_keys() {
1866
- try {
1867
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1868
- wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr);
1869
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1870
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1871
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1872
- if (r2) {
1873
- throw takeObject(r1);
1874
- }
1875
- return takeObject(r0);
1876
- } finally {
1877
- wasm.__wbindgen_add_to_stack_pointer(16);
1878
- }
1879
- }
1880
- /**
1881
- * Create the data necessary to update the user's kdf settings. The user's encryption key is
1882
- * re-encrypted for the password under the new kdf settings. This returns the re-encrypted
1883
- * user key and the new password hash but does not update sdk state.
1884
- * @param {string} password
1885
- * @param {Kdf} kdf
1886
- * @returns {UpdateKdfResponse}
1887
- */
1888
- make_update_kdf(password, kdf) {
1889
- try {
1890
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1891
- const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1892
- const len0 = WASM_VECTOR_LEN;
1893
- wasm.cryptoclient_make_update_kdf(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(kdf));
1894
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1895
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1896
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1897
- if (r2) {
1898
- throw takeObject(r1);
1899
- }
1900
- return takeObject(r0);
1901
- } finally {
1902
- wasm.__wbindgen_add_to_stack_pointer(16);
1903
- }
1904
- }
1905
- /**
1906
- * Protects the current user key with the provided PIN. The result can be stored and later
1907
- * used to initialize another client instance by using the PIN and the PIN key with
1908
- * `initialize_user_crypto`.
1909
- * @param {string} pin
1910
- * @returns {EnrollPinResponse}
1911
- */
1912
- enroll_pin(pin) {
1913
- try {
1914
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1915
- const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1916
- const len0 = WASM_VECTOR_LEN;
1917
- wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
1918
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1919
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1920
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1921
- if (r2) {
1922
- throw takeObject(r1);
1923
- }
1924
- return takeObject(r0);
1925
- } finally {
1926
- wasm.__wbindgen_add_to_stack_pointer(16);
1927
- }
1928
- }
1929
- /**
1930
- * Protects the current user key with the provided PIN. The result can be stored and later
1931
- * used to initialize another client instance by using the PIN and the PIN key with
1932
- * `initialize_user_crypto`. The provided pin is encrypted with the user key.
1933
- * @param {string} encrypted_pin
1934
- * @returns {EnrollPinResponse}
1935
- */
1936
- enroll_pin_with_encrypted_pin(encrypted_pin) {
1937
- try {
1938
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1939
- const ptr0 = passStringToWasm0(
1940
- encrypted_pin,
1941
- wasm.__wbindgen_malloc,
1942
- wasm.__wbindgen_realloc,
1943
- );
1944
- const len0 = WASM_VECTOR_LEN;
1945
- wasm.cryptoclient_enroll_pin_with_encrypted_pin(retptr, this.__wbg_ptr, ptr0, len0);
1946
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1947
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1948
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1949
- if (r2) {
1950
- throw takeObject(r1);
1951
- }
1952
- return takeObject(r0);
1953
- } finally {
1954
- wasm.__wbindgen_add_to_stack_pointer(16);
1955
- }
1956
- }
1957
- /**
1958
- * Decrypts a `PasswordProtectedKeyEnvelope`, returning the user key, if successful.
1959
- * This is a stop-gap solution, until initialization of the SDK is used.
1960
- * @param {string} pin
1961
- * @param {PasswordProtectedKeyEnvelope} envelope
1962
- * @returns {Uint8Array}
1963
- */
1964
- unseal_password_protected_key_envelope(pin, envelope) {
1965
- try {
1966
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1967
- const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1968
- const len0 = WASM_VECTOR_LEN;
1969
- wasm.cryptoclient_unseal_password_protected_key_envelope(
1970
- retptr,
1971
- this.__wbg_ptr,
1972
- ptr0,
1973
- len0,
1974
- addHeapObject(envelope),
1975
- );
1976
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1977
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1978
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1979
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1980
- if (r3) {
1981
- throw takeObject(r2);
1982
- }
1983
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
1984
- wasm.__wbindgen_free(r0, r1 * 1, 1);
1985
- return v2;
1986
- } finally {
1987
- wasm.__wbindgen_add_to_stack_pointer(16);
1988
- }
1989
- }
1990
- }
1991
-
1992
- const ExporterClientFinalization =
1993
- typeof FinalizationRegistry === "undefined"
1994
- ? { register: () => {}, unregister: () => {} }
1995
- : new FinalizationRegistry((ptr) => wasm.__wbg_exporterclient_free(ptr >>> 0, 1));
1996
-
1997
- export class ExporterClient {
1998
- static __wrap(ptr) {
1999
- ptr = ptr >>> 0;
2000
- const obj = Object.create(ExporterClient.prototype);
2001
- obj.__wbg_ptr = ptr;
2002
- ExporterClientFinalization.register(obj, obj.__wbg_ptr, obj);
2003
- return obj;
2004
- }
2005
-
2006
- __destroy_into_raw() {
2007
- const ptr = this.__wbg_ptr;
2008
- this.__wbg_ptr = 0;
2009
- ExporterClientFinalization.unregister(this);
2010
- return ptr;
2011
- }
2012
-
2013
- free() {
2014
- const ptr = this.__destroy_into_raw();
2015
- wasm.__wbg_exporterclient_free(ptr, 0);
2016
- }
2017
- /**
2018
- * @param {Folder[]} folders
2019
- * @param {Cipher[]} ciphers
2020
- * @param {ExportFormat} format
2021
- * @returns {string}
2022
- */
2023
- export_vault(folders, ciphers, format) {
2024
- let deferred4_0;
2025
- let deferred4_1;
2026
- try {
2027
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2028
- const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
2029
- const len0 = WASM_VECTOR_LEN;
2030
- const ptr1 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2031
- const len1 = WASM_VECTOR_LEN;
2032
- wasm.exporterclient_export_vault(
2033
- retptr,
2034
- this.__wbg_ptr,
2035
- ptr0,
2036
- len0,
2037
- ptr1,
2038
- len1,
2039
- addHeapObject(format),
2040
- );
2041
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2042
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2043
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2044
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2045
- var ptr3 = r0;
2046
- var len3 = r1;
2047
- if (r3) {
2048
- ptr3 = 0;
2049
- len3 = 0;
2050
- throw takeObject(r2);
2051
- }
2052
- deferred4_0 = ptr3;
2053
- deferred4_1 = len3;
2054
- return getStringFromWasm0(ptr3, len3);
2055
- } finally {
2056
- wasm.__wbindgen_add_to_stack_pointer(16);
2057
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2058
- }
2059
- }
2060
- /**
2061
- * @param {Collection[]} collections
2062
- * @param {Cipher[]} ciphers
2063
- * @param {ExportFormat} format
2064
- * @returns {string}
2065
- */
2066
- export_organization_vault(collections, ciphers, format) {
2067
- let deferred4_0;
2068
- let deferred4_1;
2069
- try {
2070
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2071
- const ptr0 = passArrayJsValueToWasm0(collections, wasm.__wbindgen_malloc);
2072
- const len0 = WASM_VECTOR_LEN;
2073
- const ptr1 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2074
- const len1 = WASM_VECTOR_LEN;
2075
- wasm.exporterclient_export_organization_vault(
2076
- retptr,
2077
- this.__wbg_ptr,
2078
- ptr0,
2079
- len0,
2080
- ptr1,
2081
- len1,
2082
- addHeapObject(format),
2083
- );
2084
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2085
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2086
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2087
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2088
- var ptr3 = r0;
2089
- var len3 = r1;
2090
- if (r3) {
2091
- ptr3 = 0;
2092
- len3 = 0;
2093
- throw takeObject(r2);
2094
- }
2095
- deferred4_0 = ptr3;
2096
- deferred4_1 = len3;
2097
- return getStringFromWasm0(ptr3, len3);
2098
- } finally {
2099
- wasm.__wbindgen_add_to_stack_pointer(16);
2100
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2101
- }
2102
- }
2103
- /**
2104
- * Credential Exchange Format (CXF)
2105
- *
2106
- * *Warning:* Expect this API to be unstable, and it will change in the future.
2107
- *
2108
- * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2109
- * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2110
- * @param {Account} account
2111
- * @param {Cipher[]} ciphers
2112
- * @returns {string}
2113
- */
2114
- export_cxf(account, ciphers) {
2115
- let deferred3_0;
2116
- let deferred3_1;
2117
- try {
2118
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2119
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2120
- const len0 = WASM_VECTOR_LEN;
2121
- wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), ptr0, len0);
2122
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2123
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2124
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2125
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2126
- var ptr2 = r0;
2127
- var len2 = r1;
2128
- if (r3) {
2129
- ptr2 = 0;
2130
- len2 = 0;
2131
- throw takeObject(r2);
2132
- }
2133
- deferred3_0 = ptr2;
2134
- deferred3_1 = len2;
2135
- return getStringFromWasm0(ptr2, len2);
2136
- } finally {
2137
- wasm.__wbindgen_add_to_stack_pointer(16);
2138
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2139
- }
2140
- }
2141
- /**
2142
- * Credential Exchange Format (CXF)
2143
- *
2144
- * *Warning:* Expect this API to be unstable, and it will change in the future.
2145
- *
2146
- * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2147
- * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2148
- * @param {string} payload
2149
- * @returns {Cipher[]}
2150
- */
2151
- import_cxf(payload) {
2152
- try {
2153
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2154
- const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2155
- const len0 = WASM_VECTOR_LEN;
2156
- wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
2157
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2158
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2159
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2160
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2161
- if (r3) {
2162
- throw takeObject(r2);
2163
- }
2164
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2165
- wasm.__wbindgen_free(r0, r1 * 4, 4);
2166
- return v2;
2167
- } finally {
2168
- wasm.__wbindgen_add_to_stack_pointer(16);
2169
- }
2170
- }
2171
- }
2172
-
2173
- const FoldersClientFinalization =
2174
- typeof FinalizationRegistry === "undefined"
2175
- ? { register: () => {}, unregister: () => {} }
2176
- : new FinalizationRegistry((ptr) => wasm.__wbg_foldersclient_free(ptr >>> 0, 1));
2177
- /**
2178
- * Wrapper for folder specific functionality.
2179
- */
2180
- export class FoldersClient {
2181
- static __wrap(ptr) {
2182
- ptr = ptr >>> 0;
2183
- const obj = Object.create(FoldersClient.prototype);
2184
- obj.__wbg_ptr = ptr;
2185
- FoldersClientFinalization.register(obj, obj.__wbg_ptr, obj);
2186
- return obj;
2187
- }
2188
-
2189
- __destroy_into_raw() {
2190
- const ptr = this.__wbg_ptr;
2191
- this.__wbg_ptr = 0;
2192
- FoldersClientFinalization.unregister(this);
2193
- return ptr;
2194
- }
2195
-
2196
- free() {
2197
- const ptr = this.__destroy_into_raw();
2198
- wasm.__wbg_foldersclient_free(ptr, 0);
2199
- }
2200
- /**
2201
- * Encrypt a [FolderView] to a [Folder].
2202
- * @param {FolderView} folder_view
2203
- * @returns {Folder}
2204
- */
2205
- encrypt(folder_view) {
2206
- try {
2207
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2208
- wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
2209
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2210
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2211
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2212
- if (r2) {
2213
- throw takeObject(r1);
2214
- }
2215
- return takeObject(r0);
2216
- } finally {
2217
- wasm.__wbindgen_add_to_stack_pointer(16);
2218
- }
2219
- }
2220
- /**
2221
- * Encrypt a [Folder] to [FolderView].
2222
- * @param {Folder} folder
2223
- * @returns {FolderView}
2224
- */
2225
- decrypt(folder) {
2226
- try {
2227
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2228
- wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
2229
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2230
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2231
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2232
- if (r2) {
2233
- throw takeObject(r1);
2234
- }
2235
- return takeObject(r0);
2236
- } finally {
2237
- wasm.__wbindgen_add_to_stack_pointer(16);
2238
- }
2239
- }
2240
- /**
2241
- * Decrypt a list of [Folder]s to a list of [FolderView]s.
2242
- * @param {Folder[]} folders
2243
- * @returns {FolderView[]}
2244
- */
2245
- decrypt_list(folders) {
2246
- try {
2247
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2248
- const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
2249
- const len0 = WASM_VECTOR_LEN;
2250
- wasm.foldersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
2251
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2252
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2253
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2254
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2255
- if (r3) {
2256
- throw takeObject(r2);
2257
- }
2258
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2259
- wasm.__wbindgen_free(r0, r1 * 4, 4);
2260
- return v2;
2261
- } finally {
2262
- wasm.__wbindgen_add_to_stack_pointer(16);
2263
- }
2264
- }
2265
- /**
2266
- * Get all folders from state and decrypt them to a list of [FolderView].
2267
- * @returns {Promise<FolderView[]>}
2268
- */
2269
- list() {
2270
- const ret = wasm.foldersclient_list(this.__wbg_ptr);
2271
- return takeObject(ret);
2272
- }
2273
- /**
2274
- * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
2275
- * @param {FolderId} folder_id
2276
- * @returns {Promise<FolderView>}
2277
- */
2278
- get(folder_id) {
2279
- const ret = wasm.foldersclient_get(this.__wbg_ptr, addHeapObject(folder_id));
2280
- return takeObject(ret);
2281
- }
2282
- /**
2283
- * Create a new [Folder] and save it to the server.
2284
- * @param {FolderAddEditRequest} request
2285
- * @returns {Promise<FolderView>}
2286
- */
2287
- create(request) {
2288
- const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
2289
- return takeObject(ret);
2290
- }
2291
- /**
2292
- * Edit the [Folder] and save it to the server.
2293
- * @param {FolderId} folder_id
2294
- * @param {FolderAddEditRequest} request
2295
- * @returns {Promise<FolderView>}
2296
- */
2297
- edit(folder_id, request) {
2298
- const ret = wasm.foldersclient_edit(
2299
- this.__wbg_ptr,
2300
- addHeapObject(folder_id),
2301
- addHeapObject(request),
2302
- );
2303
- return takeObject(ret);
2304
- }
2305
- }
2306
-
2307
- const GeneratorClientFinalization =
2308
- typeof FinalizationRegistry === "undefined"
2309
- ? { register: () => {}, unregister: () => {} }
2310
- : new FinalizationRegistry((ptr) => wasm.__wbg_generatorclient_free(ptr >>> 0, 1));
2311
-
2312
- export class GeneratorClient {
2313
- static __wrap(ptr) {
2314
- ptr = ptr >>> 0;
2315
- const obj = Object.create(GeneratorClient.prototype);
2316
- obj.__wbg_ptr = ptr;
2317
- GeneratorClientFinalization.register(obj, obj.__wbg_ptr, obj);
2318
- return obj;
2319
- }
2320
-
2321
- __destroy_into_raw() {
2322
- const ptr = this.__wbg_ptr;
2323
- this.__wbg_ptr = 0;
2324
- GeneratorClientFinalization.unregister(this);
2325
- return ptr;
2326
- }
2327
-
2328
- free() {
2329
- const ptr = this.__destroy_into_raw();
2330
- wasm.__wbg_generatorclient_free(ptr, 0);
2331
- }
2332
- /**
2333
- * Generates a random password.
2334
- *
2335
- * The character sets and password length can be customized using the `input` parameter.
2336
- *
2337
- * # Examples
2338
- *
2339
- * ```
2340
- * use bitwarden_core::Client;
2341
- * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2342
- *
2343
- * async fn test() -> Result<(), PassphraseError> {
2344
- * let input = PasswordGeneratorRequest {
2345
- * lowercase: true,
2346
- * uppercase: true,
2347
- * numbers: true,
2348
- * length: 20,
2349
- * ..Default::default()
2350
- * };
2351
- * let password = Client::new(None).generator().password(input).unwrap();
2352
- * println!("{}", password);
2353
- * Ok(())
2354
- * }
2355
- * ```
2356
- * @param {PasswordGeneratorRequest} input
2357
- * @returns {string}
2358
- */
2359
- password(input) {
2360
- let deferred2_0;
2361
- let deferred2_1;
2362
- try {
2363
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2364
- wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
2365
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2366
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2367
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2368
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2369
- var ptr1 = r0;
2370
- var len1 = r1;
2371
- if (r3) {
2372
- ptr1 = 0;
2373
- len1 = 0;
2374
- throw takeObject(r2);
2375
- }
2376
- deferred2_0 = ptr1;
2377
- deferred2_1 = len1;
2378
- return getStringFromWasm0(ptr1, len1);
2379
- } finally {
2380
- wasm.__wbindgen_add_to_stack_pointer(16);
2381
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2382
- }
2383
- }
2384
- /**
2385
- * Generates a random passphrase.
2386
- * A passphrase is a combination of random words separated by a character.
2387
- * An example of passphrase is `correct horse battery staple`.
2388
- *
2389
- * The number of words and their case, the word separator, and the inclusion of
2390
- * a number in the passphrase can be customized using the `input` parameter.
2391
- *
2392
- * # Examples
2393
- *
2394
- * ```
2395
- * use bitwarden_core::Client;
2396
- * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
2397
- *
2398
- * async fn test() -> Result<(), PassphraseError> {
2399
- * let input = PassphraseGeneratorRequest {
2400
- * num_words: 4,
2401
- * ..Default::default()
2402
- * };
2403
- * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
2404
- * println!("{}", passphrase);
2405
- * Ok(())
2406
- * }
2407
- * ```
2408
- * @param {PassphraseGeneratorRequest} input
2409
- * @returns {string}
2410
- */
2411
- passphrase(input) {
2412
- let deferred2_0;
2413
- let deferred2_1;
2414
- try {
2415
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2416
- wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
2417
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2418
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2419
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2420
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2421
- var ptr1 = r0;
2422
- var len1 = r1;
2423
- if (r3) {
2424
- ptr1 = 0;
2425
- len1 = 0;
2426
- throw takeObject(r2);
2427
- }
2428
- deferred2_0 = ptr1;
2429
- deferred2_1 = len1;
2430
- return getStringFromWasm0(ptr1, len1);
2431
- } finally {
2432
- wasm.__wbindgen_add_to_stack_pointer(16);
2433
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2434
- }
2435
- }
2436
- }
2437
-
2438
- const IncomingMessageFinalization =
2439
- typeof FinalizationRegistry === "undefined"
2440
- ? { register: () => {}, unregister: () => {} }
2441
- : new FinalizationRegistry((ptr) => wasm.__wbg_incomingmessage_free(ptr >>> 0, 1));
2442
-
2443
- export class IncomingMessage {
2444
- static __wrap(ptr) {
2445
- ptr = ptr >>> 0;
2446
- const obj = Object.create(IncomingMessage.prototype);
2447
- obj.__wbg_ptr = ptr;
2448
- IncomingMessageFinalization.register(obj, obj.__wbg_ptr, obj);
2449
- return obj;
2450
- }
2451
-
2452
- __destroy_into_raw() {
2453
- const ptr = this.__wbg_ptr;
2454
- this.__wbg_ptr = 0;
2455
- IncomingMessageFinalization.unregister(this);
2456
- return ptr;
2457
- }
2458
-
2459
- free() {
2460
- const ptr = this.__destroy_into_raw();
2461
- wasm.__wbg_incomingmessage_free(ptr, 0);
2462
- }
2463
- /**
2464
- * @returns {Uint8Array}
2465
- */
2466
- get payload() {
2467
- try {
2468
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2469
- wasm.__wbg_get_incomingmessage_payload(retptr, this.__wbg_ptr);
2470
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2471
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2472
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
2473
- wasm.__wbindgen_free(r0, r1 * 1, 1);
2474
- return v1;
2475
- } finally {
2476
- wasm.__wbindgen_add_to_stack_pointer(16);
2477
- }
2478
- }
2479
- /**
2480
- * @param {Uint8Array} arg0
2481
- */
2482
- set payload(arg0) {
2483
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
2484
- const len0 = WASM_VECTOR_LEN;
2485
- wasm.__wbg_set_incomingmessage_payload(this.__wbg_ptr, ptr0, len0);
2486
- }
2487
- /**
2488
- * @returns {Endpoint}
2489
- */
2490
- get destination() {
2491
- const ret = wasm.__wbg_get_incomingmessage_destination(this.__wbg_ptr);
2492
- return takeObject(ret);
2493
- }
2494
- /**
2495
- * @param {Endpoint} arg0
2496
- */
2497
- set destination(arg0) {
2498
- wasm.__wbg_set_incomingmessage_destination(this.__wbg_ptr, addHeapObject(arg0));
2499
- }
2500
- /**
2501
- * @returns {Endpoint}
2502
- */
2503
- get source() {
2504
- const ret = wasm.__wbg_get_incomingmessage_source(this.__wbg_ptr);
2505
- return takeObject(ret);
2506
- }
2507
- /**
2508
- * @param {Endpoint} arg0
2509
- */
2510
- set source(arg0) {
2511
- wasm.__wbg_set_incomingmessage_source(this.__wbg_ptr, addHeapObject(arg0));
2512
- }
2513
- /**
2514
- * @returns {string | undefined}
2515
- */
2516
- get topic() {
2517
- try {
2518
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2519
- wasm.__wbg_get_incomingmessage_topic(retptr, this.__wbg_ptr);
2520
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2521
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2522
- let v1;
2523
- if (r0 !== 0) {
2524
- v1 = getStringFromWasm0(r0, r1).slice();
2525
- wasm.__wbindgen_free(r0, r1 * 1, 1);
2526
- }
2527
- return v1;
2528
- } finally {
2529
- wasm.__wbindgen_add_to_stack_pointer(16);
2530
- }
2531
- }
2532
- /**
2533
- * @param {string | null} [arg0]
2534
- */
2535
- set topic(arg0) {
2536
- var ptr0 = isLikeNone(arg0)
2537
- ? 0
2538
- : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2539
- var len0 = WASM_VECTOR_LEN;
2540
- wasm.__wbg_set_incomingmessage_topic(this.__wbg_ptr, ptr0, len0);
2541
- }
2542
- /**
2543
- * @param {Uint8Array} payload
2544
- * @param {Endpoint} destination
2545
- * @param {Endpoint} source
2546
- * @param {string | null} [topic]
2547
- */
2548
- constructor(payload, destination, source, topic) {
2549
- const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2550
- const len0 = WASM_VECTOR_LEN;
2551
- var ptr1 = isLikeNone(topic)
2552
- ? 0
2553
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2554
- var len1 = WASM_VECTOR_LEN;
2555
- const ret = wasm.incomingmessage_new(
2556
- ptr0,
2557
- len0,
2558
- addHeapObject(destination),
2559
- addHeapObject(source),
2560
- ptr1,
2561
- len1,
2562
- );
2563
- this.__wbg_ptr = ret >>> 0;
2564
- IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
2565
- return this;
2566
- }
2567
- /**
2568
- * Try to parse the payload as JSON.
2569
- * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2570
- */
2571
- parse_payload_as_json() {
2572
- const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2573
- return takeObject(ret);
2574
- }
2575
- }
2576
-
2577
- const IpcClientFinalization =
2578
- typeof FinalizationRegistry === "undefined"
2579
- ? { register: () => {}, unregister: () => {} }
2580
- : new FinalizationRegistry((ptr) => wasm.__wbg_ipcclient_free(ptr >>> 0, 1));
2581
- /**
2582
- * JavaScript wrapper around the IPC client. For more information, see the
2583
- * [IpcClient] documentation.
2584
- */
2585
- export class IpcClient {
2586
- __destroy_into_raw() {
2587
- const ptr = this.__wbg_ptr;
2588
- this.__wbg_ptr = 0;
2589
- IpcClientFinalization.unregister(this);
2590
- return ptr;
2591
- }
2592
-
2593
- free() {
2594
- const ptr = this.__destroy_into_raw();
2595
- wasm.__wbg_ipcclient_free(ptr, 0);
2596
- }
2597
- /**
2598
- * @param {IpcCommunicationBackend} communication_provider
2599
- */
2600
- constructor(communication_provider) {
2601
- _assertClass(communication_provider, IpcCommunicationBackend);
2602
- const ret = wasm.ipcclient_new(communication_provider.__wbg_ptr);
2603
- this.__wbg_ptr = ret >>> 0;
2604
- IpcClientFinalization.register(this, this.__wbg_ptr, this);
2605
- return this;
2606
- }
2607
- /**
2608
- * @returns {Promise<void>}
2609
- */
2610
- start() {
2611
- const ret = wasm.ipcclient_start(this.__wbg_ptr);
2612
- return takeObject(ret);
2613
- }
2614
- /**
2615
- * @returns {Promise<boolean>}
2616
- */
2617
- isRunning() {
2618
- const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2619
- return takeObject(ret);
2620
- }
2621
- /**
2622
- * @param {OutgoingMessage} message
2623
- * @returns {Promise<void>}
2624
- */
2625
- send(message) {
2626
- _assertClass(message, OutgoingMessage);
2627
- var ptr0 = message.__destroy_into_raw();
2628
- const ret = wasm.ipcclient_send(this.__wbg_ptr, ptr0);
2629
- return takeObject(ret);
2630
- }
2631
- /**
2632
- * @returns {Promise<IpcClientSubscription>}
2633
- */
2634
- subscribe() {
2635
- const ret = wasm.ipcclient_subscribe(this.__wbg_ptr);
2636
- return takeObject(ret);
2637
- }
2638
- }
2639
-
2640
- const IpcClientSubscriptionFinalization =
2641
- typeof FinalizationRegistry === "undefined"
2642
- ? { register: () => {}, unregister: () => {} }
2643
- : new FinalizationRegistry((ptr) => wasm.__wbg_ipcclientsubscription_free(ptr >>> 0, 1));
2644
- /**
2645
- * JavaScript wrapper around the IPC client subscription. For more information, see the
2646
- * [IpcClientSubscription](crate::IpcClientSubscription) documentation.
2647
- */
2648
- export class IpcClientSubscription {
2649
- static __wrap(ptr) {
2650
- ptr = ptr >>> 0;
2651
- const obj = Object.create(IpcClientSubscription.prototype);
2652
- obj.__wbg_ptr = ptr;
2653
- IpcClientSubscriptionFinalization.register(obj, obj.__wbg_ptr, obj);
2654
- return obj;
2655
- }
2656
-
2657
- __destroy_into_raw() {
2658
- const ptr = this.__wbg_ptr;
2659
- this.__wbg_ptr = 0;
2660
- IpcClientSubscriptionFinalization.unregister(this);
2661
- return ptr;
2662
- }
2663
-
2664
- free() {
2665
- const ptr = this.__destroy_into_raw();
2666
- wasm.__wbg_ipcclientsubscription_free(ptr, 0);
2667
- }
2668
- /**
2669
- * @param {AbortSignal | null} [abort_signal]
2670
- * @returns {Promise<IncomingMessage>}
2671
- */
2672
- receive(abort_signal) {
2673
- const ret = wasm.ipcclientsubscription_receive(
2674
- this.__wbg_ptr,
2675
- isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
2676
- );
2677
- return takeObject(ret);
2678
- }
2679
- }
2680
-
2681
- const IpcCommunicationBackendFinalization =
2682
- typeof FinalizationRegistry === "undefined"
2683
- ? { register: () => {}, unregister: () => {} }
2684
- : new FinalizationRegistry((ptr) => wasm.__wbg_ipccommunicationbackend_free(ptr >>> 0, 1));
2685
- /**
2686
- * JavaScript implementation of the `CommunicationBackend` trait for IPC communication.
2687
- */
2688
- export class IpcCommunicationBackend {
2689
- __destroy_into_raw() {
2690
- const ptr = this.__wbg_ptr;
2691
- this.__wbg_ptr = 0;
2692
- IpcCommunicationBackendFinalization.unregister(this);
2693
- return ptr;
2694
- }
2695
-
2696
- free() {
2697
- const ptr = this.__destroy_into_raw();
2698
- wasm.__wbg_ipccommunicationbackend_free(ptr, 0);
2699
- }
2700
- /**
2701
- * Creates a new instance of the JavaScript communication backend.
2702
- * @param {IpcCommunicationBackendSender} sender
2703
- */
2704
- constructor(sender) {
2705
- const ret = wasm.ipccommunicationbackend_new(addHeapObject(sender));
2706
- this.__wbg_ptr = ret >>> 0;
2707
- IpcCommunicationBackendFinalization.register(this, this.__wbg_ptr, this);
2708
- return this;
2709
- }
2710
- /**
2711
- * Used by JavaScript to provide an incoming message to the IPC framework.
2712
- * @param {IncomingMessage} message
2713
- */
2714
- receive(message) {
2715
- try {
2716
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2717
- _assertClass(message, IncomingMessage);
2718
- var ptr0 = message.__destroy_into_raw();
2719
- wasm.ipccommunicationbackend_receive(retptr, this.__wbg_ptr, ptr0);
2720
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2721
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2722
- if (r1) {
2723
- throw takeObject(r0);
2724
- }
2725
- } finally {
2726
- wasm.__wbindgen_add_to_stack_pointer(16);
2727
- }
2728
- }
2729
- }
2730
-
2731
- const OutgoingMessageFinalization =
2732
- typeof FinalizationRegistry === "undefined"
2733
- ? { register: () => {}, unregister: () => {} }
2734
- : new FinalizationRegistry((ptr) => wasm.__wbg_outgoingmessage_free(ptr >>> 0, 1));
2735
-
2736
- export class OutgoingMessage {
2737
- static __wrap(ptr) {
2738
- ptr = ptr >>> 0;
2739
- const obj = Object.create(OutgoingMessage.prototype);
2740
- obj.__wbg_ptr = ptr;
2741
- OutgoingMessageFinalization.register(obj, obj.__wbg_ptr, obj);
2742
- return obj;
2743
- }
2744
-
2745
- __destroy_into_raw() {
2746
- const ptr = this.__wbg_ptr;
2747
- this.__wbg_ptr = 0;
2748
- OutgoingMessageFinalization.unregister(this);
2749
- return ptr;
2750
- }
2751
-
2752
- free() {
2753
- const ptr = this.__destroy_into_raw();
2754
- wasm.__wbg_outgoingmessage_free(ptr, 0);
2755
- }
2756
- /**
2757
- * @returns {Uint8Array}
2758
- */
2759
- get payload() {
2760
- try {
2761
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2762
- wasm.__wbg_get_outgoingmessage_payload(retptr, this.__wbg_ptr);
2763
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2764
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2765
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
2766
- wasm.__wbindgen_free(r0, r1 * 1, 1);
2767
- return v1;
2768
- } finally {
2769
- wasm.__wbindgen_add_to_stack_pointer(16);
2770
- }
2771
- }
2772
- /**
2773
- * @param {Uint8Array} arg0
2774
- */
2775
- set payload(arg0) {
2776
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
2777
- const len0 = WASM_VECTOR_LEN;
2778
- wasm.__wbg_set_outgoingmessage_payload(this.__wbg_ptr, ptr0, len0);
2779
- }
2780
- /**
2781
- * @returns {Endpoint}
2782
- */
2783
- get destination() {
2784
- const ret = wasm.__wbg_get_incomingmessage_destination(this.__wbg_ptr);
2785
- return takeObject(ret);
2786
- }
2787
- /**
2788
- * @param {Endpoint} arg0
2789
- */
2790
- set destination(arg0) {
2791
- wasm.__wbg_set_incomingmessage_destination(this.__wbg_ptr, addHeapObject(arg0));
2792
- }
2793
- /**
2794
- * @returns {string | undefined}
2795
- */
2796
- get topic() {
2797
- try {
2798
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2799
- wasm.__wbg_get_outgoingmessage_topic(retptr, this.__wbg_ptr);
2800
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2801
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2802
- let v1;
2803
- if (r0 !== 0) {
2804
- v1 = getStringFromWasm0(r0, r1).slice();
2805
- wasm.__wbindgen_free(r0, r1 * 1, 1);
2806
- }
2807
- return v1;
2808
- } finally {
2809
- wasm.__wbindgen_add_to_stack_pointer(16);
2810
- }
2811
- }
2812
- /**
2813
- * @param {string | null} [arg0]
2814
- */
2815
- set topic(arg0) {
2816
- var ptr0 = isLikeNone(arg0)
2817
- ? 0
2818
- : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2819
- var len0 = WASM_VECTOR_LEN;
2820
- wasm.__wbg_set_outgoingmessage_topic(this.__wbg_ptr, ptr0, len0);
2821
- }
2822
- /**
2823
- * @param {Uint8Array} payload
2824
- * @param {Endpoint} destination
2825
- * @param {string | null} [topic]
2826
- */
2827
- constructor(payload, destination, topic) {
2828
- const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2829
- const len0 = WASM_VECTOR_LEN;
2830
- var ptr1 = isLikeNone(topic)
2831
- ? 0
2832
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2833
- var len1 = WASM_VECTOR_LEN;
2834
- const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
2835
- this.__wbg_ptr = ret >>> 0;
2836
- OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
2837
- return this;
2838
- }
2839
- /**
2840
- * Create a new message and encode the payload as JSON.
2841
- * @param {any} payload
2842
- * @param {Endpoint} destination
2843
- * @param {string | null} [topic]
2844
- * @returns {OutgoingMessage}
2845
- */
2846
- static new_json_payload(payload, destination, topic) {
2847
- try {
2848
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2849
- var ptr0 = isLikeNone(topic)
2850
- ? 0
2851
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2852
- var len0 = WASM_VECTOR_LEN;
2853
- wasm.outgoingmessage_new_json_payload(
2854
- retptr,
2855
- addHeapObject(payload),
2856
- addHeapObject(destination),
2857
- ptr0,
2858
- len0,
2859
- );
2860
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2861
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2862
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2863
- if (r2) {
2864
- throw takeObject(r1);
2865
- }
2866
- return OutgoingMessage.__wrap(r0);
2867
- } finally {
2868
- wasm.__wbindgen_add_to_stack_pointer(16);
2869
- }
2870
- }
2871
- }
2872
-
2873
- const PlatformClientFinalization =
2874
- typeof FinalizationRegistry === "undefined"
2875
- ? { register: () => {}, unregister: () => {} }
2876
- : new FinalizationRegistry((ptr) => wasm.__wbg_platformclient_free(ptr >>> 0, 1));
2877
-
2878
- export class PlatformClient {
2879
- static __wrap(ptr) {
2880
- ptr = ptr >>> 0;
2881
- const obj = Object.create(PlatformClient.prototype);
2882
- obj.__wbg_ptr = ptr;
2883
- PlatformClientFinalization.register(obj, obj.__wbg_ptr, obj);
2884
- return obj;
2885
- }
2886
-
2887
- __destroy_into_raw() {
2888
- const ptr = this.__wbg_ptr;
2889
- this.__wbg_ptr = 0;
2890
- PlatformClientFinalization.unregister(this);
2891
- return ptr;
2892
- }
2893
-
2894
- free() {
2895
- const ptr = this.__destroy_into_raw();
2896
- wasm.__wbg_platformclient_free(ptr, 0);
2897
- }
2898
- /**
2899
- * @returns {StateClient}
2900
- */
2901
- state() {
2902
- const ret = wasm.bitwardenclient_platform(this.__wbg_ptr);
2903
- return StateClient.__wrap(ret);
2904
- }
2905
- /**
2906
- * Load feature flags into the client
2907
- * @param {FeatureFlags} flags
2908
- */
2909
- load_flags(flags) {
2910
- try {
2911
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2912
- wasm.platformclient_load_flags(retptr, this.__wbg_ptr, addHeapObject(flags));
2913
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2914
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2915
- if (r1) {
2916
- throw takeObject(r0);
2917
- }
2918
- } finally {
2919
- wasm.__wbindgen_add_to_stack_pointer(16);
2920
- }
2921
- }
2922
- }
2923
-
2924
- const PureCryptoFinalization =
2925
- typeof FinalizationRegistry === "undefined"
2926
- ? { register: () => {}, unregister: () => {} }
2927
- : new FinalizationRegistry((ptr) => wasm.__wbg_purecrypto_free(ptr >>> 0, 1));
2928
- /**
2929
- * This module represents a stopgap solution to provide access to primitive crypto functions for JS
2930
- * clients. It is not intended to be used outside of the JS clients and this pattern should not be
2931
- * proliferated. It is necessary because we want to use SDK crypto prior to the SDK being fully
2932
- * responsible for state and keys.
2933
- */
2934
- export class PureCrypto {
2935
- __destroy_into_raw() {
2936
- const ptr = this.__wbg_ptr;
2937
- this.__wbg_ptr = 0;
2938
- PureCryptoFinalization.unregister(this);
2939
- return ptr;
2940
- }
2941
-
2942
- free() {
2943
- const ptr = this.__destroy_into_raw();
2944
- wasm.__wbg_purecrypto_free(ptr, 0);
2945
- }
2946
- /**
2947
- * DEPRECATED: Use `symmetric_decrypt_string` instead.
2948
- * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
2949
- * @param {string} enc_string
2950
- * @param {Uint8Array} key
2951
- * @returns {string}
2952
- */
2953
- static symmetric_decrypt(enc_string, key) {
2954
- let deferred4_0;
2955
- let deferred4_1;
2956
- try {
2957
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2958
- const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2959
- const len0 = WASM_VECTOR_LEN;
2960
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
2961
- const len1 = WASM_VECTOR_LEN;
2962
- wasm.purecrypto_symmetric_decrypt(retptr, ptr0, len0, ptr1, len1);
2963
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2964
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2965
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2966
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2967
- var ptr3 = r0;
2968
- var len3 = r1;
2969
- if (r3) {
2970
- ptr3 = 0;
2971
- len3 = 0;
2972
- throw takeObject(r2);
2973
- }
2974
- deferred4_0 = ptr3;
2975
- deferred4_1 = len3;
2976
- return getStringFromWasm0(ptr3, len3);
2977
- } finally {
2978
- wasm.__wbindgen_add_to_stack_pointer(16);
2979
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2980
- }
2981
- }
2982
- /**
2983
- * @param {string} enc_string
2984
- * @param {Uint8Array} key
2985
- * @returns {string}
2986
- */
2987
- static symmetric_decrypt_string(enc_string, key) {
2988
- let deferred4_0;
2989
- let deferred4_1;
2990
- try {
2991
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2992
- const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2993
- const len0 = WASM_VECTOR_LEN;
2994
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
2995
- const len1 = WASM_VECTOR_LEN;
2996
- wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
2997
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2998
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2999
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3000
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3001
- var ptr3 = r0;
3002
- var len3 = r1;
3003
- if (r3) {
3004
- ptr3 = 0;
3005
- len3 = 0;
3006
- throw takeObject(r2);
3007
- }
3008
- deferred4_0 = ptr3;
3009
- deferred4_1 = len3;
3010
- return getStringFromWasm0(ptr3, len3);
3011
- } finally {
3012
- wasm.__wbindgen_add_to_stack_pointer(16);
3013
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3014
- }
3015
- }
3016
- /**
3017
- * @param {string} enc_string
3018
- * @param {Uint8Array} key
3019
- * @returns {Uint8Array}
3020
- */
3021
- static symmetric_decrypt_bytes(enc_string, key) {
3022
- try {
3023
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3024
- const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3025
- const len0 = WASM_VECTOR_LEN;
3026
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3027
- const len1 = WASM_VECTOR_LEN;
3028
- wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3029
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3030
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3031
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3032
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3033
- if (r3) {
3034
- throw takeObject(r2);
3035
- }
3036
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3037
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3038
- return v3;
3039
- } finally {
3040
- wasm.__wbindgen_add_to_stack_pointer(16);
3041
- }
3042
- }
3043
- /**
3044
- * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
3045
- * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3046
- * @param {Uint8Array} enc_bytes
3047
- * @param {Uint8Array} key
3048
- * @returns {Uint8Array}
3049
- */
3050
- static symmetric_decrypt_array_buffer(enc_bytes, key) {
3051
- try {
3052
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3053
- const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3054
- const len0 = WASM_VECTOR_LEN;
3055
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3056
- const len1 = WASM_VECTOR_LEN;
3057
- wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
3058
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3059
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3060
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3061
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3062
- if (r3) {
3063
- throw takeObject(r2);
3064
- }
3065
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3066
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3067
- return v3;
3068
- } finally {
3069
- wasm.__wbindgen_add_to_stack_pointer(16);
3070
- }
3071
- }
3072
- /**
3073
- * @param {Uint8Array} enc_bytes
3074
- * @param {Uint8Array} key
3075
- * @returns {Uint8Array}
3076
- */
3077
- static symmetric_decrypt_filedata(enc_bytes, key) {
3078
- try {
3079
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3080
- const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3081
- const len0 = WASM_VECTOR_LEN;
3082
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3083
- const len1 = WASM_VECTOR_LEN;
3084
- wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3085
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3086
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3087
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3088
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3089
- if (r3) {
3090
- throw takeObject(r2);
3091
- }
3092
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3093
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3094
- return v3;
3095
- } finally {
3096
- wasm.__wbindgen_add_to_stack_pointer(16);
3097
- }
3098
- }
3099
- /**
3100
- * @param {string} plain
3101
- * @param {Uint8Array} key
3102
- * @returns {string}
3103
- */
3104
- static symmetric_encrypt_string(plain, key) {
3105
- let deferred4_0;
3106
- let deferred4_1;
3107
- try {
3108
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3109
- const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3110
- const len0 = WASM_VECTOR_LEN;
3111
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3112
- const len1 = WASM_VECTOR_LEN;
3113
- wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
3114
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3115
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3116
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3117
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3118
- var ptr3 = r0;
3119
- var len3 = r1;
3120
- if (r3) {
3121
- ptr3 = 0;
3122
- len3 = 0;
3123
- throw takeObject(r2);
3124
- }
3125
- deferred4_0 = ptr3;
3126
- deferred4_1 = len3;
3127
- return getStringFromWasm0(ptr3, len3);
3128
- } finally {
3129
- wasm.__wbindgen_add_to_stack_pointer(16);
3130
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3131
- }
3132
- }
3133
- /**
3134
- * DEPRECATED: Only used by send keys
3135
- * @param {Uint8Array} plain
3136
- * @param {Uint8Array} key
3137
- * @returns {string}
3138
- */
3139
- static symmetric_encrypt_bytes(plain, key) {
3140
- let deferred4_0;
3141
- let deferred4_1;
3142
- try {
3143
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3144
- const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3145
- const len0 = WASM_VECTOR_LEN;
3146
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3147
- const len1 = WASM_VECTOR_LEN;
3148
- wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3149
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3150
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3151
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3152
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3153
- var ptr3 = r0;
3154
- var len3 = r1;
3155
- if (r3) {
3156
- ptr3 = 0;
3157
- len3 = 0;
3158
- throw takeObject(r2);
3159
- }
3160
- deferred4_0 = ptr3;
3161
- deferred4_1 = len3;
3162
- return getStringFromWasm0(ptr3, len3);
3163
- } finally {
3164
- wasm.__wbindgen_add_to_stack_pointer(16);
3165
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3166
- }
3167
- }
3168
- /**
3169
- * @param {Uint8Array} plain
3170
- * @param {Uint8Array} key
3171
- * @returns {Uint8Array}
3172
- */
3173
- static symmetric_encrypt_filedata(plain, key) {
3174
- try {
3175
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3176
- const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3177
- const len0 = WASM_VECTOR_LEN;
3178
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3179
- const len1 = WASM_VECTOR_LEN;
3180
- wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3181
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3182
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3183
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3184
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3185
- if (r3) {
3186
- throw takeObject(r2);
3187
- }
3188
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3189
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3190
- return v3;
3191
- } finally {
3192
- wasm.__wbindgen_add_to_stack_pointer(16);
3193
- }
3194
- }
3195
- /**
3196
- * @param {string} encrypted_user_key
3197
- * @param {string} master_password
3198
- * @param {string} email
3199
- * @param {Kdf} kdf
3200
- * @returns {Uint8Array}
3201
- */
3202
- static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
3203
- try {
3204
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3205
- const ptr0 = passStringToWasm0(
3206
- encrypted_user_key,
3207
- wasm.__wbindgen_malloc,
3208
- wasm.__wbindgen_realloc,
3209
- );
3210
- const len0 = WASM_VECTOR_LEN;
3211
- const ptr1 = passStringToWasm0(
3212
- master_password,
3213
- wasm.__wbindgen_malloc,
3214
- wasm.__wbindgen_realloc,
3215
- );
3216
- const len1 = WASM_VECTOR_LEN;
3217
- const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3218
- const len2 = WASM_VECTOR_LEN;
3219
- wasm.purecrypto_decrypt_user_key_with_master_password(
3220
- retptr,
3221
- ptr0,
3222
- len0,
3223
- ptr1,
3224
- len1,
3225
- ptr2,
3226
- len2,
3227
- addHeapObject(kdf),
3228
- );
3229
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3230
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3231
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3232
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3233
- if (r3) {
3234
- throw takeObject(r2);
3235
- }
3236
- var v4 = getArrayU8FromWasm0(r0, r1).slice();
3237
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3238
- return v4;
3239
- } finally {
3240
- wasm.__wbindgen_add_to_stack_pointer(16);
3241
- }
3242
- }
3243
- /**
3244
- * @param {Uint8Array} user_key
3245
- * @param {string} master_password
3246
- * @param {string} email
3247
- * @param {Kdf} kdf
3248
- * @returns {string}
3249
- */
3250
- static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
3251
- let deferred5_0;
3252
- let deferred5_1;
3253
- try {
3254
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3255
- const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
3256
- const len0 = WASM_VECTOR_LEN;
3257
- const ptr1 = passStringToWasm0(
3258
- master_password,
3259
- wasm.__wbindgen_malloc,
3260
- wasm.__wbindgen_realloc,
3261
- );
3262
- const len1 = WASM_VECTOR_LEN;
3263
- const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3264
- const len2 = WASM_VECTOR_LEN;
3265
- wasm.purecrypto_encrypt_user_key_with_master_password(
3266
- retptr,
3267
- ptr0,
3268
- len0,
3269
- ptr1,
3270
- len1,
3271
- ptr2,
3272
- len2,
3273
- addHeapObject(kdf),
3274
- );
3275
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3276
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3277
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3278
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3279
- var ptr4 = r0;
3280
- var len4 = r1;
3281
- if (r3) {
3282
- ptr4 = 0;
3283
- len4 = 0;
3284
- throw takeObject(r2);
3285
- }
3286
- deferred5_0 = ptr4;
3287
- deferred5_1 = len4;
3288
- return getStringFromWasm0(ptr4, len4);
3289
- } finally {
3290
- wasm.__wbindgen_add_to_stack_pointer(16);
3291
- wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
3292
- }
3293
- }
3294
- /**
3295
- * @returns {Uint8Array}
3296
- */
3297
- static make_user_key_aes256_cbc_hmac() {
3298
- try {
3299
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3300
- wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
3301
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3302
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3303
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
3304
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3305
- return v1;
3306
- } finally {
3307
- wasm.__wbindgen_add_to_stack_pointer(16);
3308
- }
3309
- }
3310
- /**
3311
- * @returns {Uint8Array}
3312
- */
3313
- static make_user_key_xchacha20_poly1305() {
3314
- try {
3315
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3316
- wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
3317
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3318
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3319
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
3320
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3321
- return v1;
3322
- } finally {
3323
- wasm.__wbindgen_add_to_stack_pointer(16);
3324
- }
3325
- }
3326
- /**
3327
- * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
3328
- * as an EncString.
3329
- * @param {Uint8Array} key_to_be_wrapped
3330
- * @param {Uint8Array} wrapping_key
3331
- * @returns {string}
3332
- */
3333
- static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
3334
- let deferred4_0;
3335
- let deferred4_1;
3336
- try {
3337
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3338
- const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
3339
- const len0 = WASM_VECTOR_LEN;
3340
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3341
- const len1 = WASM_VECTOR_LEN;
3342
- wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3343
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3344
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3345
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3346
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3347
- var ptr3 = r0;
3348
- var len3 = r1;
3349
- if (r3) {
3350
- ptr3 = 0;
3351
- len3 = 0;
3352
- throw takeObject(r2);
3353
- }
3354
- deferred4_0 = ptr3;
3355
- deferred4_1 = len3;
3356
- return getStringFromWasm0(ptr3, len3);
3357
- } finally {
3358
- wasm.__wbindgen_add_to_stack_pointer(16);
3359
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3360
- }
3361
- }
3362
- /**
3363
- * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
3364
- * unwrapped key as a serialized byte array.
3365
- * @param {string} wrapped_key
3366
- * @param {Uint8Array} wrapping_key
3367
- * @returns {Uint8Array}
3368
- */
3369
- static unwrap_symmetric_key(wrapped_key, wrapping_key) {
3370
- try {
3371
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3372
- const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3373
- const len0 = WASM_VECTOR_LEN;
3374
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3375
- const len1 = WASM_VECTOR_LEN;
3376
- wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3377
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3378
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3379
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3380
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3381
- if (r3) {
3382
- throw takeObject(r2);
3383
- }
3384
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3385
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3386
- return v3;
3387
- } finally {
3388
- wasm.__wbindgen_add_to_stack_pointer(16);
3389
- }
3390
- }
3391
- /**
3392
- * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
3393
- * key. Note: Usually, a public key is - by definition - public, so this should not be
3394
- * used. The specific use-case for this function is to enable rotateable key sets, where
3395
- * the "public key" is not public, with the intent of preventing the server from being able
3396
- * to overwrite the user key unlocked by the rotateable keyset.
3397
- * @param {Uint8Array} encapsulation_key
3398
- * @param {Uint8Array} wrapping_key
3399
- * @returns {string}
3400
- */
3401
- static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
3402
- let deferred4_0;
3403
- let deferred4_1;
3404
- try {
3405
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3406
- const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3407
- const len0 = WASM_VECTOR_LEN;
3408
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3409
- const len1 = WASM_VECTOR_LEN;
3410
- wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
3411
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3412
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3413
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3414
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3415
- var ptr3 = r0;
3416
- var len3 = r1;
3417
- if (r3) {
3418
- ptr3 = 0;
3419
- len3 = 0;
3420
- throw takeObject(r2);
3421
- }
3422
- deferred4_0 = ptr3;
3423
- deferred4_1 = len3;
3424
- return getStringFromWasm0(ptr3, len3);
3425
- } finally {
3426
- wasm.__wbindgen_add_to_stack_pointer(16);
3427
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3428
- }
3429
- }
3430
- /**
3431
- * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
3432
- * wrapping key.
3433
- * @param {string} wrapped_key
3434
- * @param {Uint8Array} wrapping_key
3435
- * @returns {Uint8Array}
3436
- */
3437
- static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
3438
- try {
3439
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3440
- const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3441
- const len0 = WASM_VECTOR_LEN;
3442
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3443
- const len1 = WASM_VECTOR_LEN;
3444
- wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3445
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3446
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3447
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3448
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3449
- if (r3) {
3450
- throw takeObject(r2);
3451
- }
3452
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3453
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3454
- return v3;
3455
- } finally {
3456
- wasm.__wbindgen_add_to_stack_pointer(16);
3457
- }
3458
- }
3459
- /**
3460
- * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
3461
- * key,
3462
- * @param {Uint8Array} decapsulation_key
3463
- * @param {Uint8Array} wrapping_key
3464
- * @returns {string}
3465
- */
3466
- static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
3467
- let deferred4_0;
3468
- let deferred4_1;
3469
- try {
3470
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3471
- const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3472
- const len0 = WASM_VECTOR_LEN;
3473
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3474
- const len1 = WASM_VECTOR_LEN;
3475
- wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3476
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3477
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3478
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3479
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3480
- var ptr3 = r0;
3481
- var len3 = r1;
3482
- if (r3) {
3483
- ptr3 = 0;
3484
- len3 = 0;
3485
- throw takeObject(r2);
3486
- }
3487
- deferred4_0 = ptr3;
3488
- deferred4_1 = len3;
3489
- return getStringFromWasm0(ptr3, len3);
3490
- } finally {
3491
- wasm.__wbindgen_add_to_stack_pointer(16);
3492
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3493
- }
3494
- }
3495
- /**
3496
- * Unwraps (decrypts) a wrapped PKCS8 DER encoded decapsulation (private) key using a symmetric
3497
- * wrapping key.
3498
- * @param {string} wrapped_key
3499
- * @param {Uint8Array} wrapping_key
3500
- * @returns {Uint8Array}
3501
- */
3502
- static unwrap_decapsulation_key(wrapped_key, wrapping_key) {
3503
- try {
3504
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3505
- const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3506
- const len0 = WASM_VECTOR_LEN;
3507
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3508
- const len1 = WASM_VECTOR_LEN;
3509
- wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3510
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3511
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3512
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3513
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3514
- if (r3) {
3515
- throw takeObject(r2);
3516
- }
3517
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3518
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3519
- return v3;
3520
- } finally {
3521
- wasm.__wbindgen_add_to_stack_pointer(16);
3522
- }
3523
- }
3524
- /**
3525
- * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
3526
- * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
3527
- * the sender's authenticity cannot be verified by the recipient.
3528
- * @param {Uint8Array} shared_key
3529
- * @param {Uint8Array} encapsulation_key
3530
- * @returns {string}
3531
- */
3532
- static encapsulate_key_unsigned(shared_key, encapsulation_key) {
3533
- let deferred4_0;
3534
- let deferred4_1;
3535
- try {
3536
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3537
- const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
3538
- const len0 = WASM_VECTOR_LEN;
3539
- const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3540
- const len1 = WASM_VECTOR_LEN;
3541
- wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3542
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3543
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3544
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3545
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3546
- var ptr3 = r0;
3547
- var len3 = r1;
3548
- if (r3) {
3549
- ptr3 = 0;
3550
- len3 = 0;
3551
- throw takeObject(r2);
3552
- }
3553
- deferred4_0 = ptr3;
3554
- deferred4_1 = len3;
3555
- return getStringFromWasm0(ptr3, len3);
3556
- } finally {
3557
- wasm.__wbindgen_add_to_stack_pointer(16);
3558
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3559
- }
3560
- }
3561
- /**
3562
- * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
3563
- * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
3564
- * recipient.
3565
- * @param {string} encapsulated_key
3566
- * @param {Uint8Array} decapsulation_key
3567
- * @returns {Uint8Array}
3568
- */
3569
- static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
3570
- try {
3571
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3572
- const ptr0 = passStringToWasm0(
3573
- encapsulated_key,
3574
- wasm.__wbindgen_malloc,
3575
- wasm.__wbindgen_realloc,
3576
- );
3577
- const len0 = WASM_VECTOR_LEN;
3578
- const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3579
- const len1 = WASM_VECTOR_LEN;
3580
- wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3581
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3582
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3583
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3584
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3585
- if (r3) {
3586
- throw takeObject(r2);
3587
- }
3588
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3589
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3590
- return v3;
3591
- } finally {
3592
- wasm.__wbindgen_add_to_stack_pointer(16);
3593
- }
3594
- }
3595
- /**
3596
- * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
3597
- * the corresponding verifying key.
3598
- * @param {string} signing_key
3599
- * @param {Uint8Array} wrapping_key
3600
- * @returns {Uint8Array}
3601
- */
3602
- static verifying_key_for_signing_key(signing_key, wrapping_key) {
3603
- try {
3604
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3605
- const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3606
- const len0 = WASM_VECTOR_LEN;
3607
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3608
- const len1 = WASM_VECTOR_LEN;
3609
- wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
3610
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3611
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3612
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3613
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3614
- if (r3) {
3615
- throw takeObject(r2);
3616
- }
3617
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3618
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3619
- return v3;
3620
- } finally {
3621
- wasm.__wbindgen_add_to_stack_pointer(16);
3622
- }
3623
- }
3624
- /**
3625
- * Returns the algorithm used for the given verifying key.
3626
- * @param {Uint8Array} verifying_key
3627
- * @returns {SignatureAlgorithm}
3628
- */
3629
- static key_algorithm_for_verifying_key(verifying_key) {
3630
- try {
3631
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3632
- const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3633
- const len0 = WASM_VECTOR_LEN;
3634
- wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
3635
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3636
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3637
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3638
- if (r2) {
3639
- throw takeObject(r1);
3640
- }
3641
- return takeObject(r0);
3642
- } finally {
3643
- wasm.__wbindgen_add_to_stack_pointer(16);
3644
- }
3645
- }
3646
- /**
3647
- * For a given signing identity (verifying key), this function verifies that the signing
3648
- * identity claimed ownership of the public key. This is a one-sided claim and merely shows
3649
- * that the signing identity has the intent to receive messages encrypted to the public
3650
- * key.
3651
- * @param {Uint8Array} signed_public_key
3652
- * @param {Uint8Array} verifying_key
3653
- * @returns {Uint8Array}
3654
- */
3655
- static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
3656
- try {
3657
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3658
- const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
3659
- const len0 = WASM_VECTOR_LEN;
3660
- const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3661
- const len1 = WASM_VECTOR_LEN;
3662
- wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
3663
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3664
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3665
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3666
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3667
- if (r3) {
3668
- throw takeObject(r2);
3669
- }
3670
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3671
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3672
- return v3;
3673
- } finally {
3674
- wasm.__wbindgen_add_to_stack_pointer(16);
3675
- }
3676
- }
3677
- /**
3678
- * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
3679
- * @param {Uint8Array} password
3680
- * @param {Uint8Array} salt
3681
- * @param {Kdf} kdf
3682
- * @returns {Uint8Array}
3683
- */
3684
- static derive_kdf_material(password, salt, kdf) {
3685
- try {
3686
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3687
- const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
3688
- const len0 = WASM_VECTOR_LEN;
3689
- const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
3690
- const len1 = WASM_VECTOR_LEN;
3691
- wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
3692
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3693
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3694
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3695
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3696
- if (r3) {
3697
- throw takeObject(r2);
3698
- }
3699
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3700
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3701
- return v3;
3702
- } finally {
3703
- wasm.__wbindgen_add_to_stack_pointer(16);
3704
- }
3705
- }
3706
- /**
3707
- * @param {string} encrypted_user_key
3708
- * @param {Uint8Array} master_key
3709
- * @returns {Uint8Array}
3710
- */
3711
- static decrypt_user_key_with_master_key(encrypted_user_key, master_key) {
3712
- try {
3713
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3714
- const ptr0 = passStringToWasm0(
3715
- encrypted_user_key,
3716
- wasm.__wbindgen_malloc,
3717
- wasm.__wbindgen_realloc,
3718
- );
3719
- const len0 = WASM_VECTOR_LEN;
3720
- const ptr1 = passArray8ToWasm0(master_key, wasm.__wbindgen_malloc);
3721
- const len1 = WASM_VECTOR_LEN;
3722
- wasm.purecrypto_decrypt_user_key_with_master_key(retptr, ptr0, len0, ptr1, len1);
3723
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3724
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3725
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3726
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3727
- if (r3) {
3728
- throw takeObject(r2);
3729
- }
3730
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3731
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3732
- return v3;
3733
- } finally {
3734
- wasm.__wbindgen_add_to_stack_pointer(16);
3735
- }
3736
- }
3737
- }
3738
-
3739
- const SendAccessClientFinalization =
3740
- typeof FinalizationRegistry === "undefined"
3741
- ? { register: () => {}, unregister: () => {} }
3742
- : new FinalizationRegistry((ptr) => wasm.__wbg_sendaccessclient_free(ptr >>> 0, 1));
3743
- /**
3744
- * The `SendAccessClient` is used to interact with the Bitwarden API to get send access tokens.
3745
- */
3746
- export class SendAccessClient {
3747
- static __wrap(ptr) {
3748
- ptr = ptr >>> 0;
3749
- const obj = Object.create(SendAccessClient.prototype);
3750
- obj.__wbg_ptr = ptr;
3751
- SendAccessClientFinalization.register(obj, obj.__wbg_ptr, obj);
3752
- return obj;
3753
- }
3754
-
3755
- __destroy_into_raw() {
3756
- const ptr = this.__wbg_ptr;
3757
- this.__wbg_ptr = 0;
3758
- SendAccessClientFinalization.unregister(this);
3759
- return ptr;
3760
- }
3761
-
3762
- free() {
3763
- const ptr = this.__destroy_into_raw();
3764
- wasm.__wbg_sendaccessclient_free(ptr, 0);
3765
- }
3766
- /**
3767
- * Requests a new send access token.
3768
- * @param {SendAccessTokenRequest} request
3769
- * @returns {Promise<SendAccessTokenResponse>}
3770
- */
3771
- request_send_access_token(request) {
3772
- const ret = wasm.sendaccessclient_request_send_access_token(
3773
- this.__wbg_ptr,
3774
- addHeapObject(request),
3775
- );
3776
- return takeObject(ret);
3777
- }
3778
- }
3779
-
3780
- const StateClientFinalization =
3781
- typeof FinalizationRegistry === "undefined"
3782
- ? { register: () => {}, unregister: () => {} }
3783
- : new FinalizationRegistry((ptr) => wasm.__wbg_stateclient_free(ptr >>> 0, 1));
3784
-
3785
- export class StateClient {
3786
- static __wrap(ptr) {
3787
- ptr = ptr >>> 0;
3788
- const obj = Object.create(StateClient.prototype);
3789
- obj.__wbg_ptr = ptr;
3790
- StateClientFinalization.register(obj, obj.__wbg_ptr, obj);
3791
- return obj;
3792
- }
3793
-
3794
- __destroy_into_raw() {
3795
- const ptr = this.__wbg_ptr;
3796
- this.__wbg_ptr = 0;
3797
- StateClientFinalization.unregister(this);
3798
- return ptr;
3799
- }
3800
-
3801
- free() {
3802
- const ptr = this.__destroy_into_raw();
3803
- wasm.__wbg_stateclient_free(ptr, 0);
3804
- }
3805
- /**
3806
- * @param {any} cipher_repository
3807
- */
3808
- register_cipher_repository(cipher_repository) {
3809
- wasm.stateclient_register_cipher_repository(this.__wbg_ptr, addHeapObject(cipher_repository));
3810
- }
3811
- /**
3812
- * @param {any} store
3813
- */
3814
- register_folder_repository(store) {
3815
- wasm.stateclient_register_folder_repository(this.__wbg_ptr, addHeapObject(store));
3816
- }
3817
- /**
3818
- * @param {Repositories} repositories
3819
- */
3820
- register_client_managed_repositories(repositories) {
3821
- wasm.stateclient_register_client_managed_repositories(
3822
- this.__wbg_ptr,
3823
- addHeapObject(repositories),
3824
- );
3825
- }
3826
- /**
3827
- * Initialize the database for SDK managed repositories.
3828
- * @param {IndexedDbConfiguration} configuration
3829
- * @returns {Promise<void>}
3830
- */
3831
- initialize_state(configuration) {
3832
- const ret = wasm.stateclient_initialize_state(this.__wbg_ptr, addHeapObject(configuration));
3833
- return takeObject(ret);
3834
- }
3835
- }
3836
-
3837
- const TotpClientFinalization =
3838
- typeof FinalizationRegistry === "undefined"
3839
- ? { register: () => {}, unregister: () => {} }
3840
- : new FinalizationRegistry((ptr) => wasm.__wbg_totpclient_free(ptr >>> 0, 1));
3841
-
3842
- export class TotpClient {
3843
- static __wrap(ptr) {
3844
- ptr = ptr >>> 0;
3845
- const obj = Object.create(TotpClient.prototype);
3846
- obj.__wbg_ptr = ptr;
3847
- TotpClientFinalization.register(obj, obj.__wbg_ptr, obj);
3848
- return obj;
3849
- }
3850
-
3851
- __destroy_into_raw() {
3852
- const ptr = this.__wbg_ptr;
3853
- this.__wbg_ptr = 0;
3854
- TotpClientFinalization.unregister(this);
3855
- return ptr;
3856
- }
3857
-
3858
- free() {
3859
- const ptr = this.__destroy_into_raw();
3860
- wasm.__wbg_totpclient_free(ptr, 0);
3861
- }
3862
- /**
3863
- * Generates a TOTP code from a provided key
3864
- *
3865
- * # Arguments
3866
- * - `key` - Can be:
3867
- * - A base32 encoded string
3868
- * - OTP Auth URI
3869
- * - Steam URI
3870
- * - `time_ms` - Optional timestamp in milliseconds
3871
- * @param {string} key
3872
- * @param {number | null} [time_ms]
3873
- * @returns {TotpResponse}
3874
- */
3875
- generate_totp(key, time_ms) {
3876
- try {
3877
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3878
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3879
- const len0 = WASM_VECTOR_LEN;
3880
- wasm.totpclient_generate_totp(
3881
- retptr,
3882
- this.__wbg_ptr,
3883
- ptr0,
3884
- len0,
3885
- !isLikeNone(time_ms),
3886
- isLikeNone(time_ms) ? 0 : time_ms,
3887
- );
3888
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3889
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3890
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3891
- if (r2) {
3892
- throw takeObject(r1);
3893
- }
3894
- return takeObject(r0);
3895
- } finally {
3896
- wasm.__wbindgen_add_to_stack_pointer(16);
3897
- }
3898
- }
3899
- }
3900
-
3901
- const VaultClientFinalization =
3902
- typeof FinalizationRegistry === "undefined"
3903
- ? { register: () => {}, unregister: () => {} }
3904
- : new FinalizationRegistry((ptr) => wasm.__wbg_vaultclient_free(ptr >>> 0, 1));
3905
-
3906
- export class VaultClient {
3907
- static __wrap(ptr) {
3908
- ptr = ptr >>> 0;
3909
- const obj = Object.create(VaultClient.prototype);
3910
- obj.__wbg_ptr = ptr;
3911
- VaultClientFinalization.register(obj, obj.__wbg_ptr, obj);
3912
- return obj;
3913
- }
3914
-
3915
- __destroy_into_raw() {
3916
- const ptr = this.__wbg_ptr;
3917
- this.__wbg_ptr = 0;
3918
- VaultClientFinalization.unregister(this);
3919
- return ptr;
3920
- }
3921
-
3922
- free() {
3923
- const ptr = this.__destroy_into_raw();
3924
- wasm.__wbg_vaultclient_free(ptr, 0);
3925
- }
3926
- /**
3927
- * Attachment related operations.
3928
- * @returns {AttachmentsClient}
3929
- */
3930
- attachments() {
3931
- const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
3932
- return AttachmentsClient.__wrap(ret);
3933
- }
3934
- /**
3935
- * Cipher related operations.
3936
- * @returns {CiphersClient}
3937
- */
3938
- ciphers() {
3939
- const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
3940
- return CiphersClient.__wrap(ret);
3941
- }
3942
- /**
3943
- * Folder related operations.
3944
- * @returns {FoldersClient}
3945
- */
3946
- folders() {
3947
- const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
3948
- return FoldersClient.__wrap(ret);
3949
- }
3950
- /**
3951
- * TOTP related operations.
3952
- * @returns {TotpClient}
3953
- */
3954
- totp() {
3955
- const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
3956
- return TotpClient.__wrap(ret);
3957
- }
3958
- /**
3959
- * Collection related operations.
3960
- * @returns {CollectionsClient}
3961
- */
3962
- collections() {
3963
- const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
3964
- return CollectionsClient.__wrap(ret);
3965
- }
3966
- }
3967
-
3968
- export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
3969
- const ret = String(getObject(arg1));
3970
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3971
- const len1 = WASM_VECTOR_LEN;
3972
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3973
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3974
- }
3975
-
3976
- export function __wbg_abort_410ec47a64ac6117(arg0, arg1) {
3977
- getObject(arg0).abort(getObject(arg1));
3978
- }
3979
-
3980
- export function __wbg_abort_775ef1d17fc65868(arg0) {
3981
- getObject(arg0).abort();
3982
- }
3983
-
3984
- export function __wbg_abort_99fc644e2c79c9fb() {
3985
- return handleError(function (arg0) {
3986
- getObject(arg0).abort();
3987
- }, arguments);
3988
- }
3989
-
3990
- export function __wbg_addEventListener_dc3da056b615f634(arg0, arg1, arg2, arg3) {
3991
- getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
3992
- }
3993
-
3994
- export function __wbg_append_299d5d48292c0495() {
3995
- return handleError(function (arg0, arg1, arg2, arg3, arg4) {
3996
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
3997
- }, arguments);
3998
- }
3999
-
4000
- export function __wbg_append_8c7dd8d641a5f01b() {
4001
- return handleError(function (arg0, arg1, arg2, arg3, arg4) {
4002
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
4003
- }, arguments);
4004
- }
4005
-
4006
- export function __wbg_append_b2d1fc16de2a0e81() {
4007
- return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
4008
- getObject(arg0).append(
4009
- getStringFromWasm0(arg1, arg2),
4010
- getObject(arg3),
4011
- getStringFromWasm0(arg4, arg5),
4012
- );
4013
- }, arguments);
4014
- }
4015
-
4016
- export function __wbg_append_b44785ebeb668479() {
4017
- return handleError(function (arg0, arg1, arg2, arg3) {
4018
- getObject(arg0).append(getStringFromWasm0(arg1, arg2), getObject(arg3));
4019
- }, arguments);
4020
- }
4021
-
4022
- export function __wbg_arrayBuffer_d1b44c4390db422f() {
4023
- return handleError(function (arg0) {
4024
- const ret = getObject(arg0).arrayBuffer();
4025
- return addHeapObject(ret);
4026
- }, arguments);
4027
- }
4028
-
4029
- export function __wbg_buffer_609cc3eee51ed158(arg0) {
4030
- const ret = getObject(arg0).buffer;
4031
- return addHeapObject(ret);
4032
- }
4033
-
4034
- export function __wbg_call_672a4d21634d4a24() {
4035
- return handleError(function (arg0, arg1) {
4036
- const ret = getObject(arg0).call(getObject(arg1));
4037
- return addHeapObject(ret);
4038
- }, arguments);
4039
- }
4040
-
4041
- export function __wbg_call_7cccdd69e0791ae2() {
4042
- return handleError(function (arg0, arg1, arg2) {
4043
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
4044
- return addHeapObject(ret);
4045
- }, arguments);
4046
- }
4047
-
4048
- export function __wbg_cipher_da6f42b22b504156(arg0) {
4049
- const ret = getObject(arg0).cipher;
4050
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4051
- }
4052
-
4053
- export function __wbg_clearTimeout_b1115618e821c3b2(arg0) {
4054
- const ret = clearTimeout(takeObject(arg0));
4055
- return addHeapObject(ret);
4056
- }
4057
-
4058
- export function __wbg_collectionviewnodeitem_new(arg0) {
4059
- const ret = CollectionViewNodeItem.__wrap(arg0);
4060
- return addHeapObject(ret);
4061
- }
4062
-
4063
- export function __wbg_createObjectStore_d2f9e1016f4d81b9() {
4064
- return handleError(function (arg0, arg1, arg2, arg3) {
4065
- const ret = getObject(arg0).createObjectStore(getStringFromWasm0(arg1, arg2), getObject(arg3));
4066
- return addHeapObject(ret);
4067
- }, arguments);
4068
- }
4069
-
4070
- export function __wbg_crypto_574e78ad8b13b65f(arg0) {
4071
- const ret = getObject(arg0).crypto;
4072
- return addHeapObject(ret);
4073
- }
4074
-
4075
- export function __wbg_debug_e17b51583ca6a632(arg0, arg1, arg2, arg3) {
4076
- console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4077
- }
4078
-
4079
- export function __wbg_deleteObjectStore_3f08ae00cd288224() {
4080
- return handleError(function (arg0, arg1, arg2) {
4081
- getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
4082
- }, arguments);
4083
- }
4084
-
4085
- export function __wbg_done_769e5ede4b31c67b(arg0) {
4086
- const ret = getObject(arg0).done;
4087
- return ret;
4088
- }
4089
-
4090
- export function __wbg_entries_3265d4158b33e5dc(arg0) {
4091
- const ret = Object.entries(getObject(arg0));
4092
- return addHeapObject(ret);
4093
- }
4094
-
4095
- export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
4096
- let deferred0_0;
4097
- let deferred0_1;
4098
- try {
4099
- deferred0_0 = arg0;
4100
- deferred0_1 = arg1;
4101
- console.error(getStringFromWasm0(arg0, arg1));
4102
- } finally {
4103
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4104
- }
4105
- }
4106
-
4107
- export function __wbg_error_80de38b3f7cc3c3c(arg0, arg1, arg2, arg3) {
4108
- console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4109
- }
4110
-
4111
- export function __wbg_error_ff4ddaabdfc5dbb3() {
4112
- return handleError(function (arg0) {
4113
- const ret = getObject(arg0).error;
4114
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4115
- }, arguments);
4116
- }
4117
-
4118
- export function __wbg_fetch_3afbdcc7ddbf16fe(arg0) {
4119
- const ret = fetch(getObject(arg0));
4120
- return addHeapObject(ret);
4121
- }
4122
-
4123
- export function __wbg_fetch_509096533071c657(arg0, arg1) {
4124
- const ret = getObject(arg0).fetch(getObject(arg1));
4125
- return addHeapObject(ret);
4126
- }
4127
-
4128
- export function __wbg_folder_aa518f77d34ca1d4(arg0) {
4129
- const ret = getObject(arg0).folder;
4130
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4131
- }
4132
-
4133
- export function __wbg_getRandomValues_38097e921c2494c3() {
4134
- return handleError(function (arg0, arg1) {
4135
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
4136
- }, arguments);
4137
- }
4138
-
4139
- export function __wbg_getRandomValues_b8f5dbd5f3995a9e() {
4140
- return handleError(function (arg0, arg1) {
4141
- getObject(arg0).getRandomValues(getObject(arg1));
4142
- }, arguments);
4143
- }
4144
-
4145
- export function __wbg_getTime_46267b1c24877e30(arg0) {
4146
- const ret = getObject(arg0).getTime();
4147
- return ret;
4148
- }
4149
-
4150
- export function __wbg_get_079e75476c741988() {
4151
- return handleError(function (arg0, arg1, arg2) {
4152
- let deferred0_0;
4153
- let deferred0_1;
4154
- try {
4155
- deferred0_0 = arg1;
4156
- deferred0_1 = arg2;
4157
- const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2));
4158
- return addHeapObject(ret);
4159
- } finally {
4160
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4161
- }
4162
- }, arguments);
4163
- }
4164
-
4165
- export function __wbg_get_67b2ba62fc30de12() {
4166
- return handleError(function (arg0, arg1) {
4167
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
4168
- return addHeapObject(ret);
4169
- }, arguments);
4170
- }
4171
-
4172
- export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
4173
- const ret = getObject(arg0)[arg1 >>> 0];
4174
- return addHeapObject(ret);
4175
- }
4176
-
4177
- export function __wbg_get_ddc5614a79e0f53e() {
4178
- return handleError(function (arg0, arg1, arg2) {
4179
- let deferred0_0;
4180
- let deferred0_1;
4181
- try {
4182
- deferred0_0 = arg1;
4183
- deferred0_1 = arg2;
4184
- const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2));
4185
- return addHeapObject(ret);
4186
- } finally {
4187
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4188
- }
4189
- }, arguments);
4190
- }
4191
-
4192
- export function __wbg_getaccesstoken_aed711374b7de179(arg0) {
4193
- const ret = getObject(arg0).get_access_token();
4194
- return addHeapObject(ret);
4195
- }
4196
-
4197
- export function __wbg_getwithrefkey_1dc361bd10053bfe(arg0, arg1) {
4198
- const ret = getObject(arg0)[getObject(arg1)];
4199
- return addHeapObject(ret);
4200
- }
4201
-
4202
- export function __wbg_has_a5ea9117f258a0ec() {
4203
- return handleError(function (arg0, arg1) {
4204
- const ret = Reflect.has(getObject(arg0), getObject(arg1));
4205
- return ret;
4206
- }, arguments);
4207
- }
4208
-
4209
- export function __wbg_headers_9cb51cfd2ac780a4(arg0) {
4210
- const ret = getObject(arg0).headers;
4211
- return addHeapObject(ret);
4212
- }
4213
-
4214
- export function __wbg_incomingmessage_new(arg0) {
4215
- const ret = IncomingMessage.__wrap(arg0);
4216
- return addHeapObject(ret);
4217
- }
4218
-
4219
- export function __wbg_indexedDB_b1f49280282046f8() {
4220
- return handleError(function (arg0) {
4221
- const ret = getObject(arg0).indexedDB;
4222
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4223
- }, arguments);
4224
- }
4225
-
4226
- export function __wbg_indexedDB_f6b47b0dc333fd2f() {
4227
- return handleError(function (arg0) {
4228
- const ret = getObject(arg0).indexedDB;
4229
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4230
- }, arguments);
4231
- }
4232
-
4233
- export function __wbg_info_033d8b8a0838f1d3(arg0, arg1, arg2, arg3) {
4234
- console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4235
- }
4236
-
4237
- export function __wbg_instanceof_ArrayBuffer_e14585432e3737fc(arg0) {
4238
- let result;
4239
- try {
4240
- result = getObject(arg0) instanceof ArrayBuffer;
4241
- } catch (_) {
4242
- result = false;
4243
- }
4244
- const ret = result;
4245
- return ret;
4246
- }
4247
-
4248
- export function __wbg_instanceof_DomException_ed1ccb7aaf39034c(arg0) {
4249
- let result;
4250
- try {
4251
- result = getObject(arg0) instanceof DOMException;
4252
- } catch (_) {
4253
- result = false;
4254
- }
4255
- const ret = result;
4256
- return ret;
4257
- }
4258
-
4259
- export function __wbg_instanceof_IdbDatabase_a3ef009ca00059f9(arg0) {
4260
- let result;
4261
- try {
4262
- result = getObject(arg0) instanceof IDBDatabase;
4263
- } catch (_) {
4264
- result = false;
4265
- }
4266
- const ret = result;
4267
- return ret;
4268
- }
4269
-
4270
- export function __wbg_instanceof_IdbOpenDbRequest_a3416e156c9db893(arg0) {
4271
- let result;
4272
- try {
4273
- result = getObject(arg0) instanceof IDBOpenDBRequest;
4274
- } catch (_) {
4275
- result = false;
4276
- }
4277
- const ret = result;
4278
- return ret;
4279
- }
4280
-
4281
- export function __wbg_instanceof_IdbRequest_4813c3f207666aa4(arg0) {
4282
- let result;
4283
- try {
4284
- result = getObject(arg0) instanceof IDBRequest;
4285
- } catch (_) {
4286
- result = false;
4287
- }
4288
- const ret = result;
4289
- return ret;
4290
- }
4291
-
4292
- export function __wbg_instanceof_Map_f3469ce2244d2430(arg0) {
4293
- let result;
4294
- try {
4295
- result = getObject(arg0) instanceof Map;
4296
- } catch (_) {
4297
- result = false;
4298
- }
4299
- const ret = result;
4300
- return ret;
4301
- }
4302
-
4303
- export function __wbg_instanceof_Response_f2cc20d9f7dfd644(arg0) {
4304
- let result;
4305
- try {
4306
- result = getObject(arg0) instanceof Response;
4307
- } catch (_) {
4308
- result = false;
4309
- }
4310
- const ret = result;
4311
- return ret;
4312
- }
4313
-
4314
- export function __wbg_instanceof_Uint8Array_17156bcf118086a9(arg0) {
4315
- let result;
4316
- try {
4317
- result = getObject(arg0) instanceof Uint8Array;
4318
- } catch (_) {
4319
- result = false;
4320
- }
4321
- const ret = result;
4322
- return ret;
4323
- }
4324
-
4325
- export function __wbg_instanceof_Window_def73ea0955fc569(arg0) {
4326
- let result;
4327
- try {
4328
- result = getObject(arg0) instanceof Window;
4329
- } catch (_) {
4330
- result = false;
4331
- }
4332
- const ret = result;
4333
- return ret;
4334
- }
4335
-
4336
- export function __wbg_instanceof_WorkerGlobalScope_dbdbdea7e3b56493(arg0) {
4337
- let result;
4338
- try {
4339
- result = getObject(arg0) instanceof WorkerGlobalScope;
4340
- } catch (_) {
4341
- result = false;
4342
- }
4343
- const ret = result;
4344
- return ret;
4345
- }
4346
-
4347
- export function __wbg_ipcclientsubscription_new(arg0) {
4348
- const ret = IpcClientSubscription.__wrap(arg0);
4349
- return addHeapObject(ret);
4350
- }
4351
-
4352
- export function __wbg_isArray_a1eab7e0d067391b(arg0) {
4353
- const ret = Array.isArray(getObject(arg0));
4354
- return ret;
4355
- }
4356
-
4357
- export function __wbg_isSafeInteger_343e2beeeece1bb0(arg0) {
4358
- const ret = Number.isSafeInteger(getObject(arg0));
4359
- return ret;
4360
- }
4361
-
4362
- export function __wbg_iterator_9a24c88df860dc65() {
4363
- const ret = Symbol.iterator;
4364
- return addHeapObject(ret);
4365
- }
4366
-
4367
- export function __wbg_length_a446193dc22c12f8(arg0) {
4368
- const ret = getObject(arg0).length;
4369
- return ret;
4370
- }
4371
-
4372
- export function __wbg_length_e2d2a49132c1b256(arg0) {
4373
- const ret = getObject(arg0).length;
4374
- return ret;
4375
- }
4376
-
4377
- export function __wbg_list_2e1ff5bb1edcdff6() {
4378
- return handleError(function (arg0) {
4379
- const ret = getObject(arg0).list();
4380
- return addHeapObject(ret);
4381
- }, arguments);
4382
- }
4383
-
4384
- export function __wbg_list_799aeedf8a6950bf() {
4385
- return handleError(function (arg0) {
4386
- const ret = getObject(arg0).list();
4387
- return addHeapObject(ret);
4388
- }, arguments);
4389
- }
4390
-
4391
- export function __wbg_log_cad59bb680daec67(arg0, arg1, arg2, arg3) {
4392
- console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4393
- }
4394
-
4395
- export function __wbg_msCrypto_a61aeb35a24c1329(arg0) {
4396
- const ret = getObject(arg0).msCrypto;
4397
- return addHeapObject(ret);
4398
- }
4399
-
4400
- export function __wbg_name_f2d27098bfd843e7(arg0, arg1) {
4401
- const ret = getObject(arg1).name;
4402
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4403
- const len1 = WASM_VECTOR_LEN;
4404
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4405
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4406
- }
4407
-
4408
- export function __wbg_new0_f788a2397c7ca929() {
4409
- const ret = new Date();
4410
- return addHeapObject(ret);
4411
- }
4412
-
4413
- export function __wbg_new_018dcc2d6c8c2f6a() {
4414
- return handleError(function () {
4415
- const ret = new Headers();
4416
- return addHeapObject(ret);
4417
- }, arguments);
4418
- }
4419
-
4420
- export function __wbg_new_23a2665fac83c611(arg0, arg1) {
4421
- try {
4422
- var state0 = { a: arg0, b: arg1 };
4423
- var cb0 = (arg0, arg1) => {
4424
- const a = state0.a;
4425
- state0.a = 0;
4426
- try {
4427
- return __wbg_adapter_341(a, state0.b, arg0, arg1);
4428
- } finally {
4429
- state0.a = a;
4430
- }
4431
- };
4432
- const ret = new Promise(cb0);
4433
- return addHeapObject(ret);
4434
- } finally {
4435
- state0.a = state0.b = 0;
4436
- }
4437
- }
4438
-
4439
- export function __wbg_new_405e22f390576ce2() {
4440
- const ret = new Object();
4441
- return addHeapObject(ret);
4442
- }
4443
-
4444
- export function __wbg_new_5e0be73521bc8c17() {
4445
- const ret = new Map();
4446
- return addHeapObject(ret);
4447
- }
4448
-
4449
- export function __wbg_new_78feb108b6472713() {
4450
- const ret = new Array();
4451
- return addHeapObject(ret);
4452
- }
4453
-
4454
- export function __wbg_new_8a6f238a6ece86ea() {
4455
- const ret = new Error();
4456
- return addHeapObject(ret);
4457
- }
4458
-
4459
- export function __wbg_new_9fd39a253424609a() {
4460
- return handleError(function () {
4461
- const ret = new FormData();
4462
- return addHeapObject(ret);
4463
- }, arguments);
4464
- }
4465
-
4466
- export function __wbg_new_a12002a7f91c75be(arg0) {
4467
- const ret = new Uint8Array(getObject(arg0));
4468
- return addHeapObject(ret);
4469
- }
4470
-
4471
- export function __wbg_new_c68d7209be747379(arg0, arg1) {
4472
- const ret = new Error(getStringFromWasm0(arg0, arg1));
4473
- return addHeapObject(ret);
4474
- }
4475
-
4476
- export function __wbg_new_e25e5aab09ff45db() {
4477
- return handleError(function () {
4478
- const ret = new AbortController();
4479
- return addHeapObject(ret);
4480
- }, arguments);
4481
- }
4482
-
4483
- export function __wbg_new_f24b6d53abe5bc82(arg0, arg1) {
4484
- let deferred0_0;
4485
- let deferred0_1;
4486
- try {
4487
- deferred0_0 = arg0;
4488
- deferred0_1 = arg1;
4489
- const ret = new Error(getStringFromWasm0(arg0, arg1));
4490
- return addHeapObject(ret);
4491
- } finally {
4492
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4493
- }
4494
- }
4495
-
4496
- export function __wbg_newnoargs_105ed471475aaf50(arg0, arg1) {
4497
- const ret = new Function(getStringFromWasm0(arg0, arg1));
4498
- return addHeapObject(ret);
4499
- }
4500
-
4501
- export function __wbg_newwithbyteoffsetandlength_d97e637ebe145a9a(arg0, arg1, arg2) {
4502
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
4503
- return addHeapObject(ret);
4504
- }
4505
-
4506
- export function __wbg_newwithlength_a381634e90c276d4(arg0) {
4507
- const ret = new Uint8Array(arg0 >>> 0);
4508
- return addHeapObject(ret);
4509
- }
4510
-
4511
- export function __wbg_newwithstrandinit_06c535e0a867c635() {
4512
- return handleError(function (arg0, arg1, arg2) {
4513
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
4514
- return addHeapObject(ret);
4515
- }, arguments);
4516
- }
4517
-
4518
- export function __wbg_newwithu8arraysequenceandoptions_068570c487f69127() {
4519
- return handleError(function (arg0, arg1) {
4520
- const ret = new Blob(getObject(arg0), getObject(arg1));
4521
- return addHeapObject(ret);
4522
- }, arguments);
4523
- }
4524
-
4525
- export function __wbg_next_25feadfc0913fea9(arg0) {
4526
- const ret = getObject(arg0).next;
4527
- return addHeapObject(ret);
4528
- }
4529
-
4530
- export function __wbg_next_6574e1a8a62d1055() {
4531
- return handleError(function (arg0) {
4532
- const ret = getObject(arg0).next();
4533
- return addHeapObject(ret);
4534
- }, arguments);
4535
- }
4536
-
4537
- export function __wbg_node_905d3e251edff8a2(arg0) {
4538
- const ret = getObject(arg0).node;
4539
- return addHeapObject(ret);
4540
- }
4541
-
4542
- export function __wbg_open_e0c0b2993eb596e1() {
4543
- return handleError(function (arg0, arg1, arg2, arg3) {
4544
- const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
4545
- return addHeapObject(ret);
4546
- }, arguments);
4547
- }
4548
-
4549
- export function __wbg_parse_def2e24ef1252aff() {
4550
- return handleError(function (arg0, arg1) {
4551
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
4552
- return addHeapObject(ret);
4553
- }, arguments);
4554
- }
4555
-
4556
- export function __wbg_preventDefault_c2314fd813c02b3c(arg0) {
4557
- getObject(arg0).preventDefault();
4558
- }
4559
-
4560
- export function __wbg_process_dc0fbacc7c1c06f7(arg0) {
4561
- const ret = getObject(arg0).process;
4562
- return addHeapObject(ret);
4563
- }
4564
-
4565
- export function __wbg_push_737cfc8c1432c2c6(arg0, arg1) {
4566
- const ret = getObject(arg0).push(getObject(arg1));
4567
- return ret;
4568
- }
4569
-
4570
- export function __wbg_queueMicrotask_97d92b4fcc8a61c5(arg0) {
4571
- queueMicrotask(getObject(arg0));
4572
- }
4573
-
4574
- export function __wbg_queueMicrotask_d3219def82552485(arg0) {
4575
- const ret = getObject(arg0).queueMicrotask;
4576
- return addHeapObject(ret);
4577
- }
4578
-
4579
- export function __wbg_randomFillSync_ac0988aba3254290() {
4580
- return handleError(function (arg0, arg1) {
4581
- getObject(arg0).randomFillSync(takeObject(arg1));
4582
- }, arguments);
4583
- }
4584
-
4585
- export function __wbg_remove_aa3e7e71f7fc38bb() {
4586
- return handleError(function (arg0, arg1, arg2) {
4587
- let deferred0_0;
4588
- let deferred0_1;
4589
- try {
4590
- deferred0_0 = arg1;
4591
- deferred0_1 = arg2;
4592
- const ret = getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
4593
- return addHeapObject(ret);
4594
- } finally {
4595
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4596
- }
4597
- }, arguments);
4598
- }
4599
-
4600
- export function __wbg_remove_d9e4c76546611386() {
4601
- return handleError(function (arg0, arg1, arg2) {
4602
- let deferred0_0;
4603
- let deferred0_1;
4604
- try {
4605
- deferred0_0 = arg1;
4606
- deferred0_1 = arg2;
4607
- const ret = getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
4608
- return addHeapObject(ret);
4609
- } finally {
4610
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4611
- }
4612
- }, arguments);
4613
- }
4614
-
4615
- export function __wbg_require_60cc747a6bc5215a() {
4616
- return handleError(function () {
4617
- const ret = module.require;
4618
- return addHeapObject(ret);
4619
- }, arguments);
4620
- }
4621
-
4622
- export function __wbg_resolve_4851785c9c5f573d(arg0) {
4623
- const ret = Promise.resolve(getObject(arg0));
4624
- return addHeapObject(ret);
4625
- }
4626
-
4627
- export function __wbg_result_f29afabdf2c05826() {
4628
- return handleError(function (arg0) {
4629
- const ret = getObject(arg0).result;
4630
- return addHeapObject(ret);
4631
- }, arguments);
4632
- }
4633
-
4634
- export function __wbg_send_9b8fc6bb517867dd() {
4635
- return handleError(function (arg0, arg1) {
4636
- const ret = getObject(arg0).send(OutgoingMessage.__wrap(arg1));
4637
- return addHeapObject(ret);
4638
- }, arguments);
4639
- }
4640
-
4641
- export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
4642
- const ret = setTimeout(getObject(arg0), arg1);
4643
- return addHeapObject(ret);
4644
- }
4645
-
4646
- export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
4647
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
4648
- }
4649
-
4650
- export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
4651
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
4652
- }
4653
-
4654
- export function __wbg_set_5780424121460bb2() {
4655
- return handleError(function (arg0, arg1, arg2, arg3) {
4656
- let deferred0_0;
4657
- let deferred0_1;
4658
- try {
4659
- deferred0_0 = arg1;
4660
- deferred0_1 = arg2;
4661
- const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
4662
- return addHeapObject(ret);
4663
- } finally {
4664
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4665
- }
4666
- }, arguments);
4667
- }
4668
-
4669
- export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
4670
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4671
- }
4672
-
4673
- export function __wbg_set_843ff2720448142f() {
4674
- return handleError(function (arg0, arg1, arg2, arg3) {
4675
- let deferred0_0;
4676
- let deferred0_1;
4677
- try {
4678
- deferred0_0 = arg1;
4679
- deferred0_1 = arg2;
4680
- const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
4681
- return addHeapObject(ret);
4682
- } finally {
4683
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4684
- }
4685
- }, arguments);
4686
- }
4687
-
4688
- export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
4689
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
4690
- return addHeapObject(ret);
4691
- }
4692
-
4693
- export function __wbg_setbody_5923b78a95eedf29(arg0, arg1) {
4694
- getObject(arg0).body = getObject(arg1);
4695
- }
4696
-
4697
- export function __wbg_setcredentials_c3a22f1cd105a2c6(arg0, arg1) {
4698
- getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
4699
- }
4700
-
4701
- export function __wbg_setheaders_834c0bdb6a8949ad(arg0, arg1) {
4702
- getObject(arg0).headers = getObject(arg1);
4703
- }
4704
-
4705
- export function __wbg_setmethod_3c5280fe5d890842(arg0, arg1, arg2) {
4706
- getObject(arg0).method = getStringFromWasm0(arg1, arg2);
4707
- }
4708
-
4709
- export function __wbg_setmode_5dc300b865044b65(arg0, arg1) {
4710
- getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
4711
- }
4712
-
4713
- export function __wbg_setname_c0e2d6f348c746f4(arg0, arg1, arg2) {
4714
- let deferred0_0;
4715
- let deferred0_1;
4716
- try {
4717
- deferred0_0 = arg1;
4718
- deferred0_1 = arg2;
4719
- getObject(arg0).name = getStringFromWasm0(arg1, arg2);
4720
- } finally {
4721
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4722
- }
4723
- }
4724
-
4725
- export function __wbg_setonerror_d7e3056cc6e56085(arg0, arg1) {
4726
- getObject(arg0).onerror = getObject(arg1);
4727
- }
4728
-
4729
- export function __wbg_setonsuccess_afa464ee777a396d(arg0, arg1) {
4730
- getObject(arg0).onsuccess = getObject(arg1);
4731
- }
4732
-
4733
- export function __wbg_setonupgradeneeded_fcf7ce4f2eb0cb5f(arg0, arg1) {
4734
- getObject(arg0).onupgradeneeded = getObject(arg1);
4735
- }
4736
-
4737
- export function __wbg_setsignal_75b21ef3a81de905(arg0, arg1) {
4738
- getObject(arg0).signal = getObject(arg1);
4739
- }
4740
-
4741
- export function __wbg_settype_39ed370d3edd403c(arg0, arg1, arg2) {
4742
- getObject(arg0).type = getStringFromWasm0(arg1, arg2);
4743
- }
4744
-
4745
- export function __wbg_setvariant_d1d41b778dfe9c17(arg0, arg1, arg2) {
4746
- let deferred0_0;
4747
- let deferred0_1;
4748
- try {
4749
- deferred0_0 = arg1;
4750
- deferred0_1 = arg2;
4751
- getObject(arg0).variant = getStringFromWasm0(arg1, arg2);
4752
- } finally {
4753
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4754
- }
4755
- }
4756
-
4757
- export function __wbg_signal_aaf9ad74119f20a4(arg0) {
4758
- const ret = getObject(arg0).signal;
4759
- return addHeapObject(ret);
4760
- }
4761
-
4762
- export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
4763
- const ret = getObject(arg1).stack;
4764
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4765
- const len1 = WASM_VECTOR_LEN;
4766
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4767
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4768
- }
4769
-
4770
- export function __wbg_static_accessor_GLOBAL_88a902d13a557d07() {
4771
- const ret = typeof global === "undefined" ? null : global;
4772
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4773
- }
4774
-
4775
- export function __wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0() {
4776
- const ret = typeof globalThis === "undefined" ? null : globalThis;
4777
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4778
- }
4779
-
4780
- export function __wbg_static_accessor_SELF_37c5d418e4bf5819() {
4781
- const ret = typeof self === "undefined" ? null : self;
4782
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4783
- }
4784
-
4785
- export function __wbg_static_accessor_WINDOW_5de37043a91a9c40() {
4786
- const ret = typeof window === "undefined" ? null : window;
4787
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4788
- }
4789
-
4790
- export function __wbg_status_f6360336ca686bf0(arg0) {
4791
- const ret = getObject(arg0).status;
4792
- return ret;
4793
- }
4794
-
4795
- export function __wbg_stringify_f7ed6987935b4a24() {
4796
- return handleError(function (arg0) {
4797
- const ret = JSON.stringify(getObject(arg0));
4798
- return addHeapObject(ret);
4799
- }, arguments);
4800
- }
4801
-
4802
- export function __wbg_subarray_aa9065fa9dc5df96(arg0, arg1, arg2) {
4803
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
4804
- return addHeapObject(ret);
4805
- }
4806
-
4807
- export function __wbg_target_0a62d9d79a2a1ede(arg0) {
4808
- const ret = getObject(arg0).target;
4809
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4810
- }
4811
-
4812
- export function __wbg_text_7805bea50de2af49() {
4813
- return handleError(function (arg0) {
4814
- const ret = getObject(arg0).text();
4815
- return addHeapObject(ret);
4816
- }, arguments);
4817
- }
4818
-
4819
- export function __wbg_then_44b73946d2fb3e7d(arg0, arg1) {
4820
- const ret = getObject(arg0).then(getObject(arg1));
4821
- return addHeapObject(ret);
4822
- }
4823
-
4824
- export function __wbg_then_48b406749878a531(arg0, arg1, arg2) {
4825
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
4826
- return addHeapObject(ret);
4827
- }
4828
-
4829
- export function __wbg_transaction_e713aa7b07ccaedd(arg0) {
4830
- const ret = getObject(arg0).transaction;
4831
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
4832
- }
4833
-
4834
- export function __wbg_url_ae10c34ca209681d(arg0, arg1) {
4835
- const ret = getObject(arg1).url;
4836
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4837
- const len1 = WASM_VECTOR_LEN;
4838
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4839
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4840
- }
4841
-
4842
- export function __wbg_value_cd1ffa7b1ab794f1(arg0) {
4843
- const ret = getObject(arg0).value;
4844
- return addHeapObject(ret);
4845
- }
4846
-
4847
- export function __wbg_versions_c01dfd4722a88165(arg0) {
4848
- const ret = getObject(arg0).versions;
4849
- return addHeapObject(ret);
4850
- }
4851
-
4852
- export function __wbg_warn_aaf1f4664a035bd6(arg0, arg1, arg2, arg3) {
4853
- console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4854
- }
4855
-
4856
- export function __wbindgen_array_new() {
4857
- const ret = [];
4858
- return addHeapObject(ret);
4859
- }
4860
-
4861
- export function __wbindgen_array_push(arg0, arg1) {
4862
- getObject(arg0).push(takeObject(arg1));
4863
- }
4864
-
4865
- export function __wbindgen_as_number(arg0) {
4866
- const ret = +getObject(arg0);
4867
- return ret;
4868
- }
4869
-
4870
- export function __wbindgen_bigint_from_i64(arg0) {
4871
- const ret = arg0;
4872
- return addHeapObject(ret);
4873
- }
4874
-
4875
- export function __wbindgen_bigint_from_u64(arg0) {
4876
- const ret = BigInt.asUintN(64, arg0);
4877
- return addHeapObject(ret);
4878
- }
4879
-
4880
- export function __wbindgen_bigint_get_as_i64(arg0, arg1) {
4881
- const v = getObject(arg1);
4882
- const ret = typeof v === "bigint" ? v : undefined;
4883
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
4884
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
4885
- }
4886
-
4887
- export function __wbindgen_boolean_get(arg0) {
4888
- const v = getObject(arg0);
4889
- const ret = typeof v === "boolean" ? (v ? 1 : 0) : 2;
4890
- return ret;
4891
- }
4892
-
4893
- export function __wbindgen_cb_drop(arg0) {
4894
- const obj = takeObject(arg0).original;
4895
- if (obj.cnt-- == 1) {
4896
- obj.a = 0;
4897
- return true;
4898
- }
4899
- const ret = false;
4900
- return ret;
4901
- }
4902
-
4903
- export function __wbindgen_closure_wrapper193(arg0, arg1, arg2) {
4904
- const ret = makeMutClosure(arg0, arg1, 7, __wbg_adapter_54);
4905
- return addHeapObject(ret);
4906
- }
4907
-
4908
- export function __wbindgen_closure_wrapper195(arg0, arg1, arg2) {
4909
- const ret = makeMutClosure(arg0, arg1, 7, __wbg_adapter_57);
4910
- return addHeapObject(ret);
4911
- }
4912
-
4913
- export function __wbindgen_closure_wrapper3848(arg0, arg1, arg2) {
4914
- const ret = makeMutClosure(arg0, arg1, 294, __wbg_adapter_60);
4915
- return addHeapObject(ret);
4916
- }
4917
-
4918
- export function __wbindgen_closure_wrapper6177(arg0, arg1, arg2) {
4919
- const ret = makeMutClosure(arg0, arg1, 319, __wbg_adapter_60);
4920
- return addHeapObject(ret);
4921
- }
4922
-
4923
- export function __wbindgen_closure_wrapper6556(arg0, arg1, arg2) {
4924
- const ret = makeMutClosure(arg0, arg1, 342, __wbg_adapter_54);
4925
- return addHeapObject(ret);
4926
- }
4927
-
4928
- export function __wbindgen_debug_string(arg0, arg1) {
4929
- const ret = debugString(getObject(arg1));
4930
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4931
- const len1 = WASM_VECTOR_LEN;
4932
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4933
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4934
- }
4935
-
4936
- export function __wbindgen_error_new(arg0, arg1) {
4937
- const ret = new Error(getStringFromWasm0(arg0, arg1));
4938
- return addHeapObject(ret);
4939
- }
4940
-
4941
- export function __wbindgen_in(arg0, arg1) {
4942
- const ret = getObject(arg0) in getObject(arg1);
4943
- return ret;
4944
- }
4945
-
4946
- export function __wbindgen_is_bigint(arg0) {
4947
- const ret = typeof getObject(arg0) === "bigint";
4948
- return ret;
4949
- }
4950
-
4951
- export function __wbindgen_is_function(arg0) {
4952
- const ret = typeof getObject(arg0) === "function";
4953
- return ret;
4954
- }
4955
-
4956
- export function __wbindgen_is_object(arg0) {
4957
- const val = getObject(arg0);
4958
- const ret = typeof val === "object" && val !== null;
4959
- return ret;
4960
- }
4961
-
4962
- export function __wbindgen_is_string(arg0) {
4963
- const ret = typeof getObject(arg0) === "string";
4964
- return ret;
4965
- }
4966
-
4967
- export function __wbindgen_is_undefined(arg0) {
4968
- const ret = getObject(arg0) === undefined;
4969
- return ret;
4970
- }
4971
-
4972
- export function __wbindgen_jsval_eq(arg0, arg1) {
4973
- const ret = getObject(arg0) === getObject(arg1);
4974
- return ret;
4975
- }
4976
-
4977
- export function __wbindgen_jsval_loose_eq(arg0, arg1) {
4978
- const ret = getObject(arg0) == getObject(arg1);
4979
- return ret;
4980
- }
4981
-
4982
- export function __wbindgen_memory() {
4983
- const ret = wasm.memory;
4984
- return addHeapObject(ret);
4985
- }
4986
-
4987
- export function __wbindgen_number_get(arg0, arg1) {
4988
- const obj = getObject(arg1);
4989
- const ret = typeof obj === "number" ? obj : undefined;
4990
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
4991
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
4992
- }
4993
-
4994
- export function __wbindgen_number_new(arg0) {
4995
- const ret = arg0;
4996
- return addHeapObject(ret);
4997
- }
4998
-
4999
- export function __wbindgen_object_clone_ref(arg0) {
5000
- const ret = getObject(arg0);
5001
- return addHeapObject(ret);
5002
- }
5003
-
5004
- export function __wbindgen_object_drop_ref(arg0) {
5005
- takeObject(arg0);
5006
- }
5007
-
5008
- export function __wbindgen_string_get(arg0, arg1) {
5009
- const obj = getObject(arg1);
5010
- const ret = typeof obj === "string" ? obj : undefined;
5011
- var ptr1 = isLikeNone(ret)
5012
- ? 0
5013
- : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5014
- var len1 = WASM_VECTOR_LEN;
5015
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
5016
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
5017
- }
5018
-
5019
- export function __wbindgen_string_new(arg0, arg1) {
5020
- const ret = getStringFromWasm0(arg0, arg1);
5021
- return addHeapObject(ret);
5022
- }
5023
-
5024
- export function __wbindgen_throw(arg0, arg1) {
5025
- throw new Error(getStringFromWasm0(arg0, arg1));
5026
- }