@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.
@@ -256,12 +256,6 @@ function getArrayJsValueFromWasm0(ptr, len) {
256
256
  }
257
257
  return result;
258
258
  }
259
- /**
260
- * @param {LogLevel | null} [log_level]
261
- */
262
- export function init_sdk(log_level) {
263
- wasm.init_sdk(isLikeNone(log_level) ? 5 : log_level);
264
- }
265
259
 
266
260
  function passArray8ToWasm0(arg, malloc) {
267
261
  const ptr = malloc(arg.length * 1, 1) >>> 0;
@@ -337,6 +331,13 @@ export function import_ssh_key(imported_key, password) {
337
331
  }
338
332
  }
339
333
 
334
+ /**
335
+ * @param {LogLevel | null} [log_level]
336
+ */
337
+ export function init_sdk(log_level) {
338
+ wasm.init_sdk(isLikeNone(log_level) ? 5 : log_level);
339
+ }
340
+
340
341
  let stack_pointer = 128;
341
342
 
342
343
  function addBorrowedObject(obj) {
@@ -387,9 +388,9 @@ export function isMasterPasswordError(error) {
387
388
  * @param {any} error
388
389
  * @returns {boolean}
389
390
  */
390
- export function isDeriveKeyConnectorError(error) {
391
+ export function isAccountCryptographyInitializationError(error) {
391
392
  try {
392
- const ret = wasm.isDeriveKeyConnectorError(addBorrowedObject(error));
393
+ const ret = wasm.isAccountCryptographyInitializationError(addBorrowedObject(error));
393
394
  return ret !== 0;
394
395
  } finally {
395
396
  heap[stack_pointer++] = undefined;
@@ -400,9 +401,9 @@ export function isDeriveKeyConnectorError(error) {
400
401
  * @param {any} error
401
402
  * @returns {boolean}
402
403
  */
403
- export function isEnrollAdminPasswordResetError(error) {
404
+ export function isCryptoClientError(error) {
404
405
  try {
405
- const ret = wasm.isEnrollAdminPasswordResetError(addBorrowedObject(error));
406
+ const ret = wasm.isCryptoClientError(addBorrowedObject(error));
406
407
  return ret !== 0;
407
408
  } finally {
408
409
  heap[stack_pointer++] = undefined;
@@ -413,9 +414,9 @@ export function isEnrollAdminPasswordResetError(error) {
413
414
  * @param {any} error
414
415
  * @returns {boolean}
415
416
  */
416
- export function isCryptoClientError(error) {
417
+ export function isDeriveKeyConnectorError(error) {
417
418
  try {
418
- const ret = wasm.isCryptoClientError(addBorrowedObject(error));
419
+ const ret = wasm.isDeriveKeyConnectorError(addBorrowedObject(error));
419
420
  return ret !== 0;
420
421
  } finally {
421
422
  heap[stack_pointer++] = undefined;
@@ -426,9 +427,9 @@ export function isCryptoClientError(error) {
426
427
  * @param {any} error
427
428
  * @returns {boolean}
428
429
  */
429
- export function isAccountCryptographyInitializationError(error) {
430
+ export function isEnrollAdminPasswordResetError(error) {
430
431
  try {
431
- const ret = wasm.isAccountCryptographyInitializationError(addBorrowedObject(error));
432
+ const ret = wasm.isEnrollAdminPasswordResetError(addBorrowedObject(error));
432
433
  return ret !== 0;
433
434
  } finally {
434
435
  heap[stack_pointer++] = undefined;
@@ -500,9 +501,9 @@ export function isExportError(error) {
500
501
  * @param {any} error
501
502
  * @returns {boolean}
502
503
  */
503
- export function isUsernameError(error) {
504
+ export function isPasswordError(error) {
504
505
  try {
505
- const ret = wasm.isUsernameError(addBorrowedObject(error));
506
+ const ret = wasm.isPasswordError(addBorrowedObject(error));
506
507
  return ret !== 0;
507
508
  } finally {
508
509
  heap[stack_pointer++] = undefined;
@@ -513,56 +514,22 @@ export function isUsernameError(error) {
513
514
  * @param {any} error
514
515
  * @returns {boolean}
515
516
  */
516
- export function isPasswordError(error) {
517
+ export function isUsernameError(error) {
517
518
  try {
518
- const ret = wasm.isPasswordError(addBorrowedObject(error));
519
+ const ret = wasm.isUsernameError(addBorrowedObject(error));
519
520
  return ret !== 0;
520
521
  } finally {
521
522
  heap[stack_pointer++] = undefined;
522
523
  }
523
524
  }
524
525
 
525
- function _assertClass(instance, klass) {
526
- if (!(instance instanceof klass)) {
527
- throw new Error(`expected instance of ${klass.name}`);
528
- }
529
- }
530
- /**
531
- * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
532
- * @param {IpcClient} ipc_client
533
- * @param {DiscoverResponse} response
534
- * @returns {Promise<void>}
535
- */
536
- export function ipcRegisterDiscoverHandler(ipc_client, response) {
537
- _assertClass(ipc_client, IpcClient);
538
- const ret = wasm.ipcRegisterDiscoverHandler(ipc_client.__wbg_ptr, addHeapObject(response));
539
- return takeObject(ret);
540
- }
541
-
542
- /**
543
- * Sends a DiscoverRequest to the specified destination and returns the response.
544
- * @param {IpcClient} ipc_client
545
- * @param {Endpoint} destination
546
- * @param {AbortSignal | null} [abort_signal]
547
- * @returns {Promise<DiscoverResponse>}
548
- */
549
- export function ipcRequestDiscover(ipc_client, destination, abort_signal) {
550
- _assertClass(ipc_client, IpcClient);
551
- const ret = wasm.ipcRequestDiscover(
552
- ipc_client.__wbg_ptr,
553
- addHeapObject(destination),
554
- isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
555
- );
556
- return takeObject(ret);
557
- }
558
-
559
526
  /**
560
527
  * @param {any} error
561
528
  * @returns {boolean}
562
529
  */
563
- export function isChannelError(error) {
530
+ export function isRequestError(error) {
564
531
  try {
565
- const ret = wasm.isChannelError(addBorrowedObject(error));
532
+ const ret = wasm.isRequestError(addBorrowedObject(error));
566
533
  return ret !== 0;
567
534
  } finally {
568
535
  heap[stack_pointer++] = undefined;
@@ -573,9 +540,9 @@ export function isChannelError(error) {
573
540
  * @param {any} error
574
541
  * @returns {boolean}
575
542
  */
576
- export function isDeserializeError(error) {
543
+ export function isTypedReceiveError(error) {
577
544
  try {
578
- const ret = wasm.isDeserializeError(addBorrowedObject(error));
545
+ const ret = wasm.isTypedReceiveError(addBorrowedObject(error));
579
546
  return ret !== 0;
580
547
  } finally {
581
548
  heap[stack_pointer++] = undefined;
@@ -586,9 +553,9 @@ export function isDeserializeError(error) {
586
553
  * @param {any} error
587
554
  * @returns {boolean}
588
555
  */
589
- export function isRequestError(error) {
556
+ export function isSubscribeError(error) {
590
557
  try {
591
- const ret = wasm.isRequestError(addBorrowedObject(error));
558
+ const ret = wasm.isSubscribeError(addBorrowedObject(error));
592
559
  return ret !== 0;
593
560
  } finally {
594
561
  heap[stack_pointer++] = undefined;
@@ -599,22 +566,27 @@ export function isRequestError(error) {
599
566
  * @param {any} error
600
567
  * @returns {boolean}
601
568
  */
602
- export function isTypedReceiveError(error) {
569
+ export function isReceiveError(error) {
603
570
  try {
604
- const ret = wasm.isTypedReceiveError(addBorrowedObject(error));
571
+ const ret = wasm.isReceiveError(addBorrowedObject(error));
605
572
  return ret !== 0;
606
573
  } finally {
607
574
  heap[stack_pointer++] = undefined;
608
575
  }
609
576
  }
610
577
 
578
+ function _assertClass(instance, klass) {
579
+ if (!(instance instanceof klass)) {
580
+ throw new Error(`expected instance of ${klass.name}`);
581
+ }
582
+ }
611
583
  /**
612
584
  * @param {any} error
613
585
  * @returns {boolean}
614
586
  */
615
- export function isReceiveError(error) {
587
+ export function isDeserializeError(error) {
616
588
  try {
617
- const ret = wasm.isReceiveError(addBorrowedObject(error));
589
+ const ret = wasm.isDeserializeError(addBorrowedObject(error));
618
590
  return ret !== 0;
619
591
  } finally {
620
592
  heap[stack_pointer++] = undefined;
@@ -625,22 +597,51 @@ export function isReceiveError(error) {
625
597
  * @param {any} error
626
598
  * @returns {boolean}
627
599
  */
628
- export function isSubscribeError(error) {
600
+ export function isChannelError(error) {
629
601
  try {
630
- const ret = wasm.isSubscribeError(addBorrowedObject(error));
602
+ const ret = wasm.isChannelError(addBorrowedObject(error));
631
603
  return ret !== 0;
632
604
  } finally {
633
605
  heap[stack_pointer++] = undefined;
634
606
  }
635
607
  }
636
608
 
609
+ /**
610
+ * Sends a DiscoverRequest to the specified destination and returns the response.
611
+ * @param {IpcClient} ipc_client
612
+ * @param {Endpoint} destination
613
+ * @param {AbortSignal | null} [abort_signal]
614
+ * @returns {Promise<DiscoverResponse>}
615
+ */
616
+ export function ipcRequestDiscover(ipc_client, destination, abort_signal) {
617
+ _assertClass(ipc_client, IpcClient);
618
+ const ret = wasm.ipcRequestDiscover(
619
+ ipc_client.__wbg_ptr,
620
+ addHeapObject(destination),
621
+ isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
622
+ );
623
+ return takeObject(ret);
624
+ }
625
+
626
+ /**
627
+ * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
628
+ * @param {IpcClient} ipc_client
629
+ * @param {DiscoverResponse} response
630
+ * @returns {Promise<void>}
631
+ */
632
+ export function ipcRegisterDiscoverHandler(ipc_client, response) {
633
+ _assertClass(ipc_client, IpcClient);
634
+ const ret = wasm.ipcRegisterDiscoverHandler(ipc_client.__wbg_ptr, addHeapObject(response));
635
+ return takeObject(ret);
636
+ }
637
+
637
638
  /**
638
639
  * @param {any} error
639
640
  * @returns {boolean}
640
641
  */
641
- export function isSshKeyExportError(error) {
642
+ export function isKeyGenerationError(error) {
642
643
  try {
643
- const ret = wasm.isSshKeyExportError(addBorrowedObject(error));
644
+ const ret = wasm.isKeyGenerationError(addBorrowedObject(error));
644
645
  return ret !== 0;
645
646
  } finally {
646
647
  heap[stack_pointer++] = undefined;
@@ -651,9 +652,9 @@ export function isSshKeyExportError(error) {
651
652
  * @param {any} error
652
653
  * @returns {boolean}
653
654
  */
654
- export function isSshKeyImportError(error) {
655
+ export function isSshKeyExportError(error) {
655
656
  try {
656
- const ret = wasm.isSshKeyImportError(addBorrowedObject(error));
657
+ const ret = wasm.isSshKeyExportError(addBorrowedObject(error));
657
658
  return ret !== 0;
658
659
  } finally {
659
660
  heap[stack_pointer++] = undefined;
@@ -664,9 +665,9 @@ export function isSshKeyImportError(error) {
664
665
  * @param {any} error
665
666
  * @returns {boolean}
666
667
  */
667
- export function isKeyGenerationError(error) {
668
+ export function isSshKeyImportError(error) {
668
669
  try {
669
- const ret = wasm.isKeyGenerationError(addBorrowedObject(error));
670
+ const ret = wasm.isSshKeyImportError(addBorrowedObject(error));
670
671
  return ret !== 0;
671
672
  } finally {
672
673
  heap[stack_pointer++] = undefined;
@@ -716,9 +717,9 @@ export function isCallError(error) {
716
717
  * @param {any} error
717
718
  * @returns {boolean}
718
719
  */
719
- export function isDecryptError(error) {
720
+ export function isCipherRiskError(error) {
720
721
  try {
721
- const ret = wasm.isDecryptError(addBorrowedObject(error));
722
+ const ret = wasm.isCipherRiskError(addBorrowedObject(error));
722
723
  return ret !== 0;
723
724
  } finally {
724
725
  heap[stack_pointer++] = undefined;
@@ -729,9 +730,9 @@ export function isDecryptError(error) {
729
730
  * @param {any} error
730
731
  * @returns {boolean}
731
732
  */
732
- export function isEncryptError(error) {
733
+ export function isTotpError(error) {
733
734
  try {
734
- const ret = wasm.isEncryptError(addBorrowedObject(error));
735
+ const ret = wasm.isTotpError(addBorrowedObject(error));
735
736
  return ret !== 0;
736
737
  } finally {
737
738
  heap[stack_pointer++] = undefined;
@@ -742,9 +743,9 @@ export function isEncryptError(error) {
742
743
  * @param {any} error
743
744
  * @returns {boolean}
744
745
  */
745
- export function isTotpError(error) {
746
+ export function isEncryptError(error) {
746
747
  try {
747
- const ret = wasm.isTotpError(addBorrowedObject(error));
748
+ const ret = wasm.isEncryptError(addBorrowedObject(error));
748
749
  return ret !== 0;
749
750
  } finally {
750
751
  heap[stack_pointer++] = undefined;
@@ -755,9 +756,9 @@ export function isTotpError(error) {
755
756
  * @param {any} error
756
757
  * @returns {boolean}
757
758
  */
758
- export function isGetFolderError(error) {
759
+ export function isDecryptError(error) {
759
760
  try {
760
- const ret = wasm.isGetFolderError(addBorrowedObject(error));
761
+ const ret = wasm.isDecryptError(addBorrowedObject(error));
761
762
  return ret !== 0;
762
763
  } finally {
763
764
  heap[stack_pointer++] = undefined;
@@ -768,9 +769,9 @@ export function isGetFolderError(error) {
768
769
  * @param {any} error
769
770
  * @returns {boolean}
770
771
  */
771
- export function isEditFolderError(error) {
772
+ export function isGetCipherError(error) {
772
773
  try {
773
- const ret = wasm.isEditFolderError(addBorrowedObject(error));
774
+ const ret = wasm.isGetCipherError(addBorrowedObject(error));
774
775
  return ret !== 0;
775
776
  } finally {
776
777
  heap[stack_pointer++] = undefined;
@@ -781,9 +782,9 @@ export function isEditFolderError(error) {
781
782
  * @param {any} error
782
783
  * @returns {boolean}
783
784
  */
784
- export function isCreateFolderError(error) {
785
+ export function isEditCipherError(error) {
785
786
  try {
786
- const ret = wasm.isCreateFolderError(addBorrowedObject(error));
787
+ const ret = wasm.isEditCipherError(addBorrowedObject(error));
787
788
  return ret !== 0;
788
789
  } finally {
789
790
  heap[stack_pointer++] = undefined;
@@ -794,9 +795,9 @@ export function isCreateFolderError(error) {
794
795
  * @param {any} error
795
796
  * @returns {boolean}
796
797
  */
797
- export function isCipherRiskError(error) {
798
+ export function isCreateCipherError(error) {
798
799
  try {
799
- const ret = wasm.isCipherRiskError(addBorrowedObject(error));
800
+ const ret = wasm.isCreateCipherError(addBorrowedObject(error));
800
801
  return ret !== 0;
801
802
  } finally {
802
803
  heap[stack_pointer++] = undefined;
@@ -807,9 +808,9 @@ export function isCipherRiskError(error) {
807
808
  * @param {any} error
808
809
  * @returns {boolean}
809
810
  */
810
- export function isGetCipherError(error) {
811
+ export function isEncryptFileError(error) {
811
812
  try {
812
- const ret = wasm.isGetCipherError(addBorrowedObject(error));
813
+ const ret = wasm.isEncryptFileError(addBorrowedObject(error));
813
814
  return ret !== 0;
814
815
  } finally {
815
816
  heap[stack_pointer++] = undefined;
@@ -820,9 +821,9 @@ export function isGetCipherError(error) {
820
821
  * @param {any} error
821
822
  * @returns {boolean}
822
823
  */
823
- export function isEditCipherError(error) {
824
+ export function isDecryptFileError(error) {
824
825
  try {
825
- const ret = wasm.isEditCipherError(addBorrowedObject(error));
826
+ const ret = wasm.isDecryptFileError(addBorrowedObject(error));
826
827
  return ret !== 0;
827
828
  } finally {
828
829
  heap[stack_pointer++] = undefined;
@@ -833,9 +834,9 @@ export function isEditCipherError(error) {
833
834
  * @param {any} error
834
835
  * @returns {boolean}
835
836
  */
836
- export function isCreateCipherError(error) {
837
+ export function isCipherError(error) {
837
838
  try {
838
- const ret = wasm.isCreateCipherError(addBorrowedObject(error));
839
+ const ret = wasm.isCipherError(addBorrowedObject(error));
839
840
  return ret !== 0;
840
841
  } finally {
841
842
  heap[stack_pointer++] = undefined;
@@ -846,9 +847,9 @@ export function isCreateCipherError(error) {
846
847
  * @param {any} error
847
848
  * @returns {boolean}
848
849
  */
849
- export function isCipherError(error) {
850
+ export function isEditFolderError(error) {
850
851
  try {
851
- const ret = wasm.isCipherError(addBorrowedObject(error));
852
+ const ret = wasm.isEditFolderError(addBorrowedObject(error));
852
853
  return ret !== 0;
853
854
  } finally {
854
855
  heap[stack_pointer++] = undefined;
@@ -859,9 +860,9 @@ export function isCipherError(error) {
859
860
  * @param {any} error
860
861
  * @returns {boolean}
861
862
  */
862
- export function isDecryptFileError(error) {
863
+ export function isCreateFolderError(error) {
863
864
  try {
864
- const ret = wasm.isDecryptFileError(addBorrowedObject(error));
865
+ const ret = wasm.isCreateFolderError(addBorrowedObject(error));
865
866
  return ret !== 0;
866
867
  } finally {
867
868
  heap[stack_pointer++] = undefined;
@@ -872,31 +873,27 @@ export function isDecryptFileError(error) {
872
873
  * @param {any} error
873
874
  * @returns {boolean}
874
875
  */
875
- export function isEncryptFileError(error) {
876
+ export function isGetFolderError(error) {
876
877
  try {
877
- const ret = wasm.isEncryptFileError(addBorrowedObject(error));
878
+ const ret = wasm.isGetFolderError(addBorrowedObject(error));
878
879
  return ret !== 0;
879
880
  } finally {
880
881
  heap[stack_pointer++] = undefined;
881
882
  }
882
883
  }
883
884
 
884
- function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
885
- wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
886
- }
887
-
888
- function wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(arg0, arg1, arg2) {
889
- wasm.wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(
885
+ function wasm_bindgen__convert__closures_____invoke__h05da89f3ce503b8f(arg0, arg1, arg2) {
886
+ wasm.wasm_bindgen__convert__closures_____invoke__h05da89f3ce503b8f(
890
887
  arg0,
891
888
  arg1,
892
889
  addHeapObject(arg2),
893
890
  );
894
891
  }
895
892
 
896
- function wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf(arg0, arg1, arg2) {
893
+ function wasm_bindgen__convert__closures_____invoke__h389a5517bdf6e196(arg0, arg1, arg2) {
897
894
  try {
898
895
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
899
- wasm.wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf(
896
+ wasm.wasm_bindgen__convert__closures_____invoke__h389a5517bdf6e196(
900
897
  retptr,
901
898
  arg0,
902
899
  arg1,
@@ -912,8 +909,12 @@ function wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf(arg0, arg
912
909
  }
913
910
  }
914
911
 
915
- function wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(arg0, arg1, arg2, arg3) {
916
- wasm.wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(
912
+ function wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2(arg0, arg1) {
913
+ wasm.wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2(arg0, arg1);
914
+ }
915
+
916
+ function wasm_bindgen__convert__closures_____invoke__h0cb536241502fe83(arg0, arg1, arg2, arg3) {
917
+ wasm.wasm_bindgen__convert__closures_____invoke__h0cb536241502fe83(
917
918
  arg0,
918
919
  arg1,
919
920
  addHeapObject(arg2),
@@ -1185,14 +1186,6 @@ export class AuthClient {
1185
1186
  const ptr = this.__destroy_into_raw();
1186
1187
  wasm.__wbg_authclient_free(ptr, 0);
1187
1188
  }
1188
- /**
1189
- * Client for identity functionality
1190
- * @returns {IdentityClient}
1191
- */
1192
- identity() {
1193
- const ret = wasm.authclient_identity(this.__wbg_ptr);
1194
- return IdentityClient.__wrap(ret);
1195
- }
1196
1189
  /**
1197
1190
  * Client for send access functionality
1198
1191
  * @returns {SendAccessClient}
@@ -1209,6 +1202,14 @@ export class AuthClient {
1209
1202
  const ret = wasm.authclient_identity(this.__wbg_ptr);
1210
1203
  return RegistrationClient.__wrap(ret);
1211
1204
  }
1205
+ /**
1206
+ * Client for identity functionality
1207
+ * @returns {IdentityClient}
1208
+ */
1209
+ identity() {
1210
+ const ret = wasm.authclient_identity(this.__wbg_ptr);
1211
+ return IdentityClient.__wrap(ret);
1212
+ }
1212
1213
  }
1213
1214
  if (Symbol.dispose) AuthClient.prototype[Symbol.dispose] = AuthClient.prototype.free;
1214
1215
 
@@ -1239,21 +1240,6 @@ export class CipherRiskClient {
1239
1240
  const ptr = this.__destroy_into_raw();
1240
1241
  wasm.__wbg_cipherriskclient_free(ptr, 0);
1241
1242
  }
1242
- /**
1243
- * Build password reuse map for a list of login ciphers.
1244
- *
1245
- * Returns a map where keys are passwords and values are the number of times
1246
- * each password appears in the provided list. This map can be passed to `compute_risk()`
1247
- * to enable password reuse detection.
1248
- * @param {CipherLoginDetails[]} login_details
1249
- * @returns {PasswordReuseMap}
1250
- */
1251
- password_reuse_map(login_details) {
1252
- const ptr0 = passArrayJsValueToWasm0(login_details, wasm.__wbindgen_malloc);
1253
- const len0 = WASM_VECTOR_LEN;
1254
- const ret = wasm.cipherriskclient_password_reuse_map(this.__wbg_ptr, ptr0, len0);
1255
- return takeObject(ret);
1256
- }
1257
1243
  /**
1258
1244
  * Evaluate security risks for multiple login ciphers concurrently.
1259
1245
  *
@@ -1292,6 +1278,21 @@ export class CipherRiskClient {
1292
1278
  );
1293
1279
  return takeObject(ret);
1294
1280
  }
1281
+ /**
1282
+ * Build password reuse map for a list of login ciphers.
1283
+ *
1284
+ * Returns a map where keys are passwords and values are the number of times
1285
+ * each password appears in the provided list. This map can be passed to `compute_risk()`
1286
+ * to enable password reuse detection.
1287
+ * @param {CipherLoginDetails[]} login_details
1288
+ * @returns {PasswordReuseMap}
1289
+ */
1290
+ password_reuse_map(login_details) {
1291
+ const ptr0 = passArrayJsValueToWasm0(login_details, wasm.__wbindgen_malloc);
1292
+ const len0 = WASM_VECTOR_LEN;
1293
+ const ret = wasm.cipherriskclient_password_reuse_map(this.__wbg_ptr, ptr0, len0);
1294
+ return takeObject(ret);
1295
+ }
1295
1296
  }
1296
1297
  if (Symbol.dispose) CipherRiskClient.prototype[Symbol.dispose] = CipherRiskClient.prototype.free;
1297
1298
 
@@ -1321,30 +1322,12 @@ export class CiphersClient {
1321
1322
  wasm.__wbg_ciphersclient_free(ptr, 0);
1322
1323
  }
1323
1324
  /**
1324
- * Create a new [Cipher] and save it to the server.
1325
- * @param {CipherCreateRequest} request
1326
- * @returns {Promise<CipherView>}
1327
- */
1328
- create(request) {
1329
- const ret = wasm.ciphersclient_create(this.__wbg_ptr, addHeapObject(request));
1330
- return takeObject(ret);
1331
- }
1332
- /**
1333
- * Edit an existing [Cipher] and save it to the server.
1334
- * @param {CipherEditRequest} request
1335
- * @returns {Promise<CipherView>}
1336
- */
1337
- edit(request) {
1338
- const ret = wasm.ciphersclient_edit(this.__wbg_ptr, addHeapObject(request));
1339
- return takeObject(ret);
1340
- }
1341
- /**
1342
- * Moves a cipher into an organization, adds it to collections, and calls the share_cipher API.
1343
- * @param {CipherView} cipher_view
1344
- * @param {OrganizationId} organization_id
1345
- * @param {CollectionId[]} collection_ids
1346
- * @param {Cipher | null} [original_cipher]
1347
- * @returns {Promise<Cipher>}
1325
+ * Moves a cipher into an organization, adds it to collections, and calls the share_cipher API.
1326
+ * @param {CipherView} cipher_view
1327
+ * @param {OrganizationId} organization_id
1328
+ * @param {CollectionId[]} collection_ids
1329
+ * @param {Cipher | null} [original_cipher]
1330
+ * @returns {Promise<Cipher>}
1348
1331
  */
1349
1332
  share_cipher(cipher_view, organization_id, collection_ids, original_cipher) {
1350
1333
  const ptr0 = passArrayJsValueToWasm0(collection_ids, wasm.__wbindgen_malloc);
@@ -1383,47 +1366,42 @@ export class CiphersClient {
1383
1366
  return takeObject(ret);
1384
1367
  }
1385
1368
  /**
1386
- * @param {CipherView} cipher_view
1387
- * @returns {EncryptionContext}
1369
+ * @param {Cipher[]} ciphers
1370
+ * @returns {CipherListView[]}
1388
1371
  */
1389
- encrypt(cipher_view) {
1372
+ decrypt_list(ciphers) {
1390
1373
  try {
1391
1374
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1392
- wasm.ciphersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
1375
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1376
+ const len0 = WASM_VECTOR_LEN;
1377
+ wasm.ciphersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1393
1378
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1394
1379
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1395
1380
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1396
- if (r2) {
1397
- throw takeObject(r1);
1381
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1382
+ if (r3) {
1383
+ throw takeObject(r2);
1398
1384
  }
1399
- return takeObject(r0);
1385
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1386
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1387
+ return v2;
1400
1388
  } finally {
1401
1389
  wasm.__wbindgen_add_to_stack_pointer(16);
1402
1390
  }
1403
1391
  }
1404
1392
  /**
1405
- * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1406
- * keys in the Web client.
1407
- *
1408
- * Until key rotation is fully implemented in the SDK, this method must be provided the new
1409
- * symmetric key in base64 format. See PM-23084
1410
- *
1411
- * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1412
- * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1413
- * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1414
- * key directly.
1415
1393
  * @param {CipherView} cipher_view
1416
- * @param {B64} new_key
1417
- * @returns {EncryptionContext}
1394
+ * @param {OrganizationId} organization_id
1395
+ * @returns {CipherView}
1418
1396
  */
1419
- encrypt_cipher_for_rotation(cipher_view, new_key) {
1397
+ move_to_organization(cipher_view, organization_id) {
1420
1398
  try {
1421
1399
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1422
- wasm.ciphersclient_encrypt_cipher_for_rotation(
1400
+ wasm.ciphersclient_move_to_organization(
1423
1401
  retptr,
1424
1402
  this.__wbg_ptr,
1425
1403
  addHeapObject(cipher_view),
1426
- addHeapObject(new_key),
1404
+ addHeapObject(organization_id),
1427
1405
  );
1428
1406
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1429
1407
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
@@ -1437,13 +1415,27 @@ export class CiphersClient {
1437
1415
  }
1438
1416
  }
1439
1417
  /**
1440
- * @param {Cipher} cipher
1418
+ * Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
1419
+ * Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
1420
+ * TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
1421
+ * encrypting the rest of the CipherView.
1422
+ * TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
1423
+ * @param {CipherView} cipher_view
1424
+ * @param {Fido2CredentialFullView[]} fido2_credentials
1441
1425
  * @returns {CipherView}
1442
1426
  */
1443
- decrypt(cipher) {
1427
+ set_fido2_credentials(cipher_view, fido2_credentials) {
1444
1428
  try {
1445
1429
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1446
- wasm.ciphersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
1430
+ const ptr0 = passArrayJsValueToWasm0(fido2_credentials, wasm.__wbindgen_malloc);
1431
+ const len0 = WASM_VECTOR_LEN;
1432
+ wasm.ciphersclient_set_fido2_credentials(
1433
+ retptr,
1434
+ this.__wbg_ptr,
1435
+ addHeapObject(cipher_view),
1436
+ ptr0,
1437
+ len0,
1438
+ );
1447
1439
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1448
1440
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1449
1441
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1456,15 +1448,17 @@ export class CiphersClient {
1456
1448
  }
1457
1449
  }
1458
1450
  /**
1459
- * @param {Cipher[]} ciphers
1460
- * @returns {CipherListView[]}
1451
+ * @param {CipherView} cipher_view
1452
+ * @returns {Fido2CredentialView[]}
1461
1453
  */
1462
- decrypt_list(ciphers) {
1454
+ decrypt_fido2_credentials(cipher_view) {
1463
1455
  try {
1464
1456
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1465
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1466
- const len0 = WASM_VECTOR_LEN;
1467
- wasm.ciphersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1457
+ wasm.ciphersclient_decrypt_fido2_credentials(
1458
+ retptr,
1459
+ this.__wbg_ptr,
1460
+ addHeapObject(cipher_view),
1461
+ );
1468
1462
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1469
1463
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1470
1464
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1472,33 +1466,23 @@ export class CiphersClient {
1472
1466
  if (r3) {
1473
1467
  throw takeObject(r2);
1474
1468
  }
1475
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1469
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1476
1470
  wasm.__wbindgen_free(r0, r1 * 4, 4);
1477
- return v2;
1471
+ return v1;
1478
1472
  } finally {
1479
1473
  wasm.__wbindgen_add_to_stack_pointer(16);
1480
1474
  }
1481
1475
  }
1482
- /**
1483
- * Decrypt cipher list with failures
1484
- * Returns both successfully decrypted ciphers and any that failed to decrypt
1485
- * @param {Cipher[]} ciphers
1486
- * @returns {DecryptCipherListResult}
1487
- */
1488
- decrypt_list_with_failures(ciphers) {
1489
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1490
- const len0 = WASM_VECTOR_LEN;
1491
- const ret = wasm.ciphersclient_decrypt_list_with_failures(this.__wbg_ptr, ptr0, len0);
1492
- return takeObject(ret);
1493
- }
1494
1476
  /**
1495
1477
  * @param {CipherView} cipher_view
1496
- * @returns {Fido2CredentialView[]}
1478
+ * @returns {string}
1497
1479
  */
1498
- decrypt_fido2_credentials(cipher_view) {
1480
+ decrypt_fido2_private_key(cipher_view) {
1481
+ let deferred2_0;
1482
+ let deferred2_1;
1499
1483
  try {
1500
1484
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1501
- wasm.ciphersclient_decrypt_fido2_credentials(
1485
+ wasm.ciphersclient_decrypt_fido2_private_key(
1502
1486
  retptr,
1503
1487
  this.__wbg_ptr,
1504
1488
  addHeapObject(cipher_view),
@@ -1507,37 +1491,56 @@ export class CiphersClient {
1507
1491
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1508
1492
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1509
1493
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1494
+ var ptr1 = r0;
1495
+ var len1 = r1;
1510
1496
  if (r3) {
1497
+ ptr1 = 0;
1498
+ len1 = 0;
1511
1499
  throw takeObject(r2);
1512
1500
  }
1513
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1514
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1515
- return v1;
1501
+ deferred2_0 = ptr1;
1502
+ deferred2_1 = len1;
1503
+ return getStringFromWasm0(ptr1, len1);
1516
1504
  } finally {
1517
1505
  wasm.__wbindgen_add_to_stack_pointer(16);
1506
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1518
1507
  }
1519
1508
  }
1520
1509
  /**
1521
- * Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
1522
- * Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
1523
- * TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
1524
- * encrypting the rest of the CipherView.
1525
- * TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
1510
+ * Decrypt cipher list with failures
1511
+ * Returns both successfully decrypted ciphers and any that failed to decrypt
1512
+ * @param {Cipher[]} ciphers
1513
+ * @returns {DecryptCipherListResult}
1514
+ */
1515
+ decrypt_list_with_failures(ciphers) {
1516
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1517
+ const len0 = WASM_VECTOR_LEN;
1518
+ const ret = wasm.ciphersclient_decrypt_list_with_failures(this.__wbg_ptr, ptr0, len0);
1519
+ return takeObject(ret);
1520
+ }
1521
+ /**
1522
+ * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1523
+ * keys in the Web client.
1524
+ *
1525
+ * Until key rotation is fully implemented in the SDK, this method must be provided the new
1526
+ * symmetric key in base64 format. See PM-23084
1527
+ *
1528
+ * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1529
+ * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1530
+ * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1531
+ * key directly.
1526
1532
  * @param {CipherView} cipher_view
1527
- * @param {Fido2CredentialFullView[]} fido2_credentials
1528
- * @returns {CipherView}
1533
+ * @param {B64} new_key
1534
+ * @returns {EncryptionContext}
1529
1535
  */
1530
- set_fido2_credentials(cipher_view, fido2_credentials) {
1536
+ encrypt_cipher_for_rotation(cipher_view, new_key) {
1531
1537
  try {
1532
1538
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1533
- const ptr0 = passArrayJsValueToWasm0(fido2_credentials, wasm.__wbindgen_malloc);
1534
- const len0 = WASM_VECTOR_LEN;
1535
- wasm.ciphersclient_set_fido2_credentials(
1539
+ wasm.ciphersclient_encrypt_cipher_for_rotation(
1536
1540
  retptr,
1537
1541
  this.__wbg_ptr,
1538
1542
  addHeapObject(cipher_view),
1539
- ptr0,
1540
- len0,
1543
+ addHeapObject(new_key),
1541
1544
  );
1542
1545
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1543
1546
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
@@ -1551,19 +1554,13 @@ export class CiphersClient {
1551
1554
  }
1552
1555
  }
1553
1556
  /**
1554
- * @param {CipherView} cipher_view
1555
- * @param {OrganizationId} organization_id
1557
+ * @param {Cipher} cipher
1556
1558
  * @returns {CipherView}
1557
1559
  */
1558
- move_to_organization(cipher_view, organization_id) {
1560
+ decrypt(cipher) {
1559
1561
  try {
1560
1562
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1561
- wasm.ciphersclient_move_to_organization(
1562
- retptr,
1563
- this.__wbg_ptr,
1564
- addHeapObject(cipher_view),
1565
- addHeapObject(organization_id),
1566
- );
1563
+ wasm.ciphersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
1567
1564
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1568
1565
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1569
1566
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1577,37 +1574,41 @@ export class CiphersClient {
1577
1574
  }
1578
1575
  /**
1579
1576
  * @param {CipherView} cipher_view
1580
- * @returns {string}
1577
+ * @returns {EncryptionContext}
1581
1578
  */
1582
- decrypt_fido2_private_key(cipher_view) {
1583
- let deferred2_0;
1584
- let deferred2_1;
1579
+ encrypt(cipher_view) {
1585
1580
  try {
1586
1581
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1587
- wasm.ciphersclient_decrypt_fido2_private_key(
1588
- retptr,
1589
- this.__wbg_ptr,
1590
- addHeapObject(cipher_view),
1591
- );
1582
+ wasm.ciphersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
1592
1583
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1593
1584
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1594
1585
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1595
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1596
- var ptr1 = r0;
1597
- var len1 = r1;
1598
- if (r3) {
1599
- ptr1 = 0;
1600
- len1 = 0;
1601
- throw takeObject(r2);
1586
+ if (r2) {
1587
+ throw takeObject(r1);
1602
1588
  }
1603
- deferred2_0 = ptr1;
1604
- deferred2_1 = len1;
1605
- return getStringFromWasm0(ptr1, len1);
1589
+ return takeObject(r0);
1606
1590
  } finally {
1607
1591
  wasm.__wbindgen_add_to_stack_pointer(16);
1608
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1609
1592
  }
1610
1593
  }
1594
+ /**
1595
+ * Edit an existing [Cipher] and save it to the server.
1596
+ * @param {CipherEditRequest} request
1597
+ * @returns {Promise<CipherView>}
1598
+ */
1599
+ edit(request) {
1600
+ const ret = wasm.ciphersclient_edit(this.__wbg_ptr, addHeapObject(request));
1601
+ return takeObject(ret);
1602
+ }
1603
+ /**
1604
+ * Create a new [Cipher] and save it to the server.
1605
+ * @param {CipherCreateRequest} request
1606
+ * @returns {Promise<CipherView>}
1607
+ */
1608
+ create(request) {
1609
+ const ret = wasm.ciphersclient_create(this.__wbg_ptr, addHeapObject(request));
1610
+ return takeObject(ret);
1611
+ }
1611
1612
  }
1612
1613
  if (Symbol.dispose) CiphersClient.prototype[Symbol.dispose] = CiphersClient.prototype.free;
1613
1614
 
@@ -1636,13 +1637,6 @@ export class CollectionViewNodeItem {
1636
1637
  const ptr = this.__destroy_into_raw();
1637
1638
  wasm.__wbg_collectionviewnodeitem_free(ptr, 0);
1638
1639
  }
1639
- /**
1640
- * @returns {CollectionView}
1641
- */
1642
- get_item() {
1643
- const ret = wasm.collectionviewnodeitem_get_item(this.__wbg_ptr);
1644
- return takeObject(ret);
1645
- }
1646
1640
  /**
1647
1641
  * @returns {CollectionView | undefined}
1648
1642
  */
@@ -1673,6 +1667,13 @@ export class CollectionViewNodeItem {
1673
1667
  const ret = wasm.collectionviewnodeitem_get_ancestors(this.__wbg_ptr);
1674
1668
  return takeObject(ret);
1675
1669
  }
1670
+ /**
1671
+ * @returns {CollectionView}
1672
+ */
1673
+ get_item() {
1674
+ const ret = wasm.collectionviewnodeitem_get_item(this.__wbg_ptr);
1675
+ return takeObject(ret);
1676
+ }
1676
1677
  }
1677
1678
  if (Symbol.dispose)
1678
1679
  CollectionViewNodeItem.prototype[Symbol.dispose] = CollectionViewNodeItem.prototype.free;
@@ -1702,24 +1703,13 @@ export 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 @@ export 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 @@ export 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
  const CollectionsClientFinalization =
@@ -1774,25 +1775,6 @@ export class CollectionsClient {
1774
1775
  const ptr = this.__destroy_into_raw();
1775
1776
  wasm.__wbg_collectionsclient_free(ptr, 0);
1776
1777
  }
1777
- /**
1778
- * @param {Collection} collection
1779
- * @returns {CollectionView}
1780
- */
1781
- decrypt(collection) {
1782
- try {
1783
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1784
- wasm.collectionsclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(collection));
1785
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1786
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1787
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1788
- if (r2) {
1789
- throw takeObject(r1);
1790
- }
1791
- return takeObject(r0);
1792
- } finally {
1793
- wasm.__wbindgen_add_to_stack_pointer(16);
1794
- }
1795
- }
1796
1778
  /**
1797
1779
  * @param {Collection[]} collections
1798
1780
  * @returns {CollectionView[]}
@@ -1830,6 +1812,25 @@ export class CollectionsClient {
1830
1812
  const ret = wasm.collectionsclient_get_collection_tree(this.__wbg_ptr, ptr0, len0);
1831
1813
  return CollectionViewTree.__wrap(ret);
1832
1814
  }
1815
+ /**
1816
+ * @param {Collection} collection
1817
+ * @returns {CollectionView}
1818
+ */
1819
+ decrypt(collection) {
1820
+ try {
1821
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1822
+ wasm.collectionsclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(collection));
1823
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1824
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1825
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1826
+ if (r2) {
1827
+ throw takeObject(r1);
1828
+ }
1829
+ return takeObject(r0);
1830
+ } finally {
1831
+ wasm.__wbindgen_add_to_stack_pointer(16);
1832
+ }
1833
+ }
1833
1834
  }
1834
1835
  if (Symbol.dispose) CollectionsClient.prototype[Symbol.dispose] = CollectionsClient.prototype.free;
1835
1836
 
@@ -1861,35 +1862,18 @@ export class CryptoClient {
1861
1862
  wasm.__wbg_cryptoclient_free(ptr, 0);
1862
1863
  }
1863
1864
  /**
1864
- * Initialization method for the user crypto. Needs to be called before any other crypto
1865
- * operations.
1866
- * @param {InitUserCryptoRequest} req
1867
- * @returns {Promise<void>}
1868
- */
1869
- initialize_user_crypto(req) {
1870
- const ret = wasm.cryptoclient_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
1871
- return takeObject(ret);
1872
- }
1873
- /**
1874
- * Initialization method for the organization crypto. Needs to be called after
1875
- * `initialize_user_crypto` but before any other crypto operations.
1876
- * @param {InitOrgCryptoRequest} req
1877
- * @returns {Promise<void>}
1878
- */
1879
- initialize_org_crypto(req) {
1880
- const ret = wasm.cryptoclient_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
1881
- return takeObject(ret);
1882
- }
1883
- /**
1884
- * Generates a new key pair and encrypts the private key with the provided user key.
1885
- * Crypto initialization not required.
1886
- * @param {B64} user_key
1887
- * @returns {MakeKeyPairResponse}
1865
+ * Protects the current user key with the provided PIN. The result can be stored and later
1866
+ * used to initialize another client instance by using the PIN and the PIN key with
1867
+ * `initialize_user_crypto`.
1868
+ * @param {string} pin
1869
+ * @returns {EnrollPinResponse}
1888
1870
  */
1889
- make_key_pair(user_key) {
1871
+ enroll_pin(pin) {
1890
1872
  try {
1891
1873
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1892
- wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, addHeapObject(user_key));
1874
+ const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1875
+ const len0 = WASM_VECTOR_LEN;
1876
+ wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
1893
1877
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1894
1878
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1895
1879
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1902,16 +1886,15 @@ export class CryptoClient {
1902
1886
  }
1903
1887
  }
1904
1888
  /**
1905
- * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1906
- * key. Returns if the private key is decryptable and if it is a valid matching key.
1889
+ * Generates a new key pair and encrypts the private key with the provided user key.
1907
1890
  * Crypto initialization not required.
1908
- * @param {VerifyAsymmetricKeysRequest} request
1909
- * @returns {VerifyAsymmetricKeysResponse}
1891
+ * @param {B64} user_key
1892
+ * @returns {MakeKeyPairResponse}
1910
1893
  */
1911
- verify_asymmetric_keys(request) {
1894
+ make_key_pair(user_key) {
1912
1895
  try {
1913
1896
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1914
- wasm.cryptoclient_verify_asymmetric_keys(retptr, this.__wbg_ptr, addHeapObject(request));
1897
+ wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, addHeapObject(user_key));
1915
1898
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1916
1899
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1917
1900
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1924,13 +1907,19 @@ export class CryptoClient {
1924
1907
  }
1925
1908
  }
1926
1909
  /**
1927
- * Makes a new signing key pair and signs the public key for the user
1928
- * @returns {UserCryptoV2KeysResponse}
1910
+ * Create the data necessary to update the user's kdf settings. The user's encryption key is
1911
+ * re-encrypted for the password under the new kdf settings. This returns the re-encrypted
1912
+ * user key and the new password hash but does not update sdk state.
1913
+ * @param {string} password
1914
+ * @param {Kdf} kdf
1915
+ * @returns {UpdateKdfResponse}
1929
1916
  */
1930
- make_keys_for_user_crypto_v2() {
1917
+ make_update_kdf(password, kdf) {
1931
1918
  try {
1932
1919
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1933
- wasm.cryptoclient_make_keys_for_user_crypto_v2(retptr, this.__wbg_ptr);
1920
+ const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1921
+ const len0 = WASM_VECTOR_LEN;
1922
+ wasm.cryptoclient_make_update_kdf(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(kdf));
1934
1923
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1935
1924
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1936
1925
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1943,13 +1932,36 @@ export class CryptoClient {
1943
1932
  }
1944
1933
  }
1945
1934
  /**
1946
- * Creates a rotated set of account keys for the current state
1947
- * @returns {UserCryptoV2KeysResponse}
1935
+ * Initialization method for the organization crypto. Needs to be called after
1936
+ * `initialize_user_crypto` but before any other crypto operations.
1937
+ * @param {InitOrgCryptoRequest} req
1938
+ * @returns {Promise<void>}
1948
1939
  */
1949
- get_v2_rotated_account_keys() {
1940
+ initialize_org_crypto(req) {
1941
+ const ret = wasm.cryptoclient_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
1942
+ return takeObject(ret);
1943
+ }
1944
+ /**
1945
+ * Initialization method for the user crypto. Needs to be called before any other crypto
1946
+ * operations.
1947
+ * @param {InitUserCryptoRequest} req
1948
+ * @returns {Promise<void>}
1949
+ */
1950
+ initialize_user_crypto(req) {
1951
+ const ret = wasm.cryptoclient_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
1952
+ return takeObject(ret);
1953
+ }
1954
+ /**
1955
+ * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1956
+ * key. Returns if the private key is decryptable and if it is a valid matching key.
1957
+ * Crypto initialization not required.
1958
+ * @param {VerifyAsymmetricKeysRequest} request
1959
+ * @returns {VerifyAsymmetricKeysResponse}
1960
+ */
1961
+ verify_asymmetric_keys(request) {
1950
1962
  try {
1951
1963
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1952
- wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr);
1964
+ wasm.cryptoclient_verify_asymmetric_keys(retptr, this.__wbg_ptr, addHeapObject(request));
1953
1965
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1954
1966
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1955
1967
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1962,19 +1974,13 @@ export class CryptoClient {
1962
1974
  }
1963
1975
  }
1964
1976
  /**
1965
- * Create the data necessary to update the user's kdf settings. The user's encryption key is
1966
- * re-encrypted for the password under the new kdf settings. This returns the re-encrypted
1967
- * user key and the new password hash but does not update sdk state.
1968
- * @param {string} password
1969
- * @param {Kdf} kdf
1970
- * @returns {UpdateKdfResponse}
1977
+ * Creates a rotated set of account keys for the current state
1978
+ * @returns {UserCryptoV2KeysResponse}
1971
1979
  */
1972
- make_update_kdf(password, kdf) {
1980
+ get_v2_rotated_account_keys() {
1973
1981
  try {
1974
1982
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1975
- const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1976
- const len0 = WASM_VECTOR_LEN;
1977
- wasm.cryptoclient_make_update_kdf(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(kdf));
1983
+ wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr);
1978
1984
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1979
1985
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1980
1986
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1987,18 +1993,13 @@ export class CryptoClient {
1987
1993
  }
1988
1994
  }
1989
1995
  /**
1990
- * Protects the current user key with the provided PIN. The result can be stored and later
1991
- * used to initialize another client instance by using the PIN and the PIN key with
1992
- * `initialize_user_crypto`.
1993
- * @param {string} pin
1994
- * @returns {EnrollPinResponse}
1996
+ * Makes a new signing key pair and signs the public key for the user
1997
+ * @returns {UserCryptoV2KeysResponse}
1995
1998
  */
1996
- enroll_pin(pin) {
1999
+ make_keys_for_user_crypto_v2() {
1997
2000
  try {
1998
2001
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1999
- const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2000
- const len0 = WASM_VECTOR_LEN;
2001
- wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
2002
+ wasm.cryptoclient_make_keys_for_user_crypto_v2(retptr, this.__wbg_ptr);
2002
2003
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2003
2004
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2004
2005
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2102,6 +2103,74 @@ export class ExporterClient {
2102
2103
  const ptr = this.__destroy_into_raw();
2103
2104
  wasm.__wbg_exporterclient_free(ptr, 0);
2104
2105
  }
2106
+ /**
2107
+ * Credential Exchange Format (CXF)
2108
+ *
2109
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2110
+ *
2111
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2112
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2113
+ * @param {Account} account
2114
+ * @param {Cipher[]} ciphers
2115
+ * @returns {string}
2116
+ */
2117
+ export_cxf(account, ciphers) {
2118
+ let deferred3_0;
2119
+ let deferred3_1;
2120
+ try {
2121
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2122
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2123
+ const len0 = WASM_VECTOR_LEN;
2124
+ wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), ptr0, len0);
2125
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2126
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2127
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2128
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2129
+ var ptr2 = r0;
2130
+ var len2 = r1;
2131
+ if (r3) {
2132
+ ptr2 = 0;
2133
+ len2 = 0;
2134
+ throw takeObject(r2);
2135
+ }
2136
+ deferred3_0 = ptr2;
2137
+ deferred3_1 = len2;
2138
+ return getStringFromWasm0(ptr2, len2);
2139
+ } finally {
2140
+ wasm.__wbindgen_add_to_stack_pointer(16);
2141
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2142
+ }
2143
+ }
2144
+ /**
2145
+ * Credential Exchange Format (CXF)
2146
+ *
2147
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2148
+ *
2149
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2150
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2151
+ * @param {string} payload
2152
+ * @returns {Cipher[]}
2153
+ */
2154
+ import_cxf(payload) {
2155
+ try {
2156
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2157
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2158
+ const len0 = WASM_VECTOR_LEN;
2159
+ wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
2160
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2161
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2162
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2163
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2164
+ if (r3) {
2165
+ throw takeObject(r2);
2166
+ }
2167
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2168
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
2169
+ return v2;
2170
+ } finally {
2171
+ wasm.__wbindgen_add_to_stack_pointer(16);
2172
+ }
2173
+ }
2105
2174
  /**
2106
2175
  * @param {Folder[]} folders
2107
2176
  * @param {Cipher[]} ciphers
@@ -2188,74 +2257,6 @@ export class ExporterClient {
2188
2257
  wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2189
2258
  }
2190
2259
  }
2191
- /**
2192
- * Credential Exchange Format (CXF)
2193
- *
2194
- * *Warning:* Expect this API to be unstable, and it will change in the future.
2195
- *
2196
- * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2197
- * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2198
- * @param {Account} account
2199
- * @param {Cipher[]} ciphers
2200
- * @returns {string}
2201
- */
2202
- export_cxf(account, ciphers) {
2203
- let deferred3_0;
2204
- let deferred3_1;
2205
- try {
2206
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2207
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2208
- const len0 = WASM_VECTOR_LEN;
2209
- wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), ptr0, len0);
2210
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2211
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2212
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2213
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2214
- var ptr2 = r0;
2215
- var len2 = r1;
2216
- if (r3) {
2217
- ptr2 = 0;
2218
- len2 = 0;
2219
- throw takeObject(r2);
2220
- }
2221
- deferred3_0 = ptr2;
2222
- deferred3_1 = len2;
2223
- return getStringFromWasm0(ptr2, len2);
2224
- } finally {
2225
- wasm.__wbindgen_add_to_stack_pointer(16);
2226
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2227
- }
2228
- }
2229
- /**
2230
- * Credential Exchange Format (CXF)
2231
- *
2232
- * *Warning:* Expect this API to be unstable, and it will change in the future.
2233
- *
2234
- * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2235
- * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2236
- * @param {string} payload
2237
- * @returns {Cipher[]}
2238
- */
2239
- import_cxf(payload) {
2240
- try {
2241
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2242
- const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2243
- const len0 = WASM_VECTOR_LEN;
2244
- wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
2245
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2246
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2247
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2248
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2249
- if (r3) {
2250
- throw takeObject(r2);
2251
- }
2252
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2253
- wasm.__wbindgen_free(r0, r1 * 4, 4);
2254
- return v2;
2255
- } finally {
2256
- wasm.__wbindgen_add_to_stack_pointer(16);
2257
- }
2258
- }
2259
2260
  }
2260
2261
  if (Symbol.dispose) ExporterClient.prototype[Symbol.dispose] = ExporterClient.prototype.free;
2261
2262
 
@@ -2286,46 +2287,6 @@ export class FoldersClient {
2286
2287
  const ptr = this.__destroy_into_raw();
2287
2288
  wasm.__wbg_foldersclient_free(ptr, 0);
2288
2289
  }
2289
- /**
2290
- * Encrypt a [FolderView] to a [Folder].
2291
- * @param {FolderView} folder_view
2292
- * @returns {Folder}
2293
- */
2294
- encrypt(folder_view) {
2295
- try {
2296
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2297
- wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
2298
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2299
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2300
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2301
- if (r2) {
2302
- throw takeObject(r1);
2303
- }
2304
- return takeObject(r0);
2305
- } finally {
2306
- wasm.__wbindgen_add_to_stack_pointer(16);
2307
- }
2308
- }
2309
- /**
2310
- * Encrypt a [Folder] to [FolderView].
2311
- * @param {Folder} folder
2312
- * @returns {FolderView}
2313
- */
2314
- decrypt(folder) {
2315
- try {
2316
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2317
- wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
2318
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2319
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2320
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2321
- if (r2) {
2322
- throw takeObject(r1);
2323
- }
2324
- return takeObject(r0);
2325
- } finally {
2326
- wasm.__wbindgen_add_to_stack_pointer(16);
2327
- }
2328
- }
2329
2290
  /**
2330
2291
  * Decrypt a list of [Folder]s to a list of [FolderView]s.
2331
2292
  * @param {Folder[]} folders
@@ -2351,14 +2312,6 @@ export class FoldersClient {
2351
2312
  wasm.__wbindgen_add_to_stack_pointer(16);
2352
2313
  }
2353
2314
  }
2354
- /**
2355
- * Get all folders from state and decrypt them to a list of [FolderView].
2356
- * @returns {Promise<FolderView[]>}
2357
- */
2358
- list() {
2359
- const ret = wasm.foldersclient_list(this.__wbg_ptr);
2360
- return takeObject(ret);
2361
- }
2362
2315
  /**
2363
2316
  * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
2364
2317
  * @param {FolderId} folder_id
@@ -2368,15 +2321,6 @@ export class FoldersClient {
2368
2321
  const ret = wasm.foldersclient_get(this.__wbg_ptr, addHeapObject(folder_id));
2369
2322
  return takeObject(ret);
2370
2323
  }
2371
- /**
2372
- * Create a new [Folder] and save it to the server.
2373
- * @param {FolderAddEditRequest} request
2374
- * @returns {Promise<FolderView>}
2375
- */
2376
- create(request) {
2377
- const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
2378
- return takeObject(ret);
2379
- }
2380
2324
  /**
2381
2325
  * Edit the [Folder] and save it to the server.
2382
2326
  * @param {FolderId} folder_id
@@ -2391,6 +2335,63 @@ export class FoldersClient {
2391
2335
  );
2392
2336
  return takeObject(ret);
2393
2337
  }
2338
+ /**
2339
+ * Get all folders from state and decrypt them to a list of [FolderView].
2340
+ * @returns {Promise<FolderView[]>}
2341
+ */
2342
+ list() {
2343
+ const ret = wasm.foldersclient_list(this.__wbg_ptr);
2344
+ return takeObject(ret);
2345
+ }
2346
+ /**
2347
+ * Create a new [Folder] and save it to the server.
2348
+ * @param {FolderAddEditRequest} request
2349
+ * @returns {Promise<FolderView>}
2350
+ */
2351
+ create(request) {
2352
+ const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
2353
+ return takeObject(ret);
2354
+ }
2355
+ /**
2356
+ * Encrypt a [Folder] to [FolderView].
2357
+ * @param {Folder} folder
2358
+ * @returns {FolderView}
2359
+ */
2360
+ decrypt(folder) {
2361
+ try {
2362
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2363
+ wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
2364
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2365
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2366
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2367
+ if (r2) {
2368
+ throw takeObject(r1);
2369
+ }
2370
+ return takeObject(r0);
2371
+ } finally {
2372
+ wasm.__wbindgen_add_to_stack_pointer(16);
2373
+ }
2374
+ }
2375
+ /**
2376
+ * Encrypt a [FolderView] to a [Folder].
2377
+ * @param {FolderView} folder_view
2378
+ * @returns {Folder}
2379
+ */
2380
+ encrypt(folder_view) {
2381
+ try {
2382
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2383
+ wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
2384
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2385
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2386
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2387
+ if (r2) {
2388
+ throw takeObject(r1);
2389
+ }
2390
+ return takeObject(r0);
2391
+ } finally {
2392
+ wasm.__wbindgen_add_to_stack_pointer(16);
2393
+ }
2394
+ }
2394
2395
  }
2395
2396
  if (Symbol.dispose) FoldersClient.prototype[Symbol.dispose] = FoldersClient.prototype.free;
2396
2397
 
@@ -2420,38 +2421,38 @@ export class GeneratorClient {
2420
2421
  wasm.__wbg_generatorclient_free(ptr, 0);
2421
2422
  }
2422
2423
  /**
2423
- * Generates a random password.
2424
+ * Generates a random passphrase.
2425
+ * A passphrase is a combination of random words separated by a character.
2426
+ * An example of passphrase is `correct horse battery staple`.
2424
2427
  *
2425
- * The character sets and password length can be customized using the `input` parameter.
2428
+ * The number of words and their case, the word separator, and the inclusion of
2429
+ * a number in the passphrase can be customized using the `input` parameter.
2426
2430
  *
2427
2431
  * # Examples
2428
2432
  *
2429
2433
  * ```
2430
2434
  * use bitwarden_core::Client;
2431
- * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2435
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
2432
2436
  *
2433
2437
  * async fn test() -> Result<(), PassphraseError> {
2434
- * let input = PasswordGeneratorRequest {
2435
- * lowercase: true,
2436
- * uppercase: true,
2437
- * numbers: true,
2438
- * length: 20,
2438
+ * let input = PassphraseGeneratorRequest {
2439
+ * num_words: 4,
2439
2440
  * ..Default::default()
2440
2441
  * };
2441
- * let password = Client::new(None).generator().password(input).unwrap();
2442
- * println!("{}", password);
2442
+ * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
2443
+ * println!("{}", passphrase);
2443
2444
  * Ok(())
2444
2445
  * }
2445
2446
  * ```
2446
- * @param {PasswordGeneratorRequest} input
2447
+ * @param {PassphraseGeneratorRequest} input
2447
2448
  * @returns {string}
2448
2449
  */
2449
- password(input) {
2450
+ passphrase(input) {
2450
2451
  let deferred2_0;
2451
2452
  let deferred2_1;
2452
2453
  try {
2453
2454
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2454
- wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
2455
+ wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
2455
2456
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2456
2457
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2457
2458
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2472,38 +2473,38 @@ export class GeneratorClient {
2472
2473
  }
2473
2474
  }
2474
2475
  /**
2475
- * Generates a random passphrase.
2476
- * A passphrase is a combination of random words separated by a character.
2477
- * An example of passphrase is `correct horse battery staple`.
2476
+ * Generates a random password.
2478
2477
  *
2479
- * The number of words and their case, the word separator, and the inclusion of
2480
- * a number in the passphrase can be customized using the `input` parameter.
2478
+ * The character sets and password length can be customized using the `input` parameter.
2481
2479
  *
2482
2480
  * # Examples
2483
2481
  *
2484
2482
  * ```
2485
2483
  * use bitwarden_core::Client;
2486
- * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
2484
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2487
2485
  *
2488
2486
  * async fn test() -> Result<(), PassphraseError> {
2489
- * let input = PassphraseGeneratorRequest {
2490
- * num_words: 4,
2487
+ * let input = PasswordGeneratorRequest {
2488
+ * lowercase: true,
2489
+ * uppercase: true,
2490
+ * numbers: true,
2491
+ * length: 20,
2491
2492
  * ..Default::default()
2492
2493
  * };
2493
- * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
2494
- * println!("{}", passphrase);
2494
+ * let password = Client::new(None).generator().password(input).unwrap();
2495
+ * println!("{}", password);
2495
2496
  * Ok(())
2496
2497
  * }
2497
2498
  * ```
2498
- * @param {PassphraseGeneratorRequest} input
2499
+ * @param {PasswordGeneratorRequest} input
2499
2500
  * @returns {string}
2500
2501
  */
2501
- passphrase(input) {
2502
+ password(input) {
2502
2503
  let deferred2_0;
2503
2504
  let deferred2_1;
2504
2505
  try {
2505
2506
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2506
- wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
2507
+ wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
2507
2508
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2508
2509
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2509
2510
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2581,6 +2582,39 @@ export class IncomingMessage {
2581
2582
  const ptr = this.__destroy_into_raw();
2582
2583
  wasm.__wbg_incomingmessage_free(ptr, 0);
2583
2584
  }
2585
+ /**
2586
+ * Try to parse the payload as JSON.
2587
+ * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2588
+ */
2589
+ parse_payload_as_json() {
2590
+ const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2591
+ return takeObject(ret);
2592
+ }
2593
+ /**
2594
+ * @param {Uint8Array} payload
2595
+ * @param {Endpoint} destination
2596
+ * @param {Endpoint} source
2597
+ * @param {string | null} [topic]
2598
+ */
2599
+ constructor(payload, destination, source, topic) {
2600
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2601
+ const len0 = WASM_VECTOR_LEN;
2602
+ var ptr1 = isLikeNone(topic)
2603
+ ? 0
2604
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2605
+ var len1 = WASM_VECTOR_LEN;
2606
+ const ret = wasm.incomingmessage_new(
2607
+ ptr0,
2608
+ len0,
2609
+ addHeapObject(destination),
2610
+ addHeapObject(source),
2611
+ ptr1,
2612
+ len1,
2613
+ );
2614
+ this.__wbg_ptr = ret >>> 0;
2615
+ IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
2616
+ return this;
2617
+ }
2584
2618
  /**
2585
2619
  * @returns {Uint8Array}
2586
2620
  */
@@ -2660,39 +2694,6 @@ export class IncomingMessage {
2660
2694
  var len0 = WASM_VECTOR_LEN;
2661
2695
  wasm.__wbg_set_incomingmessage_topic(this.__wbg_ptr, ptr0, len0);
2662
2696
  }
2663
- /**
2664
- * @param {Uint8Array} payload
2665
- * @param {Endpoint} destination
2666
- * @param {Endpoint} source
2667
- * @param {string | null} [topic]
2668
- */
2669
- constructor(payload, destination, source, topic) {
2670
- const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2671
- const len0 = WASM_VECTOR_LEN;
2672
- var ptr1 = isLikeNone(topic)
2673
- ? 0
2674
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2675
- var len1 = WASM_VECTOR_LEN;
2676
- const ret = wasm.incomingmessage_new(
2677
- ptr0,
2678
- len0,
2679
- addHeapObject(destination),
2680
- addHeapObject(source),
2681
- ptr1,
2682
- len1,
2683
- );
2684
- this.__wbg_ptr = ret >>> 0;
2685
- IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
2686
- return this;
2687
- }
2688
- /**
2689
- * Try to parse the payload as JSON.
2690
- * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2691
- */
2692
- parse_payload_as_json() {
2693
- const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2694
- return takeObject(ret);
2695
- }
2696
2697
  }
2697
2698
  if (Symbol.dispose) IncomingMessage.prototype[Symbol.dispose] = IncomingMessage.prototype.free;
2698
2699
 
@@ -2724,6 +2725,13 @@ export class IpcClient {
2724
2725
  const ptr = this.__destroy_into_raw();
2725
2726
  wasm.__wbg_ipcclient_free(ptr, 0);
2726
2727
  }
2728
+ /**
2729
+ * @returns {Promise<boolean>}
2730
+ */
2731
+ isRunning() {
2732
+ const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2733
+ return takeObject(ret);
2734
+ }
2727
2735
  /**
2728
2736
  * Create a new `IpcClient` instance with an in-memory session repository for saving
2729
2737
  * sessions within the SDK.
@@ -2750,20 +2758,6 @@ export class IpcClient {
2750
2758
  );
2751
2759
  return IpcClient.__wrap(ret);
2752
2760
  }
2753
- /**
2754
- * @returns {Promise<void>}
2755
- */
2756
- start() {
2757
- const ret = wasm.ipcclient_start(this.__wbg_ptr);
2758
- return takeObject(ret);
2759
- }
2760
- /**
2761
- * @returns {Promise<boolean>}
2762
- */
2763
- isRunning() {
2764
- const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2765
- return takeObject(ret);
2766
- }
2767
2761
  /**
2768
2762
  * @param {OutgoingMessage} message
2769
2763
  * @returns {Promise<void>}
@@ -2774,6 +2768,13 @@ export class IpcClient {
2774
2768
  const ret = wasm.ipcclient_send(this.__wbg_ptr, ptr0);
2775
2769
  return takeObject(ret);
2776
2770
  }
2771
+ /**
2772
+ * @returns {Promise<void>}
2773
+ */
2774
+ start() {
2775
+ const ret = wasm.ipcclient_start(this.__wbg_ptr);
2776
+ return takeObject(ret);
2777
+ }
2777
2778
  /**
2778
2779
  * @returns {Promise<IpcClientSubscription>}
2779
2780
  */
@@ -2904,6 +2905,55 @@ export class OutgoingMessage {
2904
2905
  const ptr = this.__destroy_into_raw();
2905
2906
  wasm.__wbg_outgoingmessage_free(ptr, 0);
2906
2907
  }
2908
+ /**
2909
+ * Create a new message and encode the payload as JSON.
2910
+ * @param {any} payload
2911
+ * @param {Endpoint} destination
2912
+ * @param {string | null} [topic]
2913
+ * @returns {OutgoingMessage}
2914
+ */
2915
+ static new_json_payload(payload, destination, topic) {
2916
+ try {
2917
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2918
+ var ptr0 = isLikeNone(topic)
2919
+ ? 0
2920
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2921
+ var len0 = WASM_VECTOR_LEN;
2922
+ wasm.outgoingmessage_new_json_payload(
2923
+ retptr,
2924
+ addHeapObject(payload),
2925
+ addHeapObject(destination),
2926
+ ptr0,
2927
+ len0,
2928
+ );
2929
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2930
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2931
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2932
+ if (r2) {
2933
+ throw takeObject(r1);
2934
+ }
2935
+ return OutgoingMessage.__wrap(r0);
2936
+ } finally {
2937
+ wasm.__wbindgen_add_to_stack_pointer(16);
2938
+ }
2939
+ }
2940
+ /**
2941
+ * @param {Uint8Array} payload
2942
+ * @param {Endpoint} destination
2943
+ * @param {string | null} [topic]
2944
+ */
2945
+ constructor(payload, destination, topic) {
2946
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2947
+ const len0 = WASM_VECTOR_LEN;
2948
+ var ptr1 = isLikeNone(topic)
2949
+ ? 0
2950
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2951
+ var len1 = WASM_VECTOR_LEN;
2952
+ const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
2953
+ this.__wbg_ptr = ret >>> 0;
2954
+ OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
2955
+ return this;
2956
+ }
2907
2957
  /**
2908
2958
  * @returns {Uint8Array}
2909
2959
  */
@@ -2970,55 +3020,6 @@ export class OutgoingMessage {
2970
3020
  var len0 = WASM_VECTOR_LEN;
2971
3021
  wasm.__wbg_set_outgoingmessage_topic(this.__wbg_ptr, ptr0, len0);
2972
3022
  }
2973
- /**
2974
- * @param {Uint8Array} payload
2975
- * @param {Endpoint} destination
2976
- * @param {string | null} [topic]
2977
- */
2978
- constructor(payload, destination, topic) {
2979
- const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2980
- const len0 = WASM_VECTOR_LEN;
2981
- var ptr1 = isLikeNone(topic)
2982
- ? 0
2983
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2984
- var len1 = WASM_VECTOR_LEN;
2985
- const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
2986
- this.__wbg_ptr = ret >>> 0;
2987
- OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
2988
- return this;
2989
- }
2990
- /**
2991
- * Create a new message and encode the payload as JSON.
2992
- * @param {any} payload
2993
- * @param {Endpoint} destination
2994
- * @param {string | null} [topic]
2995
- * @returns {OutgoingMessage}
2996
- */
2997
- static new_json_payload(payload, destination, topic) {
2998
- try {
2999
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3000
- var ptr0 = isLikeNone(topic)
3001
- ? 0
3002
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3003
- var len0 = WASM_VECTOR_LEN;
3004
- wasm.outgoingmessage_new_json_payload(
3005
- retptr,
3006
- addHeapObject(payload),
3007
- addHeapObject(destination),
3008
- ptr0,
3009
- len0,
3010
- );
3011
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3012
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3013
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3014
- if (r2) {
3015
- throw takeObject(r1);
3016
- }
3017
- return OutgoingMessage.__wrap(r0);
3018
- } finally {
3019
- wasm.__wbindgen_add_to_stack_pointer(16);
3020
- }
3021
- }
3022
3023
  }
3023
3024
  if (Symbol.dispose) OutgoingMessage.prototype[Symbol.dispose] = OutgoingMessage.prototype.free;
3024
3025
 
@@ -3055,6 +3056,14 @@ export class PasswordManagerClient {
3055
3056
  PasswordManagerClientFinalization.register(this, this.__wbg_ptr, this);
3056
3057
  return this;
3057
3058
  }
3059
+ /**
3060
+ * Auth related operations.
3061
+ * @returns {AuthClient}
3062
+ */
3063
+ auth() {
3064
+ const ret = wasm.passwordmanagerclient_auth(this.__wbg_ptr);
3065
+ return AuthClient.__wrap(ret);
3066
+ }
3058
3067
  /**
3059
3068
  * Test method, echoes back the input
3060
3069
  * @param {string} msg
@@ -3078,26 +3087,6 @@ export class PasswordManagerClient {
3078
3087
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
3079
3088
  }
3080
3089
  }
3081
- /**
3082
- * Returns the current SDK version
3083
- * @returns {string}
3084
- */
3085
- version() {
3086
- let deferred1_0;
3087
- let deferred1_1;
3088
- try {
3089
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3090
- wasm.passwordmanagerclient_version(retptr, this.__wbg_ptr);
3091
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3092
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3093
- deferred1_0 = r0;
3094
- deferred1_1 = r1;
3095
- return getStringFromWasm0(r0, r1);
3096
- } finally {
3097
- wasm.__wbindgen_add_to_stack_pointer(16);
3098
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3099
- }
3100
- }
3101
3090
  /**
3102
3091
  * Test method, always throws an error
3103
3092
  * @param {string} msg
@@ -3118,23 +3107,12 @@ export class PasswordManagerClient {
3118
3107
  }
3119
3108
  }
3120
3109
  /**
3121
- * Test method, calls http endpoint
3122
- * @param {string} url
3123
- * @returns {Promise<string>}
3124
- */
3125
- http_get(url) {
3126
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3127
- const len0 = WASM_VECTOR_LEN;
3128
- const ret = wasm.passwordmanagerclient_http_get(this.__wbg_ptr, ptr0, len0);
3129
- return takeObject(ret);
3130
- }
3131
- /**
3132
- * Auth related operations.
3133
- * @returns {AuthClient}
3110
+ * Vault item related operations.
3111
+ * @returns {VaultClient}
3134
3112
  */
3135
- auth() {
3136
- const ret = wasm.passwordmanagerclient_auth(this.__wbg_ptr);
3137
- return AuthClient.__wrap(ret);
3113
+ vault() {
3114
+ const ret = wasm.passwordmanagerclient_vault(this.__wbg_ptr);
3115
+ return VaultClient.__wrap(ret);
3138
3116
  }
3139
3117
  /**
3140
3118
  * Crypto related operations.
@@ -3145,12 +3123,35 @@ export class PasswordManagerClient {
3145
3123
  return CryptoClient.__wrap(ret);
3146
3124
  }
3147
3125
  /**
3148
- * Vault item related operations.
3149
- * @returns {VaultClient}
3126
+ * Returns the current SDK version
3127
+ * @returns {string}
3150
3128
  */
3151
- vault() {
3152
- const ret = wasm.passwordmanagerclient_vault(this.__wbg_ptr);
3153
- return VaultClient.__wrap(ret);
3129
+ version() {
3130
+ let deferred1_0;
3131
+ let deferred1_1;
3132
+ try {
3133
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3134
+ wasm.passwordmanagerclient_version(retptr, this.__wbg_ptr);
3135
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3136
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3137
+ deferred1_0 = r0;
3138
+ deferred1_1 = r1;
3139
+ return getStringFromWasm0(r0, r1);
3140
+ } finally {
3141
+ wasm.__wbindgen_add_to_stack_pointer(16);
3142
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3143
+ }
3144
+ }
3145
+ /**
3146
+ * Test method, calls http endpoint
3147
+ * @param {string} url
3148
+ * @returns {Promise<string>}
3149
+ */
3150
+ http_get(url) {
3151
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3152
+ const len0 = WASM_VECTOR_LEN;
3153
+ const ret = wasm.passwordmanagerclient_http_get(this.__wbg_ptr, ptr0, len0);
3154
+ return takeObject(ret);
3154
3155
  }
3155
3156
  /**
3156
3157
  * Constructs a specific client for platform-specific functionality
@@ -3160,14 +3161,6 @@ export class PasswordManagerClient {
3160
3161
  const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3161
3162
  return PlatformClient.__wrap(ret);
3162
3163
  }
3163
- /**
3164
- * Constructs a specific client for generating passwords and passphrases
3165
- * @returns {GeneratorClient}
3166
- */
3167
- generator() {
3168
- const ret = wasm.passwordmanagerclient_generator(this.__wbg_ptr);
3169
- return GeneratorClient.__wrap(ret);
3170
- }
3171
3164
  /**
3172
3165
  * Exporter related operations.
3173
3166
  * @returns {ExporterClient}
@@ -3176,6 +3169,14 @@ export class PasswordManagerClient {
3176
3169
  const ret = wasm.passwordmanagerclient_exporters(this.__wbg_ptr);
3177
3170
  return ExporterClient.__wrap(ret);
3178
3171
  }
3172
+ /**
3173
+ * Constructs a specific client for generating passwords and passphrases
3174
+ * @returns {GeneratorClient}
3175
+ */
3176
+ generator() {
3177
+ const ret = wasm.passwordmanagerclient_generator(this.__wbg_ptr);
3178
+ return GeneratorClient.__wrap(ret);
3179
+ }
3179
3180
  }
3180
3181
  if (Symbol.dispose)
3181
3182
  PasswordManagerClient.prototype[Symbol.dispose] = PasswordManagerClient.prototype.free;
@@ -3205,13 +3206,6 @@ export class PlatformClient {
3205
3206
  const ptr = this.__destroy_into_raw();
3206
3207
  wasm.__wbg_platformclient_free(ptr, 0);
3207
3208
  }
3208
- /**
3209
- * @returns {StateClient}
3210
- */
3211
- state() {
3212
- const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3213
- return StateClient.__wrap(ret);
3214
- }
3215
3209
  /**
3216
3210
  * Load feature flags into the client
3217
3211
  * @param {FeatureFlags} flags
@@ -3229,6 +3223,13 @@ export class PlatformClient {
3229
3223
  wasm.__wbindgen_add_to_stack_pointer(16);
3230
3224
  }
3231
3225
  }
3226
+ /**
3227
+ * @returns {StateClient}
3228
+ */
3229
+ state() {
3230
+ const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3231
+ return StateClient.__wrap(ret);
3232
+ }
3232
3233
  }
3233
3234
  if (Symbol.dispose) PlatformClient.prototype[Symbol.dispose] = PlatformClient.prototype.free;
3234
3235
 
@@ -3254,6 +3255,64 @@ export class PureCrypto {
3254
3255
  const ptr = this.__destroy_into_raw();
3255
3256
  wasm.__wbg_purecrypto_free(ptr, 0);
3256
3257
  }
3258
+ /**
3259
+ * Decrypts data using RSAES-OAEP with SHA-1
3260
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3261
+ * @param {Uint8Array} encrypted_data
3262
+ * @param {Uint8Array} private_key
3263
+ * @returns {Uint8Array}
3264
+ */
3265
+ static rsa_decrypt_data(encrypted_data, private_key) {
3266
+ try {
3267
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3268
+ const ptr0 = passArray8ToWasm0(encrypted_data, wasm.__wbindgen_malloc);
3269
+ const len0 = WASM_VECTOR_LEN;
3270
+ const ptr1 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
3271
+ const len1 = WASM_VECTOR_LEN;
3272
+ wasm.purecrypto_rsa_decrypt_data(retptr, ptr0, len0, ptr1, len1);
3273
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3274
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3275
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3276
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3277
+ if (r3) {
3278
+ throw takeObject(r2);
3279
+ }
3280
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3281
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3282
+ return v3;
3283
+ } finally {
3284
+ wasm.__wbindgen_add_to_stack_pointer(16);
3285
+ }
3286
+ }
3287
+ /**
3288
+ * Encrypts data using RSAES-OAEP with SHA-1
3289
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3290
+ * @param {Uint8Array} plain_data
3291
+ * @param {Uint8Array} public_key
3292
+ * @returns {Uint8Array}
3293
+ */
3294
+ static rsa_encrypt_data(plain_data, public_key) {
3295
+ try {
3296
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3297
+ const ptr0 = passArray8ToWasm0(plain_data, wasm.__wbindgen_malloc);
3298
+ const len0 = WASM_VECTOR_LEN;
3299
+ const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
3300
+ const len1 = WASM_VECTOR_LEN;
3301
+ wasm.purecrypto_rsa_encrypt_data(retptr, ptr0, len0, ptr1, len1);
3302
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3303
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3304
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3305
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3306
+ if (r3) {
3307
+ throw takeObject(r2);
3308
+ }
3309
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3310
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3311
+ return v3;
3312
+ } finally {
3313
+ wasm.__wbindgen_add_to_stack_pointer(16);
3314
+ }
3315
+ }
3257
3316
  /**
3258
3317
  * DEPRECATED: Use `symmetric_decrypt_string` instead.
3259
3318
  * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
@@ -3291,20 +3350,22 @@ export class PureCrypto {
3291
3350
  }
3292
3351
  }
3293
3352
  /**
3294
- * @param {string} enc_string
3295
- * @param {Uint8Array} key
3353
+ * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
3354
+ * as an EncString.
3355
+ * @param {Uint8Array} key_to_be_wrapped
3356
+ * @param {Uint8Array} wrapping_key
3296
3357
  * @returns {string}
3297
3358
  */
3298
- static symmetric_decrypt_string(enc_string, key) {
3359
+ static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
3299
3360
  let deferred4_0;
3300
3361
  let deferred4_1;
3301
3362
  try {
3302
3363
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3303
- const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3364
+ const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
3304
3365
  const len0 = WASM_VECTOR_LEN;
3305
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3366
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3306
3367
  const len1 = WASM_VECTOR_LEN;
3307
- wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
3368
+ wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3308
3369
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3309
3370
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3310
3371
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3325,18 +3386,20 @@ export class PureCrypto {
3325
3386
  }
3326
3387
  }
3327
3388
  /**
3328
- * @param {string} enc_string
3329
- * @param {Uint8Array} key
3389
+ * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
3390
+ * @param {Uint8Array} password
3391
+ * @param {Uint8Array} salt
3392
+ * @param {Kdf} kdf
3330
3393
  * @returns {Uint8Array}
3331
3394
  */
3332
- static symmetric_decrypt_bytes(enc_string, key) {
3395
+ static derive_kdf_material(password, salt, kdf) {
3333
3396
  try {
3334
3397
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3335
- const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3398
+ const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
3336
3399
  const len0 = WASM_VECTOR_LEN;
3337
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3400
+ const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
3338
3401
  const len1 = WASM_VECTOR_LEN;
3339
- wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3402
+ wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
3340
3403
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3341
3404
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3342
3405
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3352,20 +3415,14 @@ export class PureCrypto {
3352
3415
  }
3353
3416
  }
3354
3417
  /**
3355
- * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
3356
- * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3357
- * @param {Uint8Array} enc_bytes
3358
- * @param {Uint8Array} key
3418
+ * Generates a new RSA key pair and returns the private key
3419
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3359
3420
  * @returns {Uint8Array}
3360
3421
  */
3361
- static symmetric_decrypt_array_buffer(enc_bytes, key) {
3422
+ static rsa_generate_keypair() {
3362
3423
  try {
3363
3424
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3364
- const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3365
- const len0 = WASM_VECTOR_LEN;
3366
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3367
- const len1 = WASM_VECTOR_LEN;
3368
- wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
3425
+ wasm.purecrypto_rsa_generate_keypair(retptr);
3369
3426
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3370
3427
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3371
3428
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3373,26 +3430,28 @@ export class PureCrypto {
3373
3430
  if (r3) {
3374
3431
  throw takeObject(r2);
3375
3432
  }
3376
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3433
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3377
3434
  wasm.__wbindgen_free(r0, r1 * 1, 1);
3378
- return v3;
3435
+ return v1;
3379
3436
  } finally {
3380
3437
  wasm.__wbindgen_add_to_stack_pointer(16);
3381
3438
  }
3382
3439
  }
3383
3440
  /**
3384
- * @param {Uint8Array} enc_bytes
3385
- * @param {Uint8Array} key
3441
+ * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
3442
+ * unwrapped key as a serialized byte array.
3443
+ * @param {string} wrapped_key
3444
+ * @param {Uint8Array} wrapping_key
3386
3445
  * @returns {Uint8Array}
3387
3446
  */
3388
- static symmetric_decrypt_filedata(enc_bytes, key) {
3447
+ static unwrap_symmetric_key(wrapped_key, wrapping_key) {
3389
3448
  try {
3390
3449
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3391
- const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3450
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3392
3451
  const len0 = WASM_VECTOR_LEN;
3393
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3452
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3394
3453
  const len1 = WASM_VECTOR_LEN;
3395
- wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3454
+ wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3396
3455
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3397
3456
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3398
3457
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3408,55 +3467,49 @@ export class PureCrypto {
3408
3467
  }
3409
3468
  }
3410
3469
  /**
3411
- * @param {string} plain
3412
- * @param {Uint8Array} key
3413
- * @returns {string}
3470
+ * Given a decrypted private RSA key PKCS8 DER this
3471
+ * returns the corresponding public RSA key in DER format.
3472
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3473
+ * @param {Uint8Array} private_key
3474
+ * @returns {Uint8Array}
3414
3475
  */
3415
- static symmetric_encrypt_string(plain, key) {
3416
- let deferred4_0;
3417
- let deferred4_1;
3476
+ static rsa_extract_public_key(private_key) {
3418
3477
  try {
3419
3478
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3420
- const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3479
+ const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
3421
3480
  const len0 = WASM_VECTOR_LEN;
3422
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3423
- const len1 = WASM_VECTOR_LEN;
3424
- wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
3481
+ wasm.purecrypto_rsa_extract_public_key(retptr, ptr0, len0);
3425
3482
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3426
3483
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3427
3484
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3428
3485
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3429
- var ptr3 = r0;
3430
- var len3 = r1;
3431
3486
  if (r3) {
3432
- ptr3 = 0;
3433
- len3 = 0;
3434
3487
  throw takeObject(r2);
3435
3488
  }
3436
- deferred4_0 = ptr3;
3437
- deferred4_1 = len3;
3438
- return getStringFromWasm0(ptr3, len3);
3489
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
3490
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3491
+ return v2;
3439
3492
  } finally {
3440
3493
  wasm.__wbindgen_add_to_stack_pointer(16);
3441
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3442
3494
  }
3443
3495
  }
3444
3496
  /**
3445
- * DEPRECATED: Only used by send keys
3446
- * @param {Uint8Array} plain
3447
- * @param {Uint8Array} key
3497
+ * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
3498
+ * key,
3499
+ * @param {Uint8Array} decapsulation_key
3500
+ * @param {Uint8Array} wrapping_key
3448
3501
  * @returns {string}
3449
3502
  */
3450
- static symmetric_encrypt_bytes(plain, key) {
3503
+ static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
3451
3504
  let deferred4_0;
3452
3505
  let deferred4_1;
3453
3506
  try {
3454
3507
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3455
- const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3508
+ const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3456
3509
  const len0 = WASM_VECTOR_LEN;
3457
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3510
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3458
3511
  const len1 = WASM_VECTOR_LEN;
3459
- wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3512
+ wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3460
3513
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3461
3514
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3462
3515
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3477,180 +3530,87 @@ export class PureCrypto {
3477
3530
  }
3478
3531
  }
3479
3532
  /**
3480
- * @param {Uint8Array} plain
3481
- * @param {Uint8Array} key
3482
- * @returns {Uint8Array}
3533
+ * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
3534
+ * key. Note: Usually, a public key is - by definition - public, so this should not be
3535
+ * used. The specific use-case for this function is to enable rotateable key sets, where
3536
+ * the "public key" is not public, with the intent of preventing the server from being able
3537
+ * to overwrite the user key unlocked by the rotateable keyset.
3538
+ * @param {Uint8Array} encapsulation_key
3539
+ * @param {Uint8Array} wrapping_key
3540
+ * @returns {string}
3483
3541
  */
3484
- static symmetric_encrypt_filedata(plain, key) {
3542
+ static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
3543
+ let deferred4_0;
3544
+ let deferred4_1;
3485
3545
  try {
3486
3546
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3487
- const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3547
+ const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3488
3548
  const len0 = WASM_VECTOR_LEN;
3489
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3549
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3490
3550
  const len1 = WASM_VECTOR_LEN;
3491
- wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3551
+ wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
3492
3552
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3493
3553
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3494
3554
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3495
3555
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3556
+ var ptr3 = r0;
3557
+ var len3 = r1;
3496
3558
  if (r3) {
3559
+ ptr3 = 0;
3560
+ len3 = 0;
3497
3561
  throw takeObject(r2);
3498
3562
  }
3499
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3500
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3501
- return v3;
3563
+ deferred4_0 = ptr3;
3564
+ deferred4_1 = len3;
3565
+ return getStringFromWasm0(ptr3, len3);
3502
3566
  } finally {
3503
3567
  wasm.__wbindgen_add_to_stack_pointer(16);
3568
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3504
3569
  }
3505
3570
  }
3506
3571
  /**
3507
- * @param {string} encrypted_user_key
3508
- * @param {string} master_password
3509
- * @param {string} email
3510
- * @param {Kdf} kdf
3572
+ * @param {string} enc_string
3573
+ * @param {Uint8Array} key
3511
3574
  * @returns {Uint8Array}
3512
3575
  */
3513
- static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
3514
- try {
3515
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3516
- const ptr0 = passStringToWasm0(
3517
- encrypted_user_key,
3518
- wasm.__wbindgen_malloc,
3519
- wasm.__wbindgen_realloc,
3520
- );
3521
- const len0 = WASM_VECTOR_LEN;
3522
- const ptr1 = passStringToWasm0(
3523
- master_password,
3524
- wasm.__wbindgen_malloc,
3525
- wasm.__wbindgen_realloc,
3526
- );
3527
- const len1 = WASM_VECTOR_LEN;
3528
- const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3529
- const len2 = WASM_VECTOR_LEN;
3530
- wasm.purecrypto_decrypt_user_key_with_master_password(
3531
- retptr,
3532
- ptr0,
3533
- len0,
3534
- ptr1,
3535
- len1,
3536
- ptr2,
3537
- len2,
3538
- addHeapObject(kdf),
3539
- );
3540
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3541
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3542
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3543
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3544
- if (r3) {
3545
- throw takeObject(r2);
3546
- }
3547
- var v4 = getArrayU8FromWasm0(r0, r1).slice();
3548
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3549
- return v4;
3550
- } finally {
3551
- wasm.__wbindgen_add_to_stack_pointer(16);
3552
- }
3553
- }
3554
- /**
3555
- * @param {Uint8Array} user_key
3556
- * @param {string} master_password
3557
- * @param {string} email
3558
- * @param {Kdf} kdf
3559
- * @returns {string}
3560
- */
3561
- static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
3562
- let deferred5_0;
3563
- let deferred5_1;
3576
+ static symmetric_decrypt_bytes(enc_string, key) {
3564
3577
  try {
3565
3578
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3566
- const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
3579
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3567
3580
  const len0 = WASM_VECTOR_LEN;
3568
- const ptr1 = passStringToWasm0(
3569
- master_password,
3570
- wasm.__wbindgen_malloc,
3571
- wasm.__wbindgen_realloc,
3572
- );
3581
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3573
3582
  const len1 = WASM_VECTOR_LEN;
3574
- const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3575
- const len2 = WASM_VECTOR_LEN;
3576
- wasm.purecrypto_encrypt_user_key_with_master_password(
3577
- retptr,
3578
- ptr0,
3579
- len0,
3580
- ptr1,
3581
- len1,
3582
- ptr2,
3583
- len2,
3584
- addHeapObject(kdf),
3585
- );
3583
+ wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3586
3584
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3587
3585
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3588
3586
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3589
3587
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3590
- var ptr4 = r0;
3591
- var len4 = r1;
3592
3588
  if (r3) {
3593
- ptr4 = 0;
3594
- len4 = 0;
3595
3589
  throw takeObject(r2);
3596
3590
  }
3597
- deferred5_0 = ptr4;
3598
- deferred5_1 = len4;
3599
- return getStringFromWasm0(ptr4, len4);
3600
- } finally {
3601
- wasm.__wbindgen_add_to_stack_pointer(16);
3602
- wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
3603
- }
3604
- }
3605
- /**
3606
- * @returns {Uint8Array}
3607
- */
3608
- static make_user_key_aes256_cbc_hmac() {
3609
- try {
3610
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3611
- wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
3612
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3613
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3614
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
3615
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3616
- return v1;
3617
- } finally {
3618
- wasm.__wbindgen_add_to_stack_pointer(16);
3619
- }
3620
- }
3621
- /**
3622
- * @returns {Uint8Array}
3623
- */
3624
- static make_user_key_xchacha20_poly1305() {
3625
- try {
3626
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3627
- wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
3628
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3629
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3630
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
3591
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3631
3592
  wasm.__wbindgen_free(r0, r1 * 1, 1);
3632
- return v1;
3593
+ return v3;
3633
3594
  } finally {
3634
3595
  wasm.__wbindgen_add_to_stack_pointer(16);
3635
3596
  }
3636
3597
  }
3637
3598
  /**
3638
- * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
3639
- * as an EncString.
3640
- * @param {Uint8Array} key_to_be_wrapped
3641
- * @param {Uint8Array} wrapping_key
3599
+ * DEPRECATED: Only used by send keys
3600
+ * @param {Uint8Array} plain
3601
+ * @param {Uint8Array} key
3642
3602
  * @returns {string}
3643
3603
  */
3644
- static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
3604
+ static symmetric_encrypt_bytes(plain, key) {
3645
3605
  let deferred4_0;
3646
3606
  let deferred4_1;
3647
3607
  try {
3648
3608
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3649
- const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
3609
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3650
3610
  const len0 = WASM_VECTOR_LEN;
3651
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3611
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3652
3612
  const len1 = WASM_VECTOR_LEN;
3653
- wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3613
+ wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3654
3614
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3655
3615
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3656
3616
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3671,20 +3631,25 @@ export class PureCrypto {
3671
3631
  }
3672
3632
  }
3673
3633
  /**
3674
- * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
3675
- * unwrapped key as a serialized byte array.
3676
- * @param {string} wrapped_key
3677
- * @param {Uint8Array} wrapping_key
3634
+ * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
3635
+ * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
3636
+ * recipient.
3637
+ * @param {string} encapsulated_key
3638
+ * @param {Uint8Array} decapsulation_key
3678
3639
  * @returns {Uint8Array}
3679
3640
  */
3680
- static unwrap_symmetric_key(wrapped_key, wrapping_key) {
3641
+ static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
3681
3642
  try {
3682
3643
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3683
- const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3644
+ const ptr0 = passStringToWasm0(
3645
+ encapsulated_key,
3646
+ wasm.__wbindgen_malloc,
3647
+ wasm.__wbindgen_realloc,
3648
+ );
3684
3649
  const len0 = WASM_VECTOR_LEN;
3685
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3650
+ const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3686
3651
  const len1 = WASM_VECTOR_LEN;
3687
- wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3652
+ wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3688
3653
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3689
3654
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3690
3655
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3700,25 +3665,23 @@ export class PureCrypto {
3700
3665
  }
3701
3666
  }
3702
3667
  /**
3703
- * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
3704
- * key. Note: Usually, a public key is - by definition - public, so this should not be
3705
- * used. The specific use-case for this function is to enable rotateable key sets, where
3706
- * the "public key" is not public, with the intent of preventing the server from being able
3707
- * to overwrite the user key unlocked by the rotateable keyset.
3668
+ * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
3669
+ * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
3670
+ * the sender's authenticity cannot be verified by the recipient.
3671
+ * @param {Uint8Array} shared_key
3708
3672
  * @param {Uint8Array} encapsulation_key
3709
- * @param {Uint8Array} wrapping_key
3710
3673
  * @returns {string}
3711
3674
  */
3712
- static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
3675
+ static encapsulate_key_unsigned(shared_key, encapsulation_key) {
3713
3676
  let deferred4_0;
3714
3677
  let deferred4_1;
3715
3678
  try {
3716
3679
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3717
- const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3680
+ const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
3718
3681
  const len0 = WASM_VECTOR_LEN;
3719
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3682
+ const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3720
3683
  const len1 = WASM_VECTOR_LEN;
3721
- wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
3684
+ wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3722
3685
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3723
3686
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3724
3687
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3739,51 +3702,54 @@ export class PureCrypto {
3739
3702
  }
3740
3703
  }
3741
3704
  /**
3742
- * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
3743
- * wrapping key.
3744
- * @param {string} wrapped_key
3745
- * @param {Uint8Array} wrapping_key
3746
- * @returns {Uint8Array}
3705
+ * @param {string} enc_string
3706
+ * @param {Uint8Array} key
3707
+ * @returns {string}
3747
3708
  */
3748
- static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
3709
+ static symmetric_decrypt_string(enc_string, key) {
3710
+ let deferred4_0;
3711
+ let deferred4_1;
3749
3712
  try {
3750
3713
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3751
- const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3714
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3752
3715
  const len0 = WASM_VECTOR_LEN;
3753
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3716
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3754
3717
  const len1 = WASM_VECTOR_LEN;
3755
- wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3718
+ wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
3756
3719
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3757
3720
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3758
3721
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3759
3722
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3723
+ var ptr3 = r0;
3724
+ var len3 = r1;
3760
3725
  if (r3) {
3726
+ ptr3 = 0;
3727
+ len3 = 0;
3761
3728
  throw takeObject(r2);
3762
3729
  }
3763
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3764
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3765
- return v3;
3730
+ deferred4_0 = ptr3;
3731
+ deferred4_1 = len3;
3732
+ return getStringFromWasm0(ptr3, len3);
3766
3733
  } finally {
3767
3734
  wasm.__wbindgen_add_to_stack_pointer(16);
3735
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3768
3736
  }
3769
3737
  }
3770
3738
  /**
3771
- * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
3772
- * key,
3773
- * @param {Uint8Array} decapsulation_key
3774
- * @param {Uint8Array} wrapping_key
3739
+ * @param {string} plain
3740
+ * @param {Uint8Array} key
3775
3741
  * @returns {string}
3776
3742
  */
3777
- static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
3743
+ static symmetric_encrypt_string(plain, key) {
3778
3744
  let deferred4_0;
3779
3745
  let deferred4_1;
3780
3746
  try {
3781
3747
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3782
- const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3748
+ const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3783
3749
  const len0 = WASM_VECTOR_LEN;
3784
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3750
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3785
3751
  const len1 = WASM_VECTOR_LEN;
3786
- wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3752
+ wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
3787
3753
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3788
3754
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3789
3755
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3833,62 +3799,47 @@ export class PureCrypto {
3833
3799
  }
3834
3800
  }
3835
3801
  /**
3836
- * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
3837
- * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
3838
- * the sender's authenticity cannot be verified by the recipient.
3839
- * @param {Uint8Array} shared_key
3840
- * @param {Uint8Array} encapsulation_key
3841
- * @returns {string}
3802
+ * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
3803
+ * wrapping key.
3804
+ * @param {string} wrapped_key
3805
+ * @param {Uint8Array} wrapping_key
3806
+ * @returns {Uint8Array}
3842
3807
  */
3843
- static encapsulate_key_unsigned(shared_key, encapsulation_key) {
3844
- let deferred4_0;
3845
- let deferred4_1;
3808
+ static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
3846
3809
  try {
3847
3810
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3848
- const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
3811
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3849
3812
  const len0 = WASM_VECTOR_LEN;
3850
- const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3813
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3851
3814
  const len1 = WASM_VECTOR_LEN;
3852
- wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3815
+ wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3853
3816
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3854
3817
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3855
3818
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3856
3819
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3857
- var ptr3 = r0;
3858
- var len3 = r1;
3859
3820
  if (r3) {
3860
- ptr3 = 0;
3861
- len3 = 0;
3862
3821
  throw takeObject(r2);
3863
3822
  }
3864
- deferred4_0 = ptr3;
3865
- deferred4_1 = len3;
3866
- return getStringFromWasm0(ptr3, len3);
3823
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3824
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3825
+ return v3;
3867
3826
  } finally {
3868
3827
  wasm.__wbindgen_add_to_stack_pointer(16);
3869
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3870
3828
  }
3871
3829
  }
3872
3830
  /**
3873
- * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
3874
- * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
3875
- * recipient.
3876
- * @param {string} encapsulated_key
3877
- * @param {Uint8Array} decapsulation_key
3831
+ * @param {Uint8Array} enc_bytes
3832
+ * @param {Uint8Array} key
3878
3833
  * @returns {Uint8Array}
3879
3834
  */
3880
- static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
3835
+ static symmetric_decrypt_filedata(enc_bytes, key) {
3881
3836
  try {
3882
3837
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3883
- const ptr0 = passStringToWasm0(
3884
- encapsulated_key,
3885
- wasm.__wbindgen_malloc,
3886
- wasm.__wbindgen_realloc,
3887
- );
3838
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3888
3839
  const len0 = WASM_VECTOR_LEN;
3889
- const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3840
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3890
3841
  const len1 = WASM_VECTOR_LEN;
3891
- wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3842
+ wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3892
3843
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3893
3844
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3894
3845
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3904,20 +3855,18 @@ export class PureCrypto {
3904
3855
  }
3905
3856
  }
3906
3857
  /**
3907
- * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
3908
- * the corresponding verifying key.
3909
- * @param {string} signing_key
3910
- * @param {Uint8Array} wrapping_key
3858
+ * @param {Uint8Array} plain
3859
+ * @param {Uint8Array} key
3911
3860
  * @returns {Uint8Array}
3912
3861
  */
3913
- static verifying_key_for_signing_key(signing_key, wrapping_key) {
3862
+ static symmetric_encrypt_filedata(plain, key) {
3914
3863
  try {
3915
3864
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3916
- const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3865
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3917
3866
  const len0 = WASM_VECTOR_LEN;
3918
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3867
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3919
3868
  const len1 = WASM_VECTOR_LEN;
3920
- wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
3869
+ wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3921
3870
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3922
3871
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3923
3872
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3933,44 +3882,36 @@ export class PureCrypto {
3933
3882
  }
3934
3883
  }
3935
3884
  /**
3936
- * Returns the algorithm used for the given verifying key.
3937
- * @param {Uint8Array} verifying_key
3938
- * @returns {SignatureAlgorithm}
3885
+ * @returns {Uint8Array}
3939
3886
  */
3940
- static key_algorithm_for_verifying_key(verifying_key) {
3887
+ static make_user_key_aes256_cbc_hmac() {
3941
3888
  try {
3942
3889
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3943
- const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3944
- const len0 = WASM_VECTOR_LEN;
3945
- wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
3890
+ wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
3946
3891
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3947
3892
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3948
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3949
- if (r2) {
3950
- throw takeObject(r1);
3951
- }
3952
- return takeObject(r0);
3893
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3894
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3895
+ return v1;
3953
3896
  } finally {
3954
3897
  wasm.__wbindgen_add_to_stack_pointer(16);
3955
3898
  }
3956
3899
  }
3957
3900
  /**
3958
- * For a given signing identity (verifying key), this function verifies that the signing
3959
- * identity claimed ownership of the public key. This is a one-sided claim and merely shows
3960
- * that the signing identity has the intent to receive messages encrypted to the public
3961
- * key.
3962
- * @param {Uint8Array} signed_public_key
3963
- * @param {Uint8Array} verifying_key
3901
+ * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
3902
+ * the corresponding verifying key.
3903
+ * @param {string} signing_key
3904
+ * @param {Uint8Array} wrapping_key
3964
3905
  * @returns {Uint8Array}
3965
3906
  */
3966
- static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
3907
+ static verifying_key_for_signing_key(signing_key, wrapping_key) {
3967
3908
  try {
3968
3909
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3969
- const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
3910
+ const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3970
3911
  const len0 = WASM_VECTOR_LEN;
3971
- const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3912
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3972
3913
  const len1 = WASM_VECTOR_LEN;
3973
- wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
3914
+ wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
3974
3915
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3975
3916
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3976
3917
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3986,20 +3927,20 @@ export class PureCrypto {
3986
3927
  }
3987
3928
  }
3988
3929
  /**
3989
- * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
3990
- * @param {Uint8Array} password
3991
- * @param {Uint8Array} salt
3992
- * @param {Kdf} kdf
3930
+ * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
3931
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3932
+ * @param {Uint8Array} enc_bytes
3933
+ * @param {Uint8Array} key
3993
3934
  * @returns {Uint8Array}
3994
3935
  */
3995
- static derive_kdf_material(password, salt, kdf) {
3936
+ static symmetric_decrypt_array_buffer(enc_bytes, key) {
3996
3937
  try {
3997
3938
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3998
- const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
3939
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3999
3940
  const len0 = WASM_VECTOR_LEN;
4000
- const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
3941
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
4001
3942
  const len1 = WASM_VECTOR_LEN;
4002
- wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
3943
+ wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
4003
3944
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4004
3945
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4005
3946
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4014,6 +3955,28 @@ export class PureCrypto {
4014
3955
  wasm.__wbindgen_add_to_stack_pointer(16);
4015
3956
  }
4016
3957
  }
3958
+ /**
3959
+ * Returns the algorithm used for the given verifying key.
3960
+ * @param {Uint8Array} verifying_key
3961
+ * @returns {SignatureAlgorithm}
3962
+ */
3963
+ static key_algorithm_for_verifying_key(verifying_key) {
3964
+ try {
3965
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3966
+ const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3967
+ const len0 = WASM_VECTOR_LEN;
3968
+ wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
3969
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3970
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3971
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3972
+ if (r2) {
3973
+ throw takeObject(r1);
3974
+ }
3975
+ return takeObject(r0);
3976
+ } finally {
3977
+ wasm.__wbindgen_add_to_stack_pointer(16);
3978
+ }
3979
+ }
4017
3980
  /**
4018
3981
  * @param {string} encrypted_user_key
4019
3982
  * @param {Uint8Array} master_key
@@ -4046,41 +4009,38 @@ export class PureCrypto {
4046
4009
  }
4047
4010
  }
4048
4011
  /**
4049
- * Given a decrypted private RSA key PKCS8 DER this
4050
- * returns the corresponding public RSA key in DER format.
4051
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4052
- * @param {Uint8Array} private_key
4053
4012
  * @returns {Uint8Array}
4054
4013
  */
4055
- static rsa_extract_public_key(private_key) {
4014
+ static make_user_key_xchacha20_poly1305() {
4056
4015
  try {
4057
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4058
- const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
4059
- const len0 = WASM_VECTOR_LEN;
4060
- wasm.purecrypto_rsa_extract_public_key(retptr, ptr0, len0);
4061
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4062
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4063
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4064
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
4065
- if (r3) {
4066
- throw takeObject(r2);
4067
- }
4068
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
4016
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4017
+ wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
4018
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4019
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4020
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4069
4021
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4070
- return v2;
4022
+ return v1;
4071
4023
  } finally {
4072
4024
  wasm.__wbindgen_add_to_stack_pointer(16);
4073
4025
  }
4074
4026
  }
4075
4027
  /**
4076
- * Generates a new RSA key pair and returns the private key
4077
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4028
+ * For a given signing identity (verifying key), this function verifies that the signing
4029
+ * identity claimed ownership of the public key. This is a one-sided claim and merely shows
4030
+ * that the signing identity has the intent to receive messages encrypted to the public
4031
+ * key.
4032
+ * @param {Uint8Array} signed_public_key
4033
+ * @param {Uint8Array} verifying_key
4078
4034
  * @returns {Uint8Array}
4079
4035
  */
4080
- static rsa_generate_keypair() {
4036
+ static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
4081
4037
  try {
4082
4038
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4083
- wasm.purecrypto_rsa_generate_keypair(retptr);
4039
+ const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
4040
+ const len0 = WASM_VECTOR_LEN;
4041
+ const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
4042
+ const len1 = WASM_VECTOR_LEN;
4043
+ wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
4084
4044
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4085
4045
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4086
4046
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4088,28 +4048,47 @@ export class PureCrypto {
4088
4048
  if (r3) {
4089
4049
  throw takeObject(r2);
4090
4050
  }
4091
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
4051
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
4092
4052
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4093
- return v1;
4053
+ return v3;
4094
4054
  } finally {
4095
4055
  wasm.__wbindgen_add_to_stack_pointer(16);
4096
4056
  }
4097
4057
  }
4098
4058
  /**
4099
- * Decrypts data using RSAES-OAEP with SHA-1
4100
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4101
- * @param {Uint8Array} encrypted_data
4102
- * @param {Uint8Array} private_key
4059
+ * @param {string} encrypted_user_key
4060
+ * @param {string} master_password
4061
+ * @param {string} email
4062
+ * @param {Kdf} kdf
4103
4063
  * @returns {Uint8Array}
4104
4064
  */
4105
- static rsa_decrypt_data(encrypted_data, private_key) {
4065
+ static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
4106
4066
  try {
4107
4067
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4108
- const ptr0 = passArray8ToWasm0(encrypted_data, wasm.__wbindgen_malloc);
4068
+ const ptr0 = passStringToWasm0(
4069
+ encrypted_user_key,
4070
+ wasm.__wbindgen_malloc,
4071
+ wasm.__wbindgen_realloc,
4072
+ );
4109
4073
  const len0 = WASM_VECTOR_LEN;
4110
- const ptr1 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
4074
+ const ptr1 = passStringToWasm0(
4075
+ master_password,
4076
+ wasm.__wbindgen_malloc,
4077
+ wasm.__wbindgen_realloc,
4078
+ );
4111
4079
  const len1 = WASM_VECTOR_LEN;
4112
- wasm.purecrypto_rsa_decrypt_data(retptr, ptr0, len0, ptr1, len1);
4080
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4081
+ const len2 = WASM_VECTOR_LEN;
4082
+ wasm.purecrypto_decrypt_user_key_with_master_password(
4083
+ retptr,
4084
+ ptr0,
4085
+ len0,
4086
+ ptr1,
4087
+ len1,
4088
+ ptr2,
4089
+ len2,
4090
+ addHeapObject(kdf),
4091
+ );
4113
4092
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4114
4093
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4115
4094
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4117,40 +4096,62 @@ export class PureCrypto {
4117
4096
  if (r3) {
4118
4097
  throw takeObject(r2);
4119
4098
  }
4120
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
4099
+ var v4 = getArrayU8FromWasm0(r0, r1).slice();
4121
4100
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4122
- return v3;
4101
+ return v4;
4123
4102
  } finally {
4124
4103
  wasm.__wbindgen_add_to_stack_pointer(16);
4125
4104
  }
4126
4105
  }
4127
4106
  /**
4128
- * Encrypts data using RSAES-OAEP with SHA-1
4129
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4130
- * @param {Uint8Array} plain_data
4131
- * @param {Uint8Array} public_key
4132
- * @returns {Uint8Array}
4107
+ * @param {Uint8Array} user_key
4108
+ * @param {string} master_password
4109
+ * @param {string} email
4110
+ * @param {Kdf} kdf
4111
+ * @returns {string}
4133
4112
  */
4134
- static rsa_encrypt_data(plain_data, public_key) {
4113
+ static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
4114
+ let deferred5_0;
4115
+ let deferred5_1;
4135
4116
  try {
4136
4117
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4137
- const ptr0 = passArray8ToWasm0(plain_data, wasm.__wbindgen_malloc);
4118
+ const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
4138
4119
  const len0 = WASM_VECTOR_LEN;
4139
- const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
4120
+ const ptr1 = passStringToWasm0(
4121
+ master_password,
4122
+ wasm.__wbindgen_malloc,
4123
+ wasm.__wbindgen_realloc,
4124
+ );
4140
4125
  const len1 = WASM_VECTOR_LEN;
4141
- wasm.purecrypto_rsa_encrypt_data(retptr, ptr0, len0, ptr1, len1);
4126
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4127
+ const len2 = WASM_VECTOR_LEN;
4128
+ wasm.purecrypto_encrypt_user_key_with_master_password(
4129
+ retptr,
4130
+ ptr0,
4131
+ len0,
4132
+ ptr1,
4133
+ len1,
4134
+ ptr2,
4135
+ len2,
4136
+ addHeapObject(kdf),
4137
+ );
4142
4138
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4143
4139
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4144
4140
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4145
4141
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
4142
+ var ptr4 = r0;
4143
+ var len4 = r1;
4146
4144
  if (r3) {
4145
+ ptr4 = 0;
4146
+ len4 = 0;
4147
4147
  throw takeObject(r2);
4148
4148
  }
4149
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
4150
- wasm.__wbindgen_free(r0, r1 * 1, 1);
4151
- return v3;
4149
+ deferred5_0 = ptr4;
4150
+ deferred5_1 = len4;
4151
+ return getStringFromWasm0(ptr4, len4);
4152
4152
  } finally {
4153
4153
  wasm.__wbindgen_add_to_stack_pointer(16);
4154
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
4154
4155
  }
4155
4156
  }
4156
4157
  }
@@ -4254,6 +4255,15 @@ export class StateClient {
4254
4255
  const ptr = this.__destroy_into_raw();
4255
4256
  wasm.__wbg_stateclient_free(ptr, 0);
4256
4257
  }
4258
+ /**
4259
+ * Initialize the database for SDK managed repositories.
4260
+ * @param {IndexedDbConfiguration} configuration
4261
+ * @returns {Promise<void>}
4262
+ */
4263
+ initialize_state(configuration) {
4264
+ const ret = wasm.stateclient_initialize_state(this.__wbg_ptr, addHeapObject(configuration));
4265
+ return takeObject(ret);
4266
+ }
4257
4267
  /**
4258
4268
  * @param {any} cipher_repository
4259
4269
  */
@@ -4275,15 +4285,6 @@ export class StateClient {
4275
4285
  addHeapObject(repositories),
4276
4286
  );
4277
4287
  }
4278
- /**
4279
- * Initialize the database for SDK managed repositories.
4280
- * @param {IndexedDbConfiguration} configuration
4281
- * @returns {Promise<void>}
4282
- */
4283
- initialize_state(configuration) {
4284
- const ret = wasm.stateclient_initialize_state(this.__wbg_ptr, addHeapObject(configuration));
4285
- return takeObject(ret);
4286
- }
4287
4288
  }
4288
4289
  if (Symbol.dispose) StateClient.prototype[Symbol.dispose] = StateClient.prototype.free;
4289
4290
 
@@ -4386,20 +4387,20 @@ export class VaultClient {
4386
4387
  return AttachmentsClient.__wrap(ret);
4387
4388
  }
4388
4389
  /**
4389
- * Cipher related operations.
4390
- * @returns {CiphersClient}
4390
+ * Cipher risk evaluation operations.
4391
+ * @returns {CipherRiskClient}
4391
4392
  */
4392
- ciphers() {
4393
+ cipher_risk() {
4393
4394
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4394
- return CiphersClient.__wrap(ret);
4395
+ return CipherRiskClient.__wrap(ret);
4395
4396
  }
4396
4397
  /**
4397
- * Folder related operations.
4398
- * @returns {FoldersClient}
4398
+ * Collection related operations.
4399
+ * @returns {CollectionsClient}
4399
4400
  */
4400
- folders() {
4401
+ collections() {
4401
4402
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4402
- return FoldersClient.__wrap(ret);
4403
+ return CollectionsClient.__wrap(ret);
4403
4404
  }
4404
4405
  /**
4405
4406
  * TOTP related operations.
@@ -4410,20 +4411,20 @@ export class VaultClient {
4410
4411
  return TotpClient.__wrap(ret);
4411
4412
  }
4412
4413
  /**
4413
- * Collection related operations.
4414
- * @returns {CollectionsClient}
4414
+ * Cipher related operations.
4415
+ * @returns {CiphersClient}
4415
4416
  */
4416
- collections() {
4417
+ ciphers() {
4417
4418
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4418
- return CollectionsClient.__wrap(ret);
4419
+ return CiphersClient.__wrap(ret);
4419
4420
  }
4420
4421
  /**
4421
- * Cipher risk evaluation operations.
4422
- * @returns {CipherRiskClient}
4422
+ * Folder related operations.
4423
+ * @returns {FoldersClient}
4423
4424
  */
4424
- cipher_risk() {
4425
+ folders() {
4425
4426
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4426
- return CipherRiskClient.__wrap(ret);
4427
+ return FoldersClient.__wrap(ret);
4427
4428
  }
4428
4429
  }
4429
4430
  if (Symbol.dispose) VaultClient.prototype[Symbol.dispose] = VaultClient.prototype.free;
@@ -4601,7 +4602,7 @@ export function __wbg_call_e762c39fa8ea36bf() {
4601
4602
  }, arguments);
4602
4603
  }
4603
4604
 
4604
- export function __wbg_cipher_f01ad37fe153c74a(arg0) {
4605
+ export function __wbg_cipher_ca1a8072783e8524(arg0) {
4605
4606
  const ret = getObject(arg0).cipher;
4606
4607
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4607
4608
  }
@@ -4694,7 +4695,7 @@ export function __wbg_fetch_f8ba0e29a9d6de0d(arg0, arg1) {
4694
4695
  return addHeapObject(ret);
4695
4696
  }
4696
4697
 
4697
- export function __wbg_folder_b2f27ca5801406fe(arg0) {
4698
+ export function __wbg_folder_c3e4ac6ced93af5a(arg0) {
4698
4699
  const ret = getObject(arg0).folder;
4699
4700
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4700
4701
  }
@@ -4727,12 +4728,7 @@ export function __wbg_getTime_14776bfb48a1bff9(arg0) {
4727
4728
  return ret;
4728
4729
  }
4729
4730
 
4730
- export function __wbg_get_7bed016f185add81(arg0, arg1) {
4731
- const ret = getObject(arg0)[arg1 >>> 0];
4732
- return addHeapObject(ret);
4733
- }
4734
-
4735
- export function __wbg_get_7d24a56df19d62f6() {
4731
+ export function __wbg_get_021b4709a0cd459d() {
4736
4732
  return handleError(function (arg0, arg1, arg2) {
4737
4733
  let deferred0_0;
4738
4734
  let deferred0_1;
@@ -4747,12 +4743,17 @@ export function __wbg_get_7d24a56df19d62f6() {
4747
4743
  }, arguments);
4748
4744
  }
4749
4745
 
4750
- export function __wbg_get_access_token_f4e462d38899439f(arg0) {
4746
+ export function __wbg_get_7bed016f185add81(arg0, arg1) {
4747
+ const ret = getObject(arg0)[arg1 >>> 0];
4748
+ return addHeapObject(ret);
4749
+ }
4750
+
4751
+ export function __wbg_get_access_token_1bd76bc1d6872a37(arg0) {
4751
4752
  const ret = getObject(arg0).get_access_token();
4752
4753
  return addHeapObject(ret);
4753
4754
  }
4754
4755
 
4755
- export function __wbg_get_cf7a5a169adcb6d4() {
4756
+ export function __wbg_get_bcdf6d1f18330518() {
4756
4757
  return handleError(function (arg0, arg1, arg2) {
4757
4758
  let deferred0_0;
4758
4759
  let deferred0_1;
@@ -4958,14 +4959,14 @@ export function __wbg_length_cdd215e10d9dd507(arg0) {
4958
4959
  return ret;
4959
4960
  }
4960
4961
 
4961
- export function __wbg_list_9632da36688eb013() {
4962
+ export function __wbg_list_e1b7ba42d5e1f9e4() {
4962
4963
  return handleError(function (arg0) {
4963
4964
  const ret = getObject(arg0).list();
4964
4965
  return addHeapObject(ret);
4965
4966
  }, arguments);
4966
4967
  }
4967
4968
 
4968
- export function __wbg_list_971afaee385941da() {
4969
+ export function __wbg_list_f9b0200b46781635() {
4969
4970
  return handleError(function (arg0) {
4970
4971
  const ret = getObject(arg0).list();
4971
4972
  return addHeapObject(ret);
@@ -5037,7 +5038,7 @@ export function __wbg_new_3c3d849046688a66(arg0, arg1) {
5037
5038
  const a = state0.a;
5038
5039
  state0.a = 0;
5039
5040
  try {
5040
- return wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(
5041
+ return wasm_bindgen__convert__closures_____invoke__h0cb536241502fe83(
5041
5042
  a,
5042
5043
  state0.b,
5043
5044
  arg0,
@@ -5209,7 +5210,7 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
5209
5210
  }, arguments);
5210
5211
  }
5211
5212
 
5212
- export function __wbg_remove_0c50f1a372592522() {
5213
+ export function __wbg_remove_4b6c74678272e489() {
5213
5214
  return handleError(function (arg0, arg1, arg2) {
5214
5215
  let deferred0_0;
5215
5216
  let deferred0_1;
@@ -5224,7 +5225,7 @@ export function __wbg_remove_0c50f1a372592522() {
5224
5225
  }, arguments);
5225
5226
  }
5226
5227
 
5227
- export function __wbg_remove_d52ba16f05c98799() {
5228
+ export function __wbg_remove_b83e730d13c289dd() {
5228
5229
  return handleError(function (arg0, arg1, arg2) {
5229
5230
  let deferred0_0;
5230
5231
  let deferred0_1;
@@ -5270,31 +5271,7 @@ export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
5270
5271
  return addHeapObject(ret);
5271
5272
  }
5272
5273
 
5273
- export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
5274
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5275
- }
5276
-
5277
- export function __wbg_set_907fb406c34a251d(arg0, arg1, arg2) {
5278
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5279
- return addHeapObject(ret);
5280
- }
5281
-
5282
- export function __wbg_set_body_3c365989753d61f4(arg0, arg1) {
5283
- getObject(arg0).body = getObject(arg1);
5284
- }
5285
-
5286
- export function __wbg_set_c213c871859d6500(arg0, arg1, arg2) {
5287
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
5288
- }
5289
-
5290
- export function __wbg_set_c2abbebe8b9ebee1() {
5291
- return handleError(function (arg0, arg1, arg2) {
5292
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
5293
- return ret;
5294
- }, arguments);
5295
- }
5296
-
5297
- export function __wbg_set_cf238f02b0469517() {
5274
+ export function __wbg_set_0a163d5675fd3741() {
5298
5275
  return handleError(function (arg0, arg1, arg2, arg3) {
5299
5276
  let deferred0_0;
5300
5277
  let deferred0_1;
@@ -5309,11 +5286,11 @@ export function __wbg_set_cf238f02b0469517() {
5309
5286
  }, arguments);
5310
5287
  }
5311
5288
 
5312
- export function __wbg_set_credentials_f621cd2d85c0c228(arg0, arg1) {
5313
- getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
5289
+ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
5290
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5314
5291
  }
5315
5292
 
5316
- export function __wbg_set_e87a8a3d69deff6e() {
5293
+ export function __wbg_set_5e51294e627b72fd() {
5317
5294
  return handleError(function (arg0, arg1, arg2, arg3) {
5318
5295
  let deferred0_0;
5319
5296
  let deferred0_1;
@@ -5328,6 +5305,30 @@ export function __wbg_set_e87a8a3d69deff6e() {
5328
5305
  }, arguments);
5329
5306
  }
5330
5307
 
5308
+ export function __wbg_set_907fb406c34a251d(arg0, arg1, arg2) {
5309
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5310
+ return addHeapObject(ret);
5311
+ }
5312
+
5313
+ export function __wbg_set_body_3c365989753d61f4(arg0, arg1) {
5314
+ getObject(arg0).body = getObject(arg1);
5315
+ }
5316
+
5317
+ export function __wbg_set_c213c871859d6500(arg0, arg1, arg2) {
5318
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
5319
+ }
5320
+
5321
+ export function __wbg_set_c2abbebe8b9ebee1() {
5322
+ return handleError(function (arg0, arg1, arg2) {
5323
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
5324
+ return ret;
5325
+ }, arguments);
5326
+ }
5327
+
5328
+ export function __wbg_set_credentials_f621cd2d85c0c228(arg0, arg1) {
5329
+ getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
5330
+ }
5331
+
5331
5332
  export function __wbg_set_headers_6926da238cd32ee4(arg0, arg1) {
5332
5333
  getObject(arg0).headers = getObject(arg1);
5333
5334
  }
@@ -5498,34 +5499,34 @@ export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
5498
5499
  return addHeapObject(ret);
5499
5500
  }
5500
5501
 
5501
- export function __wbindgen_cast_4042b341512ce63a(arg0, arg1) {
5502
- // 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`.
5502
+ export function __wbindgen_cast_34ef3ce950757bdd(arg0, arg1) {
5503
+ // 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`.
5503
5504
  const ret = makeMutClosure(
5504
5505
  arg0,
5505
5506
  arg1,
5506
- wasm.wasm_bindgen__closure__destroy__h09d4e676b918dc23,
5507
- wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa,
5507
+ wasm.wasm_bindgen__closure__destroy__h003cf2eb90144982,
5508
+ wasm_bindgen__convert__closures_____invoke__h05da89f3ce503b8f,
5508
5509
  );
5509
5510
  return addHeapObject(ret);
5510
5511
  }
5511
5512
 
5512
- export function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
5513
- // Cast intrinsic for `U64 -> Externref`.
5514
- const ret = BigInt.asUintN(64, arg0);
5515
- return addHeapObject(ret);
5516
- }
5517
-
5518
- export function __wbindgen_cast_567ce6425eb96825(arg0, arg1) {
5519
- // Cast intrinsic for `Closure(Closure { dtor_idx: 551, function: Function { arguments: [], shim_idx: 305, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5513
+ export function __wbindgen_cast_397295739b4135cd(arg0, arg1) {
5514
+ // 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`.
5520
5515
  const ret = makeMutClosure(
5521
5516
  arg0,
5522
5517
  arg1,
5523
- wasm.wasm_bindgen__closure__destroy__hfcb631b72e5e985c,
5524
- wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e,
5518
+ wasm.wasm_bindgen__closure__destroy__h003cf2eb90144982,
5519
+ wasm_bindgen__convert__closures_____invoke__h389a5517bdf6e196,
5525
5520
  );
5526
5521
  return addHeapObject(ret);
5527
5522
  }
5528
5523
 
5524
+ export function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
5525
+ // Cast intrinsic for `U64 -> Externref`.
5526
+ const ret = BigInt.asUintN(64, arg0);
5527
+ return addHeapObject(ret);
5528
+ }
5529
+
5529
5530
  export function __wbindgen_cast_5fea77eff9dd275c(arg0, arg1) {
5530
5531
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
5531
5532
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
@@ -5542,24 +5543,13 @@ export function __wbindgen_cast_7a6d185652cd8149(arg0, arg1) {
5542
5543
  return addHeapObject(ret);
5543
5544
  }
5544
5545
 
5545
- export function __wbindgen_cast_8340b5b160d85933(arg0, arg1) {
5546
- // Cast intrinsic for `Closure(Closure { dtor_idx: 304, function: Function { arguments: [], shim_idx: 305, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5547
- const ret = makeMutClosure(
5548
- arg0,
5549
- arg1,
5550
- wasm.wasm_bindgen__closure__destroy__h5bf455f3385c4f71,
5551
- wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e,
5552
- );
5553
- return addHeapObject(ret);
5554
- }
5555
-
5556
- export function __wbindgen_cast_9654b59eb60e619d(arg0, arg1) {
5557
- // Cast intrinsic for `Closure(Closure { dtor_idx: 304, function: Function { arguments: [Externref], shim_idx: 44, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5546
+ export function __wbindgen_cast_930d054add031527(arg0, arg1) {
5547
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 303, function: Function { arguments: [Externref], shim_idx: 41, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5558
5548
  const ret = makeMutClosure(
5559
5549
  arg0,
5560
5550
  arg1,
5561
- wasm.wasm_bindgen__closure__destroy__h5bf455f3385c4f71,
5562
- wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa,
5551
+ wasm.wasm_bindgen__closure__destroy__h591e0f2efd143068,
5552
+ wasm_bindgen__convert__closures_____invoke__h05da89f3ce503b8f,
5563
5553
  );
5564
5554
  return addHeapObject(ret);
5565
5555
  }
@@ -5570,23 +5560,34 @@ export function __wbindgen_cast_9ae0607507abb057(arg0) {
5570
5560
  return addHeapObject(ret);
5571
5561
  }
5572
5562
 
5573
- export function __wbindgen_cast_cb9088102bce6b30(arg0, arg1) {
5574
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
5575
- const ret = getArrayU8FromWasm0(arg0, arg1);
5563
+ export function __wbindgen_cast_9b35fe50b76611f9(arg0, arg1) {
5564
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 552, function: Function { arguments: [], shim_idx: 304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5565
+ const ret = makeMutClosure(
5566
+ arg0,
5567
+ arg1,
5568
+ wasm.wasm_bindgen__closure__destroy__he41cbbdbe831f2ac,
5569
+ wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2,
5570
+ );
5576
5571
  return addHeapObject(ret);
5577
5572
  }
5578
5573
 
5579
- export function __wbindgen_cast_d49c305f67640cb1(arg0, arg1) {
5580
- // 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`.
5574
+ export function __wbindgen_cast_bfa5a190b0f2e981(arg0, arg1) {
5575
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 303, function: Function { arguments: [], shim_idx: 304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5581
5576
  const ret = makeMutClosure(
5582
5577
  arg0,
5583
5578
  arg1,
5584
- wasm.wasm_bindgen__closure__destroy__h09d4e676b918dc23,
5585
- wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf,
5579
+ wasm.wasm_bindgen__closure__destroy__h591e0f2efd143068,
5580
+ wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2,
5586
5581
  );
5587
5582
  return addHeapObject(ret);
5588
5583
  }
5589
5584
 
5585
+ export function __wbindgen_cast_cb9088102bce6b30(arg0, arg1) {
5586
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
5587
+ const ret = getArrayU8FromWasm0(arg0, arg1);
5588
+ return addHeapObject(ret);
5589
+ }
5590
+
5590
5591
  export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
5591
5592
  // Cast intrinsic for `F64 -> Externref`.
5592
5593
  const ret = arg0;