@bitwarden/sdk-internal 0.2.0-main.410 → 0.2.0-main.411

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.
@@ -246,12 +246,6 @@ function getArrayJsValueFromWasm0(ptr, len) {
246
246
  }
247
247
  return result;
248
248
  }
249
- /**
250
- * @param {LogLevel | null} [log_level]
251
- */
252
- exports.init_sdk = function (log_level) {
253
- wasm.init_sdk(isLikeNone(log_level) ? 5 : log_level);
254
- };
255
249
 
256
250
  function passArray8ToWasm0(arg, malloc) {
257
251
  const ptr = malloc(arg.length * 1, 1) >>> 0;
@@ -327,6 +321,13 @@ exports.import_ssh_key = function (imported_key, password) {
327
321
  }
328
322
  };
329
323
 
324
+ /**
325
+ * @param {LogLevel | null} [log_level]
326
+ */
327
+ exports.init_sdk = function (log_level) {
328
+ wasm.init_sdk(isLikeNone(log_level) ? 5 : log_level);
329
+ };
330
+
330
331
  let stack_pointer = 128;
331
332
 
332
333
  function addBorrowedObject(obj) {
@@ -377,9 +378,9 @@ exports.isMasterPasswordError = function (error) {
377
378
  * @param {any} error
378
379
  * @returns {boolean}
379
380
  */
380
- exports.isDeriveKeyConnectorError = function (error) {
381
+ exports.isAccountCryptographyInitializationError = function (error) {
381
382
  try {
382
- const ret = wasm.isDeriveKeyConnectorError(addBorrowedObject(error));
383
+ const ret = wasm.isAccountCryptographyInitializationError(addBorrowedObject(error));
383
384
  return ret !== 0;
384
385
  } finally {
385
386
  heap[stack_pointer++] = undefined;
@@ -390,9 +391,9 @@ exports.isDeriveKeyConnectorError = function (error) {
390
391
  * @param {any} error
391
392
  * @returns {boolean}
392
393
  */
393
- exports.isEnrollAdminPasswordResetError = function (error) {
394
+ exports.isCryptoClientError = function (error) {
394
395
  try {
395
- const ret = wasm.isEnrollAdminPasswordResetError(addBorrowedObject(error));
396
+ const ret = wasm.isCryptoClientError(addBorrowedObject(error));
396
397
  return ret !== 0;
397
398
  } finally {
398
399
  heap[stack_pointer++] = undefined;
@@ -403,9 +404,9 @@ exports.isEnrollAdminPasswordResetError = function (error) {
403
404
  * @param {any} error
404
405
  * @returns {boolean}
405
406
  */
406
- exports.isCryptoClientError = function (error) {
407
+ exports.isDeriveKeyConnectorError = function (error) {
407
408
  try {
408
- const ret = wasm.isCryptoClientError(addBorrowedObject(error));
409
+ const ret = wasm.isDeriveKeyConnectorError(addBorrowedObject(error));
409
410
  return ret !== 0;
410
411
  } finally {
411
412
  heap[stack_pointer++] = undefined;
@@ -416,9 +417,9 @@ exports.isCryptoClientError = function (error) {
416
417
  * @param {any} error
417
418
  * @returns {boolean}
418
419
  */
419
- exports.isAccountCryptographyInitializationError = function (error) {
420
+ exports.isEnrollAdminPasswordResetError = function (error) {
420
421
  try {
421
- const ret = wasm.isAccountCryptographyInitializationError(addBorrowedObject(error));
422
+ const ret = wasm.isEnrollAdminPasswordResetError(addBorrowedObject(error));
422
423
  return ret !== 0;
423
424
  } finally {
424
425
  heap[stack_pointer++] = undefined;
@@ -490,9 +491,9 @@ exports.isExportError = function (error) {
490
491
  * @param {any} error
491
492
  * @returns {boolean}
492
493
  */
493
- exports.isUsernameError = function (error) {
494
+ exports.isPasswordError = function (error) {
494
495
  try {
495
- const ret = wasm.isUsernameError(addBorrowedObject(error));
496
+ const ret = wasm.isPasswordError(addBorrowedObject(error));
496
497
  return ret !== 0;
497
498
  } finally {
498
499
  heap[stack_pointer++] = undefined;
@@ -503,56 +504,22 @@ exports.isUsernameError = function (error) {
503
504
  * @param {any} error
504
505
  * @returns {boolean}
505
506
  */
506
- exports.isPasswordError = function (error) {
507
+ exports.isUsernameError = function (error) {
507
508
  try {
508
- const ret = wasm.isPasswordError(addBorrowedObject(error));
509
+ const ret = wasm.isUsernameError(addBorrowedObject(error));
509
510
  return ret !== 0;
510
511
  } finally {
511
512
  heap[stack_pointer++] = undefined;
512
513
  }
513
514
  };
514
515
 
515
- function _assertClass(instance, klass) {
516
- if (!(instance instanceof klass)) {
517
- throw new Error(`expected instance of ${klass.name}`);
518
- }
519
- }
520
- /**
521
- * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
522
- * @param {IpcClient} ipc_client
523
- * @param {DiscoverResponse} response
524
- * @returns {Promise<void>}
525
- */
526
- exports.ipcRegisterDiscoverHandler = function (ipc_client, response) {
527
- _assertClass(ipc_client, IpcClient);
528
- const ret = wasm.ipcRegisterDiscoverHandler(ipc_client.__wbg_ptr, addHeapObject(response));
529
- return takeObject(ret);
530
- };
531
-
532
- /**
533
- * Sends a DiscoverRequest to the specified destination and returns the response.
534
- * @param {IpcClient} ipc_client
535
- * @param {Endpoint} destination
536
- * @param {AbortSignal | null} [abort_signal]
537
- * @returns {Promise<DiscoverResponse>}
538
- */
539
- exports.ipcRequestDiscover = function (ipc_client, destination, abort_signal) {
540
- _assertClass(ipc_client, IpcClient);
541
- const ret = wasm.ipcRequestDiscover(
542
- ipc_client.__wbg_ptr,
543
- addHeapObject(destination),
544
- isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
545
- );
546
- return takeObject(ret);
547
- };
548
-
549
516
  /**
550
517
  * @param {any} error
551
518
  * @returns {boolean}
552
519
  */
553
- exports.isChannelError = function (error) {
520
+ exports.isRequestError = function (error) {
554
521
  try {
555
- const ret = wasm.isChannelError(addBorrowedObject(error));
522
+ const ret = wasm.isRequestError(addBorrowedObject(error));
556
523
  return ret !== 0;
557
524
  } finally {
558
525
  heap[stack_pointer++] = undefined;
@@ -563,9 +530,9 @@ exports.isChannelError = function (error) {
563
530
  * @param {any} error
564
531
  * @returns {boolean}
565
532
  */
566
- exports.isDeserializeError = function (error) {
533
+ exports.isTypedReceiveError = function (error) {
567
534
  try {
568
- const ret = wasm.isDeserializeError(addBorrowedObject(error));
535
+ const ret = wasm.isTypedReceiveError(addBorrowedObject(error));
569
536
  return ret !== 0;
570
537
  } finally {
571
538
  heap[stack_pointer++] = undefined;
@@ -576,9 +543,9 @@ exports.isDeserializeError = function (error) {
576
543
  * @param {any} error
577
544
  * @returns {boolean}
578
545
  */
579
- exports.isRequestError = function (error) {
546
+ exports.isSubscribeError = function (error) {
580
547
  try {
581
- const ret = wasm.isRequestError(addBorrowedObject(error));
548
+ const ret = wasm.isSubscribeError(addBorrowedObject(error));
582
549
  return ret !== 0;
583
550
  } finally {
584
551
  heap[stack_pointer++] = undefined;
@@ -589,22 +556,27 @@ exports.isRequestError = function (error) {
589
556
  * @param {any} error
590
557
  * @returns {boolean}
591
558
  */
592
- exports.isTypedReceiveError = function (error) {
559
+ exports.isReceiveError = function (error) {
593
560
  try {
594
- const ret = wasm.isTypedReceiveError(addBorrowedObject(error));
561
+ const ret = wasm.isReceiveError(addBorrowedObject(error));
595
562
  return ret !== 0;
596
563
  } finally {
597
564
  heap[stack_pointer++] = undefined;
598
565
  }
599
566
  };
600
567
 
568
+ function _assertClass(instance, klass) {
569
+ if (!(instance instanceof klass)) {
570
+ throw new Error(`expected instance of ${klass.name}`);
571
+ }
572
+ }
601
573
  /**
602
574
  * @param {any} error
603
575
  * @returns {boolean}
604
576
  */
605
- exports.isReceiveError = function (error) {
577
+ exports.isDeserializeError = function (error) {
606
578
  try {
607
- const ret = wasm.isReceiveError(addBorrowedObject(error));
579
+ const ret = wasm.isDeserializeError(addBorrowedObject(error));
608
580
  return ret !== 0;
609
581
  } finally {
610
582
  heap[stack_pointer++] = undefined;
@@ -615,22 +587,51 @@ exports.isReceiveError = function (error) {
615
587
  * @param {any} error
616
588
  * @returns {boolean}
617
589
  */
618
- exports.isSubscribeError = function (error) {
590
+ exports.isChannelError = function (error) {
619
591
  try {
620
- const ret = wasm.isSubscribeError(addBorrowedObject(error));
592
+ const ret = wasm.isChannelError(addBorrowedObject(error));
621
593
  return ret !== 0;
622
594
  } finally {
623
595
  heap[stack_pointer++] = undefined;
624
596
  }
625
597
  };
626
598
 
599
+ /**
600
+ * Sends a DiscoverRequest to the specified destination and returns the response.
601
+ * @param {IpcClient} ipc_client
602
+ * @param {Endpoint} destination
603
+ * @param {AbortSignal | null} [abort_signal]
604
+ * @returns {Promise<DiscoverResponse>}
605
+ */
606
+ exports.ipcRequestDiscover = function (ipc_client, destination, abort_signal) {
607
+ _assertClass(ipc_client, IpcClient);
608
+ const ret = wasm.ipcRequestDiscover(
609
+ ipc_client.__wbg_ptr,
610
+ addHeapObject(destination),
611
+ isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
612
+ );
613
+ return takeObject(ret);
614
+ };
615
+
616
+ /**
617
+ * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
618
+ * @param {IpcClient} ipc_client
619
+ * @param {DiscoverResponse} response
620
+ * @returns {Promise<void>}
621
+ */
622
+ exports.ipcRegisterDiscoverHandler = function (ipc_client, response) {
623
+ _assertClass(ipc_client, IpcClient);
624
+ const ret = wasm.ipcRegisterDiscoverHandler(ipc_client.__wbg_ptr, addHeapObject(response));
625
+ return takeObject(ret);
626
+ };
627
+
627
628
  /**
628
629
  * @param {any} error
629
630
  * @returns {boolean}
630
631
  */
631
- exports.isSshKeyExportError = function (error) {
632
+ exports.isKeyGenerationError = function (error) {
632
633
  try {
633
- const ret = wasm.isSshKeyExportError(addBorrowedObject(error));
634
+ const ret = wasm.isKeyGenerationError(addBorrowedObject(error));
634
635
  return ret !== 0;
635
636
  } finally {
636
637
  heap[stack_pointer++] = undefined;
@@ -641,9 +642,9 @@ exports.isSshKeyExportError = function (error) {
641
642
  * @param {any} error
642
643
  * @returns {boolean}
643
644
  */
644
- exports.isSshKeyImportError = function (error) {
645
+ exports.isSshKeyExportError = function (error) {
645
646
  try {
646
- const ret = wasm.isSshKeyImportError(addBorrowedObject(error));
647
+ const ret = wasm.isSshKeyExportError(addBorrowedObject(error));
647
648
  return ret !== 0;
648
649
  } finally {
649
650
  heap[stack_pointer++] = undefined;
@@ -654,9 +655,9 @@ exports.isSshKeyImportError = function (error) {
654
655
  * @param {any} error
655
656
  * @returns {boolean}
656
657
  */
657
- exports.isKeyGenerationError = function (error) {
658
+ exports.isSshKeyImportError = function (error) {
658
659
  try {
659
- const ret = wasm.isKeyGenerationError(addBorrowedObject(error));
660
+ const ret = wasm.isSshKeyImportError(addBorrowedObject(error));
660
661
  return ret !== 0;
661
662
  } finally {
662
663
  heap[stack_pointer++] = undefined;
@@ -706,9 +707,9 @@ exports.isCallError = function (error) {
706
707
  * @param {any} error
707
708
  * @returns {boolean}
708
709
  */
709
- exports.isDecryptError = function (error) {
710
+ exports.isCipherRiskError = function (error) {
710
711
  try {
711
- const ret = wasm.isDecryptError(addBorrowedObject(error));
712
+ const ret = wasm.isCipherRiskError(addBorrowedObject(error));
712
713
  return ret !== 0;
713
714
  } finally {
714
715
  heap[stack_pointer++] = undefined;
@@ -719,9 +720,9 @@ exports.isDecryptError = function (error) {
719
720
  * @param {any} error
720
721
  * @returns {boolean}
721
722
  */
722
- exports.isEncryptError = function (error) {
723
+ exports.isTotpError = function (error) {
723
724
  try {
724
- const ret = wasm.isEncryptError(addBorrowedObject(error));
725
+ const ret = wasm.isTotpError(addBorrowedObject(error));
725
726
  return ret !== 0;
726
727
  } finally {
727
728
  heap[stack_pointer++] = undefined;
@@ -732,9 +733,9 @@ exports.isEncryptError = function (error) {
732
733
  * @param {any} error
733
734
  * @returns {boolean}
734
735
  */
735
- exports.isTotpError = function (error) {
736
+ exports.isEncryptError = function (error) {
736
737
  try {
737
- const ret = wasm.isTotpError(addBorrowedObject(error));
738
+ const ret = wasm.isEncryptError(addBorrowedObject(error));
738
739
  return ret !== 0;
739
740
  } finally {
740
741
  heap[stack_pointer++] = undefined;
@@ -745,9 +746,9 @@ exports.isTotpError = function (error) {
745
746
  * @param {any} error
746
747
  * @returns {boolean}
747
748
  */
748
- exports.isGetFolderError = function (error) {
749
+ exports.isDecryptError = function (error) {
749
750
  try {
750
- const ret = wasm.isGetFolderError(addBorrowedObject(error));
751
+ const ret = wasm.isDecryptError(addBorrowedObject(error));
751
752
  return ret !== 0;
752
753
  } finally {
753
754
  heap[stack_pointer++] = undefined;
@@ -758,9 +759,9 @@ exports.isGetFolderError = function (error) {
758
759
  * @param {any} error
759
760
  * @returns {boolean}
760
761
  */
761
- exports.isEditFolderError = function (error) {
762
+ exports.isGetCipherError = function (error) {
762
763
  try {
763
- const ret = wasm.isEditFolderError(addBorrowedObject(error));
764
+ const ret = wasm.isGetCipherError(addBorrowedObject(error));
764
765
  return ret !== 0;
765
766
  } finally {
766
767
  heap[stack_pointer++] = undefined;
@@ -771,9 +772,9 @@ exports.isEditFolderError = function (error) {
771
772
  * @param {any} error
772
773
  * @returns {boolean}
773
774
  */
774
- exports.isCreateFolderError = function (error) {
775
+ exports.isEditCipherError = function (error) {
775
776
  try {
776
- const ret = wasm.isCreateFolderError(addBorrowedObject(error));
777
+ const ret = wasm.isEditCipherError(addBorrowedObject(error));
777
778
  return ret !== 0;
778
779
  } finally {
779
780
  heap[stack_pointer++] = undefined;
@@ -784,9 +785,9 @@ exports.isCreateFolderError = function (error) {
784
785
  * @param {any} error
785
786
  * @returns {boolean}
786
787
  */
787
- exports.isCipherRiskError = function (error) {
788
+ exports.isCreateCipherError = function (error) {
788
789
  try {
789
- const ret = wasm.isCipherRiskError(addBorrowedObject(error));
790
+ const ret = wasm.isCreateCipherError(addBorrowedObject(error));
790
791
  return ret !== 0;
791
792
  } finally {
792
793
  heap[stack_pointer++] = undefined;
@@ -797,9 +798,9 @@ exports.isCipherRiskError = function (error) {
797
798
  * @param {any} error
798
799
  * @returns {boolean}
799
800
  */
800
- exports.isGetCipherError = function (error) {
801
+ exports.isEncryptFileError = function (error) {
801
802
  try {
802
- const ret = wasm.isGetCipherError(addBorrowedObject(error));
803
+ const ret = wasm.isEncryptFileError(addBorrowedObject(error));
803
804
  return ret !== 0;
804
805
  } finally {
805
806
  heap[stack_pointer++] = undefined;
@@ -810,9 +811,9 @@ exports.isGetCipherError = function (error) {
810
811
  * @param {any} error
811
812
  * @returns {boolean}
812
813
  */
813
- exports.isEditCipherError = function (error) {
814
+ exports.isDecryptFileError = function (error) {
814
815
  try {
815
- const ret = wasm.isEditCipherError(addBorrowedObject(error));
816
+ const ret = wasm.isDecryptFileError(addBorrowedObject(error));
816
817
  return ret !== 0;
817
818
  } finally {
818
819
  heap[stack_pointer++] = undefined;
@@ -823,9 +824,9 @@ exports.isEditCipherError = function (error) {
823
824
  * @param {any} error
824
825
  * @returns {boolean}
825
826
  */
826
- exports.isCreateCipherError = function (error) {
827
+ exports.isCipherError = function (error) {
827
828
  try {
828
- const ret = wasm.isCreateCipherError(addBorrowedObject(error));
829
+ const ret = wasm.isCipherError(addBorrowedObject(error));
829
830
  return ret !== 0;
830
831
  } finally {
831
832
  heap[stack_pointer++] = undefined;
@@ -836,9 +837,9 @@ exports.isCreateCipherError = function (error) {
836
837
  * @param {any} error
837
838
  * @returns {boolean}
838
839
  */
839
- exports.isCipherError = function (error) {
840
+ exports.isEditFolderError = function (error) {
840
841
  try {
841
- const ret = wasm.isCipherError(addBorrowedObject(error));
842
+ const ret = wasm.isEditFolderError(addBorrowedObject(error));
842
843
  return ret !== 0;
843
844
  } finally {
844
845
  heap[stack_pointer++] = undefined;
@@ -849,9 +850,9 @@ exports.isCipherError = function (error) {
849
850
  * @param {any} error
850
851
  * @returns {boolean}
851
852
  */
852
- exports.isDecryptFileError = function (error) {
853
+ exports.isCreateFolderError = function (error) {
853
854
  try {
854
- const ret = wasm.isDecryptFileError(addBorrowedObject(error));
855
+ const ret = wasm.isCreateFolderError(addBorrowedObject(error));
855
856
  return ret !== 0;
856
857
  } finally {
857
858
  heap[stack_pointer++] = undefined;
@@ -862,31 +863,19 @@ exports.isDecryptFileError = function (error) {
862
863
  * @param {any} error
863
864
  * @returns {boolean}
864
865
  */
865
- exports.isEncryptFileError = function (error) {
866
+ exports.isGetFolderError = function (error) {
866
867
  try {
867
- const ret = wasm.isEncryptFileError(addBorrowedObject(error));
868
+ const ret = wasm.isGetFolderError(addBorrowedObject(error));
868
869
  return ret !== 0;
869
870
  } finally {
870
871
  heap[stack_pointer++] = undefined;
871
872
  }
872
873
  };
873
874
 
874
- function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
875
- wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
876
- }
877
-
878
- function wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(arg0, arg1, arg2) {
879
- wasm.wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(
880
- arg0,
881
- arg1,
882
- addHeapObject(arg2),
883
- );
884
- }
885
-
886
- function wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf(arg0, arg1, arg2) {
875
+ function wasm_bindgen__convert__closures_____invoke__h389a5517bdf6e196(arg0, arg1, arg2) {
887
876
  try {
888
877
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
889
- wasm.wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf(
878
+ wasm.wasm_bindgen__convert__closures_____invoke__h389a5517bdf6e196(
890
879
  retptr,
891
880
  arg0,
892
881
  arg1,
@@ -902,8 +891,20 @@ function wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf(arg0, arg
902
891
  }
903
892
  }
904
893
 
905
- function wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(arg0, arg1, arg2, arg3) {
906
- wasm.wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(
894
+ function wasm_bindgen__convert__closures_____invoke__h05da89f3ce503b8f(arg0, arg1, arg2) {
895
+ wasm.wasm_bindgen__convert__closures_____invoke__h05da89f3ce503b8f(
896
+ arg0,
897
+ arg1,
898
+ addHeapObject(arg2),
899
+ );
900
+ }
901
+
902
+ function wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2(arg0, arg1) {
903
+ wasm.wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2(arg0, arg1);
904
+ }
905
+
906
+ function wasm_bindgen__convert__closures_____invoke__h0cb536241502fe83(arg0, arg1, arg2, arg3) {
907
+ wasm.wasm_bindgen__convert__closures_____invoke__h0cb536241502fe83(
907
908
  arg0,
908
909
  arg1,
909
910
  addHeapObject(arg2),
@@ -1177,14 +1178,6 @@ class AuthClient {
1177
1178
  const ptr = this.__destroy_into_raw();
1178
1179
  wasm.__wbg_authclient_free(ptr, 0);
1179
1180
  }
1180
- /**
1181
- * Client for identity functionality
1182
- * @returns {IdentityClient}
1183
- */
1184
- identity() {
1185
- const ret = wasm.authclient_identity(this.__wbg_ptr);
1186
- return IdentityClient.__wrap(ret);
1187
- }
1188
1181
  /**
1189
1182
  * Client for send access functionality
1190
1183
  * @returns {SendAccessClient}
@@ -1201,6 +1194,14 @@ class AuthClient {
1201
1194
  const ret = wasm.authclient_identity(this.__wbg_ptr);
1202
1195
  return RegistrationClient.__wrap(ret);
1203
1196
  }
1197
+ /**
1198
+ * Client for identity functionality
1199
+ * @returns {IdentityClient}
1200
+ */
1201
+ identity() {
1202
+ const ret = wasm.authclient_identity(this.__wbg_ptr);
1203
+ return IdentityClient.__wrap(ret);
1204
+ }
1204
1205
  }
1205
1206
  if (Symbol.dispose) AuthClient.prototype[Symbol.dispose] = AuthClient.prototype.free;
1206
1207
 
@@ -1233,21 +1234,6 @@ class CipherRiskClient {
1233
1234
  const ptr = this.__destroy_into_raw();
1234
1235
  wasm.__wbg_cipherriskclient_free(ptr, 0);
1235
1236
  }
1236
- /**
1237
- * Build password reuse map for a list of login ciphers.
1238
- *
1239
- * Returns a map where keys are passwords and values are the number of times
1240
- * each password appears in the provided list. This map can be passed to `compute_risk()`
1241
- * to enable password reuse detection.
1242
- * @param {CipherLoginDetails[]} login_details
1243
- * @returns {PasswordReuseMap}
1244
- */
1245
- password_reuse_map(login_details) {
1246
- const ptr0 = passArrayJsValueToWasm0(login_details, wasm.__wbindgen_malloc);
1247
- const len0 = WASM_VECTOR_LEN;
1248
- const ret = wasm.cipherriskclient_password_reuse_map(this.__wbg_ptr, ptr0, len0);
1249
- return takeObject(ret);
1250
- }
1251
1237
  /**
1252
1238
  * Evaluate security risks for multiple login ciphers concurrently.
1253
1239
  *
@@ -1286,6 +1272,21 @@ class CipherRiskClient {
1286
1272
  );
1287
1273
  return takeObject(ret);
1288
1274
  }
1275
+ /**
1276
+ * Build password reuse map for a list of login ciphers.
1277
+ *
1278
+ * Returns a map where keys are passwords and values are the number of times
1279
+ * each password appears in the provided list. This map can be passed to `compute_risk()`
1280
+ * to enable password reuse detection.
1281
+ * @param {CipherLoginDetails[]} login_details
1282
+ * @returns {PasswordReuseMap}
1283
+ */
1284
+ password_reuse_map(login_details) {
1285
+ const ptr0 = passArrayJsValueToWasm0(login_details, wasm.__wbindgen_malloc);
1286
+ const len0 = WASM_VECTOR_LEN;
1287
+ const ret = wasm.cipherriskclient_password_reuse_map(this.__wbg_ptr, ptr0, len0);
1288
+ return takeObject(ret);
1289
+ }
1289
1290
  }
1290
1291
  if (Symbol.dispose) CipherRiskClient.prototype[Symbol.dispose] = CipherRiskClient.prototype.free;
1291
1292
 
@@ -1316,24 +1317,6 @@ class CiphersClient {
1316
1317
  const ptr = this.__destroy_into_raw();
1317
1318
  wasm.__wbg_ciphersclient_free(ptr, 0);
1318
1319
  }
1319
- /**
1320
- * Create a new [Cipher] and save it to the server.
1321
- * @param {CipherCreateRequest} request
1322
- * @returns {Promise<CipherView>}
1323
- */
1324
- create(request) {
1325
- const ret = wasm.ciphersclient_create(this.__wbg_ptr, addHeapObject(request));
1326
- return takeObject(ret);
1327
- }
1328
- /**
1329
- * Edit an existing [Cipher] and save it to the server.
1330
- * @param {CipherEditRequest} request
1331
- * @returns {Promise<CipherView>}
1332
- */
1333
- edit(request) {
1334
- const ret = wasm.ciphersclient_edit(this.__wbg_ptr, addHeapObject(request));
1335
- return takeObject(ret);
1336
- }
1337
1320
  /**
1338
1321
  * Moves a cipher into an organization, adds it to collections, and calls the share_cipher API.
1339
1322
  * @param {CipherView} cipher_view
@@ -1379,47 +1362,42 @@ class CiphersClient {
1379
1362
  return takeObject(ret);
1380
1363
  }
1381
1364
  /**
1382
- * @param {CipherView} cipher_view
1383
- * @returns {EncryptionContext}
1365
+ * @param {Cipher[]} ciphers
1366
+ * @returns {CipherListView[]}
1384
1367
  */
1385
- encrypt(cipher_view) {
1368
+ decrypt_list(ciphers) {
1386
1369
  try {
1387
1370
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1388
- wasm.ciphersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
1371
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1372
+ const len0 = WASM_VECTOR_LEN;
1373
+ wasm.ciphersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1389
1374
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1390
1375
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1391
1376
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1392
- if (r2) {
1393
- throw takeObject(r1);
1377
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1378
+ if (r3) {
1379
+ throw takeObject(r2);
1394
1380
  }
1395
- return takeObject(r0);
1381
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1382
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1383
+ return v2;
1396
1384
  } finally {
1397
1385
  wasm.__wbindgen_add_to_stack_pointer(16);
1398
1386
  }
1399
1387
  }
1400
1388
  /**
1401
- * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1402
- * keys in the Web client.
1403
- *
1404
- * Until key rotation is fully implemented in the SDK, this method must be provided the new
1405
- * symmetric key in base64 format. See PM-23084
1406
- *
1407
- * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1408
- * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1409
- * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1410
- * key directly.
1411
1389
  * @param {CipherView} cipher_view
1412
- * @param {B64} new_key
1413
- * @returns {EncryptionContext}
1390
+ * @param {OrganizationId} organization_id
1391
+ * @returns {CipherView}
1414
1392
  */
1415
- encrypt_cipher_for_rotation(cipher_view, new_key) {
1393
+ move_to_organization(cipher_view, organization_id) {
1416
1394
  try {
1417
1395
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1418
- wasm.ciphersclient_encrypt_cipher_for_rotation(
1396
+ wasm.ciphersclient_move_to_organization(
1419
1397
  retptr,
1420
1398
  this.__wbg_ptr,
1421
1399
  addHeapObject(cipher_view),
1422
- addHeapObject(new_key),
1400
+ addHeapObject(organization_id),
1423
1401
  );
1424
1402
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1425
1403
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
@@ -1433,13 +1411,27 @@ class CiphersClient {
1433
1411
  }
1434
1412
  }
1435
1413
  /**
1436
- * @param {Cipher} cipher
1414
+ * Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
1415
+ * Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
1416
+ * TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
1417
+ * encrypting the rest of the CipherView.
1418
+ * TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
1419
+ * @param {CipherView} cipher_view
1420
+ * @param {Fido2CredentialFullView[]} fido2_credentials
1437
1421
  * @returns {CipherView}
1438
1422
  */
1439
- decrypt(cipher) {
1423
+ set_fido2_credentials(cipher_view, fido2_credentials) {
1440
1424
  try {
1441
1425
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1442
- wasm.ciphersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
1426
+ const ptr0 = passArrayJsValueToWasm0(fido2_credentials, wasm.__wbindgen_malloc);
1427
+ const len0 = WASM_VECTOR_LEN;
1428
+ wasm.ciphersclient_set_fido2_credentials(
1429
+ retptr,
1430
+ this.__wbg_ptr,
1431
+ addHeapObject(cipher_view),
1432
+ ptr0,
1433
+ len0,
1434
+ );
1443
1435
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1444
1436
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1445
1437
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1452,15 +1444,17 @@ class CiphersClient {
1452
1444
  }
1453
1445
  }
1454
1446
  /**
1455
- * @param {Cipher[]} ciphers
1456
- * @returns {CipherListView[]}
1447
+ * @param {CipherView} cipher_view
1448
+ * @returns {Fido2CredentialView[]}
1457
1449
  */
1458
- decrypt_list(ciphers) {
1450
+ decrypt_fido2_credentials(cipher_view) {
1459
1451
  try {
1460
1452
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1461
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1462
- const len0 = WASM_VECTOR_LEN;
1463
- wasm.ciphersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1453
+ wasm.ciphersclient_decrypt_fido2_credentials(
1454
+ retptr,
1455
+ this.__wbg_ptr,
1456
+ addHeapObject(cipher_view),
1457
+ );
1464
1458
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1465
1459
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1466
1460
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1468,33 +1462,23 @@ class CiphersClient {
1468
1462
  if (r3) {
1469
1463
  throw takeObject(r2);
1470
1464
  }
1471
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1465
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1472
1466
  wasm.__wbindgen_free(r0, r1 * 4, 4);
1473
- return v2;
1467
+ return v1;
1474
1468
  } finally {
1475
1469
  wasm.__wbindgen_add_to_stack_pointer(16);
1476
1470
  }
1477
1471
  }
1478
- /**
1479
- * Decrypt cipher list with failures
1480
- * Returns both successfully decrypted ciphers and any that failed to decrypt
1481
- * @param {Cipher[]} ciphers
1482
- * @returns {DecryptCipherListResult}
1483
- */
1484
- decrypt_list_with_failures(ciphers) {
1485
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1486
- const len0 = WASM_VECTOR_LEN;
1487
- const ret = wasm.ciphersclient_decrypt_list_with_failures(this.__wbg_ptr, ptr0, len0);
1488
- return takeObject(ret);
1489
- }
1490
1472
  /**
1491
1473
  * @param {CipherView} cipher_view
1492
- * @returns {Fido2CredentialView[]}
1474
+ * @returns {string}
1493
1475
  */
1494
- decrypt_fido2_credentials(cipher_view) {
1476
+ decrypt_fido2_private_key(cipher_view) {
1477
+ let deferred2_0;
1478
+ let deferred2_1;
1495
1479
  try {
1496
1480
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1497
- wasm.ciphersclient_decrypt_fido2_credentials(
1481
+ wasm.ciphersclient_decrypt_fido2_private_key(
1498
1482
  retptr,
1499
1483
  this.__wbg_ptr,
1500
1484
  addHeapObject(cipher_view),
@@ -1503,37 +1487,56 @@ class CiphersClient {
1503
1487
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1504
1488
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1505
1489
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1490
+ var ptr1 = r0;
1491
+ var len1 = r1;
1506
1492
  if (r3) {
1493
+ ptr1 = 0;
1494
+ len1 = 0;
1507
1495
  throw takeObject(r2);
1508
1496
  }
1509
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1510
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1511
- return v1;
1497
+ deferred2_0 = ptr1;
1498
+ deferred2_1 = len1;
1499
+ return getStringFromWasm0(ptr1, len1);
1512
1500
  } finally {
1513
1501
  wasm.__wbindgen_add_to_stack_pointer(16);
1502
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1514
1503
  }
1515
1504
  }
1516
1505
  /**
1517
- * Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
1518
- * Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
1519
- * TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
1520
- * encrypting the rest of the CipherView.
1521
- * TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
1506
+ * Decrypt cipher list with failures
1507
+ * Returns both successfully decrypted ciphers and any that failed to decrypt
1508
+ * @param {Cipher[]} ciphers
1509
+ * @returns {DecryptCipherListResult}
1510
+ */
1511
+ decrypt_list_with_failures(ciphers) {
1512
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1513
+ const len0 = WASM_VECTOR_LEN;
1514
+ const ret = wasm.ciphersclient_decrypt_list_with_failures(this.__wbg_ptr, ptr0, len0);
1515
+ return takeObject(ret);
1516
+ }
1517
+ /**
1518
+ * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1519
+ * keys in the Web client.
1520
+ *
1521
+ * Until key rotation is fully implemented in the SDK, this method must be provided the new
1522
+ * symmetric key in base64 format. See PM-23084
1523
+ *
1524
+ * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1525
+ * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1526
+ * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1527
+ * key directly.
1522
1528
  * @param {CipherView} cipher_view
1523
- * @param {Fido2CredentialFullView[]} fido2_credentials
1524
- * @returns {CipherView}
1529
+ * @param {B64} new_key
1530
+ * @returns {EncryptionContext}
1525
1531
  */
1526
- set_fido2_credentials(cipher_view, fido2_credentials) {
1532
+ encrypt_cipher_for_rotation(cipher_view, new_key) {
1527
1533
  try {
1528
1534
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1529
- const ptr0 = passArrayJsValueToWasm0(fido2_credentials, wasm.__wbindgen_malloc);
1530
- const len0 = WASM_VECTOR_LEN;
1531
- wasm.ciphersclient_set_fido2_credentials(
1535
+ wasm.ciphersclient_encrypt_cipher_for_rotation(
1532
1536
  retptr,
1533
1537
  this.__wbg_ptr,
1534
1538
  addHeapObject(cipher_view),
1535
- ptr0,
1536
- len0,
1539
+ addHeapObject(new_key),
1537
1540
  );
1538
1541
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1539
1542
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
@@ -1547,19 +1550,13 @@ class CiphersClient {
1547
1550
  }
1548
1551
  }
1549
1552
  /**
1550
- * @param {CipherView} cipher_view
1551
- * @param {OrganizationId} organization_id
1553
+ * @param {Cipher} cipher
1552
1554
  * @returns {CipherView}
1553
1555
  */
1554
- move_to_organization(cipher_view, organization_id) {
1556
+ decrypt(cipher) {
1555
1557
  try {
1556
1558
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1557
- wasm.ciphersclient_move_to_organization(
1558
- retptr,
1559
- this.__wbg_ptr,
1560
- addHeapObject(cipher_view),
1561
- addHeapObject(organization_id),
1562
- );
1559
+ wasm.ciphersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
1563
1560
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1564
1561
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1565
1562
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1573,37 +1570,41 @@ class CiphersClient {
1573
1570
  }
1574
1571
  /**
1575
1572
  * @param {CipherView} cipher_view
1576
- * @returns {string}
1573
+ * @returns {EncryptionContext}
1577
1574
  */
1578
- decrypt_fido2_private_key(cipher_view) {
1579
- let deferred2_0;
1580
- let deferred2_1;
1575
+ encrypt(cipher_view) {
1581
1576
  try {
1582
1577
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1583
- wasm.ciphersclient_decrypt_fido2_private_key(
1584
- retptr,
1585
- this.__wbg_ptr,
1586
- addHeapObject(cipher_view),
1587
- );
1578
+ wasm.ciphersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
1588
1579
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1589
1580
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1590
1581
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1591
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1592
- var ptr1 = r0;
1593
- var len1 = r1;
1594
- if (r3) {
1595
- ptr1 = 0;
1596
- len1 = 0;
1597
- throw takeObject(r2);
1582
+ if (r2) {
1583
+ throw takeObject(r1);
1598
1584
  }
1599
- deferred2_0 = ptr1;
1600
- deferred2_1 = len1;
1601
- return getStringFromWasm0(ptr1, len1);
1585
+ return takeObject(r0);
1602
1586
  } finally {
1603
1587
  wasm.__wbindgen_add_to_stack_pointer(16);
1604
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1605
1588
  }
1606
1589
  }
1590
+ /**
1591
+ * Edit an existing [Cipher] and save it to the server.
1592
+ * @param {CipherEditRequest} request
1593
+ * @returns {Promise<CipherView>}
1594
+ */
1595
+ edit(request) {
1596
+ const ret = wasm.ciphersclient_edit(this.__wbg_ptr, addHeapObject(request));
1597
+ return takeObject(ret);
1598
+ }
1599
+ /**
1600
+ * Create a new [Cipher] and save it to the server.
1601
+ * @param {CipherCreateRequest} request
1602
+ * @returns {Promise<CipherView>}
1603
+ */
1604
+ create(request) {
1605
+ const ret = wasm.ciphersclient_create(this.__wbg_ptr, addHeapObject(request));
1606
+ return takeObject(ret);
1607
+ }
1607
1608
  }
1608
1609
  if (Symbol.dispose) CiphersClient.prototype[Symbol.dispose] = CiphersClient.prototype.free;
1609
1610
 
@@ -1634,13 +1635,6 @@ class CollectionViewNodeItem {
1634
1635
  const ptr = this.__destroy_into_raw();
1635
1636
  wasm.__wbg_collectionviewnodeitem_free(ptr, 0);
1636
1637
  }
1637
- /**
1638
- * @returns {CollectionView}
1639
- */
1640
- get_item() {
1641
- const ret = wasm.collectionviewnodeitem_get_item(this.__wbg_ptr);
1642
- return takeObject(ret);
1643
- }
1644
1638
  /**
1645
1639
  * @returns {CollectionView | undefined}
1646
1640
  */
@@ -1671,6 +1665,13 @@ class CollectionViewNodeItem {
1671
1665
  const ret = wasm.collectionviewnodeitem_get_ancestors(this.__wbg_ptr);
1672
1666
  return takeObject(ret);
1673
1667
  }
1668
+ /**
1669
+ * @returns {CollectionView}
1670
+ */
1671
+ get_item() {
1672
+ const ret = wasm.collectionviewnodeitem_get_item(this.__wbg_ptr);
1673
+ return takeObject(ret);
1674
+ }
1674
1675
  }
1675
1676
  if (Symbol.dispose)
1676
1677
  CollectionViewNodeItem.prototype[Symbol.dispose] = CollectionViewNodeItem.prototype.free;
@@ -1702,24 +1703,13 @@ class CollectionViewTree {
1702
1703
  const ptr = this.__destroy_into_raw();
1703
1704
  wasm.__wbg_collectionviewtree_free(ptr, 0);
1704
1705
  }
1705
- /**
1706
- * @param {CollectionView} collection_view
1707
- * @returns {CollectionViewNodeItem | undefined}
1708
- */
1709
- get_item_for_view(collection_view) {
1710
- const ret = wasm.collectionviewtree_get_item_for_view(
1711
- this.__wbg_ptr,
1712
- addHeapObject(collection_view),
1713
- );
1714
- return ret === 0 ? undefined : CollectionViewNodeItem.__wrap(ret);
1715
- }
1716
1706
  /**
1717
1707
  * @returns {CollectionViewNodeItem[]}
1718
1708
  */
1719
- get_root_items() {
1709
+ get_flat_items() {
1720
1710
  try {
1721
1711
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1722
- wasm.collectionviewtree_get_root_items(retptr, this.__wbg_ptr);
1712
+ wasm.collectionviewtree_get_flat_items(retptr, this.__wbg_ptr);
1723
1713
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1724
1714
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1725
1715
  var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
@@ -1732,10 +1722,10 @@ class CollectionViewTree {
1732
1722
  /**
1733
1723
  * @returns {CollectionViewNodeItem[]}
1734
1724
  */
1735
- get_flat_items() {
1725
+ get_root_items() {
1736
1726
  try {
1737
1727
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1738
- wasm.collectionviewtree_get_flat_items(retptr, this.__wbg_ptr);
1728
+ wasm.collectionviewtree_get_root_items(retptr, this.__wbg_ptr);
1739
1729
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1740
1730
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1741
1731
  var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
@@ -1745,8 +1735,19 @@ class CollectionViewTree {
1745
1735
  wasm.__wbindgen_add_to_stack_pointer(16);
1746
1736
  }
1747
1737
  }
1748
- }
1749
- if (Symbol.dispose)
1738
+ /**
1739
+ * @param {CollectionView} collection_view
1740
+ * @returns {CollectionViewNodeItem | undefined}
1741
+ */
1742
+ get_item_for_view(collection_view) {
1743
+ const ret = wasm.collectionviewtree_get_item_for_view(
1744
+ this.__wbg_ptr,
1745
+ addHeapObject(collection_view),
1746
+ );
1747
+ return ret === 0 ? undefined : CollectionViewNodeItem.__wrap(ret);
1748
+ }
1749
+ }
1750
+ if (Symbol.dispose)
1750
1751
  CollectionViewTree.prototype[Symbol.dispose] = CollectionViewTree.prototype.free;
1751
1752
 
1752
1753
  exports.CollectionViewTree = CollectionViewTree;
@@ -1776,25 +1777,6 @@ class CollectionsClient {
1776
1777
  const ptr = this.__destroy_into_raw();
1777
1778
  wasm.__wbg_collectionsclient_free(ptr, 0);
1778
1779
  }
1779
- /**
1780
- * @param {Collection} collection
1781
- * @returns {CollectionView}
1782
- */
1783
- decrypt(collection) {
1784
- try {
1785
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1786
- wasm.collectionsclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(collection));
1787
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1788
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1789
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1790
- if (r2) {
1791
- throw takeObject(r1);
1792
- }
1793
- return takeObject(r0);
1794
- } finally {
1795
- wasm.__wbindgen_add_to_stack_pointer(16);
1796
- }
1797
- }
1798
1780
  /**
1799
1781
  * @param {Collection[]} collections
1800
1782
  * @returns {CollectionView[]}
@@ -1832,6 +1814,25 @@ class CollectionsClient {
1832
1814
  const ret = wasm.collectionsclient_get_collection_tree(this.__wbg_ptr, ptr0, len0);
1833
1815
  return CollectionViewTree.__wrap(ret);
1834
1816
  }
1817
+ /**
1818
+ * @param {Collection} collection
1819
+ * @returns {CollectionView}
1820
+ */
1821
+ decrypt(collection) {
1822
+ try {
1823
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1824
+ wasm.collectionsclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(collection));
1825
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1826
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1827
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1828
+ if (r2) {
1829
+ throw takeObject(r1);
1830
+ }
1831
+ return takeObject(r0);
1832
+ } finally {
1833
+ wasm.__wbindgen_add_to_stack_pointer(16);
1834
+ }
1835
+ }
1835
1836
  }
1836
1837
  if (Symbol.dispose) CollectionsClient.prototype[Symbol.dispose] = CollectionsClient.prototype.free;
1837
1838
 
@@ -1865,35 +1866,18 @@ class CryptoClient {
1865
1866
  wasm.__wbg_cryptoclient_free(ptr, 0);
1866
1867
  }
1867
1868
  /**
1868
- * Initialization method for the user crypto. Needs to be called before any other crypto
1869
- * operations.
1870
- * @param {InitUserCryptoRequest} req
1871
- * @returns {Promise<void>}
1872
- */
1873
- initialize_user_crypto(req) {
1874
- const ret = wasm.cryptoclient_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
1875
- return takeObject(ret);
1876
- }
1877
- /**
1878
- * Initialization method for the organization crypto. Needs to be called after
1879
- * `initialize_user_crypto` but before any other crypto operations.
1880
- * @param {InitOrgCryptoRequest} req
1881
- * @returns {Promise<void>}
1882
- */
1883
- initialize_org_crypto(req) {
1884
- const ret = wasm.cryptoclient_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
1885
- return takeObject(ret);
1886
- }
1887
- /**
1888
- * Generates a new key pair and encrypts the private key with the provided user key.
1889
- * Crypto initialization not required.
1890
- * @param {B64} user_key
1891
- * @returns {MakeKeyPairResponse}
1869
+ * Protects the current user key with the provided PIN. The result can be stored and later
1870
+ * used to initialize another client instance by using the PIN and the PIN key with
1871
+ * `initialize_user_crypto`.
1872
+ * @param {string} pin
1873
+ * @returns {EnrollPinResponse}
1892
1874
  */
1893
- make_key_pair(user_key) {
1875
+ enroll_pin(pin) {
1894
1876
  try {
1895
1877
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1896
- wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, addHeapObject(user_key));
1878
+ const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1879
+ const len0 = WASM_VECTOR_LEN;
1880
+ wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
1897
1881
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1898
1882
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1899
1883
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1906,16 +1890,15 @@ class CryptoClient {
1906
1890
  }
1907
1891
  }
1908
1892
  /**
1909
- * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1910
- * key. Returns if the private key is decryptable and if it is a valid matching key.
1893
+ * Generates a new key pair and encrypts the private key with the provided user key.
1911
1894
  * Crypto initialization not required.
1912
- * @param {VerifyAsymmetricKeysRequest} request
1913
- * @returns {VerifyAsymmetricKeysResponse}
1895
+ * @param {B64} user_key
1896
+ * @returns {MakeKeyPairResponse}
1914
1897
  */
1915
- verify_asymmetric_keys(request) {
1898
+ make_key_pair(user_key) {
1916
1899
  try {
1917
1900
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1918
- wasm.cryptoclient_verify_asymmetric_keys(retptr, this.__wbg_ptr, addHeapObject(request));
1901
+ wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, addHeapObject(user_key));
1919
1902
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1920
1903
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1921
1904
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1928,13 +1911,19 @@ class CryptoClient {
1928
1911
  }
1929
1912
  }
1930
1913
  /**
1931
- * Makes a new signing key pair and signs the public key for the user
1932
- * @returns {UserCryptoV2KeysResponse}
1914
+ * Create the data necessary to update the user's kdf settings. The user's encryption key is
1915
+ * re-encrypted for the password under the new kdf settings. This returns the re-encrypted
1916
+ * user key and the new password hash but does not update sdk state.
1917
+ * @param {string} password
1918
+ * @param {Kdf} kdf
1919
+ * @returns {UpdateKdfResponse}
1933
1920
  */
1934
- make_keys_for_user_crypto_v2() {
1921
+ make_update_kdf(password, kdf) {
1935
1922
  try {
1936
1923
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1937
- wasm.cryptoclient_make_keys_for_user_crypto_v2(retptr, this.__wbg_ptr);
1924
+ const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1925
+ const len0 = WASM_VECTOR_LEN;
1926
+ wasm.cryptoclient_make_update_kdf(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(kdf));
1938
1927
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1939
1928
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1940
1929
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1947,13 +1936,36 @@ class CryptoClient {
1947
1936
  }
1948
1937
  }
1949
1938
  /**
1950
- * Creates a rotated set of account keys for the current state
1951
- * @returns {UserCryptoV2KeysResponse}
1939
+ * Initialization method for the organization crypto. Needs to be called after
1940
+ * `initialize_user_crypto` but before any other crypto operations.
1941
+ * @param {InitOrgCryptoRequest} req
1942
+ * @returns {Promise<void>}
1952
1943
  */
1953
- get_v2_rotated_account_keys() {
1944
+ initialize_org_crypto(req) {
1945
+ const ret = wasm.cryptoclient_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
1946
+ return takeObject(ret);
1947
+ }
1948
+ /**
1949
+ * Initialization method for the user crypto. Needs to be called before any other crypto
1950
+ * operations.
1951
+ * @param {InitUserCryptoRequest} req
1952
+ * @returns {Promise<void>}
1953
+ */
1954
+ initialize_user_crypto(req) {
1955
+ const ret = wasm.cryptoclient_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
1956
+ return takeObject(ret);
1957
+ }
1958
+ /**
1959
+ * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1960
+ * key. Returns if the private key is decryptable and if it is a valid matching key.
1961
+ * Crypto initialization not required.
1962
+ * @param {VerifyAsymmetricKeysRequest} request
1963
+ * @returns {VerifyAsymmetricKeysResponse}
1964
+ */
1965
+ verify_asymmetric_keys(request) {
1954
1966
  try {
1955
1967
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1956
- wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr);
1968
+ wasm.cryptoclient_verify_asymmetric_keys(retptr, this.__wbg_ptr, addHeapObject(request));
1957
1969
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1958
1970
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1959
1971
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1966,19 +1978,13 @@ class CryptoClient {
1966
1978
  }
1967
1979
  }
1968
1980
  /**
1969
- * Create the data necessary to update the user's kdf settings. The user's encryption key is
1970
- * re-encrypted for the password under the new kdf settings. This returns the re-encrypted
1971
- * user key and the new password hash but does not update sdk state.
1972
- * @param {string} password
1973
- * @param {Kdf} kdf
1974
- * @returns {UpdateKdfResponse}
1981
+ * Creates a rotated set of account keys for the current state
1982
+ * @returns {UserCryptoV2KeysResponse}
1975
1983
  */
1976
- make_update_kdf(password, kdf) {
1984
+ get_v2_rotated_account_keys() {
1977
1985
  try {
1978
1986
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1979
- const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1980
- const len0 = WASM_VECTOR_LEN;
1981
- wasm.cryptoclient_make_update_kdf(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(kdf));
1987
+ wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr);
1982
1988
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1983
1989
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1984
1990
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1991,18 +1997,13 @@ class CryptoClient {
1991
1997
  }
1992
1998
  }
1993
1999
  /**
1994
- * Protects the current user key with the provided PIN. The result can be stored and later
1995
- * used to initialize another client instance by using the PIN and the PIN key with
1996
- * `initialize_user_crypto`.
1997
- * @param {string} pin
1998
- * @returns {EnrollPinResponse}
2000
+ * Makes a new signing key pair and signs the public key for the user
2001
+ * @returns {UserCryptoV2KeysResponse}
1999
2002
  */
2000
- enroll_pin(pin) {
2003
+ make_keys_for_user_crypto_v2() {
2001
2004
  try {
2002
2005
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2003
- const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2004
- const len0 = WASM_VECTOR_LEN;
2005
- wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
2006
+ wasm.cryptoclient_make_keys_for_user_crypto_v2(retptr, this.__wbg_ptr);
2006
2007
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2007
2008
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2008
2009
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2108,6 +2109,74 @@ class ExporterClient {
2108
2109
  const ptr = this.__destroy_into_raw();
2109
2110
  wasm.__wbg_exporterclient_free(ptr, 0);
2110
2111
  }
2112
+ /**
2113
+ * Credential Exchange Format (CXF)
2114
+ *
2115
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2116
+ *
2117
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2118
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2119
+ * @param {Account} account
2120
+ * @param {Cipher[]} ciphers
2121
+ * @returns {string}
2122
+ */
2123
+ export_cxf(account, ciphers) {
2124
+ let deferred3_0;
2125
+ let deferred3_1;
2126
+ try {
2127
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2128
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2129
+ const len0 = WASM_VECTOR_LEN;
2130
+ wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), ptr0, len0);
2131
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2132
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2133
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2134
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2135
+ var ptr2 = r0;
2136
+ var len2 = r1;
2137
+ if (r3) {
2138
+ ptr2 = 0;
2139
+ len2 = 0;
2140
+ throw takeObject(r2);
2141
+ }
2142
+ deferred3_0 = ptr2;
2143
+ deferred3_1 = len2;
2144
+ return getStringFromWasm0(ptr2, len2);
2145
+ } finally {
2146
+ wasm.__wbindgen_add_to_stack_pointer(16);
2147
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2148
+ }
2149
+ }
2150
+ /**
2151
+ * Credential Exchange Format (CXF)
2152
+ *
2153
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2154
+ *
2155
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2156
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2157
+ * @param {string} payload
2158
+ * @returns {Cipher[]}
2159
+ */
2160
+ import_cxf(payload) {
2161
+ try {
2162
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2163
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2164
+ const len0 = WASM_VECTOR_LEN;
2165
+ wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
2166
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2167
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2168
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2169
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2170
+ if (r3) {
2171
+ throw takeObject(r2);
2172
+ }
2173
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2174
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
2175
+ return v2;
2176
+ } finally {
2177
+ wasm.__wbindgen_add_to_stack_pointer(16);
2178
+ }
2179
+ }
2111
2180
  /**
2112
2181
  * @param {Folder[]} folders
2113
2182
  * @param {Cipher[]} ciphers
@@ -2194,74 +2263,6 @@ class ExporterClient {
2194
2263
  wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2195
2264
  }
2196
2265
  }
2197
- /**
2198
- * Credential Exchange Format (CXF)
2199
- *
2200
- * *Warning:* Expect this API to be unstable, and it will change in the future.
2201
- *
2202
- * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2203
- * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2204
- * @param {Account} account
2205
- * @param {Cipher[]} ciphers
2206
- * @returns {string}
2207
- */
2208
- export_cxf(account, ciphers) {
2209
- let deferred3_0;
2210
- let deferred3_1;
2211
- try {
2212
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2213
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2214
- const len0 = WASM_VECTOR_LEN;
2215
- wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), 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
- var ptr2 = r0;
2221
- var len2 = r1;
2222
- if (r3) {
2223
- ptr2 = 0;
2224
- len2 = 0;
2225
- throw takeObject(r2);
2226
- }
2227
- deferred3_0 = ptr2;
2228
- deferred3_1 = len2;
2229
- return getStringFromWasm0(ptr2, len2);
2230
- } finally {
2231
- wasm.__wbindgen_add_to_stack_pointer(16);
2232
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2233
- }
2234
- }
2235
- /**
2236
- * Credential Exchange Format (CXF)
2237
- *
2238
- * *Warning:* Expect this API to be unstable, and it will change in the future.
2239
- *
2240
- * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2241
- * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2242
- * @param {string} payload
2243
- * @returns {Cipher[]}
2244
- */
2245
- import_cxf(payload) {
2246
- try {
2247
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2248
- const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2249
- const len0 = WASM_VECTOR_LEN;
2250
- wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
2251
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2252
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2253
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2254
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2255
- if (r3) {
2256
- throw takeObject(r2);
2257
- }
2258
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2259
- wasm.__wbindgen_free(r0, r1 * 4, 4);
2260
- return v2;
2261
- } finally {
2262
- wasm.__wbindgen_add_to_stack_pointer(16);
2263
- }
2264
- }
2265
2266
  }
2266
2267
  if (Symbol.dispose) ExporterClient.prototype[Symbol.dispose] = ExporterClient.prototype.free;
2267
2268
 
@@ -2294,46 +2295,6 @@ class FoldersClient {
2294
2295
  const ptr = this.__destroy_into_raw();
2295
2296
  wasm.__wbg_foldersclient_free(ptr, 0);
2296
2297
  }
2297
- /**
2298
- * Encrypt a [FolderView] to a [Folder].
2299
- * @param {FolderView} folder_view
2300
- * @returns {Folder}
2301
- */
2302
- encrypt(folder_view) {
2303
- try {
2304
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2305
- wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
2306
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2307
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2308
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2309
- if (r2) {
2310
- throw takeObject(r1);
2311
- }
2312
- return takeObject(r0);
2313
- } finally {
2314
- wasm.__wbindgen_add_to_stack_pointer(16);
2315
- }
2316
- }
2317
- /**
2318
- * Encrypt a [Folder] to [FolderView].
2319
- * @param {Folder} folder
2320
- * @returns {FolderView}
2321
- */
2322
- decrypt(folder) {
2323
- try {
2324
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2325
- wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
2326
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2327
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2328
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2329
- if (r2) {
2330
- throw takeObject(r1);
2331
- }
2332
- return takeObject(r0);
2333
- } finally {
2334
- wasm.__wbindgen_add_to_stack_pointer(16);
2335
- }
2336
- }
2337
2298
  /**
2338
2299
  * Decrypt a list of [Folder]s to a list of [FolderView]s.
2339
2300
  * @param {Folder[]} folders
@@ -2359,14 +2320,6 @@ class FoldersClient {
2359
2320
  wasm.__wbindgen_add_to_stack_pointer(16);
2360
2321
  }
2361
2322
  }
2362
- /**
2363
- * Get all folders from state and decrypt them to a list of [FolderView].
2364
- * @returns {Promise<FolderView[]>}
2365
- */
2366
- list() {
2367
- const ret = wasm.foldersclient_list(this.__wbg_ptr);
2368
- return takeObject(ret);
2369
- }
2370
2323
  /**
2371
2324
  * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
2372
2325
  * @param {FolderId} folder_id
@@ -2376,15 +2329,6 @@ class FoldersClient {
2376
2329
  const ret = wasm.foldersclient_get(this.__wbg_ptr, addHeapObject(folder_id));
2377
2330
  return takeObject(ret);
2378
2331
  }
2379
- /**
2380
- * Create a new [Folder] and save it to the server.
2381
- * @param {FolderAddEditRequest} request
2382
- * @returns {Promise<FolderView>}
2383
- */
2384
- create(request) {
2385
- const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
2386
- return takeObject(ret);
2387
- }
2388
2332
  /**
2389
2333
  * Edit the [Folder] and save it to the server.
2390
2334
  * @param {FolderId} folder_id
@@ -2399,6 +2343,63 @@ class FoldersClient {
2399
2343
  );
2400
2344
  return takeObject(ret);
2401
2345
  }
2346
+ /**
2347
+ * Get all folders from state and decrypt them to a list of [FolderView].
2348
+ * @returns {Promise<FolderView[]>}
2349
+ */
2350
+ list() {
2351
+ const ret = wasm.foldersclient_list(this.__wbg_ptr);
2352
+ return takeObject(ret);
2353
+ }
2354
+ /**
2355
+ * Create a new [Folder] and save it to the server.
2356
+ * @param {FolderAddEditRequest} request
2357
+ * @returns {Promise<FolderView>}
2358
+ */
2359
+ create(request) {
2360
+ const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
2361
+ return takeObject(ret);
2362
+ }
2363
+ /**
2364
+ * Encrypt a [Folder] to [FolderView].
2365
+ * @param {Folder} folder
2366
+ * @returns {FolderView}
2367
+ */
2368
+ decrypt(folder) {
2369
+ try {
2370
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2371
+ wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
2372
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2373
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2374
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2375
+ if (r2) {
2376
+ throw takeObject(r1);
2377
+ }
2378
+ return takeObject(r0);
2379
+ } finally {
2380
+ wasm.__wbindgen_add_to_stack_pointer(16);
2381
+ }
2382
+ }
2383
+ /**
2384
+ * Encrypt a [FolderView] to a [Folder].
2385
+ * @param {FolderView} folder_view
2386
+ * @returns {Folder}
2387
+ */
2388
+ encrypt(folder_view) {
2389
+ try {
2390
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2391
+ wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
2392
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2393
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2394
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2395
+ if (r2) {
2396
+ throw takeObject(r1);
2397
+ }
2398
+ return takeObject(r0);
2399
+ } finally {
2400
+ wasm.__wbindgen_add_to_stack_pointer(16);
2401
+ }
2402
+ }
2402
2403
  }
2403
2404
  if (Symbol.dispose) FoldersClient.prototype[Symbol.dispose] = FoldersClient.prototype.free;
2404
2405
 
@@ -2430,38 +2431,38 @@ class GeneratorClient {
2430
2431
  wasm.__wbg_generatorclient_free(ptr, 0);
2431
2432
  }
2432
2433
  /**
2433
- * Generates a random password.
2434
+ * Generates a random passphrase.
2435
+ * A passphrase is a combination of random words separated by a character.
2436
+ * An example of passphrase is `correct horse battery staple`.
2434
2437
  *
2435
- * The character sets and password length can be customized using the `input` parameter.
2438
+ * The number of words and their case, the word separator, and the inclusion of
2439
+ * a number in the passphrase can be customized using the `input` parameter.
2436
2440
  *
2437
2441
  * # Examples
2438
2442
  *
2439
2443
  * ```
2440
2444
  * use bitwarden_core::Client;
2441
- * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2445
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
2442
2446
  *
2443
2447
  * async fn test() -> Result<(), PassphraseError> {
2444
- * let input = PasswordGeneratorRequest {
2445
- * lowercase: true,
2446
- * uppercase: true,
2447
- * numbers: true,
2448
- * length: 20,
2448
+ * let input = PassphraseGeneratorRequest {
2449
+ * num_words: 4,
2449
2450
  * ..Default::default()
2450
2451
  * };
2451
- * let password = Client::new(None).generator().password(input).unwrap();
2452
- * println!("{}", password);
2452
+ * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
2453
+ * println!("{}", passphrase);
2453
2454
  * Ok(())
2454
2455
  * }
2455
2456
  * ```
2456
- * @param {PasswordGeneratorRequest} input
2457
+ * @param {PassphraseGeneratorRequest} input
2457
2458
  * @returns {string}
2458
2459
  */
2459
- password(input) {
2460
+ passphrase(input) {
2460
2461
  let deferred2_0;
2461
2462
  let deferred2_1;
2462
2463
  try {
2463
2464
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2464
- wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
2465
+ wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
2465
2466
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2466
2467
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2467
2468
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2482,38 +2483,38 @@ class GeneratorClient {
2482
2483
  }
2483
2484
  }
2484
2485
  /**
2485
- * Generates a random passphrase.
2486
- * A passphrase is a combination of random words separated by a character.
2487
- * An example of passphrase is `correct horse battery staple`.
2486
+ * Generates a random password.
2488
2487
  *
2489
- * The number of words and their case, the word separator, and the inclusion of
2490
- * a number in the passphrase can be customized using the `input` parameter.
2488
+ * The character sets and password length can be customized using the `input` parameter.
2491
2489
  *
2492
2490
  * # Examples
2493
2491
  *
2494
2492
  * ```
2495
2493
  * use bitwarden_core::Client;
2496
- * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
2494
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2497
2495
  *
2498
2496
  * async fn test() -> Result<(), PassphraseError> {
2499
- * let input = PassphraseGeneratorRequest {
2500
- * num_words: 4,
2497
+ * let input = PasswordGeneratorRequest {
2498
+ * lowercase: true,
2499
+ * uppercase: true,
2500
+ * numbers: true,
2501
+ * length: 20,
2501
2502
  * ..Default::default()
2502
2503
  * };
2503
- * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
2504
- * println!("{}", passphrase);
2504
+ * let password = Client::new(None).generator().password(input).unwrap();
2505
+ * println!("{}", password);
2505
2506
  * Ok(())
2506
2507
  * }
2507
2508
  * ```
2508
- * @param {PassphraseGeneratorRequest} input
2509
+ * @param {PasswordGeneratorRequest} input
2509
2510
  * @returns {string}
2510
2511
  */
2511
- passphrase(input) {
2512
+ password(input) {
2512
2513
  let deferred2_0;
2513
2514
  let deferred2_1;
2514
2515
  try {
2515
2516
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2516
- wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
2517
+ wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
2517
2518
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2518
2519
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2519
2520
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2595,6 +2596,39 @@ class IncomingMessage {
2595
2596
  const ptr = this.__destroy_into_raw();
2596
2597
  wasm.__wbg_incomingmessage_free(ptr, 0);
2597
2598
  }
2599
+ /**
2600
+ * Try to parse the payload as JSON.
2601
+ * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2602
+ */
2603
+ parse_payload_as_json() {
2604
+ const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2605
+ return takeObject(ret);
2606
+ }
2607
+ /**
2608
+ * @param {Uint8Array} payload
2609
+ * @param {Endpoint} destination
2610
+ * @param {Endpoint} source
2611
+ * @param {string | null} [topic]
2612
+ */
2613
+ constructor(payload, destination, source, topic) {
2614
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2615
+ const len0 = WASM_VECTOR_LEN;
2616
+ var ptr1 = isLikeNone(topic)
2617
+ ? 0
2618
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2619
+ var len1 = WASM_VECTOR_LEN;
2620
+ const ret = wasm.incomingmessage_new(
2621
+ ptr0,
2622
+ len0,
2623
+ addHeapObject(destination),
2624
+ addHeapObject(source),
2625
+ ptr1,
2626
+ len1,
2627
+ );
2628
+ this.__wbg_ptr = ret >>> 0;
2629
+ IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
2630
+ return this;
2631
+ }
2598
2632
  /**
2599
2633
  * @returns {Uint8Array}
2600
2634
  */
@@ -2674,39 +2708,6 @@ class IncomingMessage {
2674
2708
  var len0 = WASM_VECTOR_LEN;
2675
2709
  wasm.__wbg_set_incomingmessage_topic(this.__wbg_ptr, ptr0, len0);
2676
2710
  }
2677
- /**
2678
- * @param {Uint8Array} payload
2679
- * @param {Endpoint} destination
2680
- * @param {Endpoint} source
2681
- * @param {string | null} [topic]
2682
- */
2683
- constructor(payload, destination, source, topic) {
2684
- const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2685
- const len0 = WASM_VECTOR_LEN;
2686
- var ptr1 = isLikeNone(topic)
2687
- ? 0
2688
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2689
- var len1 = WASM_VECTOR_LEN;
2690
- const ret = wasm.incomingmessage_new(
2691
- ptr0,
2692
- len0,
2693
- addHeapObject(destination),
2694
- addHeapObject(source),
2695
- ptr1,
2696
- len1,
2697
- );
2698
- this.__wbg_ptr = ret >>> 0;
2699
- IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
2700
- return this;
2701
- }
2702
- /**
2703
- * Try to parse the payload as JSON.
2704
- * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2705
- */
2706
- parse_payload_as_json() {
2707
- const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2708
- return takeObject(ret);
2709
- }
2710
2711
  }
2711
2712
  if (Symbol.dispose) IncomingMessage.prototype[Symbol.dispose] = IncomingMessage.prototype.free;
2712
2713
 
@@ -2740,6 +2741,13 @@ class IpcClient {
2740
2741
  const ptr = this.__destroy_into_raw();
2741
2742
  wasm.__wbg_ipcclient_free(ptr, 0);
2742
2743
  }
2744
+ /**
2745
+ * @returns {Promise<boolean>}
2746
+ */
2747
+ isRunning() {
2748
+ const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2749
+ return takeObject(ret);
2750
+ }
2743
2751
  /**
2744
2752
  * Create a new `IpcClient` instance with an in-memory session repository for saving
2745
2753
  * sessions within the SDK.
@@ -2766,20 +2774,6 @@ class IpcClient {
2766
2774
  );
2767
2775
  return IpcClient.__wrap(ret);
2768
2776
  }
2769
- /**
2770
- * @returns {Promise<void>}
2771
- */
2772
- start() {
2773
- const ret = wasm.ipcclient_start(this.__wbg_ptr);
2774
- return takeObject(ret);
2775
- }
2776
- /**
2777
- * @returns {Promise<boolean>}
2778
- */
2779
- isRunning() {
2780
- const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2781
- return takeObject(ret);
2782
- }
2783
2777
  /**
2784
2778
  * @param {OutgoingMessage} message
2785
2779
  * @returns {Promise<void>}
@@ -2790,6 +2784,13 @@ class IpcClient {
2790
2784
  const ret = wasm.ipcclient_send(this.__wbg_ptr, ptr0);
2791
2785
  return takeObject(ret);
2792
2786
  }
2787
+ /**
2788
+ * @returns {Promise<void>}
2789
+ */
2790
+ start() {
2791
+ const ret = wasm.ipcclient_start(this.__wbg_ptr);
2792
+ return takeObject(ret);
2793
+ }
2793
2794
  /**
2794
2795
  * @returns {Promise<IpcClientSubscription>}
2795
2796
  */
@@ -2926,6 +2927,55 @@ class OutgoingMessage {
2926
2927
  const ptr = this.__destroy_into_raw();
2927
2928
  wasm.__wbg_outgoingmessage_free(ptr, 0);
2928
2929
  }
2930
+ /**
2931
+ * Create a new message and encode the payload as JSON.
2932
+ * @param {any} payload
2933
+ * @param {Endpoint} destination
2934
+ * @param {string | null} [topic]
2935
+ * @returns {OutgoingMessage}
2936
+ */
2937
+ static new_json_payload(payload, destination, topic) {
2938
+ try {
2939
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2940
+ var ptr0 = isLikeNone(topic)
2941
+ ? 0
2942
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2943
+ var len0 = WASM_VECTOR_LEN;
2944
+ wasm.outgoingmessage_new_json_payload(
2945
+ retptr,
2946
+ addHeapObject(payload),
2947
+ addHeapObject(destination),
2948
+ ptr0,
2949
+ len0,
2950
+ );
2951
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2952
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2953
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2954
+ if (r2) {
2955
+ throw takeObject(r1);
2956
+ }
2957
+ return OutgoingMessage.__wrap(r0);
2958
+ } finally {
2959
+ wasm.__wbindgen_add_to_stack_pointer(16);
2960
+ }
2961
+ }
2962
+ /**
2963
+ * @param {Uint8Array} payload
2964
+ * @param {Endpoint} destination
2965
+ * @param {string | null} [topic]
2966
+ */
2967
+ constructor(payload, destination, topic) {
2968
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2969
+ const len0 = WASM_VECTOR_LEN;
2970
+ var ptr1 = isLikeNone(topic)
2971
+ ? 0
2972
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2973
+ var len1 = WASM_VECTOR_LEN;
2974
+ const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
2975
+ this.__wbg_ptr = ret >>> 0;
2976
+ OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
2977
+ return this;
2978
+ }
2929
2979
  /**
2930
2980
  * @returns {Uint8Array}
2931
2981
  */
@@ -2992,55 +3042,6 @@ class OutgoingMessage {
2992
3042
  var len0 = WASM_VECTOR_LEN;
2993
3043
  wasm.__wbg_set_outgoingmessage_topic(this.__wbg_ptr, ptr0, len0);
2994
3044
  }
2995
- /**
2996
- * @param {Uint8Array} payload
2997
- * @param {Endpoint} destination
2998
- * @param {string | null} [topic]
2999
- */
3000
- constructor(payload, destination, topic) {
3001
- const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
3002
- const len0 = WASM_VECTOR_LEN;
3003
- var ptr1 = isLikeNone(topic)
3004
- ? 0
3005
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3006
- var len1 = WASM_VECTOR_LEN;
3007
- const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
3008
- this.__wbg_ptr = ret >>> 0;
3009
- OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
3010
- return this;
3011
- }
3012
- /**
3013
- * Create a new message and encode the payload as JSON.
3014
- * @param {any} payload
3015
- * @param {Endpoint} destination
3016
- * @param {string | null} [topic]
3017
- * @returns {OutgoingMessage}
3018
- */
3019
- static new_json_payload(payload, destination, topic) {
3020
- try {
3021
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3022
- var ptr0 = isLikeNone(topic)
3023
- ? 0
3024
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3025
- var len0 = WASM_VECTOR_LEN;
3026
- wasm.outgoingmessage_new_json_payload(
3027
- retptr,
3028
- addHeapObject(payload),
3029
- addHeapObject(destination),
3030
- ptr0,
3031
- len0,
3032
- );
3033
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3034
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3035
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3036
- if (r2) {
3037
- throw takeObject(r1);
3038
- }
3039
- return OutgoingMessage.__wrap(r0);
3040
- } finally {
3041
- wasm.__wbindgen_add_to_stack_pointer(16);
3042
- }
3043
- }
3044
3045
  }
3045
3046
  if (Symbol.dispose) OutgoingMessage.prototype[Symbol.dispose] = OutgoingMessage.prototype.free;
3046
3047
 
@@ -3079,6 +3080,14 @@ class PasswordManagerClient {
3079
3080
  PasswordManagerClientFinalization.register(this, this.__wbg_ptr, this);
3080
3081
  return this;
3081
3082
  }
3083
+ /**
3084
+ * Auth related operations.
3085
+ * @returns {AuthClient}
3086
+ */
3087
+ auth() {
3088
+ const ret = wasm.passwordmanagerclient_auth(this.__wbg_ptr);
3089
+ return AuthClient.__wrap(ret);
3090
+ }
3082
3091
  /**
3083
3092
  * Test method, echoes back the input
3084
3093
  * @param {string} msg
@@ -3102,26 +3111,6 @@ class PasswordManagerClient {
3102
3111
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
3103
3112
  }
3104
3113
  }
3105
- /**
3106
- * Returns the current SDK version
3107
- * @returns {string}
3108
- */
3109
- version() {
3110
- let deferred1_0;
3111
- let deferred1_1;
3112
- try {
3113
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3114
- wasm.passwordmanagerclient_version(retptr, this.__wbg_ptr);
3115
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3116
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3117
- deferred1_0 = r0;
3118
- deferred1_1 = r1;
3119
- return getStringFromWasm0(r0, r1);
3120
- } finally {
3121
- wasm.__wbindgen_add_to_stack_pointer(16);
3122
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3123
- }
3124
- }
3125
3114
  /**
3126
3115
  * Test method, always throws an error
3127
3116
  * @param {string} msg
@@ -3142,23 +3131,12 @@ class PasswordManagerClient {
3142
3131
  }
3143
3132
  }
3144
3133
  /**
3145
- * Test method, calls http endpoint
3146
- * @param {string} url
3147
- * @returns {Promise<string>}
3148
- */
3149
- http_get(url) {
3150
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3151
- const len0 = WASM_VECTOR_LEN;
3152
- const ret = wasm.passwordmanagerclient_http_get(this.__wbg_ptr, ptr0, len0);
3153
- return takeObject(ret);
3154
- }
3155
- /**
3156
- * Auth related operations.
3157
- * @returns {AuthClient}
3134
+ * Vault item related operations.
3135
+ * @returns {VaultClient}
3158
3136
  */
3159
- auth() {
3160
- const ret = wasm.passwordmanagerclient_auth(this.__wbg_ptr);
3161
- return AuthClient.__wrap(ret);
3137
+ vault() {
3138
+ const ret = wasm.passwordmanagerclient_vault(this.__wbg_ptr);
3139
+ return VaultClient.__wrap(ret);
3162
3140
  }
3163
3141
  /**
3164
3142
  * Crypto related operations.
@@ -3169,12 +3147,35 @@ class PasswordManagerClient {
3169
3147
  return CryptoClient.__wrap(ret);
3170
3148
  }
3171
3149
  /**
3172
- * Vault item related operations.
3173
- * @returns {VaultClient}
3150
+ * Returns the current SDK version
3151
+ * @returns {string}
3174
3152
  */
3175
- vault() {
3176
- const ret = wasm.passwordmanagerclient_vault(this.__wbg_ptr);
3177
- return VaultClient.__wrap(ret);
3153
+ version() {
3154
+ let deferred1_0;
3155
+ let deferred1_1;
3156
+ try {
3157
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3158
+ wasm.passwordmanagerclient_version(retptr, this.__wbg_ptr);
3159
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3160
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3161
+ deferred1_0 = r0;
3162
+ deferred1_1 = r1;
3163
+ return getStringFromWasm0(r0, r1);
3164
+ } finally {
3165
+ wasm.__wbindgen_add_to_stack_pointer(16);
3166
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3167
+ }
3168
+ }
3169
+ /**
3170
+ * Test method, calls http endpoint
3171
+ * @param {string} url
3172
+ * @returns {Promise<string>}
3173
+ */
3174
+ http_get(url) {
3175
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3176
+ const len0 = WASM_VECTOR_LEN;
3177
+ const ret = wasm.passwordmanagerclient_http_get(this.__wbg_ptr, ptr0, len0);
3178
+ return takeObject(ret);
3178
3179
  }
3179
3180
  /**
3180
3181
  * Constructs a specific client for platform-specific functionality
@@ -3184,14 +3185,6 @@ class PasswordManagerClient {
3184
3185
  const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3185
3186
  return PlatformClient.__wrap(ret);
3186
3187
  }
3187
- /**
3188
- * Constructs a specific client for generating passwords and passphrases
3189
- * @returns {GeneratorClient}
3190
- */
3191
- generator() {
3192
- const ret = wasm.passwordmanagerclient_generator(this.__wbg_ptr);
3193
- return GeneratorClient.__wrap(ret);
3194
- }
3195
3188
  /**
3196
3189
  * Exporter related operations.
3197
3190
  * @returns {ExporterClient}
@@ -3200,6 +3193,14 @@ class PasswordManagerClient {
3200
3193
  const ret = wasm.passwordmanagerclient_exporters(this.__wbg_ptr);
3201
3194
  return ExporterClient.__wrap(ret);
3202
3195
  }
3196
+ /**
3197
+ * Constructs a specific client for generating passwords and passphrases
3198
+ * @returns {GeneratorClient}
3199
+ */
3200
+ generator() {
3201
+ const ret = wasm.passwordmanagerclient_generator(this.__wbg_ptr);
3202
+ return GeneratorClient.__wrap(ret);
3203
+ }
3203
3204
  }
3204
3205
  if (Symbol.dispose)
3205
3206
  PasswordManagerClient.prototype[Symbol.dispose] = PasswordManagerClient.prototype.free;
@@ -3231,13 +3232,6 @@ class PlatformClient {
3231
3232
  const ptr = this.__destroy_into_raw();
3232
3233
  wasm.__wbg_platformclient_free(ptr, 0);
3233
3234
  }
3234
- /**
3235
- * @returns {StateClient}
3236
- */
3237
- state() {
3238
- const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3239
- return StateClient.__wrap(ret);
3240
- }
3241
3235
  /**
3242
3236
  * Load feature flags into the client
3243
3237
  * @param {FeatureFlags} flags
@@ -3255,6 +3249,13 @@ class PlatformClient {
3255
3249
  wasm.__wbindgen_add_to_stack_pointer(16);
3256
3250
  }
3257
3251
  }
3252
+ /**
3253
+ * @returns {StateClient}
3254
+ */
3255
+ state() {
3256
+ const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3257
+ return StateClient.__wrap(ret);
3258
+ }
3258
3259
  }
3259
3260
  if (Symbol.dispose) PlatformClient.prototype[Symbol.dispose] = PlatformClient.prototype.free;
3260
3261
 
@@ -3282,6 +3283,64 @@ class PureCrypto {
3282
3283
  const ptr = this.__destroy_into_raw();
3283
3284
  wasm.__wbg_purecrypto_free(ptr, 0);
3284
3285
  }
3286
+ /**
3287
+ * Decrypts data using RSAES-OAEP with SHA-1
3288
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3289
+ * @param {Uint8Array} encrypted_data
3290
+ * @param {Uint8Array} private_key
3291
+ * @returns {Uint8Array}
3292
+ */
3293
+ static rsa_decrypt_data(encrypted_data, private_key) {
3294
+ try {
3295
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3296
+ const ptr0 = passArray8ToWasm0(encrypted_data, wasm.__wbindgen_malloc);
3297
+ const len0 = WASM_VECTOR_LEN;
3298
+ const ptr1 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
3299
+ const len1 = WASM_VECTOR_LEN;
3300
+ wasm.purecrypto_rsa_decrypt_data(retptr, ptr0, len0, ptr1, len1);
3301
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3302
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3303
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3304
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3305
+ if (r3) {
3306
+ throw takeObject(r2);
3307
+ }
3308
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3309
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3310
+ return v3;
3311
+ } finally {
3312
+ wasm.__wbindgen_add_to_stack_pointer(16);
3313
+ }
3314
+ }
3315
+ /**
3316
+ * Encrypts data using RSAES-OAEP with SHA-1
3317
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3318
+ * @param {Uint8Array} plain_data
3319
+ * @param {Uint8Array} public_key
3320
+ * @returns {Uint8Array}
3321
+ */
3322
+ static rsa_encrypt_data(plain_data, public_key) {
3323
+ try {
3324
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3325
+ const ptr0 = passArray8ToWasm0(plain_data, wasm.__wbindgen_malloc);
3326
+ const len0 = WASM_VECTOR_LEN;
3327
+ const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
3328
+ const len1 = WASM_VECTOR_LEN;
3329
+ wasm.purecrypto_rsa_encrypt_data(retptr, ptr0, len0, ptr1, len1);
3330
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3331
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3332
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3333
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3334
+ if (r3) {
3335
+ throw takeObject(r2);
3336
+ }
3337
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3338
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3339
+ return v3;
3340
+ } finally {
3341
+ wasm.__wbindgen_add_to_stack_pointer(16);
3342
+ }
3343
+ }
3285
3344
  /**
3286
3345
  * DEPRECATED: Use `symmetric_decrypt_string` instead.
3287
3346
  * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
@@ -3319,20 +3378,22 @@ class PureCrypto {
3319
3378
  }
3320
3379
  }
3321
3380
  /**
3322
- * @param {string} enc_string
3323
- * @param {Uint8Array} key
3381
+ * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
3382
+ * as an EncString.
3383
+ * @param {Uint8Array} key_to_be_wrapped
3384
+ * @param {Uint8Array} wrapping_key
3324
3385
  * @returns {string}
3325
3386
  */
3326
- static symmetric_decrypt_string(enc_string, key) {
3387
+ static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
3327
3388
  let deferred4_0;
3328
3389
  let deferred4_1;
3329
3390
  try {
3330
3391
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3331
- const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3392
+ const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
3332
3393
  const len0 = WASM_VECTOR_LEN;
3333
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3394
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3334
3395
  const len1 = WASM_VECTOR_LEN;
3335
- wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
3396
+ wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3336
3397
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3337
3398
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3338
3399
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3353,18 +3414,20 @@ class PureCrypto {
3353
3414
  }
3354
3415
  }
3355
3416
  /**
3356
- * @param {string} enc_string
3357
- * @param {Uint8Array} key
3417
+ * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
3418
+ * @param {Uint8Array} password
3419
+ * @param {Uint8Array} salt
3420
+ * @param {Kdf} kdf
3358
3421
  * @returns {Uint8Array}
3359
3422
  */
3360
- static symmetric_decrypt_bytes(enc_string, key) {
3423
+ static derive_kdf_material(password, salt, kdf) {
3361
3424
  try {
3362
3425
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3363
- const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3426
+ const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
3364
3427
  const len0 = WASM_VECTOR_LEN;
3365
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3428
+ const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
3366
3429
  const len1 = WASM_VECTOR_LEN;
3367
- wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3430
+ wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
3368
3431
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3369
3432
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3370
3433
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3380,20 +3443,14 @@ class PureCrypto {
3380
3443
  }
3381
3444
  }
3382
3445
  /**
3383
- * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
3384
- * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3385
- * @param {Uint8Array} enc_bytes
3386
- * @param {Uint8Array} key
3446
+ * Generates a new RSA key pair and returns the private key
3447
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3387
3448
  * @returns {Uint8Array}
3388
3449
  */
3389
- static symmetric_decrypt_array_buffer(enc_bytes, key) {
3450
+ static rsa_generate_keypair() {
3390
3451
  try {
3391
3452
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3392
- const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3393
- const len0 = WASM_VECTOR_LEN;
3394
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3395
- const len1 = WASM_VECTOR_LEN;
3396
- wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
3453
+ wasm.purecrypto_rsa_generate_keypair(retptr);
3397
3454
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3398
3455
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3399
3456
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3401,26 +3458,28 @@ class PureCrypto {
3401
3458
  if (r3) {
3402
3459
  throw takeObject(r2);
3403
3460
  }
3404
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3461
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3405
3462
  wasm.__wbindgen_free(r0, r1 * 1, 1);
3406
- return v3;
3463
+ return v1;
3407
3464
  } finally {
3408
3465
  wasm.__wbindgen_add_to_stack_pointer(16);
3409
3466
  }
3410
3467
  }
3411
3468
  /**
3412
- * @param {Uint8Array} enc_bytes
3413
- * @param {Uint8Array} key
3469
+ * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
3470
+ * unwrapped key as a serialized byte array.
3471
+ * @param {string} wrapped_key
3472
+ * @param {Uint8Array} wrapping_key
3414
3473
  * @returns {Uint8Array}
3415
3474
  */
3416
- static symmetric_decrypt_filedata(enc_bytes, key) {
3475
+ static unwrap_symmetric_key(wrapped_key, wrapping_key) {
3417
3476
  try {
3418
3477
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3419
- const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3478
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3420
3479
  const len0 = WASM_VECTOR_LEN;
3421
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3480
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3422
3481
  const len1 = WASM_VECTOR_LEN;
3423
- wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3482
+ wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3424
3483
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3425
3484
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3426
3485
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3436,55 +3495,49 @@ class PureCrypto {
3436
3495
  }
3437
3496
  }
3438
3497
  /**
3439
- * @param {string} plain
3440
- * @param {Uint8Array} key
3441
- * @returns {string}
3498
+ * Given a decrypted private RSA key PKCS8 DER this
3499
+ * returns the corresponding public RSA key in DER format.
3500
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3501
+ * @param {Uint8Array} private_key
3502
+ * @returns {Uint8Array}
3442
3503
  */
3443
- static symmetric_encrypt_string(plain, key) {
3444
- let deferred4_0;
3445
- let deferred4_1;
3504
+ static rsa_extract_public_key(private_key) {
3446
3505
  try {
3447
3506
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3448
- const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3507
+ const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
3449
3508
  const len0 = WASM_VECTOR_LEN;
3450
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3451
- const len1 = WASM_VECTOR_LEN;
3452
- wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
3509
+ wasm.purecrypto_rsa_extract_public_key(retptr, ptr0, len0);
3453
3510
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3454
3511
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3455
3512
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3456
3513
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3457
- var ptr3 = r0;
3458
- var len3 = r1;
3459
3514
  if (r3) {
3460
- ptr3 = 0;
3461
- len3 = 0;
3462
3515
  throw takeObject(r2);
3463
3516
  }
3464
- deferred4_0 = ptr3;
3465
- deferred4_1 = len3;
3466
- return getStringFromWasm0(ptr3, len3);
3517
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
3518
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3519
+ return v2;
3467
3520
  } finally {
3468
3521
  wasm.__wbindgen_add_to_stack_pointer(16);
3469
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3470
3522
  }
3471
3523
  }
3472
3524
  /**
3473
- * DEPRECATED: Only used by send keys
3474
- * @param {Uint8Array} plain
3475
- * @param {Uint8Array} key
3525
+ * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
3526
+ * key,
3527
+ * @param {Uint8Array} decapsulation_key
3528
+ * @param {Uint8Array} wrapping_key
3476
3529
  * @returns {string}
3477
3530
  */
3478
- static symmetric_encrypt_bytes(plain, key) {
3531
+ static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
3479
3532
  let deferred4_0;
3480
3533
  let deferred4_1;
3481
3534
  try {
3482
3535
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3483
- const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3536
+ const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3484
3537
  const len0 = WASM_VECTOR_LEN;
3485
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3538
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3486
3539
  const len1 = WASM_VECTOR_LEN;
3487
- wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3540
+ wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3488
3541
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3489
3542
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3490
3543
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3505,180 +3558,87 @@ class PureCrypto {
3505
3558
  }
3506
3559
  }
3507
3560
  /**
3508
- * @param {Uint8Array} plain
3509
- * @param {Uint8Array} key
3510
- * @returns {Uint8Array}
3561
+ * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
3562
+ * key. Note: Usually, a public key is - by definition - public, so this should not be
3563
+ * used. The specific use-case for this function is to enable rotateable key sets, where
3564
+ * the "public key" is not public, with the intent of preventing the server from being able
3565
+ * to overwrite the user key unlocked by the rotateable keyset.
3566
+ * @param {Uint8Array} encapsulation_key
3567
+ * @param {Uint8Array} wrapping_key
3568
+ * @returns {string}
3511
3569
  */
3512
- static symmetric_encrypt_filedata(plain, key) {
3570
+ static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
3571
+ let deferred4_0;
3572
+ let deferred4_1;
3513
3573
  try {
3514
3574
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3515
- const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3575
+ const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3516
3576
  const len0 = WASM_VECTOR_LEN;
3517
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3577
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3518
3578
  const len1 = WASM_VECTOR_LEN;
3519
- wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3579
+ wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
3520
3580
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3521
3581
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3522
3582
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3523
3583
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3584
+ var ptr3 = r0;
3585
+ var len3 = r1;
3524
3586
  if (r3) {
3587
+ ptr3 = 0;
3588
+ len3 = 0;
3525
3589
  throw takeObject(r2);
3526
3590
  }
3527
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3528
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3529
- return v3;
3591
+ deferred4_0 = ptr3;
3592
+ deferred4_1 = len3;
3593
+ return getStringFromWasm0(ptr3, len3);
3530
3594
  } finally {
3531
3595
  wasm.__wbindgen_add_to_stack_pointer(16);
3596
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3532
3597
  }
3533
3598
  }
3534
3599
  /**
3535
- * @param {string} encrypted_user_key
3536
- * @param {string} master_password
3537
- * @param {string} email
3538
- * @param {Kdf} kdf
3600
+ * @param {string} enc_string
3601
+ * @param {Uint8Array} key
3539
3602
  * @returns {Uint8Array}
3540
3603
  */
3541
- static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
3542
- try {
3543
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3544
- const ptr0 = passStringToWasm0(
3545
- encrypted_user_key,
3546
- wasm.__wbindgen_malloc,
3547
- wasm.__wbindgen_realloc,
3548
- );
3549
- const len0 = WASM_VECTOR_LEN;
3550
- const ptr1 = passStringToWasm0(
3551
- master_password,
3552
- wasm.__wbindgen_malloc,
3553
- wasm.__wbindgen_realloc,
3554
- );
3555
- const len1 = WASM_VECTOR_LEN;
3556
- const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3557
- const len2 = WASM_VECTOR_LEN;
3558
- wasm.purecrypto_decrypt_user_key_with_master_password(
3559
- retptr,
3560
- ptr0,
3561
- len0,
3562
- ptr1,
3563
- len1,
3564
- ptr2,
3565
- len2,
3566
- addHeapObject(kdf),
3567
- );
3568
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3569
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3570
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3571
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3572
- if (r3) {
3573
- throw takeObject(r2);
3574
- }
3575
- var v4 = getArrayU8FromWasm0(r0, r1).slice();
3576
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3577
- return v4;
3578
- } finally {
3579
- wasm.__wbindgen_add_to_stack_pointer(16);
3580
- }
3581
- }
3582
- /**
3583
- * @param {Uint8Array} user_key
3584
- * @param {string} master_password
3585
- * @param {string} email
3586
- * @param {Kdf} kdf
3587
- * @returns {string}
3588
- */
3589
- static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
3590
- let deferred5_0;
3591
- let deferred5_1;
3604
+ static symmetric_decrypt_bytes(enc_string, key) {
3592
3605
  try {
3593
3606
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3594
- const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
3607
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3595
3608
  const len0 = WASM_VECTOR_LEN;
3596
- const ptr1 = passStringToWasm0(
3597
- master_password,
3598
- wasm.__wbindgen_malloc,
3599
- wasm.__wbindgen_realloc,
3600
- );
3609
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3601
3610
  const len1 = WASM_VECTOR_LEN;
3602
- const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3603
- const len2 = WASM_VECTOR_LEN;
3604
- wasm.purecrypto_encrypt_user_key_with_master_password(
3605
- retptr,
3606
- ptr0,
3607
- len0,
3608
- ptr1,
3609
- len1,
3610
- ptr2,
3611
- len2,
3612
- addHeapObject(kdf),
3613
- );
3611
+ wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3614
3612
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3615
3613
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3616
3614
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3617
3615
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3618
- var ptr4 = r0;
3619
- var len4 = r1;
3620
3616
  if (r3) {
3621
- ptr4 = 0;
3622
- len4 = 0;
3623
3617
  throw takeObject(r2);
3624
3618
  }
3625
- deferred5_0 = ptr4;
3626
- deferred5_1 = len4;
3627
- return getStringFromWasm0(ptr4, len4);
3628
- } finally {
3629
- wasm.__wbindgen_add_to_stack_pointer(16);
3630
- wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
3631
- }
3632
- }
3633
- /**
3634
- * @returns {Uint8Array}
3635
- */
3636
- static make_user_key_aes256_cbc_hmac() {
3637
- try {
3638
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3639
- wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
3640
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3641
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3642
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
3643
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3644
- return v1;
3645
- } finally {
3646
- wasm.__wbindgen_add_to_stack_pointer(16);
3647
- }
3648
- }
3649
- /**
3650
- * @returns {Uint8Array}
3651
- */
3652
- static make_user_key_xchacha20_poly1305() {
3653
- try {
3654
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3655
- wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
3656
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3657
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3658
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
3619
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3659
3620
  wasm.__wbindgen_free(r0, r1 * 1, 1);
3660
- return v1;
3621
+ return v3;
3661
3622
  } finally {
3662
3623
  wasm.__wbindgen_add_to_stack_pointer(16);
3663
3624
  }
3664
3625
  }
3665
3626
  /**
3666
- * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
3667
- * as an EncString.
3668
- * @param {Uint8Array} key_to_be_wrapped
3669
- * @param {Uint8Array} wrapping_key
3627
+ * DEPRECATED: Only used by send keys
3628
+ * @param {Uint8Array} plain
3629
+ * @param {Uint8Array} key
3670
3630
  * @returns {string}
3671
3631
  */
3672
- static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
3632
+ static symmetric_encrypt_bytes(plain, key) {
3673
3633
  let deferred4_0;
3674
3634
  let deferred4_1;
3675
3635
  try {
3676
3636
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3677
- const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
3637
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3678
3638
  const len0 = WASM_VECTOR_LEN;
3679
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3639
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3680
3640
  const len1 = WASM_VECTOR_LEN;
3681
- wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3641
+ wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3682
3642
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3683
3643
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3684
3644
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3699,20 +3659,25 @@ class PureCrypto {
3699
3659
  }
3700
3660
  }
3701
3661
  /**
3702
- * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
3703
- * unwrapped key as a serialized byte array.
3704
- * @param {string} wrapped_key
3705
- * @param {Uint8Array} wrapping_key
3662
+ * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
3663
+ * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
3664
+ * recipient.
3665
+ * @param {string} encapsulated_key
3666
+ * @param {Uint8Array} decapsulation_key
3706
3667
  * @returns {Uint8Array}
3707
3668
  */
3708
- static unwrap_symmetric_key(wrapped_key, wrapping_key) {
3669
+ static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
3709
3670
  try {
3710
3671
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3711
- const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3672
+ const ptr0 = passStringToWasm0(
3673
+ encapsulated_key,
3674
+ wasm.__wbindgen_malloc,
3675
+ wasm.__wbindgen_realloc,
3676
+ );
3712
3677
  const len0 = WASM_VECTOR_LEN;
3713
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3678
+ const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3714
3679
  const len1 = WASM_VECTOR_LEN;
3715
- wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3680
+ wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3716
3681
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3717
3682
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3718
3683
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3728,25 +3693,23 @@ class PureCrypto {
3728
3693
  }
3729
3694
  }
3730
3695
  /**
3731
- * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
3732
- * key. Note: Usually, a public key is - by definition - public, so this should not be
3733
- * used. The specific use-case for this function is to enable rotateable key sets, where
3734
- * the "public key" is not public, with the intent of preventing the server from being able
3735
- * to overwrite the user key unlocked by the rotateable keyset.
3696
+ * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
3697
+ * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
3698
+ * the sender's authenticity cannot be verified by the recipient.
3699
+ * @param {Uint8Array} shared_key
3736
3700
  * @param {Uint8Array} encapsulation_key
3737
- * @param {Uint8Array} wrapping_key
3738
3701
  * @returns {string}
3739
3702
  */
3740
- static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
3703
+ static encapsulate_key_unsigned(shared_key, encapsulation_key) {
3741
3704
  let deferred4_0;
3742
3705
  let deferred4_1;
3743
3706
  try {
3744
3707
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3745
- const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3708
+ const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
3746
3709
  const len0 = WASM_VECTOR_LEN;
3747
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3710
+ const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3748
3711
  const len1 = WASM_VECTOR_LEN;
3749
- wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
3712
+ wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3750
3713
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3751
3714
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3752
3715
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3767,51 +3730,54 @@ class PureCrypto {
3767
3730
  }
3768
3731
  }
3769
3732
  /**
3770
- * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
3771
- * wrapping key.
3772
- * @param {string} wrapped_key
3773
- * @param {Uint8Array} wrapping_key
3774
- * @returns {Uint8Array}
3733
+ * @param {string} enc_string
3734
+ * @param {Uint8Array} key
3735
+ * @returns {string}
3775
3736
  */
3776
- static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
3737
+ static symmetric_decrypt_string(enc_string, key) {
3738
+ let deferred4_0;
3739
+ let deferred4_1;
3777
3740
  try {
3778
3741
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3779
- const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3742
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3780
3743
  const len0 = WASM_VECTOR_LEN;
3781
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3744
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3782
3745
  const len1 = WASM_VECTOR_LEN;
3783
- wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3746
+ wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
3784
3747
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3785
3748
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3786
3749
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3787
3750
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3751
+ var ptr3 = r0;
3752
+ var len3 = r1;
3788
3753
  if (r3) {
3754
+ ptr3 = 0;
3755
+ len3 = 0;
3789
3756
  throw takeObject(r2);
3790
3757
  }
3791
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3792
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3793
- return v3;
3758
+ deferred4_0 = ptr3;
3759
+ deferred4_1 = len3;
3760
+ return getStringFromWasm0(ptr3, len3);
3794
3761
  } finally {
3795
3762
  wasm.__wbindgen_add_to_stack_pointer(16);
3763
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3796
3764
  }
3797
3765
  }
3798
3766
  /**
3799
- * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
3800
- * key,
3801
- * @param {Uint8Array} decapsulation_key
3802
- * @param {Uint8Array} wrapping_key
3767
+ * @param {string} plain
3768
+ * @param {Uint8Array} key
3803
3769
  * @returns {string}
3804
3770
  */
3805
- static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
3771
+ static symmetric_encrypt_string(plain, key) {
3806
3772
  let deferred4_0;
3807
3773
  let deferred4_1;
3808
3774
  try {
3809
3775
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3810
- const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3776
+ const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3811
3777
  const len0 = WASM_VECTOR_LEN;
3812
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3778
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3813
3779
  const len1 = WASM_VECTOR_LEN;
3814
- wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3780
+ wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
3815
3781
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3816
3782
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3817
3783
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3861,62 +3827,47 @@ class PureCrypto {
3861
3827
  }
3862
3828
  }
3863
3829
  /**
3864
- * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
3865
- * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
3866
- * the sender's authenticity cannot be verified by the recipient.
3867
- * @param {Uint8Array} shared_key
3868
- * @param {Uint8Array} encapsulation_key
3869
- * @returns {string}
3830
+ * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
3831
+ * wrapping key.
3832
+ * @param {string} wrapped_key
3833
+ * @param {Uint8Array} wrapping_key
3834
+ * @returns {Uint8Array}
3870
3835
  */
3871
- static encapsulate_key_unsigned(shared_key, encapsulation_key) {
3872
- let deferred4_0;
3873
- let deferred4_1;
3836
+ static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
3874
3837
  try {
3875
3838
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3876
- const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
3839
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3877
3840
  const len0 = WASM_VECTOR_LEN;
3878
- const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3841
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3879
3842
  const len1 = WASM_VECTOR_LEN;
3880
- wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3843
+ wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3881
3844
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3882
3845
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3883
3846
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3884
3847
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3885
- var ptr3 = r0;
3886
- var len3 = r1;
3887
3848
  if (r3) {
3888
- ptr3 = 0;
3889
- len3 = 0;
3890
3849
  throw takeObject(r2);
3891
3850
  }
3892
- deferred4_0 = ptr3;
3893
- deferred4_1 = len3;
3894
- return getStringFromWasm0(ptr3, len3);
3851
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3852
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3853
+ return v3;
3895
3854
  } finally {
3896
3855
  wasm.__wbindgen_add_to_stack_pointer(16);
3897
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3898
3856
  }
3899
3857
  }
3900
3858
  /**
3901
- * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
3902
- * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
3903
- * recipient.
3904
- * @param {string} encapsulated_key
3905
- * @param {Uint8Array} decapsulation_key
3859
+ * @param {Uint8Array} enc_bytes
3860
+ * @param {Uint8Array} key
3906
3861
  * @returns {Uint8Array}
3907
3862
  */
3908
- static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
3863
+ static symmetric_decrypt_filedata(enc_bytes, key) {
3909
3864
  try {
3910
3865
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3911
- const ptr0 = passStringToWasm0(
3912
- encapsulated_key,
3913
- wasm.__wbindgen_malloc,
3914
- wasm.__wbindgen_realloc,
3915
- );
3866
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3916
3867
  const len0 = WASM_VECTOR_LEN;
3917
- const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3868
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3918
3869
  const len1 = WASM_VECTOR_LEN;
3919
- wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3870
+ wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3920
3871
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3921
3872
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3922
3873
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3932,20 +3883,18 @@ class PureCrypto {
3932
3883
  }
3933
3884
  }
3934
3885
  /**
3935
- * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
3936
- * the corresponding verifying key.
3937
- * @param {string} signing_key
3938
- * @param {Uint8Array} wrapping_key
3886
+ * @param {Uint8Array} plain
3887
+ * @param {Uint8Array} key
3939
3888
  * @returns {Uint8Array}
3940
3889
  */
3941
- static verifying_key_for_signing_key(signing_key, wrapping_key) {
3890
+ static symmetric_encrypt_filedata(plain, key) {
3942
3891
  try {
3943
3892
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3944
- const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3893
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3945
3894
  const len0 = WASM_VECTOR_LEN;
3946
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3895
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3947
3896
  const len1 = WASM_VECTOR_LEN;
3948
- wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
3897
+ wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3949
3898
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3950
3899
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3951
3900
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3961,44 +3910,36 @@ class PureCrypto {
3961
3910
  }
3962
3911
  }
3963
3912
  /**
3964
- * Returns the algorithm used for the given verifying key.
3965
- * @param {Uint8Array} verifying_key
3966
- * @returns {SignatureAlgorithm}
3913
+ * @returns {Uint8Array}
3967
3914
  */
3968
- static key_algorithm_for_verifying_key(verifying_key) {
3915
+ static make_user_key_aes256_cbc_hmac() {
3969
3916
  try {
3970
3917
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3971
- const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3972
- const len0 = WASM_VECTOR_LEN;
3973
- wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
3918
+ wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
3974
3919
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3975
3920
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3976
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3977
- if (r2) {
3978
- throw takeObject(r1);
3979
- }
3980
- return takeObject(r0);
3921
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3922
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3923
+ return v1;
3981
3924
  } finally {
3982
3925
  wasm.__wbindgen_add_to_stack_pointer(16);
3983
3926
  }
3984
3927
  }
3985
3928
  /**
3986
- * For a given signing identity (verifying key), this function verifies that the signing
3987
- * identity claimed ownership of the public key. This is a one-sided claim and merely shows
3988
- * that the signing identity has the intent to receive messages encrypted to the public
3989
- * key.
3990
- * @param {Uint8Array} signed_public_key
3991
- * @param {Uint8Array} verifying_key
3929
+ * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
3930
+ * the corresponding verifying key.
3931
+ * @param {string} signing_key
3932
+ * @param {Uint8Array} wrapping_key
3992
3933
  * @returns {Uint8Array}
3993
3934
  */
3994
- static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
3935
+ static verifying_key_for_signing_key(signing_key, wrapping_key) {
3995
3936
  try {
3996
3937
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3997
- const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
3938
+ const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3998
3939
  const len0 = WASM_VECTOR_LEN;
3999
- const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3940
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
4000
3941
  const len1 = WASM_VECTOR_LEN;
4001
- wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
3942
+ wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
4002
3943
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4003
3944
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4004
3945
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4014,20 +3955,20 @@ class PureCrypto {
4014
3955
  }
4015
3956
  }
4016
3957
  /**
4017
- * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
4018
- * @param {Uint8Array} password
4019
- * @param {Uint8Array} salt
4020
- * @param {Kdf} kdf
3958
+ * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
3959
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3960
+ * @param {Uint8Array} enc_bytes
3961
+ * @param {Uint8Array} key
4021
3962
  * @returns {Uint8Array}
4022
3963
  */
4023
- static derive_kdf_material(password, salt, kdf) {
3964
+ static symmetric_decrypt_array_buffer(enc_bytes, key) {
4024
3965
  try {
4025
3966
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4026
- const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
3967
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
4027
3968
  const len0 = WASM_VECTOR_LEN;
4028
- const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
3969
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
4029
3970
  const len1 = WASM_VECTOR_LEN;
4030
- wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
3971
+ wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
4031
3972
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4032
3973
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4033
3974
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4042,6 +3983,28 @@ class PureCrypto {
4042
3983
  wasm.__wbindgen_add_to_stack_pointer(16);
4043
3984
  }
4044
3985
  }
3986
+ /**
3987
+ * Returns the algorithm used for the given verifying key.
3988
+ * @param {Uint8Array} verifying_key
3989
+ * @returns {SignatureAlgorithm}
3990
+ */
3991
+ static key_algorithm_for_verifying_key(verifying_key) {
3992
+ try {
3993
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3994
+ const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3995
+ const len0 = WASM_VECTOR_LEN;
3996
+ wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
3997
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3998
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3999
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4000
+ if (r2) {
4001
+ throw takeObject(r1);
4002
+ }
4003
+ return takeObject(r0);
4004
+ } finally {
4005
+ wasm.__wbindgen_add_to_stack_pointer(16);
4006
+ }
4007
+ }
4045
4008
  /**
4046
4009
  * @param {string} encrypted_user_key
4047
4010
  * @param {Uint8Array} master_key
@@ -4074,41 +4037,38 @@ class PureCrypto {
4074
4037
  }
4075
4038
  }
4076
4039
  /**
4077
- * Given a decrypted private RSA key PKCS8 DER this
4078
- * returns the corresponding public RSA key in DER format.
4079
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4080
- * @param {Uint8Array} private_key
4081
4040
  * @returns {Uint8Array}
4082
4041
  */
4083
- static rsa_extract_public_key(private_key) {
4042
+ static make_user_key_xchacha20_poly1305() {
4084
4043
  try {
4085
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4086
- const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
4087
- const len0 = WASM_VECTOR_LEN;
4088
- wasm.purecrypto_rsa_extract_public_key(retptr, ptr0, len0);
4089
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4090
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4091
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4092
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
4093
- if (r3) {
4094
- throw takeObject(r2);
4095
- }
4096
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
4044
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4045
+ wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
4046
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4047
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4048
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4097
4049
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4098
- return v2;
4050
+ return v1;
4099
4051
  } finally {
4100
4052
  wasm.__wbindgen_add_to_stack_pointer(16);
4101
4053
  }
4102
4054
  }
4103
4055
  /**
4104
- * Generates a new RSA key pair and returns the private key
4105
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4056
+ * For a given signing identity (verifying key), this function verifies that the signing
4057
+ * identity claimed ownership of the public key. This is a one-sided claim and merely shows
4058
+ * that the signing identity has the intent to receive messages encrypted to the public
4059
+ * key.
4060
+ * @param {Uint8Array} signed_public_key
4061
+ * @param {Uint8Array} verifying_key
4106
4062
  * @returns {Uint8Array}
4107
4063
  */
4108
- static rsa_generate_keypair() {
4064
+ static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
4109
4065
  try {
4110
4066
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4111
- wasm.purecrypto_rsa_generate_keypair(retptr);
4067
+ const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
4068
+ const len0 = WASM_VECTOR_LEN;
4069
+ const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
4070
+ const len1 = WASM_VECTOR_LEN;
4071
+ wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
4112
4072
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4113
4073
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4114
4074
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4116,28 +4076,47 @@ class PureCrypto {
4116
4076
  if (r3) {
4117
4077
  throw takeObject(r2);
4118
4078
  }
4119
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
4079
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
4120
4080
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4121
- return v1;
4081
+ return v3;
4122
4082
  } finally {
4123
4083
  wasm.__wbindgen_add_to_stack_pointer(16);
4124
4084
  }
4125
4085
  }
4126
4086
  /**
4127
- * Decrypts data using RSAES-OAEP with SHA-1
4128
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4129
- * @param {Uint8Array} encrypted_data
4130
- * @param {Uint8Array} private_key
4087
+ * @param {string} encrypted_user_key
4088
+ * @param {string} master_password
4089
+ * @param {string} email
4090
+ * @param {Kdf} kdf
4131
4091
  * @returns {Uint8Array}
4132
4092
  */
4133
- static rsa_decrypt_data(encrypted_data, private_key) {
4093
+ static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
4134
4094
  try {
4135
4095
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4136
- const ptr0 = passArray8ToWasm0(encrypted_data, wasm.__wbindgen_malloc);
4096
+ const ptr0 = passStringToWasm0(
4097
+ encrypted_user_key,
4098
+ wasm.__wbindgen_malloc,
4099
+ wasm.__wbindgen_realloc,
4100
+ );
4137
4101
  const len0 = WASM_VECTOR_LEN;
4138
- const ptr1 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
4102
+ const ptr1 = passStringToWasm0(
4103
+ master_password,
4104
+ wasm.__wbindgen_malloc,
4105
+ wasm.__wbindgen_realloc,
4106
+ );
4139
4107
  const len1 = WASM_VECTOR_LEN;
4140
- wasm.purecrypto_rsa_decrypt_data(retptr, ptr0, len0, ptr1, len1);
4108
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4109
+ const len2 = WASM_VECTOR_LEN;
4110
+ wasm.purecrypto_decrypt_user_key_with_master_password(
4111
+ retptr,
4112
+ ptr0,
4113
+ len0,
4114
+ ptr1,
4115
+ len1,
4116
+ ptr2,
4117
+ len2,
4118
+ addHeapObject(kdf),
4119
+ );
4141
4120
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4142
4121
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4143
4122
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4145,40 +4124,62 @@ class PureCrypto {
4145
4124
  if (r3) {
4146
4125
  throw takeObject(r2);
4147
4126
  }
4148
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
4127
+ var v4 = getArrayU8FromWasm0(r0, r1).slice();
4149
4128
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4150
- return v3;
4129
+ return v4;
4151
4130
  } finally {
4152
4131
  wasm.__wbindgen_add_to_stack_pointer(16);
4153
4132
  }
4154
4133
  }
4155
4134
  /**
4156
- * Encrypts data using RSAES-OAEP with SHA-1
4157
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4158
- * @param {Uint8Array} plain_data
4159
- * @param {Uint8Array} public_key
4160
- * @returns {Uint8Array}
4135
+ * @param {Uint8Array} user_key
4136
+ * @param {string} master_password
4137
+ * @param {string} email
4138
+ * @param {Kdf} kdf
4139
+ * @returns {string}
4161
4140
  */
4162
- static rsa_encrypt_data(plain_data, public_key) {
4141
+ static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
4142
+ let deferred5_0;
4143
+ let deferred5_1;
4163
4144
  try {
4164
4145
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4165
- const ptr0 = passArray8ToWasm0(plain_data, wasm.__wbindgen_malloc);
4146
+ const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
4166
4147
  const len0 = WASM_VECTOR_LEN;
4167
- const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
4148
+ const ptr1 = passStringToWasm0(
4149
+ master_password,
4150
+ wasm.__wbindgen_malloc,
4151
+ wasm.__wbindgen_realloc,
4152
+ );
4168
4153
  const len1 = WASM_VECTOR_LEN;
4169
- wasm.purecrypto_rsa_encrypt_data(retptr, ptr0, len0, ptr1, len1);
4154
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4155
+ const len2 = WASM_VECTOR_LEN;
4156
+ wasm.purecrypto_encrypt_user_key_with_master_password(
4157
+ retptr,
4158
+ ptr0,
4159
+ len0,
4160
+ ptr1,
4161
+ len1,
4162
+ ptr2,
4163
+ len2,
4164
+ addHeapObject(kdf),
4165
+ );
4170
4166
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4171
4167
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4172
4168
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4173
4169
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
4170
+ var ptr4 = r0;
4171
+ var len4 = r1;
4174
4172
  if (r3) {
4173
+ ptr4 = 0;
4174
+ len4 = 0;
4175
4175
  throw takeObject(r2);
4176
4176
  }
4177
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
4178
- wasm.__wbindgen_free(r0, r1 * 1, 1);
4179
- return v3;
4177
+ deferred5_0 = ptr4;
4178
+ deferred5_1 = len4;
4179
+ return getStringFromWasm0(ptr4, len4);
4180
4180
  } finally {
4181
4181
  wasm.__wbindgen_add_to_stack_pointer(16);
4182
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
4182
4183
  }
4183
4184
  }
4184
4185
  }
@@ -4288,6 +4289,15 @@ class StateClient {
4288
4289
  const ptr = this.__destroy_into_raw();
4289
4290
  wasm.__wbg_stateclient_free(ptr, 0);
4290
4291
  }
4292
+ /**
4293
+ * Initialize the database for SDK managed repositories.
4294
+ * @param {IndexedDbConfiguration} configuration
4295
+ * @returns {Promise<void>}
4296
+ */
4297
+ initialize_state(configuration) {
4298
+ const ret = wasm.stateclient_initialize_state(this.__wbg_ptr, addHeapObject(configuration));
4299
+ return takeObject(ret);
4300
+ }
4291
4301
  /**
4292
4302
  * @param {any} cipher_repository
4293
4303
  */
@@ -4309,15 +4319,6 @@ class StateClient {
4309
4319
  addHeapObject(repositories),
4310
4320
  );
4311
4321
  }
4312
- /**
4313
- * Initialize the database for SDK managed repositories.
4314
- * @param {IndexedDbConfiguration} configuration
4315
- * @returns {Promise<void>}
4316
- */
4317
- initialize_state(configuration) {
4318
- const ret = wasm.stateclient_initialize_state(this.__wbg_ptr, addHeapObject(configuration));
4319
- return takeObject(ret);
4320
- }
4321
4322
  }
4322
4323
  if (Symbol.dispose) StateClient.prototype[Symbol.dispose] = StateClient.prototype.free;
4323
4324
 
@@ -4424,20 +4425,20 @@ class VaultClient {
4424
4425
  return AttachmentsClient.__wrap(ret);
4425
4426
  }
4426
4427
  /**
4427
- * Cipher related operations.
4428
- * @returns {CiphersClient}
4428
+ * Cipher risk evaluation operations.
4429
+ * @returns {CipherRiskClient}
4429
4430
  */
4430
- ciphers() {
4431
+ cipher_risk() {
4431
4432
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4432
- return CiphersClient.__wrap(ret);
4433
+ return CipherRiskClient.__wrap(ret);
4433
4434
  }
4434
4435
  /**
4435
- * Folder related operations.
4436
- * @returns {FoldersClient}
4436
+ * Collection related operations.
4437
+ * @returns {CollectionsClient}
4437
4438
  */
4438
- folders() {
4439
+ collections() {
4439
4440
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4440
- return FoldersClient.__wrap(ret);
4441
+ return CollectionsClient.__wrap(ret);
4441
4442
  }
4442
4443
  /**
4443
4444
  * TOTP related operations.
@@ -4448,20 +4449,20 @@ class VaultClient {
4448
4449
  return TotpClient.__wrap(ret);
4449
4450
  }
4450
4451
  /**
4451
- * Collection related operations.
4452
- * @returns {CollectionsClient}
4452
+ * Cipher related operations.
4453
+ * @returns {CiphersClient}
4453
4454
  */
4454
- collections() {
4455
+ ciphers() {
4455
4456
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4456
- return CollectionsClient.__wrap(ret);
4457
+ return CiphersClient.__wrap(ret);
4457
4458
  }
4458
4459
  /**
4459
- * Cipher risk evaluation operations.
4460
- * @returns {CipherRiskClient}
4460
+ * Folder related operations.
4461
+ * @returns {FoldersClient}
4461
4462
  */
4462
- cipher_risk() {
4463
+ folders() {
4463
4464
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4464
- return CipherRiskClient.__wrap(ret);
4465
+ return FoldersClient.__wrap(ret);
4465
4466
  }
4466
4467
  }
4467
4468
  if (Symbol.dispose) VaultClient.prototype[Symbol.dispose] = VaultClient.prototype.free;
@@ -4641,7 +4642,7 @@ exports.__wbg_call_e762c39fa8ea36bf = function () {
4641
4642
  }, arguments);
4642
4643
  };
4643
4644
 
4644
- exports.__wbg_cipher_f01ad37fe153c74a = function (arg0) {
4645
+ exports.__wbg_cipher_ca1a8072783e8524 = function (arg0) {
4645
4646
  const ret = getObject(arg0).cipher;
4646
4647
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4647
4648
  };
@@ -4734,7 +4735,7 @@ exports.__wbg_fetch_f8ba0e29a9d6de0d = function (arg0, arg1) {
4734
4735
  return addHeapObject(ret);
4735
4736
  };
4736
4737
 
4737
- exports.__wbg_folder_b2f27ca5801406fe = function (arg0) {
4738
+ exports.__wbg_folder_c3e4ac6ced93af5a = function (arg0) {
4738
4739
  const ret = getObject(arg0).folder;
4739
4740
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4740
4741
  };
@@ -4767,12 +4768,7 @@ exports.__wbg_getTime_14776bfb48a1bff9 = function (arg0) {
4767
4768
  return ret;
4768
4769
  };
4769
4770
 
4770
- exports.__wbg_get_7bed016f185add81 = function (arg0, arg1) {
4771
- const ret = getObject(arg0)[arg1 >>> 0];
4772
- return addHeapObject(ret);
4773
- };
4774
-
4775
- exports.__wbg_get_7d24a56df19d62f6 = function () {
4771
+ exports.__wbg_get_021b4709a0cd459d = function () {
4776
4772
  return handleError(function (arg0, arg1, arg2) {
4777
4773
  let deferred0_0;
4778
4774
  let deferred0_1;
@@ -4787,12 +4783,17 @@ exports.__wbg_get_7d24a56df19d62f6 = function () {
4787
4783
  }, arguments);
4788
4784
  };
4789
4785
 
4790
- exports.__wbg_get_access_token_f4e462d38899439f = function (arg0) {
4786
+ exports.__wbg_get_7bed016f185add81 = function (arg0, arg1) {
4787
+ const ret = getObject(arg0)[arg1 >>> 0];
4788
+ return addHeapObject(ret);
4789
+ };
4790
+
4791
+ exports.__wbg_get_access_token_1bd76bc1d6872a37 = function (arg0) {
4791
4792
  const ret = getObject(arg0).get_access_token();
4792
4793
  return addHeapObject(ret);
4793
4794
  };
4794
4795
 
4795
- exports.__wbg_get_cf7a5a169adcb6d4 = function () {
4796
+ exports.__wbg_get_bcdf6d1f18330518 = function () {
4796
4797
  return handleError(function (arg0, arg1, arg2) {
4797
4798
  let deferred0_0;
4798
4799
  let deferred0_1;
@@ -4998,14 +4999,14 @@ exports.__wbg_length_cdd215e10d9dd507 = function (arg0) {
4998
4999
  return ret;
4999
5000
  };
5000
5001
 
5001
- exports.__wbg_list_9632da36688eb013 = function () {
5002
+ exports.__wbg_list_e1b7ba42d5e1f9e4 = function () {
5002
5003
  return handleError(function (arg0) {
5003
5004
  const ret = getObject(arg0).list();
5004
5005
  return addHeapObject(ret);
5005
5006
  }, arguments);
5006
5007
  };
5007
5008
 
5008
- exports.__wbg_list_971afaee385941da = function () {
5009
+ exports.__wbg_list_f9b0200b46781635 = function () {
5009
5010
  return handleError(function (arg0) {
5010
5011
  const ret = getObject(arg0).list();
5011
5012
  return addHeapObject(ret);
@@ -5077,7 +5078,7 @@ exports.__wbg_new_3c3d849046688a66 = function (arg0, arg1) {
5077
5078
  const a = state0.a;
5078
5079
  state0.a = 0;
5079
5080
  try {
5080
- return wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(
5081
+ return wasm_bindgen__convert__closures_____invoke__h0cb536241502fe83(
5081
5082
  a,
5082
5083
  state0.b,
5083
5084
  arg0,
@@ -5249,7 +5250,7 @@ exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
5249
5250
  }, arguments);
5250
5251
  };
5251
5252
 
5252
- exports.__wbg_remove_0c50f1a372592522 = function () {
5253
+ exports.__wbg_remove_4b6c74678272e489 = function () {
5253
5254
  return handleError(function (arg0, arg1, arg2) {
5254
5255
  let deferred0_0;
5255
5256
  let deferred0_1;
@@ -5264,7 +5265,7 @@ exports.__wbg_remove_0c50f1a372592522 = function () {
5264
5265
  }, arguments);
5265
5266
  };
5266
5267
 
5267
- exports.__wbg_remove_d52ba16f05c98799 = function () {
5268
+ exports.__wbg_remove_b83e730d13c289dd = function () {
5268
5269
  return handleError(function (arg0, arg1, arg2) {
5269
5270
  let deferred0_0;
5270
5271
  let deferred0_1;
@@ -5310,31 +5311,7 @@ exports.__wbg_setTimeout_ca12ead8b48245e2 = function (arg0, arg1) {
5310
5311
  return addHeapObject(ret);
5311
5312
  };
5312
5313
 
5313
- exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
5314
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5315
- };
5316
-
5317
- exports.__wbg_set_907fb406c34a251d = function (arg0, arg1, arg2) {
5318
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5319
- return addHeapObject(ret);
5320
- };
5321
-
5322
- exports.__wbg_set_body_3c365989753d61f4 = function (arg0, arg1) {
5323
- getObject(arg0).body = getObject(arg1);
5324
- };
5325
-
5326
- exports.__wbg_set_c213c871859d6500 = function (arg0, arg1, arg2) {
5327
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
5328
- };
5329
-
5330
- exports.__wbg_set_c2abbebe8b9ebee1 = function () {
5331
- return handleError(function (arg0, arg1, arg2) {
5332
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
5333
- return ret;
5334
- }, arguments);
5335
- };
5336
-
5337
- exports.__wbg_set_cf238f02b0469517 = function () {
5314
+ exports.__wbg_set_0a163d5675fd3741 = function () {
5338
5315
  return handleError(function (arg0, arg1, arg2, arg3) {
5339
5316
  let deferred0_0;
5340
5317
  let deferred0_1;
@@ -5349,11 +5326,11 @@ exports.__wbg_set_cf238f02b0469517 = function () {
5349
5326
  }, arguments);
5350
5327
  };
5351
5328
 
5352
- exports.__wbg_set_credentials_f621cd2d85c0c228 = function (arg0, arg1) {
5353
- getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
5329
+ exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
5330
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5354
5331
  };
5355
5332
 
5356
- exports.__wbg_set_e87a8a3d69deff6e = function () {
5333
+ exports.__wbg_set_5e51294e627b72fd = function () {
5357
5334
  return handleError(function (arg0, arg1, arg2, arg3) {
5358
5335
  let deferred0_0;
5359
5336
  let deferred0_1;
@@ -5368,6 +5345,30 @@ exports.__wbg_set_e87a8a3d69deff6e = function () {
5368
5345
  }, arguments);
5369
5346
  };
5370
5347
 
5348
+ exports.__wbg_set_907fb406c34a251d = function (arg0, arg1, arg2) {
5349
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5350
+ return addHeapObject(ret);
5351
+ };
5352
+
5353
+ exports.__wbg_set_body_3c365989753d61f4 = function (arg0, arg1) {
5354
+ getObject(arg0).body = getObject(arg1);
5355
+ };
5356
+
5357
+ exports.__wbg_set_c213c871859d6500 = function (arg0, arg1, arg2) {
5358
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
5359
+ };
5360
+
5361
+ exports.__wbg_set_c2abbebe8b9ebee1 = function () {
5362
+ return handleError(function (arg0, arg1, arg2) {
5363
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
5364
+ return ret;
5365
+ }, arguments);
5366
+ };
5367
+
5368
+ exports.__wbg_set_credentials_f621cd2d85c0c228 = function (arg0, arg1) {
5369
+ getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
5370
+ };
5371
+
5371
5372
  exports.__wbg_set_headers_6926da238cd32ee4 = function (arg0, arg1) {
5372
5373
  getObject(arg0).headers = getObject(arg1);
5373
5374
  };
@@ -5538,34 +5539,34 @@ exports.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
5538
5539
  return addHeapObject(ret);
5539
5540
  };
5540
5541
 
5541
- exports.__wbindgen_cast_4042b341512ce63a = function (arg0, arg1) {
5542
- // Cast intrinsic for `Closure(Closure { dtor_idx: 41, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 44, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5542
+ exports.__wbindgen_cast_34ef3ce950757bdd = function (arg0, arg1) {
5543
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 40, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 41, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5543
5544
  const ret = makeMutClosure(
5544
5545
  arg0,
5545
5546
  arg1,
5546
- wasm.wasm_bindgen__closure__destroy__h09d4e676b918dc23,
5547
- wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa,
5547
+ wasm.wasm_bindgen__closure__destroy__h003cf2eb90144982,
5548
+ wasm_bindgen__convert__closures_____invoke__h05da89f3ce503b8f,
5548
5549
  );
5549
5550
  return addHeapObject(ret);
5550
5551
  };
5551
5552
 
5552
- exports.__wbindgen_cast_4625c577ab2ec9ee = function (arg0) {
5553
- // Cast intrinsic for `U64 -> Externref`.
5554
- const ret = BigInt.asUintN(64, arg0);
5555
- return addHeapObject(ret);
5556
- };
5557
-
5558
- exports.__wbindgen_cast_567ce6425eb96825 = function (arg0, arg1) {
5559
- // Cast intrinsic for `Closure(Closure { dtor_idx: 551, function: Function { arguments: [], shim_idx: 305, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5553
+ exports.__wbindgen_cast_397295739b4135cd = function (arg0, arg1) {
5554
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 40, function: Function { arguments: [NamedExternref("Event")], shim_idx: 43, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
5560
5555
  const ret = makeMutClosure(
5561
5556
  arg0,
5562
5557
  arg1,
5563
- wasm.wasm_bindgen__closure__destroy__hfcb631b72e5e985c,
5564
- wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e,
5558
+ wasm.wasm_bindgen__closure__destroy__h003cf2eb90144982,
5559
+ wasm_bindgen__convert__closures_____invoke__h389a5517bdf6e196,
5565
5560
  );
5566
5561
  return addHeapObject(ret);
5567
5562
  };
5568
5563
 
5564
+ exports.__wbindgen_cast_4625c577ab2ec9ee = function (arg0) {
5565
+ // Cast intrinsic for `U64 -> Externref`.
5566
+ const ret = BigInt.asUintN(64, arg0);
5567
+ return addHeapObject(ret);
5568
+ };
5569
+
5569
5570
  exports.__wbindgen_cast_5fea77eff9dd275c = function (arg0, arg1) {
5570
5571
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
5571
5572
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
@@ -5582,24 +5583,13 @@ exports.__wbindgen_cast_7a6d185652cd8149 = function (arg0, arg1) {
5582
5583
  return addHeapObject(ret);
5583
5584
  };
5584
5585
 
5585
- exports.__wbindgen_cast_8340b5b160d85933 = function (arg0, arg1) {
5586
- // Cast intrinsic for `Closure(Closure { dtor_idx: 304, function: Function { arguments: [], shim_idx: 305, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5587
- const ret = makeMutClosure(
5588
- arg0,
5589
- arg1,
5590
- wasm.wasm_bindgen__closure__destroy__h5bf455f3385c4f71,
5591
- wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e,
5592
- );
5593
- return addHeapObject(ret);
5594
- };
5595
-
5596
- exports.__wbindgen_cast_9654b59eb60e619d = function (arg0, arg1) {
5597
- // Cast intrinsic for `Closure(Closure { dtor_idx: 304, function: Function { arguments: [Externref], shim_idx: 44, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5586
+ exports.__wbindgen_cast_930d054add031527 = function (arg0, arg1) {
5587
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 303, function: Function { arguments: [Externref], shim_idx: 41, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5598
5588
  const ret = makeMutClosure(
5599
5589
  arg0,
5600
5590
  arg1,
5601
- wasm.wasm_bindgen__closure__destroy__h5bf455f3385c4f71,
5602
- wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa,
5591
+ wasm.wasm_bindgen__closure__destroy__h591e0f2efd143068,
5592
+ wasm_bindgen__convert__closures_____invoke__h05da89f3ce503b8f,
5603
5593
  );
5604
5594
  return addHeapObject(ret);
5605
5595
  };
@@ -5610,23 +5600,34 @@ exports.__wbindgen_cast_9ae0607507abb057 = function (arg0) {
5610
5600
  return addHeapObject(ret);
5611
5601
  };
5612
5602
 
5613
- exports.__wbindgen_cast_cb9088102bce6b30 = function (arg0, arg1) {
5614
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
5615
- const ret = getArrayU8FromWasm0(arg0, arg1);
5603
+ exports.__wbindgen_cast_9b35fe50b76611f9 = function (arg0, arg1) {
5604
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 552, function: Function { arguments: [], shim_idx: 304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5605
+ const ret = makeMutClosure(
5606
+ arg0,
5607
+ arg1,
5608
+ wasm.wasm_bindgen__closure__destroy__he41cbbdbe831f2ac,
5609
+ wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2,
5610
+ );
5616
5611
  return addHeapObject(ret);
5617
5612
  };
5618
5613
 
5619
- exports.__wbindgen_cast_d49c305f67640cb1 = function (arg0, arg1) {
5620
- // Cast intrinsic for `Closure(Closure { dtor_idx: 41, function: Function { arguments: [NamedExternref("Event")], shim_idx: 42, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
5614
+ exports.__wbindgen_cast_bfa5a190b0f2e981 = function (arg0, arg1) {
5615
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 303, function: Function { arguments: [], shim_idx: 304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5621
5616
  const ret = makeMutClosure(
5622
5617
  arg0,
5623
5618
  arg1,
5624
- wasm.wasm_bindgen__closure__destroy__h09d4e676b918dc23,
5625
- wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf,
5619
+ wasm.wasm_bindgen__closure__destroy__h591e0f2efd143068,
5620
+ wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2,
5626
5621
  );
5627
5622
  return addHeapObject(ret);
5628
5623
  };
5629
5624
 
5625
+ exports.__wbindgen_cast_cb9088102bce6b30 = function (arg0, arg1) {
5626
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
5627
+ const ret = getArrayU8FromWasm0(arg0, arg1);
5628
+ return addHeapObject(ret);
5629
+ };
5630
+
5630
5631
  exports.__wbindgen_cast_d6cd19b81560fd6e = function (arg0) {
5631
5632
  // Cast intrinsic for `F64 -> Externref`.
5632
5633
  const ret = arg0;