@bitwarden/sdk-internal 0.2.0-main.36 → 0.2.0-main.360

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