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

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