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

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,3463 @@ 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 {string} 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
+ const ptr1 = passStringToWasm0(envelope, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2027
+ const len1 = WASM_VECTOR_LEN;
2028
+ wasm.cryptoclient_unseal_password_protected_key_envelope(
2029
+ retptr,
2030
+ this.__wbg_ptr,
2031
+ ptr0,
2032
+ len0,
2033
+ ptr1,
2034
+ len1,
2035
+ );
2036
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2037
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2038
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2039
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2040
+ if (r3) {
2041
+ throw takeObject(r2);
2042
+ }
2043
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
2044
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2045
+ return v3;
2046
+ } finally {
2047
+ wasm.__wbindgen_add_to_stack_pointer(16);
2048
+ }
2049
+ }
2050
+ }
2051
+
2052
+ const ExporterClientFinalization =
2053
+ typeof FinalizationRegistry === "undefined"
2054
+ ? { register: () => {}, unregister: () => {} }
2055
+ : new FinalizationRegistry((ptr) => wasm.__wbg_exporterclient_free(ptr >>> 0, 1));
2056
+
2057
+ export class ExporterClient {
2058
+ static __wrap(ptr) {
2059
+ ptr = ptr >>> 0;
2060
+ const obj = Object.create(ExporterClient.prototype);
2061
+ obj.__wbg_ptr = ptr;
2062
+ ExporterClientFinalization.register(obj, obj.__wbg_ptr, obj);
2063
+ return obj;
2064
+ }
2065
+
2066
+ __destroy_into_raw() {
2067
+ const ptr = this.__wbg_ptr;
2068
+ this.__wbg_ptr = 0;
2069
+ ExporterClientFinalization.unregister(this);
2070
+ return ptr;
2071
+ }
2072
+
2073
+ free() {
2074
+ const ptr = this.__destroy_into_raw();
2075
+ wasm.__wbg_exporterclient_free(ptr, 0);
2076
+ }
2077
+ /**
2078
+ * @param {Folder[]} folders
2079
+ * @param {Cipher[]} ciphers
2080
+ * @param {ExportFormat} format
2081
+ * @returns {string}
2082
+ */
2083
+ export_vault(folders, ciphers, format) {
2084
+ let deferred4_0;
2085
+ let deferred4_1;
2086
+ try {
2087
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2088
+ const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
2089
+ const len0 = WASM_VECTOR_LEN;
2090
+ const ptr1 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2091
+ const len1 = WASM_VECTOR_LEN;
2092
+ wasm.exporterclient_export_vault(
2093
+ retptr,
2094
+ this.__wbg_ptr,
2095
+ ptr0,
2096
+ len0,
2097
+ ptr1,
2098
+ len1,
2099
+ addHeapObject(format),
2100
+ );
2101
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2102
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2103
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2104
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2105
+ var ptr3 = r0;
2106
+ var len3 = r1;
2107
+ if (r3) {
2108
+ ptr3 = 0;
2109
+ len3 = 0;
2110
+ throw takeObject(r2);
2111
+ }
2112
+ deferred4_0 = ptr3;
2113
+ deferred4_1 = len3;
2114
+ return getStringFromWasm0(ptr3, len3);
2115
+ } finally {
2116
+ wasm.__wbindgen_add_to_stack_pointer(16);
2117
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2118
+ }
2119
+ }
2120
+ /**
2121
+ * @param {Collection[]} collections
2122
+ * @param {Cipher[]} ciphers
2123
+ * @param {ExportFormat} format
2124
+ * @returns {string}
2125
+ */
2126
+ export_organization_vault(collections, ciphers, format) {
2127
+ let deferred4_0;
2128
+ let deferred4_1;
2129
+ try {
2130
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2131
+ const ptr0 = passArrayJsValueToWasm0(collections, wasm.__wbindgen_malloc);
2132
+ const len0 = WASM_VECTOR_LEN;
2133
+ const ptr1 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2134
+ const len1 = WASM_VECTOR_LEN;
2135
+ wasm.exporterclient_export_organization_vault(
2136
+ retptr,
2137
+ this.__wbg_ptr,
2138
+ ptr0,
2139
+ len0,
2140
+ ptr1,
2141
+ len1,
2142
+ addHeapObject(format),
2143
+ );
2144
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2145
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2146
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2147
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2148
+ var ptr3 = r0;
2149
+ var len3 = r1;
2150
+ if (r3) {
2151
+ ptr3 = 0;
2152
+ len3 = 0;
2153
+ throw takeObject(r2);
2154
+ }
2155
+ deferred4_0 = ptr3;
2156
+ deferred4_1 = len3;
2157
+ return getStringFromWasm0(ptr3, len3);
2158
+ } finally {
2159
+ wasm.__wbindgen_add_to_stack_pointer(16);
2160
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2161
+ }
2162
+ }
2163
+ /**
2164
+ * Credential Exchange Format (CXF)
2165
+ *
2166
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2167
+ *
2168
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2169
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2170
+ * @param {Account} account
2171
+ * @param {Cipher[]} ciphers
2172
+ * @returns {string}
2173
+ */
2174
+ export_cxf(account, ciphers) {
2175
+ let deferred3_0;
2176
+ let deferred3_1;
2177
+ try {
2178
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2179
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2180
+ const len0 = WASM_VECTOR_LEN;
2181
+ wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), ptr0, len0);
2182
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2183
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2184
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2185
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2186
+ var ptr2 = r0;
2187
+ var len2 = r1;
2188
+ if (r3) {
2189
+ ptr2 = 0;
2190
+ len2 = 0;
2191
+ throw takeObject(r2);
2192
+ }
2193
+ deferred3_0 = ptr2;
2194
+ deferred3_1 = len2;
2195
+ return getStringFromWasm0(ptr2, len2);
2196
+ } finally {
2197
+ wasm.__wbindgen_add_to_stack_pointer(16);
2198
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2199
+ }
2200
+ }
2201
+ /**
2202
+ * Credential Exchange Format (CXF)
2203
+ *
2204
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2205
+ *
2206
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2207
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2208
+ * @param {string} payload
2209
+ * @returns {Cipher[]}
2210
+ */
2211
+ import_cxf(payload) {
2212
+ try {
2213
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2214
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2215
+ const len0 = WASM_VECTOR_LEN;
2216
+ wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
2217
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2218
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2219
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2220
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2221
+ if (r3) {
2222
+ throw takeObject(r2);
2223
+ }
2224
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2225
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
2226
+ return v2;
2227
+ } finally {
2228
+ wasm.__wbindgen_add_to_stack_pointer(16);
2229
+ }
2230
+ }
2231
+ }
2232
+
2233
+ const FoldersClientFinalization =
2234
+ typeof FinalizationRegistry === "undefined"
2235
+ ? { register: () => {}, unregister: () => {} }
2236
+ : new FinalizationRegistry((ptr) => wasm.__wbg_foldersclient_free(ptr >>> 0, 1));
2237
+ /**
2238
+ * Wrapper for folder specific functionality.
2239
+ */
2240
+ export class FoldersClient {
2241
+ static __wrap(ptr) {
2242
+ ptr = ptr >>> 0;
2243
+ const obj = Object.create(FoldersClient.prototype);
2244
+ obj.__wbg_ptr = ptr;
2245
+ FoldersClientFinalization.register(obj, obj.__wbg_ptr, obj);
2246
+ return obj;
2247
+ }
2248
+
2249
+ __destroy_into_raw() {
2250
+ const ptr = this.__wbg_ptr;
2251
+ this.__wbg_ptr = 0;
2252
+ FoldersClientFinalization.unregister(this);
2253
+ return ptr;
2254
+ }
2255
+
2256
+ free() {
2257
+ const ptr = this.__destroy_into_raw();
2258
+ wasm.__wbg_foldersclient_free(ptr, 0);
2259
+ }
2260
+ /**
2261
+ * Encrypt a [FolderView] to a [Folder].
2262
+ * @param {FolderView} folder_view
2263
+ * @returns {Folder}
2264
+ */
2265
+ encrypt(folder_view) {
2266
+ try {
2267
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2268
+ wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
2269
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2270
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2271
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2272
+ if (r2) {
2273
+ throw takeObject(r1);
2274
+ }
2275
+ return takeObject(r0);
2276
+ } finally {
2277
+ wasm.__wbindgen_add_to_stack_pointer(16);
2278
+ }
2279
+ }
2280
+ /**
2281
+ * Encrypt a [Folder] to [FolderView].
2282
+ * @param {Folder} folder
2283
+ * @returns {FolderView}
2284
+ */
2285
+ decrypt(folder) {
2286
+ try {
2287
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2288
+ wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
2289
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2290
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2291
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2292
+ if (r2) {
2293
+ throw takeObject(r1);
2294
+ }
2295
+ return takeObject(r0);
2296
+ } finally {
2297
+ wasm.__wbindgen_add_to_stack_pointer(16);
2298
+ }
2299
+ }
2300
+ /**
2301
+ * Decrypt a list of [Folder]s to a list of [FolderView]s.
2302
+ * @param {Folder[]} folders
2303
+ * @returns {FolderView[]}
2304
+ */
2305
+ decrypt_list(folders) {
2306
+ try {
2307
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2308
+ const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
2309
+ const len0 = WASM_VECTOR_LEN;
2310
+ wasm.foldersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
2311
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2312
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2313
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2314
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2315
+ if (r3) {
2316
+ throw takeObject(r2);
2317
+ }
2318
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2319
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
2320
+ return v2;
2321
+ } finally {
2322
+ wasm.__wbindgen_add_to_stack_pointer(16);
2323
+ }
2324
+ }
2325
+ /**
2326
+ * Get all folders from state and decrypt them to a list of [FolderView].
2327
+ * @returns {Promise<FolderView[]>}
2328
+ */
2329
+ list() {
2330
+ const ret = wasm.foldersclient_list(this.__wbg_ptr);
2331
+ return takeObject(ret);
2332
+ }
2333
+ /**
2334
+ * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
2335
+ * @param {FolderId} folder_id
2336
+ * @returns {Promise<FolderView>}
2337
+ */
2338
+ get(folder_id) {
2339
+ const ret = wasm.foldersclient_get(this.__wbg_ptr, addHeapObject(folder_id));
2340
+ return takeObject(ret);
2341
+ }
2342
+ /**
2343
+ * Create a new [Folder] and save it to the server.
2344
+ * @param {FolderAddEditRequest} request
2345
+ * @returns {Promise<FolderView>}
2346
+ */
2347
+ create(request) {
2348
+ const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
2349
+ return takeObject(ret);
2350
+ }
2351
+ /**
2352
+ * Edit the [Folder] and save it to the server.
2353
+ * @param {FolderId} folder_id
2354
+ * @param {FolderAddEditRequest} request
2355
+ * @returns {Promise<FolderView>}
2356
+ */
2357
+ edit(folder_id, request) {
2358
+ const ret = wasm.foldersclient_edit(
2359
+ this.__wbg_ptr,
2360
+ addHeapObject(folder_id),
2361
+ addHeapObject(request),
2362
+ );
2363
+ return takeObject(ret);
2364
+ }
2365
+ }
2366
+
2367
+ const GeneratorClientFinalization =
2368
+ typeof FinalizationRegistry === "undefined"
2369
+ ? { register: () => {}, unregister: () => {} }
2370
+ : new FinalizationRegistry((ptr) => wasm.__wbg_generatorclient_free(ptr >>> 0, 1));
2371
+
2372
+ export class GeneratorClient {
2373
+ static __wrap(ptr) {
2374
+ ptr = ptr >>> 0;
2375
+ const obj = Object.create(GeneratorClient.prototype);
2376
+ obj.__wbg_ptr = ptr;
2377
+ GeneratorClientFinalization.register(obj, obj.__wbg_ptr, obj);
2378
+ return obj;
2379
+ }
2380
+
2381
+ __destroy_into_raw() {
2382
+ const ptr = this.__wbg_ptr;
2383
+ this.__wbg_ptr = 0;
2384
+ GeneratorClientFinalization.unregister(this);
2385
+ return ptr;
2386
+ }
2387
+
2388
+ free() {
2389
+ const ptr = this.__destroy_into_raw();
2390
+ wasm.__wbg_generatorclient_free(ptr, 0);
2391
+ }
2392
+ /**
2393
+ * Generates a random password.
2394
+ *
2395
+ * The character sets and password length can be customized using the `input` parameter.
2396
+ *
2397
+ * # Examples
2398
+ *
2399
+ * ```
2400
+ * use bitwarden_core::Client;
2401
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2402
+ *
2403
+ * async fn test() -> Result<(), PassphraseError> {
2404
+ * let input = PasswordGeneratorRequest {
2405
+ * lowercase: true,
2406
+ * uppercase: true,
2407
+ * numbers: true,
2408
+ * length: 20,
2409
+ * ..Default::default()
2410
+ * };
2411
+ * let password = Client::new(None).generator().password(input).unwrap();
2412
+ * println!("{}", password);
2413
+ * Ok(())
2414
+ * }
2415
+ * ```
2416
+ * @param {PasswordGeneratorRequest} input
2417
+ * @returns {string}
2418
+ */
2419
+ password(input) {
2420
+ let deferred2_0;
2421
+ let deferred2_1;
2422
+ try {
2423
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2424
+ wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
2425
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2426
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2427
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2428
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2429
+ var ptr1 = r0;
2430
+ var len1 = r1;
2431
+ if (r3) {
2432
+ ptr1 = 0;
2433
+ len1 = 0;
2434
+ throw takeObject(r2);
2435
+ }
2436
+ deferred2_0 = ptr1;
2437
+ deferred2_1 = len1;
2438
+ return getStringFromWasm0(ptr1, len1);
2439
+ } finally {
2440
+ wasm.__wbindgen_add_to_stack_pointer(16);
2441
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2442
+ }
2443
+ }
2444
+ /**
2445
+ * Generates a random passphrase.
2446
+ * A passphrase is a combination of random words separated by a character.
2447
+ * An example of passphrase is `correct horse battery staple`.
2448
+ *
2449
+ * The number of words and their case, the word separator, and the inclusion of
2450
+ * a number in the passphrase can be customized using the `input` parameter.
2451
+ *
2452
+ * # Examples
2453
+ *
2454
+ * ```
2455
+ * use bitwarden_core::Client;
2456
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
2457
+ *
2458
+ * async fn test() -> Result<(), PassphraseError> {
2459
+ * let input = PassphraseGeneratorRequest {
2460
+ * num_words: 4,
2461
+ * ..Default::default()
2462
+ * };
2463
+ * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
2464
+ * println!("{}", passphrase);
2465
+ * Ok(())
2466
+ * }
2467
+ * ```
2468
+ * @param {PassphraseGeneratorRequest} input
2469
+ * @returns {string}
2470
+ */
2471
+ passphrase(input) {
2472
+ let deferred2_0;
2473
+ let deferred2_1;
2474
+ try {
2475
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2476
+ wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
2477
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2478
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2479
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2480
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2481
+ var ptr1 = r0;
2482
+ var len1 = r1;
2483
+ if (r3) {
2484
+ ptr1 = 0;
2485
+ len1 = 0;
2486
+ throw takeObject(r2);
2487
+ }
2488
+ deferred2_0 = ptr1;
2489
+ deferred2_1 = len1;
2490
+ return getStringFromWasm0(ptr1, len1);
2491
+ } finally {
2492
+ wasm.__wbindgen_add_to_stack_pointer(16);
2493
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2494
+ }
2495
+ }
2496
+ }
2497
+
2498
+ const IncomingMessageFinalization =
2499
+ typeof FinalizationRegistry === "undefined"
2500
+ ? { register: () => {}, unregister: () => {} }
2501
+ : new FinalizationRegistry((ptr) => wasm.__wbg_incomingmessage_free(ptr >>> 0, 1));
2502
+
2503
+ export class IncomingMessage {
2504
+ static __wrap(ptr) {
2505
+ ptr = ptr >>> 0;
2506
+ const obj = Object.create(IncomingMessage.prototype);
2507
+ obj.__wbg_ptr = ptr;
2508
+ IncomingMessageFinalization.register(obj, obj.__wbg_ptr, obj);
2509
+ return obj;
2510
+ }
2511
+
2512
+ __destroy_into_raw() {
2513
+ const ptr = this.__wbg_ptr;
2514
+ this.__wbg_ptr = 0;
2515
+ IncomingMessageFinalization.unregister(this);
2516
+ return ptr;
2517
+ }
2518
+
2519
+ free() {
2520
+ const ptr = this.__destroy_into_raw();
2521
+ wasm.__wbg_incomingmessage_free(ptr, 0);
2522
+ }
2523
+ /**
2524
+ * @returns {Uint8Array}
2525
+ */
2526
+ get payload() {
2527
+ try {
2528
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2529
+ wasm.__wbg_get_incomingmessage_payload(retptr, this.__wbg_ptr);
2530
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2531
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2532
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2533
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2534
+ return v1;
2535
+ } finally {
2536
+ wasm.__wbindgen_add_to_stack_pointer(16);
2537
+ }
2538
+ }
2539
+ /**
2540
+ * @param {Uint8Array} arg0
2541
+ */
2542
+ set payload(arg0) {
2543
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
2544
+ const len0 = WASM_VECTOR_LEN;
2545
+ wasm.__wbg_set_incomingmessage_payload(this.__wbg_ptr, ptr0, len0);
2546
+ }
2547
+ /**
2548
+ * @returns {Endpoint}
2549
+ */
2550
+ get destination() {
2551
+ const ret = wasm.__wbg_get_incomingmessage_destination(this.__wbg_ptr);
2552
+ return takeObject(ret);
2553
+ }
2554
+ /**
2555
+ * @param {Endpoint} arg0
2556
+ */
2557
+ set destination(arg0) {
2558
+ wasm.__wbg_set_incomingmessage_destination(this.__wbg_ptr, addHeapObject(arg0));
2559
+ }
2560
+ /**
2561
+ * @returns {Endpoint}
2562
+ */
2563
+ get source() {
2564
+ const ret = wasm.__wbg_get_incomingmessage_source(this.__wbg_ptr);
2565
+ return takeObject(ret);
2566
+ }
2567
+ /**
2568
+ * @param {Endpoint} arg0
2569
+ */
2570
+ set source(arg0) {
2571
+ wasm.__wbg_set_incomingmessage_source(this.__wbg_ptr, addHeapObject(arg0));
2572
+ }
2573
+ /**
2574
+ * @returns {string | undefined}
2575
+ */
2576
+ get topic() {
2577
+ try {
2578
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2579
+ wasm.__wbg_get_incomingmessage_topic(retptr, this.__wbg_ptr);
2580
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2581
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2582
+ let v1;
2583
+ if (r0 !== 0) {
2584
+ v1 = getStringFromWasm0(r0, r1).slice();
2585
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2586
+ }
2587
+ return v1;
2588
+ } finally {
2589
+ wasm.__wbindgen_add_to_stack_pointer(16);
2590
+ }
2591
+ }
2592
+ /**
2593
+ * @param {string | null} [arg0]
2594
+ */
2595
+ set topic(arg0) {
2596
+ var ptr0 = isLikeNone(arg0)
2597
+ ? 0
2598
+ : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2599
+ var len0 = WASM_VECTOR_LEN;
2600
+ wasm.__wbg_set_incomingmessage_topic(this.__wbg_ptr, ptr0, len0);
2601
+ }
2602
+ /**
2603
+ * @param {Uint8Array} payload
2604
+ * @param {Endpoint} destination
2605
+ * @param {Endpoint} source
2606
+ * @param {string | null} [topic]
2607
+ */
2608
+ constructor(payload, destination, source, topic) {
2609
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2610
+ const len0 = WASM_VECTOR_LEN;
2611
+ var ptr1 = isLikeNone(topic)
2612
+ ? 0
2613
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2614
+ var len1 = WASM_VECTOR_LEN;
2615
+ const ret = wasm.incomingmessage_new(
2616
+ ptr0,
2617
+ len0,
2618
+ addHeapObject(destination),
2619
+ addHeapObject(source),
2620
+ ptr1,
2621
+ len1,
2622
+ );
2623
+ this.__wbg_ptr = ret >>> 0;
2624
+ IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
2625
+ return this;
2626
+ }
2627
+ /**
2628
+ * Try to parse the payload as JSON.
2629
+ * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2630
+ */
2631
+ parse_payload_as_json() {
2632
+ const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2633
+ return takeObject(ret);
2634
+ }
2635
+ }
2636
+
2637
+ const IpcClientFinalization =
2638
+ typeof FinalizationRegistry === "undefined"
2639
+ ? { register: () => {}, unregister: () => {} }
2640
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipcclient_free(ptr >>> 0, 1));
2641
+ /**
2642
+ * JavaScript wrapper around the IPC client. For more information, see the
2643
+ * [IpcClient] documentation.
2644
+ */
2645
+ export class IpcClient {
2646
+ __destroy_into_raw() {
2647
+ const ptr = this.__wbg_ptr;
2648
+ this.__wbg_ptr = 0;
2649
+ IpcClientFinalization.unregister(this);
2650
+ return ptr;
2651
+ }
2652
+
2653
+ free() {
2654
+ const ptr = this.__destroy_into_raw();
2655
+ wasm.__wbg_ipcclient_free(ptr, 0);
2656
+ }
2657
+ /**
2658
+ * @param {IpcCommunicationBackend} communication_provider
2659
+ */
2660
+ constructor(communication_provider) {
2661
+ _assertClass(communication_provider, IpcCommunicationBackend);
2662
+ const ret = wasm.ipcclient_new(communication_provider.__wbg_ptr);
2663
+ this.__wbg_ptr = ret >>> 0;
2664
+ IpcClientFinalization.register(this, this.__wbg_ptr, this);
2665
+ return this;
2666
+ }
2667
+ /**
2668
+ * @returns {Promise<void>}
2669
+ */
2670
+ start() {
2671
+ const ret = wasm.ipcclient_start(this.__wbg_ptr);
2672
+ return takeObject(ret);
2673
+ }
2674
+ /**
2675
+ * @returns {Promise<boolean>}
2676
+ */
2677
+ isRunning() {
2678
+ const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2679
+ return takeObject(ret);
2680
+ }
2681
+ /**
2682
+ * @param {OutgoingMessage} message
2683
+ * @returns {Promise<void>}
2684
+ */
2685
+ send(message) {
2686
+ _assertClass(message, OutgoingMessage);
2687
+ var ptr0 = message.__destroy_into_raw();
2688
+ const ret = wasm.ipcclient_send(this.__wbg_ptr, ptr0);
2689
+ return takeObject(ret);
2690
+ }
2691
+ /**
2692
+ * @returns {Promise<IpcClientSubscription>}
2693
+ */
2694
+ subscribe() {
2695
+ const ret = wasm.ipcclient_subscribe(this.__wbg_ptr);
2696
+ return takeObject(ret);
2697
+ }
2698
+ }
2699
+
2700
+ const IpcClientSubscriptionFinalization =
2701
+ typeof FinalizationRegistry === "undefined"
2702
+ ? { register: () => {}, unregister: () => {} }
2703
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipcclientsubscription_free(ptr >>> 0, 1));
2704
+ /**
2705
+ * JavaScript wrapper around the IPC client subscription. For more information, see the
2706
+ * [IpcClientSubscription](crate::IpcClientSubscription) documentation.
2707
+ */
2708
+ export class IpcClientSubscription {
2709
+ static __wrap(ptr) {
2710
+ ptr = ptr >>> 0;
2711
+ const obj = Object.create(IpcClientSubscription.prototype);
2712
+ obj.__wbg_ptr = ptr;
2713
+ IpcClientSubscriptionFinalization.register(obj, obj.__wbg_ptr, obj);
2714
+ return obj;
2715
+ }
2716
+
2717
+ __destroy_into_raw() {
2718
+ const ptr = this.__wbg_ptr;
2719
+ this.__wbg_ptr = 0;
2720
+ IpcClientSubscriptionFinalization.unregister(this);
2721
+ return ptr;
2722
+ }
2723
+
2724
+ free() {
2725
+ const ptr = this.__destroy_into_raw();
2726
+ wasm.__wbg_ipcclientsubscription_free(ptr, 0);
2727
+ }
2728
+ /**
2729
+ * @param {AbortSignal | null} [abort_signal]
2730
+ * @returns {Promise<IncomingMessage>}
2731
+ */
2732
+ receive(abort_signal) {
2733
+ const ret = wasm.ipcclientsubscription_receive(
2734
+ this.__wbg_ptr,
2735
+ isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
2736
+ );
2737
+ return takeObject(ret);
2738
+ }
2739
+ }
2740
+
2741
+ const IpcCommunicationBackendFinalization =
2742
+ typeof FinalizationRegistry === "undefined"
2743
+ ? { register: () => {}, unregister: () => {} }
2744
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipccommunicationbackend_free(ptr >>> 0, 1));
2745
+ /**
2746
+ * JavaScript implementation of the `CommunicationBackend` trait for IPC communication.
2747
+ */
2748
+ export class IpcCommunicationBackend {
2749
+ __destroy_into_raw() {
2750
+ const ptr = this.__wbg_ptr;
2751
+ this.__wbg_ptr = 0;
2752
+ IpcCommunicationBackendFinalization.unregister(this);
2753
+ return ptr;
2754
+ }
2755
+
2756
+ free() {
2757
+ const ptr = this.__destroy_into_raw();
2758
+ wasm.__wbg_ipccommunicationbackend_free(ptr, 0);
2759
+ }
2760
+ /**
2761
+ * Creates a new instance of the JavaScript communication backend.
2762
+ * @param {IpcCommunicationBackendSender} sender
2763
+ */
2764
+ constructor(sender) {
2765
+ const ret = wasm.ipccommunicationbackend_new(addHeapObject(sender));
2766
+ this.__wbg_ptr = ret >>> 0;
2767
+ IpcCommunicationBackendFinalization.register(this, this.__wbg_ptr, this);
2768
+ return this;
2769
+ }
2770
+ /**
2771
+ * Used by JavaScript to provide an incoming message to the IPC framework.
2772
+ * @param {IncomingMessage} message
2773
+ */
2774
+ receive(message) {
2775
+ try {
2776
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2777
+ _assertClass(message, IncomingMessage);
2778
+ var ptr0 = message.__destroy_into_raw();
2779
+ wasm.ipccommunicationbackend_receive(retptr, this.__wbg_ptr, ptr0);
2780
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2781
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2782
+ if (r1) {
2783
+ throw takeObject(r0);
2784
+ }
2785
+ } finally {
2786
+ wasm.__wbindgen_add_to_stack_pointer(16);
2787
+ }
2788
+ }
2789
+ }
2790
+
2791
+ const OutgoingMessageFinalization =
2792
+ typeof FinalizationRegistry === "undefined"
2793
+ ? { register: () => {}, unregister: () => {} }
2794
+ : new FinalizationRegistry((ptr) => wasm.__wbg_outgoingmessage_free(ptr >>> 0, 1));
2795
+
2796
+ export class OutgoingMessage {
2797
+ static __wrap(ptr) {
2798
+ ptr = ptr >>> 0;
2799
+ const obj = Object.create(OutgoingMessage.prototype);
2800
+ obj.__wbg_ptr = ptr;
2801
+ OutgoingMessageFinalization.register(obj, obj.__wbg_ptr, obj);
2802
+ return obj;
2803
+ }
2804
+
2805
+ __destroy_into_raw() {
2806
+ const ptr = this.__wbg_ptr;
2807
+ this.__wbg_ptr = 0;
2808
+ OutgoingMessageFinalization.unregister(this);
2809
+ return ptr;
2810
+ }
2811
+
2812
+ free() {
2813
+ const ptr = this.__destroy_into_raw();
2814
+ wasm.__wbg_outgoingmessage_free(ptr, 0);
2815
+ }
2816
+ /**
2817
+ * @returns {Uint8Array}
2818
+ */
2819
+ get payload() {
2820
+ try {
2821
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2822
+ wasm.__wbg_get_outgoingmessage_payload(retptr, this.__wbg_ptr);
2823
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2824
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2825
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2826
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2827
+ return v1;
2828
+ } finally {
2829
+ wasm.__wbindgen_add_to_stack_pointer(16);
2830
+ }
2831
+ }
2832
+ /**
2833
+ * @param {Uint8Array} arg0
2834
+ */
2835
+ set payload(arg0) {
2836
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
2837
+ const len0 = WASM_VECTOR_LEN;
2838
+ wasm.__wbg_set_outgoingmessage_payload(this.__wbg_ptr, ptr0, len0);
2839
+ }
2840
+ /**
2841
+ * @returns {Endpoint}
2842
+ */
2843
+ get destination() {
2844
+ const ret = wasm.__wbg_get_incomingmessage_destination(this.__wbg_ptr);
2845
+ return takeObject(ret);
2846
+ }
2847
+ /**
2848
+ * @param {Endpoint} arg0
2849
+ */
2850
+ set destination(arg0) {
2851
+ wasm.__wbg_set_incomingmessage_destination(this.__wbg_ptr, addHeapObject(arg0));
2852
+ }
2853
+ /**
2854
+ * @returns {string | undefined}
2855
+ */
2856
+ get topic() {
2857
+ try {
2858
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2859
+ wasm.__wbg_get_outgoingmessage_topic(retptr, this.__wbg_ptr);
2860
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2861
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2862
+ let v1;
2863
+ if (r0 !== 0) {
2864
+ v1 = getStringFromWasm0(r0, r1).slice();
2865
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
2866
+ }
2867
+ return v1;
2868
+ } finally {
2869
+ wasm.__wbindgen_add_to_stack_pointer(16);
2870
+ }
2871
+ }
2872
+ /**
2873
+ * @param {string | null} [arg0]
2874
+ */
2875
+ set topic(arg0) {
2876
+ var ptr0 = isLikeNone(arg0)
2877
+ ? 0
2878
+ : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2879
+ var len0 = WASM_VECTOR_LEN;
2880
+ wasm.__wbg_set_outgoingmessage_topic(this.__wbg_ptr, ptr0, len0);
2881
+ }
2882
+ /**
2883
+ * @param {Uint8Array} payload
2884
+ * @param {Endpoint} destination
2885
+ * @param {string | null} [topic]
2886
+ */
2887
+ constructor(payload, destination, topic) {
2888
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2889
+ const len0 = WASM_VECTOR_LEN;
2890
+ var ptr1 = isLikeNone(topic)
2891
+ ? 0
2892
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2893
+ var len1 = WASM_VECTOR_LEN;
2894
+ const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
2895
+ this.__wbg_ptr = ret >>> 0;
2896
+ OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
2897
+ return this;
2898
+ }
2899
+ /**
2900
+ * Create a new message and encode the payload as JSON.
2901
+ * @param {any} payload
2902
+ * @param {Endpoint} destination
2903
+ * @param {string | null} [topic]
2904
+ * @returns {OutgoingMessage}
2905
+ */
2906
+ static new_json_payload(payload, destination, topic) {
2907
+ try {
2908
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2909
+ var ptr0 = isLikeNone(topic)
2910
+ ? 0
2911
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2912
+ var len0 = WASM_VECTOR_LEN;
2913
+ wasm.outgoingmessage_new_json_payload(
2914
+ retptr,
2915
+ addHeapObject(payload),
2916
+ addHeapObject(destination),
2917
+ ptr0,
2918
+ len0,
2919
+ );
2920
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2921
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2922
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2923
+ if (r2) {
2924
+ throw takeObject(r1);
2925
+ }
2926
+ return OutgoingMessage.__wrap(r0);
2927
+ } finally {
2928
+ wasm.__wbindgen_add_to_stack_pointer(16);
2929
+ }
2930
+ }
2931
+ }
2932
+
2933
+ const PlatformClientFinalization =
2934
+ typeof FinalizationRegistry === "undefined"
2935
+ ? { register: () => {}, unregister: () => {} }
2936
+ : new FinalizationRegistry((ptr) => wasm.__wbg_platformclient_free(ptr >>> 0, 1));
2937
+
2938
+ export class PlatformClient {
2939
+ static __wrap(ptr) {
2940
+ ptr = ptr >>> 0;
2941
+ const obj = Object.create(PlatformClient.prototype);
2942
+ obj.__wbg_ptr = ptr;
2943
+ PlatformClientFinalization.register(obj, obj.__wbg_ptr, obj);
2944
+ return obj;
2945
+ }
2946
+
2947
+ __destroy_into_raw() {
2948
+ const ptr = this.__wbg_ptr;
2949
+ this.__wbg_ptr = 0;
2950
+ PlatformClientFinalization.unregister(this);
2951
+ return ptr;
2952
+ }
2953
+
2954
+ free() {
2955
+ const ptr = this.__destroy_into_raw();
2956
+ wasm.__wbg_platformclient_free(ptr, 0);
2957
+ }
2958
+ /**
2959
+ * @returns {StateClient}
2960
+ */
2961
+ state() {
2962
+ const ret = wasm.bitwardenclient_platform(this.__wbg_ptr);
2963
+ return StateClient.__wrap(ret);
2964
+ }
2965
+ /**
2966
+ * Load feature flags into the client
2967
+ * @param {FeatureFlags} flags
2968
+ */
2969
+ load_flags(flags) {
2970
+ try {
2971
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2972
+ wasm.platformclient_load_flags(retptr, this.__wbg_ptr, addHeapObject(flags));
2973
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2974
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2975
+ if (r1) {
2976
+ throw takeObject(r0);
2977
+ }
2978
+ } finally {
2979
+ wasm.__wbindgen_add_to_stack_pointer(16);
2980
+ }
2981
+ }
2982
+ }
2983
+
2984
+ const PureCryptoFinalization =
2985
+ typeof FinalizationRegistry === "undefined"
2986
+ ? { register: () => {}, unregister: () => {} }
2987
+ : new FinalizationRegistry((ptr) => wasm.__wbg_purecrypto_free(ptr >>> 0, 1));
2988
+ /**
2989
+ * This module represents a stopgap solution to provide access to primitive crypto functions for JS
2990
+ * clients. It is not intended to be used outside of the JS clients and this pattern should not be
2991
+ * proliferated. It is necessary because we want to use SDK crypto prior to the SDK being fully
2992
+ * responsible for state and keys.
2993
+ */
2994
+ export class PureCrypto {
2995
+ __destroy_into_raw() {
2996
+ const ptr = this.__wbg_ptr;
2997
+ this.__wbg_ptr = 0;
2998
+ PureCryptoFinalization.unregister(this);
2999
+ return ptr;
3000
+ }
3001
+
3002
+ free() {
3003
+ const ptr = this.__destroy_into_raw();
3004
+ wasm.__wbg_purecrypto_free(ptr, 0);
3005
+ }
3006
+ /**
3007
+ * DEPRECATED: Use `symmetric_decrypt_string` instead.
3008
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3009
+ * @param {string} enc_string
3010
+ * @param {Uint8Array} key
3011
+ * @returns {string}
3012
+ */
3013
+ static symmetric_decrypt(enc_string, key) {
3014
+ let deferred4_0;
3015
+ let deferred4_1;
3016
+ try {
3017
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3018
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3019
+ const len0 = WASM_VECTOR_LEN;
3020
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3021
+ const len1 = WASM_VECTOR_LEN;
3022
+ wasm.purecrypto_symmetric_decrypt(retptr, ptr0, len0, ptr1, len1);
3023
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3024
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3025
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3026
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3027
+ var ptr3 = r0;
3028
+ var len3 = r1;
3029
+ if (r3) {
3030
+ ptr3 = 0;
3031
+ len3 = 0;
3032
+ throw takeObject(r2);
3033
+ }
3034
+ deferred4_0 = ptr3;
3035
+ deferred4_1 = len3;
3036
+ return getStringFromWasm0(ptr3, len3);
3037
+ } finally {
3038
+ wasm.__wbindgen_add_to_stack_pointer(16);
3039
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3040
+ }
3041
+ }
3042
+ /**
3043
+ * @param {string} enc_string
3044
+ * @param {Uint8Array} key
3045
+ * @returns {string}
3046
+ */
3047
+ static symmetric_decrypt_string(enc_string, key) {
3048
+ let deferred4_0;
3049
+ let deferred4_1;
3050
+ try {
3051
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3052
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3053
+ const len0 = WASM_VECTOR_LEN;
3054
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3055
+ const len1 = WASM_VECTOR_LEN;
3056
+ wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
3057
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3058
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3059
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3060
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3061
+ var ptr3 = r0;
3062
+ var len3 = r1;
3063
+ if (r3) {
3064
+ ptr3 = 0;
3065
+ len3 = 0;
3066
+ throw takeObject(r2);
3067
+ }
3068
+ deferred4_0 = ptr3;
3069
+ deferred4_1 = len3;
3070
+ return getStringFromWasm0(ptr3, len3);
3071
+ } finally {
3072
+ wasm.__wbindgen_add_to_stack_pointer(16);
3073
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3074
+ }
3075
+ }
3076
+ /**
3077
+ * @param {string} enc_string
3078
+ * @param {Uint8Array} key
3079
+ * @returns {Uint8Array}
3080
+ */
3081
+ static symmetric_decrypt_bytes(enc_string, key) {
3082
+ try {
3083
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3084
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3085
+ const len0 = WASM_VECTOR_LEN;
3086
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3087
+ const len1 = WASM_VECTOR_LEN;
3088
+ wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3089
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3090
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3091
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3092
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3093
+ if (r3) {
3094
+ throw takeObject(r2);
3095
+ }
3096
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3097
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3098
+ return v3;
3099
+ } finally {
3100
+ wasm.__wbindgen_add_to_stack_pointer(16);
3101
+ }
3102
+ }
3103
+ /**
3104
+ * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
3105
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3106
+ * @param {Uint8Array} enc_bytes
3107
+ * @param {Uint8Array} key
3108
+ * @returns {Uint8Array}
3109
+ */
3110
+ static symmetric_decrypt_array_buffer(enc_bytes, key) {
3111
+ try {
3112
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3113
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3114
+ const len0 = WASM_VECTOR_LEN;
3115
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3116
+ const len1 = WASM_VECTOR_LEN;
3117
+ wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
3118
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3119
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3120
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3121
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3122
+ if (r3) {
3123
+ throw takeObject(r2);
3124
+ }
3125
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3126
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3127
+ return v3;
3128
+ } finally {
3129
+ wasm.__wbindgen_add_to_stack_pointer(16);
3130
+ }
3131
+ }
3132
+ /**
3133
+ * @param {Uint8Array} enc_bytes
3134
+ * @param {Uint8Array} key
3135
+ * @returns {Uint8Array}
3136
+ */
3137
+ static symmetric_decrypt_filedata(enc_bytes, key) {
3138
+ try {
3139
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3140
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3141
+ const len0 = WASM_VECTOR_LEN;
3142
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3143
+ const len1 = WASM_VECTOR_LEN;
3144
+ wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3145
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3146
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3147
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3148
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3149
+ if (r3) {
3150
+ throw takeObject(r2);
3151
+ }
3152
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3153
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3154
+ return v3;
3155
+ } finally {
3156
+ wasm.__wbindgen_add_to_stack_pointer(16);
3157
+ }
3158
+ }
3159
+ /**
3160
+ * @param {string} plain
3161
+ * @param {Uint8Array} key
3162
+ * @returns {string}
3163
+ */
3164
+ static symmetric_encrypt_string(plain, key) {
3165
+ let deferred4_0;
3166
+ let deferred4_1;
3167
+ try {
3168
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3169
+ const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3170
+ const len0 = WASM_VECTOR_LEN;
3171
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3172
+ const len1 = WASM_VECTOR_LEN;
3173
+ wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
3174
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3175
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3176
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3177
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3178
+ var ptr3 = r0;
3179
+ var len3 = r1;
3180
+ if (r3) {
3181
+ ptr3 = 0;
3182
+ len3 = 0;
3183
+ throw takeObject(r2);
3184
+ }
3185
+ deferred4_0 = ptr3;
3186
+ deferred4_1 = len3;
3187
+ return getStringFromWasm0(ptr3, len3);
3188
+ } finally {
3189
+ wasm.__wbindgen_add_to_stack_pointer(16);
3190
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3191
+ }
3192
+ }
3193
+ /**
3194
+ * DEPRECATED: Only used by send keys
3195
+ * @param {Uint8Array} plain
3196
+ * @param {Uint8Array} key
3197
+ * @returns {string}
3198
+ */
3199
+ static symmetric_encrypt_bytes(plain, key) {
3200
+ let deferred4_0;
3201
+ let deferred4_1;
3202
+ try {
3203
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3204
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3205
+ const len0 = WASM_VECTOR_LEN;
3206
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3207
+ const len1 = WASM_VECTOR_LEN;
3208
+ wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3209
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3210
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3211
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3212
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3213
+ var ptr3 = r0;
3214
+ var len3 = r1;
3215
+ if (r3) {
3216
+ ptr3 = 0;
3217
+ len3 = 0;
3218
+ throw takeObject(r2);
3219
+ }
3220
+ deferred4_0 = ptr3;
3221
+ deferred4_1 = len3;
3222
+ return getStringFromWasm0(ptr3, len3);
3223
+ } finally {
3224
+ wasm.__wbindgen_add_to_stack_pointer(16);
3225
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3226
+ }
3227
+ }
3228
+ /**
3229
+ * @param {Uint8Array} plain
3230
+ * @param {Uint8Array} key
3231
+ * @returns {Uint8Array}
3232
+ */
3233
+ static symmetric_encrypt_filedata(plain, key) {
3234
+ try {
3235
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3236
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3237
+ const len0 = WASM_VECTOR_LEN;
3238
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3239
+ const len1 = WASM_VECTOR_LEN;
3240
+ wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3241
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3242
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3243
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3244
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3245
+ if (r3) {
3246
+ throw takeObject(r2);
3247
+ }
3248
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3249
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3250
+ return v3;
3251
+ } finally {
3252
+ wasm.__wbindgen_add_to_stack_pointer(16);
3253
+ }
3254
+ }
3255
+ /**
3256
+ * @param {string} encrypted_user_key
3257
+ * @param {string} master_password
3258
+ * @param {string} email
3259
+ * @param {Kdf} kdf
3260
+ * @returns {Uint8Array}
3261
+ */
3262
+ static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
3263
+ try {
3264
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3265
+ const ptr0 = passStringToWasm0(
3266
+ encrypted_user_key,
3267
+ wasm.__wbindgen_malloc,
3268
+ wasm.__wbindgen_realloc,
3269
+ );
3270
+ const len0 = WASM_VECTOR_LEN;
3271
+ const ptr1 = passStringToWasm0(
3272
+ master_password,
3273
+ wasm.__wbindgen_malloc,
3274
+ wasm.__wbindgen_realloc,
3275
+ );
3276
+ const len1 = WASM_VECTOR_LEN;
3277
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3278
+ const len2 = WASM_VECTOR_LEN;
3279
+ wasm.purecrypto_decrypt_user_key_with_master_password(
3280
+ retptr,
3281
+ ptr0,
3282
+ len0,
3283
+ ptr1,
3284
+ len1,
3285
+ ptr2,
3286
+ len2,
3287
+ addHeapObject(kdf),
3288
+ );
3289
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3290
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3291
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3292
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3293
+ if (r3) {
3294
+ throw takeObject(r2);
3295
+ }
3296
+ var v4 = getArrayU8FromWasm0(r0, r1).slice();
3297
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3298
+ return v4;
3299
+ } finally {
3300
+ wasm.__wbindgen_add_to_stack_pointer(16);
3301
+ }
3302
+ }
3303
+ /**
3304
+ * @param {Uint8Array} user_key
3305
+ * @param {string} master_password
3306
+ * @param {string} email
3307
+ * @param {Kdf} kdf
3308
+ * @returns {string}
3309
+ */
3310
+ static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
3311
+ let deferred5_0;
3312
+ let deferred5_1;
3313
+ try {
3314
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3315
+ const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
3316
+ const len0 = WASM_VECTOR_LEN;
3317
+ const ptr1 = passStringToWasm0(
3318
+ master_password,
3319
+ wasm.__wbindgen_malloc,
3320
+ wasm.__wbindgen_realloc,
3321
+ );
3322
+ const len1 = WASM_VECTOR_LEN;
3323
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3324
+ const len2 = WASM_VECTOR_LEN;
3325
+ wasm.purecrypto_encrypt_user_key_with_master_password(
3326
+ retptr,
3327
+ ptr0,
3328
+ len0,
3329
+ ptr1,
3330
+ len1,
3331
+ ptr2,
3332
+ len2,
3333
+ addHeapObject(kdf),
3334
+ );
3335
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3336
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3337
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3338
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3339
+ var ptr4 = r0;
3340
+ var len4 = r1;
3341
+ if (r3) {
3342
+ ptr4 = 0;
3343
+ len4 = 0;
3344
+ throw takeObject(r2);
3345
+ }
3346
+ deferred5_0 = ptr4;
3347
+ deferred5_1 = len4;
3348
+ return getStringFromWasm0(ptr4, len4);
3349
+ } finally {
3350
+ wasm.__wbindgen_add_to_stack_pointer(16);
3351
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
3352
+ }
3353
+ }
3354
+ /**
3355
+ * @returns {Uint8Array}
3356
+ */
3357
+ static make_user_key_aes256_cbc_hmac() {
3358
+ try {
3359
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3360
+ wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
3361
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3362
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3363
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3364
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3365
+ return v1;
3366
+ } finally {
3367
+ wasm.__wbindgen_add_to_stack_pointer(16);
3368
+ }
3369
+ }
3370
+ /**
3371
+ * @returns {Uint8Array}
3372
+ */
3373
+ static make_user_key_xchacha20_poly1305() {
3374
+ try {
3375
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3376
+ wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
3377
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3378
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3379
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3380
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3381
+ return v1;
3382
+ } finally {
3383
+ wasm.__wbindgen_add_to_stack_pointer(16);
3384
+ }
3385
+ }
3386
+ /**
3387
+ * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
3388
+ * as an EncString.
3389
+ * @param {Uint8Array} key_to_be_wrapped
3390
+ * @param {Uint8Array} wrapping_key
3391
+ * @returns {string}
3392
+ */
3393
+ static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
3394
+ let deferred4_0;
3395
+ let deferred4_1;
3396
+ try {
3397
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3398
+ const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
3399
+ const len0 = WASM_VECTOR_LEN;
3400
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3401
+ const len1 = WASM_VECTOR_LEN;
3402
+ wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3403
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3404
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3405
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3406
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3407
+ var ptr3 = r0;
3408
+ var len3 = r1;
3409
+ if (r3) {
3410
+ ptr3 = 0;
3411
+ len3 = 0;
3412
+ throw takeObject(r2);
3413
+ }
3414
+ deferred4_0 = ptr3;
3415
+ deferred4_1 = len3;
3416
+ return getStringFromWasm0(ptr3, len3);
3417
+ } finally {
3418
+ wasm.__wbindgen_add_to_stack_pointer(16);
3419
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3420
+ }
3421
+ }
3422
+ /**
3423
+ * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
3424
+ * unwrapped key as a serialized byte array.
3425
+ * @param {string} wrapped_key
3426
+ * @param {Uint8Array} wrapping_key
3427
+ * @returns {Uint8Array}
3428
+ */
3429
+ static unwrap_symmetric_key(wrapped_key, wrapping_key) {
3430
+ try {
3431
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3432
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3433
+ const len0 = WASM_VECTOR_LEN;
3434
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3435
+ const len1 = WASM_VECTOR_LEN;
3436
+ wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3437
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3438
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3439
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3440
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3441
+ if (r3) {
3442
+ throw takeObject(r2);
3443
+ }
3444
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3445
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3446
+ return v3;
3447
+ } finally {
3448
+ wasm.__wbindgen_add_to_stack_pointer(16);
3449
+ }
3450
+ }
3451
+ /**
3452
+ * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
3453
+ * key. Note: Usually, a public key is - by definition - public, so this should not be
3454
+ * used. The specific use-case for this function is to enable rotateable key sets, where
3455
+ * the "public key" is not public, with the intent of preventing the server from being able
3456
+ * to overwrite the user key unlocked by the rotateable keyset.
3457
+ * @param {Uint8Array} encapsulation_key
3458
+ * @param {Uint8Array} wrapping_key
3459
+ * @returns {string}
3460
+ */
3461
+ static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
3462
+ let deferred4_0;
3463
+ let deferred4_1;
3464
+ try {
3465
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3466
+ const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3467
+ const len0 = WASM_VECTOR_LEN;
3468
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3469
+ const len1 = WASM_VECTOR_LEN;
3470
+ wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
3471
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3472
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3473
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3474
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3475
+ var ptr3 = r0;
3476
+ var len3 = r1;
3477
+ if (r3) {
3478
+ ptr3 = 0;
3479
+ len3 = 0;
3480
+ throw takeObject(r2);
3481
+ }
3482
+ deferred4_0 = ptr3;
3483
+ deferred4_1 = len3;
3484
+ return getStringFromWasm0(ptr3, len3);
3485
+ } finally {
3486
+ wasm.__wbindgen_add_to_stack_pointer(16);
3487
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3488
+ }
3489
+ }
3490
+ /**
3491
+ * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
3492
+ * wrapping key.
3493
+ * @param {string} wrapped_key
3494
+ * @param {Uint8Array} wrapping_key
3495
+ * @returns {Uint8Array}
3496
+ */
3497
+ static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
3498
+ try {
3499
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3500
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3501
+ const len0 = WASM_VECTOR_LEN;
3502
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3503
+ const len1 = WASM_VECTOR_LEN;
3504
+ wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3505
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3506
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3507
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3508
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3509
+ if (r3) {
3510
+ throw takeObject(r2);
3511
+ }
3512
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3513
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3514
+ return v3;
3515
+ } finally {
3516
+ wasm.__wbindgen_add_to_stack_pointer(16);
3517
+ }
3518
+ }
3519
+ /**
3520
+ * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
3521
+ * key,
3522
+ * @param {Uint8Array} decapsulation_key
3523
+ * @param {Uint8Array} wrapping_key
3524
+ * @returns {string}
3525
+ */
3526
+ static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
3527
+ let deferred4_0;
3528
+ let deferred4_1;
3529
+ try {
3530
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3531
+ const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3532
+ const len0 = WASM_VECTOR_LEN;
3533
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3534
+ const len1 = WASM_VECTOR_LEN;
3535
+ wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3536
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3537
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3538
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3539
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3540
+ var ptr3 = r0;
3541
+ var len3 = r1;
3542
+ if (r3) {
3543
+ ptr3 = 0;
3544
+ len3 = 0;
3545
+ throw takeObject(r2);
3546
+ }
3547
+ deferred4_0 = ptr3;
3548
+ deferred4_1 = len3;
3549
+ return getStringFromWasm0(ptr3, len3);
3550
+ } finally {
3551
+ wasm.__wbindgen_add_to_stack_pointer(16);
3552
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3553
+ }
374
3554
  }
375
3555
  /**
376
- * @param {ClientSettings | undefined} [settings]
377
- * @param {LogLevel | undefined} [log_level]
3556
+ * Unwraps (decrypts) a wrapped PKCS8 DER encoded decapsulation (private) key using a symmetric
3557
+ * wrapping key.
3558
+ * @param {string} wrapped_key
3559
+ * @param {Uint8Array} wrapping_key
3560
+ * @returns {Uint8Array}
378
3561
  */
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;
3562
+ static unwrap_decapsulation_key(wrapped_key, wrapping_key) {
3563
+ try {
3564
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3565
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3566
+ const len0 = WASM_VECTOR_LEN;
3567
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3568
+ const len1 = WASM_VECTOR_LEN;
3569
+ wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3570
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3571
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3572
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3573
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3574
+ if (r3) {
3575
+ throw takeObject(r2);
3576
+ }
3577
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3578
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3579
+ return v3;
3580
+ } finally {
3581
+ wasm.__wbindgen_add_to_stack_pointer(16);
3582
+ }
387
3583
  }
388
3584
  /**
389
- * Test method, echoes back the input
390
- * @param {string} msg
3585
+ * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
3586
+ * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
3587
+ * the sender's authenticity cannot be verified by the recipient.
3588
+ * @param {Uint8Array} shared_key
3589
+ * @param {Uint8Array} encapsulation_key
391
3590
  * @returns {string}
392
3591
  */
393
- echo(msg) {
394
- let deferred2_0;
395
- let deferred2_1;
3592
+ static encapsulate_key_unsigned(shared_key, encapsulation_key) {
3593
+ let deferred4_0;
3594
+ let deferred4_1;
396
3595
  try {
397
3596
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
398
- const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3597
+ const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
399
3598
  const len0 = WASM_VECTOR_LEN;
400
- wasm.bitwardenclient_echo(retptr, this.__wbg_ptr, ptr0, len0);
3599
+ const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3600
+ const len1 = WASM_VECTOR_LEN;
3601
+ wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
401
3602
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
402
3603
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
403
- deferred2_0 = r0;
404
- deferred2_1 = r1;
405
- return getStringFromWasm0(r0, r1);
3604
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3605
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3606
+ var ptr3 = r0;
3607
+ var len3 = r1;
3608
+ if (r3) {
3609
+ ptr3 = 0;
3610
+ len3 = 0;
3611
+ throw takeObject(r2);
3612
+ }
3613
+ deferred4_0 = ptr3;
3614
+ deferred4_1 = len3;
3615
+ return getStringFromWasm0(ptr3, len3);
406
3616
  } finally {
407
3617
  wasm.__wbindgen_add_to_stack_pointer(16);
408
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
3618
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
409
3619
  }
410
3620
  }
411
3621
  /**
412
- * @returns {string}
3622
+ * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
3623
+ * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
3624
+ * recipient.
3625
+ * @param {string} encapsulated_key
3626
+ * @param {Uint8Array} decapsulation_key
3627
+ * @returns {Uint8Array}
413
3628
  */
414
- version() {
415
- let deferred1_0;
416
- let deferred1_1;
3629
+ static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
417
3630
  try {
418
3631
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
419
- wasm.bitwardenclient_version(retptr, this.__wbg_ptr);
3632
+ const ptr0 = passStringToWasm0(
3633
+ encapsulated_key,
3634
+ wasm.__wbindgen_malloc,
3635
+ wasm.__wbindgen_realloc,
3636
+ );
3637
+ const len0 = WASM_VECTOR_LEN;
3638
+ const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3639
+ const len1 = WASM_VECTOR_LEN;
3640
+ wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
420
3641
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
421
3642
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
422
- deferred1_0 = r0;
423
- deferred1_1 = r1;
424
- return getStringFromWasm0(r0, r1);
3643
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3644
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3645
+ if (r3) {
3646
+ throw takeObject(r2);
3647
+ }
3648
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3649
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3650
+ return v3;
425
3651
  } finally {
426
3652
  wasm.__wbindgen_add_to_stack_pointer(16);
427
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
428
3653
  }
429
3654
  }
430
3655
  /**
431
- * @param {string} msg
432
- * @returns {Promise<void>}
3656
+ * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
3657
+ * the corresponding verifying key.
3658
+ * @param {string} signing_key
3659
+ * @param {Uint8Array} wrapping_key
3660
+ * @returns {Uint8Array}
433
3661
  */
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);
3662
+ static verifying_key_for_signing_key(signing_key, wrapping_key) {
3663
+ try {
3664
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3665
+ const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3666
+ const len0 = WASM_VECTOR_LEN;
3667
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3668
+ const len1 = WASM_VECTOR_LEN;
3669
+ wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
3670
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3671
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3672
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3673
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3674
+ if (r3) {
3675
+ throw takeObject(r2);
3676
+ }
3677
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3678
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3679
+ return v3;
3680
+ } finally {
3681
+ wasm.__wbindgen_add_to_stack_pointer(16);
3682
+ }
439
3683
  }
440
3684
  /**
441
- * Test method, calls http endpoint
442
- * @param {string} url
443
- * @returns {Promise<string>}
3685
+ * Returns the algorithm used for the given verifying key.
3686
+ * @param {Uint8Array} verifying_key
3687
+ * @returns {SignatureAlgorithm}
444
3688
  */
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);
3689
+ static key_algorithm_for_verifying_key(verifying_key) {
3690
+ try {
3691
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3692
+ const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3693
+ const len0 = WASM_VECTOR_LEN;
3694
+ wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
3695
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3696
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3697
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3698
+ if (r2) {
3699
+ throw takeObject(r1);
3700
+ }
3701
+ return takeObject(r0);
3702
+ } finally {
3703
+ wasm.__wbindgen_add_to_stack_pointer(16);
3704
+ }
450
3705
  }
451
3706
  /**
452
- * @returns {ClientCrypto}
3707
+ * For a given signing identity (verifying key), this function verifies that the signing
3708
+ * identity claimed ownership of the public key. This is a one-sided claim and merely shows
3709
+ * that the signing identity has the intent to receive messages encrypted to the public
3710
+ * key.
3711
+ * @param {Uint8Array} signed_public_key
3712
+ * @param {Uint8Array} verifying_key
3713
+ * @returns {Uint8Array}
453
3714
  */
454
- crypto() {
455
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
456
- return ClientCrypto.__wrap(ret);
3715
+ static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
3716
+ try {
3717
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3718
+ const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
3719
+ const len0 = WASM_VECTOR_LEN;
3720
+ const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3721
+ const len1 = WASM_VECTOR_LEN;
3722
+ wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
3723
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3724
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3725
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3726
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3727
+ if (r3) {
3728
+ throw takeObject(r2);
3729
+ }
3730
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3731
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3732
+ return v3;
3733
+ } finally {
3734
+ wasm.__wbindgen_add_to_stack_pointer(16);
3735
+ }
457
3736
  }
458
3737
  /**
459
- * @returns {ClientVault}
3738
+ * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
3739
+ * @param {Uint8Array} password
3740
+ * @param {Uint8Array} salt
3741
+ * @param {Kdf} kdf
3742
+ * @returns {Uint8Array}
460
3743
  */
461
- vault() {
462
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
463
- return ClientVault.__wrap(ret);
3744
+ static derive_kdf_material(password, salt, kdf) {
3745
+ try {
3746
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3747
+ const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
3748
+ const len0 = WASM_VECTOR_LEN;
3749
+ const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
3750
+ const len1 = WASM_VECTOR_LEN;
3751
+ wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
3752
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3753
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3754
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3755
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3756
+ if (r3) {
3757
+ throw takeObject(r2);
3758
+ }
3759
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3760
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3761
+ return v3;
3762
+ } finally {
3763
+ wasm.__wbindgen_add_to_stack_pointer(16);
3764
+ }
3765
+ }
3766
+ /**
3767
+ * @param {string} encrypted_user_key
3768
+ * @param {Uint8Array} master_key
3769
+ * @returns {Uint8Array}
3770
+ */
3771
+ static decrypt_user_key_with_master_key(encrypted_user_key, master_key) {
3772
+ try {
3773
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3774
+ const ptr0 = passStringToWasm0(
3775
+ encrypted_user_key,
3776
+ wasm.__wbindgen_malloc,
3777
+ wasm.__wbindgen_realloc,
3778
+ );
3779
+ const len0 = WASM_VECTOR_LEN;
3780
+ const ptr1 = passArray8ToWasm0(master_key, wasm.__wbindgen_malloc);
3781
+ const len1 = WASM_VECTOR_LEN;
3782
+ wasm.purecrypto_decrypt_user_key_with_master_key(retptr, ptr0, len0, ptr1, len1);
3783
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3784
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3785
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3786
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3787
+ if (r3) {
3788
+ throw takeObject(r2);
3789
+ }
3790
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3791
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3792
+ return v3;
3793
+ } finally {
3794
+ wasm.__wbindgen_add_to_stack_pointer(16);
3795
+ }
464
3796
  }
465
3797
  }
466
3798
 
467
- const ClientCryptoFinalization =
3799
+ const SendAccessClientFinalization =
468
3800
  typeof FinalizationRegistry === "undefined"
469
3801
  ? { register: () => {}, unregister: () => {} }
470
- : new FinalizationRegistry((ptr) => wasm.__wbg_clientcrypto_free(ptr >>> 0, 1));
471
-
472
- export class ClientCrypto {
3802
+ : new FinalizationRegistry((ptr) => wasm.__wbg_sendaccessclient_free(ptr >>> 0, 1));
3803
+ /**
3804
+ * The `SendAccessClient` is used to interact with the Bitwarden API to get send access tokens.
3805
+ */
3806
+ export class SendAccessClient {
473
3807
  static __wrap(ptr) {
474
3808
  ptr = ptr >>> 0;
475
- const obj = Object.create(ClientCrypto.prototype);
3809
+ const obj = Object.create(SendAccessClient.prototype);
476
3810
  obj.__wbg_ptr = ptr;
477
- ClientCryptoFinalization.register(obj, obj.__wbg_ptr, obj);
3811
+ SendAccessClientFinalization.register(obj, obj.__wbg_ptr, obj);
478
3812
  return obj;
479
3813
  }
480
3814
 
481
3815
  __destroy_into_raw() {
482
3816
  const ptr = this.__wbg_ptr;
483
3817
  this.__wbg_ptr = 0;
484
- ClientCryptoFinalization.unregister(this);
3818
+ SendAccessClientFinalization.unregister(this);
485
3819
  return ptr;
486
3820
  }
487
3821
 
488
3822
  free() {
489
3823
  const ptr = this.__destroy_into_raw();
490
- wasm.__wbg_clientcrypto_free(ptr, 0);
3824
+ wasm.__wbg_sendaccessclient_free(ptr, 0);
491
3825
  }
492
3826
  /**
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>}
3827
+ * Requests a new send access token.
3828
+ * @param {SendAccessTokenRequest} request
3829
+ * @returns {Promise<SendAccessTokenResponse>}
497
3830
  */
498
- initialize_user_crypto(req) {
499
- const ret = wasm.clientcrypto_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
3831
+ request_send_access_token(request) {
3832
+ const ret = wasm.sendaccessclient_request_send_access_token(
3833
+ this.__wbg_ptr,
3834
+ addHeapObject(request),
3835
+ );
500
3836
  return takeObject(ret);
501
3837
  }
3838
+ }
3839
+
3840
+ const StateClientFinalization =
3841
+ typeof FinalizationRegistry === "undefined"
3842
+ ? { register: () => {}, unregister: () => {} }
3843
+ : new FinalizationRegistry((ptr) => wasm.__wbg_stateclient_free(ptr >>> 0, 1));
3844
+
3845
+ export class StateClient {
3846
+ static __wrap(ptr) {
3847
+ ptr = ptr >>> 0;
3848
+ const obj = Object.create(StateClient.prototype);
3849
+ obj.__wbg_ptr = ptr;
3850
+ StateClientFinalization.register(obj, obj.__wbg_ptr, obj);
3851
+ return obj;
3852
+ }
3853
+
3854
+ __destroy_into_raw() {
3855
+ const ptr = this.__wbg_ptr;
3856
+ this.__wbg_ptr = 0;
3857
+ StateClientFinalization.unregister(this);
3858
+ return ptr;
3859
+ }
3860
+
3861
+ free() {
3862
+ const ptr = this.__destroy_into_raw();
3863
+ wasm.__wbg_stateclient_free(ptr, 0);
3864
+ }
502
3865
  /**
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
3866
+ * @param {any} cipher_repository
3867
+ */
3868
+ register_cipher_repository(cipher_repository) {
3869
+ wasm.stateclient_register_cipher_repository(this.__wbg_ptr, addHeapObject(cipher_repository));
3870
+ }
3871
+ /**
3872
+ * @param {any} store
3873
+ */
3874
+ register_folder_repository(store) {
3875
+ wasm.stateclient_register_folder_repository(this.__wbg_ptr, addHeapObject(store));
3876
+ }
3877
+ /**
3878
+ * @param {Repositories} repositories
3879
+ */
3880
+ register_client_managed_repositories(repositories) {
3881
+ wasm.stateclient_register_client_managed_repositories(
3882
+ this.__wbg_ptr,
3883
+ addHeapObject(repositories),
3884
+ );
3885
+ }
3886
+ /**
3887
+ * Initialize the database for SDK managed repositories.
3888
+ * @param {IndexedDbConfiguration} configuration
506
3889
  * @returns {Promise<void>}
507
3890
  */
508
- initialize_org_crypto(req) {
509
- const ret = wasm.clientcrypto_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
3891
+ initialize_state(configuration) {
3892
+ const ret = wasm.stateclient_initialize_state(this.__wbg_ptr, addHeapObject(configuration));
510
3893
  return takeObject(ret);
511
3894
  }
512
3895
  }
513
3896
 
514
- const ClientFoldersFinalization =
3897
+ const TotpClientFinalization =
515
3898
  typeof FinalizationRegistry === "undefined"
516
3899
  ? { register: () => {}, unregister: () => {} }
517
- : new FinalizationRegistry((ptr) => wasm.__wbg_clientfolders_free(ptr >>> 0, 1));
3900
+ : new FinalizationRegistry((ptr) => wasm.__wbg_totpclient_free(ptr >>> 0, 1));
518
3901
 
519
- export class ClientFolders {
3902
+ export class TotpClient {
520
3903
  static __wrap(ptr) {
521
3904
  ptr = ptr >>> 0;
522
- const obj = Object.create(ClientFolders.prototype);
3905
+ const obj = Object.create(TotpClient.prototype);
523
3906
  obj.__wbg_ptr = ptr;
524
- ClientFoldersFinalization.register(obj, obj.__wbg_ptr, obj);
3907
+ TotpClientFinalization.register(obj, obj.__wbg_ptr, obj);
525
3908
  return obj;
526
3909
  }
527
3910
 
528
3911
  __destroy_into_raw() {
529
3912
  const ptr = this.__wbg_ptr;
530
3913
  this.__wbg_ptr = 0;
531
- ClientFoldersFinalization.unregister(this);
3914
+ TotpClientFinalization.unregister(this);
532
3915
  return ptr;
533
3916
  }
534
3917
 
535
3918
  free() {
536
3919
  const ptr = this.__destroy_into_raw();
537
- wasm.__wbg_clientfolders_free(ptr, 0);
3920
+ wasm.__wbg_totpclient_free(ptr, 0);
538
3921
  }
539
3922
  /**
540
- * Decrypt folder
541
- * @param {Folder} folder
542
- * @returns {FolderView}
3923
+ * Generates a TOTP code from a provided key
3924
+ *
3925
+ * # Arguments
3926
+ * - `key` - Can be:
3927
+ * - A base32 encoded string
3928
+ * - OTP Auth URI
3929
+ * - Steam URI
3930
+ * - `time_ms` - Optional timestamp in milliseconds
3931
+ * @param {string} key
3932
+ * @param {number | null} [time_ms]
3933
+ * @returns {TotpResponse}
543
3934
  */
544
- decrypt(folder) {
3935
+ generate_totp(key, time_ms) {
545
3936
  try {
546
3937
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
547
- wasm.clientfolders_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
3938
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3939
+ const len0 = WASM_VECTOR_LEN;
3940
+ wasm.totpclient_generate_totp(
3941
+ retptr,
3942
+ this.__wbg_ptr,
3943
+ ptr0,
3944
+ len0,
3945
+ !isLikeNone(time_ms),
3946
+ isLikeNone(time_ms) ? 0 : time_ms,
3947
+ );
548
3948
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
549
3949
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
550
3950
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -558,37 +3958,70 @@ export class ClientFolders {
558
3958
  }
559
3959
  }
560
3960
 
561
- const ClientVaultFinalization =
3961
+ const VaultClientFinalization =
562
3962
  typeof FinalizationRegistry === "undefined"
563
3963
  ? { register: () => {}, unregister: () => {} }
564
- : new FinalizationRegistry((ptr) => wasm.__wbg_clientvault_free(ptr >>> 0, 1));
3964
+ : new FinalizationRegistry((ptr) => wasm.__wbg_vaultclient_free(ptr >>> 0, 1));
565
3965
 
566
- export class ClientVault {
3966
+ export class VaultClient {
567
3967
  static __wrap(ptr) {
568
3968
  ptr = ptr >>> 0;
569
- const obj = Object.create(ClientVault.prototype);
3969
+ const obj = Object.create(VaultClient.prototype);
570
3970
  obj.__wbg_ptr = ptr;
571
- ClientVaultFinalization.register(obj, obj.__wbg_ptr, obj);
3971
+ VaultClientFinalization.register(obj, obj.__wbg_ptr, obj);
572
3972
  return obj;
573
3973
  }
574
3974
 
575
3975
  __destroy_into_raw() {
576
3976
  const ptr = this.__wbg_ptr;
577
3977
  this.__wbg_ptr = 0;
578
- ClientVaultFinalization.unregister(this);
3978
+ VaultClientFinalization.unregister(this);
579
3979
  return ptr;
580
3980
  }
581
3981
 
582
3982
  free() {
583
3983
  const ptr = this.__destroy_into_raw();
584
- wasm.__wbg_clientvault_free(ptr, 0);
3984
+ wasm.__wbg_vaultclient_free(ptr, 0);
3985
+ }
3986
+ /**
3987
+ * Attachment related operations.
3988
+ * @returns {AttachmentsClient}
3989
+ */
3990
+ attachments() {
3991
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
3992
+ return AttachmentsClient.__wrap(ret);
3993
+ }
3994
+ /**
3995
+ * Cipher related operations.
3996
+ * @returns {CiphersClient}
3997
+ */
3998
+ ciphers() {
3999
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4000
+ return CiphersClient.__wrap(ret);
585
4001
  }
586
4002
  /**
587
- * @returns {ClientFolders}
4003
+ * Folder related operations.
4004
+ * @returns {FoldersClient}
588
4005
  */
589
4006
  folders() {
590
- const ret = wasm.bitwardenclient_crypto(this.__wbg_ptr);
591
- return ClientFolders.__wrap(ret);
4007
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4008
+ return FoldersClient.__wrap(ret);
4009
+ }
4010
+ /**
4011
+ * TOTP related operations.
4012
+ * @returns {TotpClient}
4013
+ */
4014
+ totp() {
4015
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4016
+ return TotpClient.__wrap(ret);
4017
+ }
4018
+ /**
4019
+ * Collection related operations.
4020
+ * @returns {CollectionsClient}
4021
+ */
4022
+ collections() {
4023
+ const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4024
+ return CollectionsClient.__wrap(ret);
592
4025
  }
593
4026
  }
594
4027
 
@@ -600,23 +4033,37 @@ export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
600
4033
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
601
4034
  }
602
4035
 
603
- export function __wbg_abort_05026c983d86824c(arg0) {
4036
+ export function __wbg_abort_410ec47a64ac6117(arg0, arg1) {
4037
+ getObject(arg0).abort(getObject(arg1));
4038
+ }
4039
+
4040
+ export function __wbg_abort_775ef1d17fc65868(arg0) {
604
4041
  getObject(arg0).abort();
605
4042
  }
606
4043
 
607
- export function __wbg_append_66f7cb821a84ee22() {
4044
+ export function __wbg_abort_99fc644e2c79c9fb() {
4045
+ return handleError(function (arg0) {
4046
+ getObject(arg0).abort();
4047
+ }, arguments);
4048
+ }
4049
+
4050
+ export function __wbg_addEventListener_dc3da056b615f634(arg0, arg1, arg2, arg3) {
4051
+ getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
4052
+ }
4053
+
4054
+ export function __wbg_append_299d5d48292c0495() {
608
4055
  return handleError(function (arg0, arg1, arg2, arg3, arg4) {
609
4056
  getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
610
4057
  }, arguments);
611
4058
  }
612
4059
 
613
- export function __wbg_append_72d1635ad8643998() {
4060
+ export function __wbg_append_8c7dd8d641a5f01b() {
614
4061
  return handleError(function (arg0, arg1, arg2, arg3, arg4) {
615
4062
  getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
616
4063
  }, arguments);
617
4064
  }
618
4065
 
619
- export function __wbg_append_7606a4b52c36db7b() {
4066
+ export function __wbg_append_b2d1fc16de2a0e81() {
620
4067
  return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
621
4068
  getObject(arg0).append(
622
4069
  getStringFromWasm0(arg1, arg2),
@@ -626,54 +4073,85 @@ export function __wbg_append_7606a4b52c36db7b() {
626
4073
  }, arguments);
627
4074
  }
628
4075
 
629
- export function __wbg_append_f513a7a3683bdc23() {
4076
+ export function __wbg_append_b44785ebeb668479() {
630
4077
  return handleError(function (arg0, arg1, arg2, arg3) {
631
4078
  getObject(arg0).append(getStringFromWasm0(arg1, arg2), getObject(arg3));
632
4079
  }, arguments);
633
4080
  }
634
4081
 
635
- export function __wbg_buffer_61b7ce01341d7f88(arg0) {
4082
+ export function __wbg_arrayBuffer_d1b44c4390db422f() {
4083
+ return handleError(function (arg0) {
4084
+ const ret = getObject(arg0).arrayBuffer();
4085
+ return addHeapObject(ret);
4086
+ }, arguments);
4087
+ }
4088
+
4089
+ export function __wbg_buffer_609cc3eee51ed158(arg0) {
636
4090
  const ret = getObject(arg0).buffer;
637
4091
  return addHeapObject(ret);
638
4092
  }
639
4093
 
640
- export function __wbg_call_500db948e69c7330() {
4094
+ export function __wbg_call_672a4d21634d4a24() {
4095
+ return handleError(function (arg0, arg1) {
4096
+ const ret = getObject(arg0).call(getObject(arg1));
4097
+ return addHeapObject(ret);
4098
+ }, arguments);
4099
+ }
4100
+
4101
+ export function __wbg_call_7cccdd69e0791ae2() {
641
4102
  return handleError(function (arg0, arg1, arg2) {
642
4103
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
643
4104
  return addHeapObject(ret);
644
4105
  }, arguments);
645
4106
  }
646
4107
 
647
- export function __wbg_call_b0d8e36992d9900d() {
648
- return handleError(function (arg0, arg1) {
649
- const ret = getObject(arg0).call(getObject(arg1));
4108
+ export function __wbg_cipher_8d57d546ebd28feb(arg0) {
4109
+ const ret = getObject(arg0).cipher;
4110
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4111
+ }
4112
+
4113
+ export function __wbg_clearTimeout_b1115618e821c3b2(arg0) {
4114
+ const ret = clearTimeout(takeObject(arg0));
4115
+ return addHeapObject(ret);
4116
+ }
4117
+
4118
+ export function __wbg_collectionviewnodeitem_new(arg0) {
4119
+ const ret = CollectionViewNodeItem.__wrap(arg0);
4120
+ return addHeapObject(ret);
4121
+ }
4122
+
4123
+ export function __wbg_createObjectStore_d2f9e1016f4d81b9() {
4124
+ return handleError(function (arg0, arg1, arg2, arg3) {
4125
+ const ret = getObject(arg0).createObjectStore(getStringFromWasm0(arg1, arg2), getObject(arg3));
650
4126
  return addHeapObject(ret);
651
4127
  }, arguments);
652
4128
  }
653
4129
 
654
- export function __wbg_crypto_ed58b8e10a292839(arg0) {
4130
+ export function __wbg_crypto_574e78ad8b13b65f(arg0) {
655
4131
  const ret = getObject(arg0).crypto;
656
4132
  return addHeapObject(ret);
657
4133
  }
658
4134
 
659
- export function __wbg_debug_19114f11037e4658(arg0, arg1, arg2, arg3) {
4135
+ export function __wbg_debug_e17b51583ca6a632(arg0, arg1, arg2, arg3) {
660
4136
  console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
661
4137
  }
662
4138
 
663
- export function __wbg_done_f22c1561fa919baa(arg0) {
4139
+ export function __wbg_deleteObjectStore_3f08ae00cd288224() {
4140
+ return handleError(function (arg0, arg1, arg2) {
4141
+ getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
4142
+ }, arguments);
4143
+ }
4144
+
4145
+ export function __wbg_done_769e5ede4b31c67b(arg0) {
664
4146
  const ret = getObject(arg0).done;
665
4147
  return ret;
666
4148
  }
667
4149
 
668
- export function __wbg_entries_4f2bb9b0d701c0f6(arg0) {
4150
+ export function __wbg_entries_3265d4158b33e5dc(arg0) {
669
4151
  const ret = Object.entries(getObject(arg0));
670
4152
  return addHeapObject(ret);
671
4153
  }
672
4154
 
673
- export function __wbg_error_483d659117b6f3f6(arg0, arg1, arg2, arg3) {
674
- console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
675
- }
676
-
677
4155
  export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
678
4156
  let deferred0_0;
679
4157
  let deferred0_1;
@@ -686,32 +4164,94 @@ export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
686
4164
  }
687
4165
  }
688
4166
 
689
- export function __wbg_fetch_229368eecee9d217(arg0, arg1) {
4167
+ export function __wbg_error_80de38b3f7cc3c3c(arg0, arg1, arg2, arg3) {
4168
+ console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
4169
+ }
4170
+
4171
+ export function __wbg_error_ff4ddaabdfc5dbb3() {
4172
+ return handleError(function (arg0) {
4173
+ const ret = getObject(arg0).error;
4174
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4175
+ }, arguments);
4176
+ }
4177
+
4178
+ export function __wbg_fetch_3afbdcc7ddbf16fe(arg0) {
4179
+ const ret = fetch(getObject(arg0));
4180
+ return addHeapObject(ret);
4181
+ }
4182
+
4183
+ export function __wbg_fetch_509096533071c657(arg0, arg1) {
690
4184
  const ret = getObject(arg0).fetch(getObject(arg1));
691
4185
  return addHeapObject(ret);
692
4186
  }
693
4187
 
694
- export function __wbg_fetch_b335d17f45a8b5a1(arg0) {
695
- const ret = fetch(getObject(arg0));
696
- return addHeapObject(ret);
4188
+ export function __wbg_folder_e7b703a9574b8633(arg0) {
4189
+ const ret = getObject(arg0).folder;
4190
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4191
+ }
4192
+
4193
+ export function __wbg_getRandomValues_38097e921c2494c3() {
4194
+ return handleError(function (arg0, arg1) {
4195
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
4196
+ }, arguments);
4197
+ }
4198
+
4199
+ export function __wbg_getRandomValues_b8f5dbd5f3995a9e() {
4200
+ return handleError(function (arg0, arg1) {
4201
+ getObject(arg0).getRandomValues(getObject(arg1));
4202
+ }, arguments);
4203
+ }
4204
+
4205
+ export function __wbg_getTime_46267b1c24877e30(arg0) {
4206
+ const ret = getObject(arg0).getTime();
4207
+ return ret;
4208
+ }
4209
+
4210
+ export function __wbg_get_0fe8cec0c515874b() {
4211
+ return handleError(function (arg0, arg1, arg2) {
4212
+ let deferred0_0;
4213
+ let deferred0_1;
4214
+ try {
4215
+ deferred0_0 = arg1;
4216
+ deferred0_1 = arg2;
4217
+ const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2));
4218
+ return addHeapObject(ret);
4219
+ } finally {
4220
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4221
+ }
4222
+ }, arguments);
4223
+ }
4224
+
4225
+ export function __wbg_get_67b2ba62fc30de12() {
4226
+ return handleError(function (arg0, arg1) {
4227
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
4228
+ return addHeapObject(ret);
4229
+ }, arguments);
697
4230
  }
698
4231
 
699
- export function __wbg_getRandomValues_bcb4912f16000dc4() {
700
- return handleError(function (arg0, arg1) {
701
- getObject(arg0).getRandomValues(getObject(arg1));
4232
+ export function __wbg_get_68689cff5a27a4e3() {
4233
+ return handleError(function (arg0, arg1, arg2) {
4234
+ let deferred0_0;
4235
+ let deferred0_1;
4236
+ try {
4237
+ deferred0_0 = arg1;
4238
+ deferred0_1 = arg2;
4239
+ const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2));
4240
+ return addHeapObject(ret);
4241
+ } finally {
4242
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4243
+ }
702
4244
  }, arguments);
703
4245
  }
704
4246
 
705
- export function __wbg_get_9aa3dff3f0266054(arg0, arg1) {
4247
+ export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
706
4248
  const ret = getObject(arg0)[arg1 >>> 0];
707
4249
  return addHeapObject(ret);
708
4250
  }
709
4251
 
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);
714
- }, arguments);
4252
+ export function __wbg_getaccesstoken_e19adb10f028d797(arg0) {
4253
+ const ret = getObject(arg0).get_access_token();
4254
+ return addHeapObject(ret);
715
4255
  }
716
4256
 
717
4257
  export function __wbg_getwithrefkey_1dc361bd10053bfe(arg0, arg1) {
@@ -719,23 +4259,42 @@ export function __wbg_getwithrefkey_1dc361bd10053bfe(arg0, arg1) {
719
4259
  return addHeapObject(ret);
720
4260
  }
721
4261
 
722
- export function __wbg_has_94c2fc1d261bbfe9() {
4262
+ export function __wbg_has_a5ea9117f258a0ec() {
723
4263
  return handleError(function (arg0, arg1) {
724
4264
  const ret = Reflect.has(getObject(arg0), getObject(arg1));
725
4265
  return ret;
726
4266
  }, arguments);
727
4267
  }
728
4268
 
729
- export function __wbg_headers_24e3e19fe3f187c0(arg0) {
4269
+ export function __wbg_headers_9cb51cfd2ac780a4(arg0) {
730
4270
  const ret = getObject(arg0).headers;
731
4271
  return addHeapObject(ret);
732
4272
  }
733
4273
 
734
- export function __wbg_info_18e75e6ce8a36a90(arg0, arg1, arg2, arg3) {
4274
+ export function __wbg_incomingmessage_new(arg0) {
4275
+ const ret = IncomingMessage.__wrap(arg0);
4276
+ return addHeapObject(ret);
4277
+ }
4278
+
4279
+ export function __wbg_indexedDB_b1f49280282046f8() {
4280
+ return handleError(function (arg0) {
4281
+ const ret = getObject(arg0).indexedDB;
4282
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4283
+ }, arguments);
4284
+ }
4285
+
4286
+ export function __wbg_indexedDB_f6b47b0dc333fd2f() {
4287
+ return handleError(function (arg0) {
4288
+ const ret = getObject(arg0).indexedDB;
4289
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4290
+ }, arguments);
4291
+ }
4292
+
4293
+ export function __wbg_info_033d8b8a0838f1d3(arg0, arg1, arg2, arg3) {
735
4294
  console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
736
4295
  }
737
4296
 
738
- export function __wbg_instanceof_ArrayBuffer_670ddde44cdb2602(arg0) {
4297
+ export function __wbg_instanceof_ArrayBuffer_e14585432e3737fc(arg0) {
739
4298
  let result;
740
4299
  try {
741
4300
  result = getObject(arg0) instanceof ArrayBuffer;
@@ -746,7 +4305,62 @@ export function __wbg_instanceof_ArrayBuffer_670ddde44cdb2602(arg0) {
746
4305
  return ret;
747
4306
  }
748
4307
 
749
- export function __wbg_instanceof_Response_d3453657e10c4300(arg0) {
4308
+ export function __wbg_instanceof_DomException_ed1ccb7aaf39034c(arg0) {
4309
+ let result;
4310
+ try {
4311
+ result = getObject(arg0) instanceof DOMException;
4312
+ } catch (_) {
4313
+ result = false;
4314
+ }
4315
+ const ret = result;
4316
+ return ret;
4317
+ }
4318
+
4319
+ export function __wbg_instanceof_IdbDatabase_a3ef009ca00059f9(arg0) {
4320
+ let result;
4321
+ try {
4322
+ result = getObject(arg0) instanceof IDBDatabase;
4323
+ } catch (_) {
4324
+ result = false;
4325
+ }
4326
+ const ret = result;
4327
+ return ret;
4328
+ }
4329
+
4330
+ export function __wbg_instanceof_IdbOpenDbRequest_a3416e156c9db893(arg0) {
4331
+ let result;
4332
+ try {
4333
+ result = getObject(arg0) instanceof IDBOpenDBRequest;
4334
+ } catch (_) {
4335
+ result = false;
4336
+ }
4337
+ const ret = result;
4338
+ return ret;
4339
+ }
4340
+
4341
+ export function __wbg_instanceof_IdbRequest_4813c3f207666aa4(arg0) {
4342
+ let result;
4343
+ try {
4344
+ result = getObject(arg0) instanceof IDBRequest;
4345
+ } catch (_) {
4346
+ result = false;
4347
+ }
4348
+ const ret = result;
4349
+ return ret;
4350
+ }
4351
+
4352
+ export function __wbg_instanceof_Map_f3469ce2244d2430(arg0) {
4353
+ let result;
4354
+ try {
4355
+ result = getObject(arg0) instanceof Map;
4356
+ } catch (_) {
4357
+ result = false;
4358
+ }
4359
+ const ret = result;
4360
+ return ret;
4361
+ }
4362
+
4363
+ export function __wbg_instanceof_Response_f2cc20d9f7dfd644(arg0) {
750
4364
  let result;
751
4365
  try {
752
4366
  result = getObject(arg0) instanceof Response;
@@ -757,7 +4371,7 @@ export function __wbg_instanceof_Response_d3453657e10c4300(arg0) {
757
4371
  return ret;
758
4372
  }
759
4373
 
760
- export function __wbg_instanceof_Uint8Array_28af5bc19d6acad8(arg0) {
4374
+ export function __wbg_instanceof_Uint8Array_17156bcf118086a9(arg0) {
761
4375
  let result;
762
4376
  try {
763
4377
  result = getObject(arg0) instanceof Uint8Array;
@@ -768,62 +4382,109 @@ export function __wbg_instanceof_Uint8Array_28af5bc19d6acad8(arg0) {
768
4382
  return ret;
769
4383
  }
770
4384
 
771
- export function __wbg_isSafeInteger_12f5549b2fca23f4(arg0) {
4385
+ export function __wbg_instanceof_Window_def73ea0955fc569(arg0) {
4386
+ let result;
4387
+ try {
4388
+ result = getObject(arg0) instanceof Window;
4389
+ } catch (_) {
4390
+ result = false;
4391
+ }
4392
+ const ret = result;
4393
+ return ret;
4394
+ }
4395
+
4396
+ export function __wbg_instanceof_WorkerGlobalScope_dbdbdea7e3b56493(arg0) {
4397
+ let result;
4398
+ try {
4399
+ result = getObject(arg0) instanceof WorkerGlobalScope;
4400
+ } catch (_) {
4401
+ result = false;
4402
+ }
4403
+ const ret = result;
4404
+ return ret;
4405
+ }
4406
+
4407
+ export function __wbg_ipcclientsubscription_new(arg0) {
4408
+ const ret = IpcClientSubscription.__wrap(arg0);
4409
+ return addHeapObject(ret);
4410
+ }
4411
+
4412
+ export function __wbg_isArray_a1eab7e0d067391b(arg0) {
4413
+ const ret = Array.isArray(getObject(arg0));
4414
+ return ret;
4415
+ }
4416
+
4417
+ export function __wbg_isSafeInteger_343e2beeeece1bb0(arg0) {
772
4418
  const ret = Number.isSafeInteger(getObject(arg0));
773
4419
  return ret;
774
4420
  }
775
4421
 
776
- export function __wbg_iterator_23604bb983791576() {
4422
+ export function __wbg_iterator_9a24c88df860dc65() {
777
4423
  const ret = Symbol.iterator;
778
4424
  return addHeapObject(ret);
779
4425
  }
780
4426
 
781
- export function __wbg_length_65d1cd11729ced11(arg0) {
4427
+ export function __wbg_length_a446193dc22c12f8(arg0) {
782
4428
  const ret = getObject(arg0).length;
783
4429
  return ret;
784
4430
  }
785
4431
 
786
- export function __wbg_length_d65cf0786bfc5739(arg0) {
4432
+ export function __wbg_length_e2d2a49132c1b256(arg0) {
787
4433
  const ret = getObject(arg0).length;
788
4434
  return ret;
789
4435
  }
790
4436
 
791
- export function __wbg_log_bc77772961bf21bb(arg0, arg1, arg2, arg3) {
4437
+ export function __wbg_list_4d7ad3b099048858() {
4438
+ return handleError(function (arg0) {
4439
+ const ret = getObject(arg0).list();
4440
+ return addHeapObject(ret);
4441
+ }, arguments);
4442
+ }
4443
+
4444
+ export function __wbg_list_58b48f9ba5ad52dc() {
4445
+ return handleError(function (arg0) {
4446
+ const ret = getObject(arg0).list();
4447
+ return addHeapObject(ret);
4448
+ }, arguments);
4449
+ }
4450
+
4451
+ export function __wbg_log_cad59bb680daec67(arg0, arg1, arg2, arg3) {
792
4452
  console.log(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
793
4453
  }
794
4454
 
795
- export function __wbg_msCrypto_0a36e2ec3a343d26(arg0) {
4455
+ export function __wbg_msCrypto_a61aeb35a24c1329(arg0) {
796
4456
  const ret = getObject(arg0).msCrypto;
797
4457
  return addHeapObject(ret);
798
4458
  }
799
4459
 
800
- export function __wbg_new_079af0206358fe9d() {
801
- return handleError(function () {
802
- const ret = new FormData();
803
- return addHeapObject(ret);
804
- }, arguments);
4460
+ export function __wbg_name_f2d27098bfd843e7(arg0, arg1) {
4461
+ const ret = getObject(arg1).name;
4462
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4463
+ const len1 = WASM_VECTOR_LEN;
4464
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4465
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
805
4466
  }
806
4467
 
807
- export function __wbg_new_254fa9eac11932ae() {
808
- const ret = new Array();
4468
+ export function __wbg_new0_f788a2397c7ca929() {
4469
+ const ret = new Date();
809
4470
  return addHeapObject(ret);
810
4471
  }
811
4472
 
812
- export function __wbg_new_35d748855c4620b9() {
4473
+ export function __wbg_new_018dcc2d6c8c2f6a() {
813
4474
  return handleError(function () {
814
4475
  const ret = new Headers();
815
4476
  return addHeapObject(ret);
816
4477
  }, arguments);
817
4478
  }
818
4479
 
819
- export function __wbg_new_3d446df9155128ef(arg0, arg1) {
4480
+ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
820
4481
  try {
821
4482
  var state0 = { a: arg0, b: arg1 };
822
4483
  var cb0 = (arg0, arg1) => {
823
4484
  const a = state0.a;
824
4485
  state0.a = 0;
825
4486
  try {
826
- return __wbg_adapter_125(a, state0.b, arg0, arg1);
4487
+ return __wbg_adapter_346(a, state0.b, arg0, arg1);
827
4488
  } finally {
828
4489
  state0.a = a;
829
4490
  }
@@ -835,31 +4496,48 @@ export function __wbg_new_3d446df9155128ef(arg0, arg1) {
835
4496
  }
836
4497
  }
837
4498
 
838
- export function __wbg_new_3ff5b33b1ce712df(arg0) {
839
- const ret = new Uint8Array(getObject(arg0));
4499
+ export function __wbg_new_405e22f390576ce2() {
4500
+ const ret = new Object();
4501
+ return addHeapObject(ret);
4502
+ }
4503
+
4504
+ export function __wbg_new_5e0be73521bc8c17() {
4505
+ const ret = new Map();
4506
+ return addHeapObject(ret);
4507
+ }
4508
+
4509
+ export function __wbg_new_78feb108b6472713() {
4510
+ const ret = new Array();
4511
+ return addHeapObject(ret);
4512
+ }
4513
+
4514
+ export function __wbg_new_8a6f238a6ece86ea() {
4515
+ const ret = new Error();
840
4516
  return addHeapObject(ret);
841
4517
  }
842
4518
 
843
- export function __wbg_new_5f48f21d4be11586() {
4519
+ export function __wbg_new_9fd39a253424609a() {
844
4520
  return handleError(function () {
845
- const ret = new AbortController();
4521
+ const ret = new FormData();
846
4522
  return addHeapObject(ret);
847
4523
  }, arguments);
848
4524
  }
849
4525
 
850
- export function __wbg_new_6799ef630abee97c(arg0, arg1) {
851
- const ret = new Error(getStringFromWasm0(arg0, arg1));
4526
+ export function __wbg_new_a12002a7f91c75be(arg0) {
4527
+ const ret = new Uint8Array(getObject(arg0));
852
4528
  return addHeapObject(ret);
853
4529
  }
854
4530
 
855
- export function __wbg_new_688846f374351c92() {
856
- const ret = new Object();
4531
+ export function __wbg_new_c68d7209be747379(arg0, arg1) {
4532
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
857
4533
  return addHeapObject(ret);
858
4534
  }
859
4535
 
860
- export function __wbg_new_8a6f238a6ece86ea() {
861
- const ret = new Error();
862
- return addHeapObject(ret);
4536
+ export function __wbg_new_e25e5aab09ff45db() {
4537
+ return handleError(function () {
4538
+ const ret = new AbortController();
4539
+ return addHeapObject(ret);
4540
+ }, arguments);
863
4541
  }
864
4542
 
865
4543
  export function __wbg_new_f24b6d53abe5bc82(arg0, arg1) {
@@ -875,114 +4553,220 @@ export function __wbg_new_f24b6d53abe5bc82(arg0, arg1) {
875
4553
  }
876
4554
  }
877
4555
 
878
- export function __wbg_newnoargs_fd9e4bf8be2bc16d(arg0, arg1) {
4556
+ export function __wbg_newnoargs_105ed471475aaf50(arg0, arg1) {
879
4557
  const ret = new Function(getStringFromWasm0(arg0, arg1));
880
4558
  return addHeapObject(ret);
881
4559
  }
882
4560
 
883
- export function __wbg_newwithbyteoffsetandlength_ba35896968751d91(arg0, arg1, arg2) {
4561
+ export function __wbg_newwithbyteoffsetandlength_d97e637ebe145a9a(arg0, arg1, arg2) {
884
4562
  const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
885
4563
  return addHeapObject(ret);
886
4564
  }
887
4565
 
888
- export function __wbg_newwithlength_34ce8f1051e74449(arg0) {
4566
+ export function __wbg_newwithlength_a381634e90c276d4(arg0) {
889
4567
  const ret = new Uint8Array(arg0 >>> 0);
890
4568
  return addHeapObject(ret);
891
4569
  }
892
4570
 
893
- export function __wbg_newwithstrandinit_a1f6583f20e4faff() {
4571
+ export function __wbg_newwithstrandinit_06c535e0a867c635() {
894
4572
  return handleError(function (arg0, arg1, arg2) {
895
4573
  const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
896
4574
  return addHeapObject(ret);
897
4575
  }, arguments);
898
4576
  }
899
4577
 
900
- export function __wbg_newwithu8arraysequenceandoptions_75a3b40c32d6c988() {
4578
+ export function __wbg_newwithu8arraysequenceandoptions_068570c487f69127() {
901
4579
  return handleError(function (arg0, arg1) {
902
4580
  const ret = new Blob(getObject(arg0), getObject(arg1));
903
4581
  return addHeapObject(ret);
904
4582
  }, arguments);
905
4583
  }
906
4584
 
907
- export function __wbg_next_01dd9234a5bf6d05() {
4585
+ export function __wbg_next_25feadfc0913fea9(arg0) {
4586
+ const ret = getObject(arg0).next;
4587
+ return addHeapObject(ret);
4588
+ }
4589
+
4590
+ export function __wbg_next_6574e1a8a62d1055() {
908
4591
  return handleError(function (arg0) {
909
4592
  const ret = getObject(arg0).next();
910
4593
  return addHeapObject(ret);
911
4594
  }, arguments);
912
4595
  }
913
4596
 
914
- export function __wbg_next_137428deb98342b0(arg0) {
915
- const ret = getObject(arg0).next;
4597
+ export function __wbg_node_905d3e251edff8a2(arg0) {
4598
+ const ret = getObject(arg0).node;
916
4599
  return addHeapObject(ret);
917
4600
  }
918
4601
 
919
- export function __wbg_node_02999533c4ea02e3(arg0) {
920
- const ret = getObject(arg0).node;
921
- return addHeapObject(ret);
4602
+ export function __wbg_open_e0c0b2993eb596e1() {
4603
+ return handleError(function (arg0, arg1, arg2, arg3) {
4604
+ const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
4605
+ return addHeapObject(ret);
4606
+ }, arguments);
4607
+ }
4608
+
4609
+ export function __wbg_parse_def2e24ef1252aff() {
4610
+ return handleError(function (arg0, arg1) {
4611
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
4612
+ return addHeapObject(ret);
4613
+ }, arguments);
4614
+ }
4615
+
4616
+ export function __wbg_preventDefault_c2314fd813c02b3c(arg0) {
4617
+ getObject(arg0).preventDefault();
922
4618
  }
923
4619
 
924
- export function __wbg_process_5c1d670bc53614b8(arg0) {
4620
+ export function __wbg_process_dc0fbacc7c1c06f7(arg0) {
925
4621
  const ret = getObject(arg0).process;
926
4622
  return addHeapObject(ret);
927
4623
  }
928
4624
 
929
- export function __wbg_push_6edad0df4b546b2c(arg0, arg1) {
4625
+ export function __wbg_push_737cfc8c1432c2c6(arg0, arg1) {
930
4626
  const ret = getObject(arg0).push(getObject(arg1));
931
4627
  return ret;
932
4628
  }
933
4629
 
934
- export function __wbg_queueMicrotask_2181040e064c0dc8(arg0) {
4630
+ export function __wbg_queueMicrotask_97d92b4fcc8a61c5(arg0) {
935
4631
  queueMicrotask(getObject(arg0));
936
4632
  }
937
4633
 
938
- export function __wbg_queueMicrotask_ef9ac43769cbcc4f(arg0) {
4634
+ export function __wbg_queueMicrotask_d3219def82552485(arg0) {
939
4635
  const ret = getObject(arg0).queueMicrotask;
940
4636
  return addHeapObject(ret);
941
4637
  }
942
4638
 
943
- export function __wbg_randomFillSync_ab2cfe79ebbf2740() {
4639
+ export function __wbg_randomFillSync_ac0988aba3254290() {
944
4640
  return handleError(function (arg0, arg1) {
945
4641
  getObject(arg0).randomFillSync(takeObject(arg1));
946
4642
  }, arguments);
947
4643
  }
948
4644
 
949
- export function __wbg_require_79b1e9274cde3c87() {
4645
+ export function __wbg_remove_3537743f8f56af1c() {
4646
+ return handleError(function (arg0, arg1, arg2) {
4647
+ let deferred0_0;
4648
+ let deferred0_1;
4649
+ try {
4650
+ deferred0_0 = arg1;
4651
+ deferred0_1 = arg2;
4652
+ const ret = getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
4653
+ return addHeapObject(ret);
4654
+ } finally {
4655
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4656
+ }
4657
+ }, arguments);
4658
+ }
4659
+
4660
+ export function __wbg_remove_588e522225864fee() {
4661
+ return handleError(function (arg0, arg1, arg2) {
4662
+ let deferred0_0;
4663
+ let deferred0_1;
4664
+ try {
4665
+ deferred0_0 = arg1;
4666
+ deferred0_1 = arg2;
4667
+ const ret = getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
4668
+ return addHeapObject(ret);
4669
+ } finally {
4670
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4671
+ }
4672
+ }, arguments);
4673
+ }
4674
+
4675
+ export function __wbg_require_60cc747a6bc5215a() {
950
4676
  return handleError(function () {
951
4677
  const ret = module.require;
952
4678
  return addHeapObject(ret);
953
4679
  }, arguments);
954
4680
  }
955
4681
 
956
- export function __wbg_resolve_0bf7c44d641804f9(arg0) {
4682
+ export function __wbg_resolve_4851785c9c5f573d(arg0) {
957
4683
  const ret = Promise.resolve(getObject(arg0));
958
4684
  return addHeapObject(ret);
959
4685
  }
960
4686
 
961
- export function __wbg_set_23d69db4e5c66a6e(arg0, arg1, arg2) {
962
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4687
+ export function __wbg_result_f29afabdf2c05826() {
4688
+ return handleError(function (arg0) {
4689
+ const ret = getObject(arg0).result;
4690
+ return addHeapObject(ret);
4691
+ }, arguments);
4692
+ }
4693
+
4694
+ export function __wbg_send_9b8fc6bb517867dd() {
4695
+ return handleError(function (arg0, arg1) {
4696
+ const ret = getObject(arg0).send(OutgoingMessage.__wrap(arg1));
4697
+ return addHeapObject(ret);
4698
+ }, arguments);
4699
+ }
4700
+
4701
+ export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
4702
+ const ret = setTimeout(getObject(arg0), arg1);
4703
+ return addHeapObject(ret);
4704
+ }
4705
+
4706
+ export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
4707
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
963
4708
  }
964
4709
 
965
4710
  export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
966
4711
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
967
4712
  }
968
4713
 
969
- export function __wbg_setbody_64920df008e48adc(arg0, arg1) {
4714
+ export function __wbg_set_5d5d2f6723f9ec70() {
4715
+ return handleError(function (arg0, arg1, arg2, arg3) {
4716
+ let deferred0_0;
4717
+ let deferred0_1;
4718
+ try {
4719
+ deferred0_0 = arg1;
4720
+ deferred0_1 = arg2;
4721
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
4722
+ return addHeapObject(ret);
4723
+ } finally {
4724
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4725
+ }
4726
+ }, arguments);
4727
+ }
4728
+
4729
+ export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
4730
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4731
+ }
4732
+
4733
+ export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
4734
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
4735
+ return addHeapObject(ret);
4736
+ }
4737
+
4738
+ export function __wbg_set_d3e2a357bd7efe01() {
4739
+ return handleError(function (arg0, arg1, arg2, arg3) {
4740
+ let deferred0_0;
4741
+ let deferred0_1;
4742
+ try {
4743
+ deferred0_0 = arg1;
4744
+ deferred0_1 = arg2;
4745
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
4746
+ return addHeapObject(ret);
4747
+ } finally {
4748
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
4749
+ }
4750
+ }, arguments);
4751
+ }
4752
+
4753
+ export function __wbg_setbody_5923b78a95eedf29(arg0, arg1) {
970
4754
  getObject(arg0).body = getObject(arg1);
971
4755
  }
972
4756
 
973
- export function __wbg_setcredentials_cfc15e48e3a3a535(arg0, arg1) {
4757
+ export function __wbg_setcredentials_c3a22f1cd105a2c6(arg0, arg1) {
974
4758
  getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
975
4759
  }
976
4760
 
977
- export function __wbg_setheaders_4c921e8e226bdfa7(arg0, arg1) {
4761
+ export function __wbg_setheaders_834c0bdb6a8949ad(arg0, arg1) {
978
4762
  getObject(arg0).headers = getObject(arg1);
979
4763
  }
980
4764
 
981
- export function __wbg_setmethod_cfc7f688ba46a6be(arg0, arg1, arg2) {
4765
+ export function __wbg_setmethod_3c5280fe5d890842(arg0, arg1, arg2) {
982
4766
  getObject(arg0).method = getStringFromWasm0(arg1, arg2);
983
4767
  }
984
4768
 
985
- export function __wbg_setmode_cd03637eb7da01e0(arg0, arg1) {
4769
+ export function __wbg_setmode_5dc300b865044b65(arg0, arg1) {
986
4770
  getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
987
4771
  }
988
4772
 
@@ -998,11 +4782,23 @@ export function __wbg_setname_c0e2d6f348c746f4(arg0, arg1, arg2) {
998
4782
  }
999
4783
  }
1000
4784
 
1001
- export function __wbg_setsignal_f766190d206f09e5(arg0, arg1) {
4785
+ export function __wbg_setonerror_d7e3056cc6e56085(arg0, arg1) {
4786
+ getObject(arg0).onerror = getObject(arg1);
4787
+ }
4788
+
4789
+ export function __wbg_setonsuccess_afa464ee777a396d(arg0, arg1) {
4790
+ getObject(arg0).onsuccess = getObject(arg1);
4791
+ }
4792
+
4793
+ export function __wbg_setonupgradeneeded_fcf7ce4f2eb0cb5f(arg0, arg1) {
4794
+ getObject(arg0).onupgradeneeded = getObject(arg1);
4795
+ }
4796
+
4797
+ export function __wbg_setsignal_75b21ef3a81de905(arg0, arg1) {
1002
4798
  getObject(arg0).signal = getObject(arg1);
1003
4799
  }
1004
4800
 
1005
- export function __wbg_settype_fd39465d237c2f36(arg0, arg1, arg2) {
4801
+ export function __wbg_settype_39ed370d3edd403c(arg0, arg1, arg2) {
1006
4802
  getObject(arg0).type = getStringFromWasm0(arg1, arg2);
1007
4803
  }
1008
4804
 
@@ -1018,7 +4814,7 @@ export function __wbg_setvariant_d1d41b778dfe9c17(arg0, arg1, arg2) {
1018
4814
  }
1019
4815
  }
1020
4816
 
1021
- export function __wbg_signal_1fdadeba2d04660e(arg0) {
4817
+ export function __wbg_signal_aaf9ad74119f20a4(arg0) {
1022
4818
  const ret = getObject(arg0).signal;
1023
4819
  return addHeapObject(ret);
1024
4820
  }
@@ -1031,61 +4827,71 @@ export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
1031
4827
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1032
4828
  }
1033
4829
 
1034
- export function __wbg_static_accessor_GLOBAL_0be7472e492ad3e3() {
4830
+ export function __wbg_static_accessor_GLOBAL_88a902d13a557d07() {
1035
4831
  const ret = typeof global === "undefined" ? null : global;
1036
4832
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
1037
4833
  }
1038
4834
 
1039
- export function __wbg_static_accessor_GLOBAL_THIS_1a6eb482d12c9bfb() {
4835
+ export function __wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0() {
1040
4836
  const ret = typeof globalThis === "undefined" ? null : globalThis;
1041
4837
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
1042
4838
  }
1043
4839
 
1044
- export function __wbg_static_accessor_SELF_1dc398a895c82351() {
4840
+ export function __wbg_static_accessor_SELF_37c5d418e4bf5819() {
1045
4841
  const ret = typeof self === "undefined" ? null : self;
1046
4842
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
1047
4843
  }
1048
4844
 
1049
- export function __wbg_static_accessor_WINDOW_ae1c80c7eea8d64a() {
4845
+ export function __wbg_static_accessor_WINDOW_5de37043a91a9c40() {
1050
4846
  const ret = typeof window === "undefined" ? null : window;
1051
4847
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
1052
4848
  }
1053
4849
 
1054
- export function __wbg_status_317f53bc4c7638df(arg0) {
4850
+ export function __wbg_status_f6360336ca686bf0(arg0) {
1055
4851
  const ret = getObject(arg0).status;
1056
4852
  return ret;
1057
4853
  }
1058
4854
 
1059
- export function __wbg_stringify_f4f701bc34ceda61() {
4855
+ export function __wbg_stringify_f7ed6987935b4a24() {
1060
4856
  return handleError(function (arg0) {
1061
4857
  const ret = JSON.stringify(getObject(arg0));
1062
4858
  return addHeapObject(ret);
1063
4859
  }, arguments);
1064
4860
  }
1065
4861
 
1066
- export function __wbg_subarray_46adeb9b86949d12(arg0, arg1, arg2) {
4862
+ export function __wbg_subarray_aa9065fa9dc5df96(arg0, arg1, arg2) {
1067
4863
  const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1068
4864
  return addHeapObject(ret);
1069
4865
  }
1070
4866
 
1071
- export function __wbg_text_dfc4cb7631d2eb34() {
4867
+ export function __wbg_target_0a62d9d79a2a1ede(arg0) {
4868
+ const ret = getObject(arg0).target;
4869
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4870
+ }
4871
+
4872
+ export function __wbg_text_7805bea50de2af49() {
1072
4873
  return handleError(function (arg0) {
1073
4874
  const ret = getObject(arg0).text();
1074
4875
  return addHeapObject(ret);
1075
4876
  }, arguments);
1076
4877
  }
1077
4878
 
1078
- export function __wbg_then_0438fad860fe38e1(arg0, arg1) {
4879
+ export function __wbg_then_44b73946d2fb3e7d(arg0, arg1) {
1079
4880
  const ret = getObject(arg0).then(getObject(arg1));
1080
4881
  return addHeapObject(ret);
1081
4882
  }
1082
4883
 
1083
- export function __wbg_then_0ffafeddf0e182a4(arg0, arg1, arg2) {
4884
+ export function __wbg_then_48b406749878a531(arg0, arg1, arg2) {
1084
4885
  const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1085
4886
  return addHeapObject(ret);
1086
4887
  }
1087
4888
 
1088
- export function __wbg_url_5327bc0a41a9b085(arg0, arg1) {
4889
+ export function __wbg_transaction_e713aa7b07ccaedd(arg0) {
4890
+ const ret = getObject(arg0).transaction;
4891
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4892
+ }
4893
+
4894
+ export function __wbg_url_ae10c34ca209681d(arg0, arg1) {
1089
4895
  const ret = getObject(arg1).url;
1090
4896
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1091
4897
  const len1 = WASM_VECTOR_LEN;
@@ -1093,25 +4899,51 @@ export function __wbg_url_5327bc0a41a9b085(arg0, arg1) {
1093
4899
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1094
4900
  }
1095
4901
 
1096
- export function __wbg_value_4c32fd138a88eee2(arg0) {
4902
+ export function __wbg_value_cd1ffa7b1ab794f1(arg0) {
1097
4903
  const ret = getObject(arg0).value;
1098
4904
  return addHeapObject(ret);
1099
4905
  }
1100
4906
 
1101
- export function __wbg_versions_c71aa1626a93e0a1(arg0) {
4907
+ export function __wbg_versions_c01dfd4722a88165(arg0) {
1102
4908
  const ret = getObject(arg0).versions;
1103
4909
  return addHeapObject(ret);
1104
4910
  }
1105
4911
 
1106
- export function __wbg_warn_cb8be8bbf790a5d6(arg0, arg1, arg2, arg3) {
4912
+ export function __wbg_warn_aaf1f4664a035bd6(arg0, arg1, arg2, arg3) {
1107
4913
  console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
1108
4914
  }
1109
4915
 
4916
+ export function __wbindgen_array_new() {
4917
+ const ret = [];
4918
+ return addHeapObject(ret);
4919
+ }
4920
+
4921
+ export function __wbindgen_array_push(arg0, arg1) {
4922
+ getObject(arg0).push(takeObject(arg1));
4923
+ }
4924
+
1110
4925
  export function __wbindgen_as_number(arg0) {
1111
4926
  const ret = +getObject(arg0);
1112
4927
  return ret;
1113
4928
  }
1114
4929
 
4930
+ export function __wbindgen_bigint_from_i64(arg0) {
4931
+ const ret = arg0;
4932
+ return addHeapObject(ret);
4933
+ }
4934
+
4935
+ export function __wbindgen_bigint_from_u64(arg0) {
4936
+ const ret = BigInt.asUintN(64, arg0);
4937
+ return addHeapObject(ret);
4938
+ }
4939
+
4940
+ export function __wbindgen_bigint_get_as_i64(arg0, arg1) {
4941
+ const v = getObject(arg1);
4942
+ const ret = typeof v === "bigint" ? v : undefined;
4943
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
4944
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
4945
+ }
4946
+
1115
4947
  export function __wbindgen_boolean_get(arg0) {
1116
4948
  const v = getObject(arg0);
1117
4949
  const ret = typeof v === "boolean" ? (v ? 1 : 0) : 2;
@@ -1128,8 +4960,28 @@ export function __wbindgen_cb_drop(arg0) {
1128
4960
  return ret;
1129
4961
  }
1130
4962
 
1131
- export function __wbindgen_closure_wrapper1832(arg0, arg1, arg2) {
1132
- const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_38);
4963
+ export function __wbindgen_closure_wrapper193(arg0, arg1, arg2) {
4964
+ const ret = makeMutClosure(arg0, arg1, 7, __wbg_adapter_54);
4965
+ return addHeapObject(ret);
4966
+ }
4967
+
4968
+ export function __wbindgen_closure_wrapper195(arg0, arg1, arg2) {
4969
+ const ret = makeMutClosure(arg0, arg1, 7, __wbg_adapter_57);
4970
+ return addHeapObject(ret);
4971
+ }
4972
+
4973
+ export function __wbindgen_closure_wrapper3915(arg0, arg1, arg2) {
4974
+ const ret = makeMutClosure(arg0, arg1, 299, __wbg_adapter_60);
4975
+ return addHeapObject(ret);
4976
+ }
4977
+
4978
+ export function __wbindgen_closure_wrapper6399(arg0, arg1, arg2) {
4979
+ const ret = makeMutClosure(arg0, arg1, 325, __wbg_adapter_60);
4980
+ return addHeapObject(ret);
4981
+ }
4982
+
4983
+ export function __wbindgen_closure_wrapper6779(arg0, arg1, arg2) {
4984
+ const ret = makeMutClosure(arg0, arg1, 348, __wbg_adapter_54);
1133
4985
  return addHeapObject(ret);
1134
4986
  }
1135
4987
 
@@ -1151,6 +5003,11 @@ export function __wbindgen_in(arg0, arg1) {
1151
5003
  return ret;
1152
5004
  }
1153
5005
 
5006
+ export function __wbindgen_is_bigint(arg0) {
5007
+ const ret = typeof getObject(arg0) === "bigint";
5008
+ return ret;
5009
+ }
5010
+
1154
5011
  export function __wbindgen_is_function(arg0) {
1155
5012
  const ret = typeof getObject(arg0) === "function";
1156
5013
  return ret;
@@ -1172,6 +5029,11 @@ export function __wbindgen_is_undefined(arg0) {
1172
5029
  return ret;
1173
5030
  }
1174
5031
 
5032
+ export function __wbindgen_jsval_eq(arg0, arg1) {
5033
+ const ret = getObject(arg0) === getObject(arg1);
5034
+ return ret;
5035
+ }
5036
+
1175
5037
  export function __wbindgen_jsval_loose_eq(arg0, arg1) {
1176
5038
  const ret = getObject(arg0) == getObject(arg1);
1177
5039
  return ret;
@@ -1189,6 +5051,11 @@ export function __wbindgen_number_get(arg0, arg1) {
1189
5051
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1190
5052
  }
1191
5053
 
5054
+ export function __wbindgen_number_new(arg0) {
5055
+ const ret = arg0;
5056
+ return addHeapObject(ret);
5057
+ }
5058
+
1192
5059
  export function __wbindgen_object_clone_ref(arg0) {
1193
5060
  const ret = getObject(arg0);
1194
5061
  return addHeapObject(ret);