@bitwarden/commercial-sdk-internal 0.2.0-main.410 → 0.2.0-main.412

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;
@@ -270,21 +264,33 @@ function passArray8ToWasm0(arg, malloc) {
270
264
  return ptr;
271
265
  }
272
266
  /**
273
- * Generate a new SSH key pair
267
+ * Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
268
+ * to an OpenSSH private key with public key and fingerprint
274
269
  *
275
270
  * # Arguments
276
- * - `key_algorithm` - The algorithm to use for the key pair
271
+ * - `imported_key` - The private key to convert
272
+ * - `password` - The password to use for decrypting the key
277
273
  *
278
274
  * # Returns
279
- * - `Ok(SshKey)` if the key was successfully generated
280
- * - `Err(KeyGenerationError)` if the key could not be generated
281
- * @param {KeyAlgorithm} key_algorithm
275
+ * - `Ok(SshKey)` if the key was successfully coneverted
276
+ * - `Err(PasswordRequired)` if the key is encrypted and no password was provided
277
+ * - `Err(WrongPassword)` if the password provided is incorrect
278
+ * - `Err(ParsingError)` if the key could not be parsed
279
+ * - `Err(UnsupportedKeyType)` if the key type is not supported
280
+ * @param {string} imported_key
281
+ * @param {string | null} [password]
282
282
  * @returns {SshKeyView}
283
283
  */
284
- export function generate_ssh_key(key_algorithm) {
284
+ export function import_ssh_key(imported_key, password) {
285
285
  try {
286
286
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
287
- wasm.generate_ssh_key(retptr, addHeapObject(key_algorithm));
287
+ const ptr0 = passStringToWasm0(imported_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
288
+ const len0 = WASM_VECTOR_LEN;
289
+ var ptr1 = isLikeNone(password)
290
+ ? 0
291
+ : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
292
+ var len1 = WASM_VECTOR_LEN;
293
+ wasm.import_ssh_key(retptr, ptr0, len0, ptr1, len1);
288
294
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
289
295
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
290
296
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -298,33 +304,21 @@ export function generate_ssh_key(key_algorithm) {
298
304
  }
299
305
 
300
306
  /**
301
- * Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
302
- * to an OpenSSH private key with public key and fingerprint
307
+ * Generate a new SSH key pair
303
308
  *
304
309
  * # Arguments
305
- * - `imported_key` - The private key to convert
306
- * - `password` - The password to use for decrypting the key
310
+ * - `key_algorithm` - The algorithm to use for the key pair
307
311
  *
308
312
  * # Returns
309
- * - `Ok(SshKey)` if the key was successfully coneverted
310
- * - `Err(PasswordRequired)` if the key is encrypted and no password was provided
311
- * - `Err(WrongPassword)` if the password provided is incorrect
312
- * - `Err(ParsingError)` if the key could not be parsed
313
- * - `Err(UnsupportedKeyType)` if the key type is not supported
314
- * @param {string} imported_key
315
- * @param {string | null} [password]
313
+ * - `Ok(SshKey)` if the key was successfully generated
314
+ * - `Err(KeyGenerationError)` if the key could not be generated
315
+ * @param {KeyAlgorithm} key_algorithm
316
316
  * @returns {SshKeyView}
317
317
  */
318
- export function import_ssh_key(imported_key, password) {
318
+ export function generate_ssh_key(key_algorithm) {
319
319
  try {
320
320
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
321
- const ptr0 = passStringToWasm0(imported_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
322
- const len0 = WASM_VECTOR_LEN;
323
- var ptr1 = isLikeNone(password)
324
- ? 0
325
- : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
326
- var len1 = WASM_VECTOR_LEN;
327
- wasm.import_ssh_key(retptr, ptr0, len0, ptr1, len1);
321
+ wasm.generate_ssh_key(retptr, addHeapObject(key_algorithm));
328
322
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
329
323
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
330
324
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -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,31 @@ 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);
885
+ function wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2(arg0, arg1) {
886
+ wasm.wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2(arg0, arg1);
886
887
  }
887
888
 
888
- function wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(arg0, arg1, arg2) {
889
- wasm.wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(
889
+ function wasm_bindgen__convert__closures_____invoke__ha3eecaeccbf508bc(arg0, arg1, arg2) {
890
+ wasm.wasm_bindgen__convert__closures_____invoke__ha3eecaeccbf508bc(
890
891
  arg0,
891
892
  arg1,
892
893
  addHeapObject(arg2),
893
894
  );
894
895
  }
895
896
 
896
- function wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe(arg0, arg1, arg2) {
897
+ function wasm_bindgen__convert__closures_____invoke__h86320ba04bc5bce5(arg0, arg1, arg2) {
897
898
  try {
898
899
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
899
- wasm.wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe(
900
+ wasm.wasm_bindgen__convert__closures_____invoke__h86320ba04bc5bce5(
900
901
  retptr,
901
902
  arg0,
902
903
  arg1,
@@ -912,8 +913,8 @@ function wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe(arg0, arg
912
913
  }
913
914
  }
914
915
 
915
- function wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(arg0, arg1, arg2, arg3) {
916
- wasm.wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(
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,9 +1202,17 @@ export class AuthClient {
1209
1202
  const ret = wasm.authclient_identity(this.__wbg_ptr);
1210
1203
  return RegistrationClient.__wrap(ret);
1211
1204
  }
1212
- }
1213
- if (Symbol.dispose) AuthClient.prototype[Symbol.dispose] = AuthClient.prototype.free;
1214
-
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
+ }
1213
+ }
1214
+ if (Symbol.dispose) AuthClient.prototype[Symbol.dispose] = AuthClient.prototype.free;
1215
+
1215
1216
  const CipherRiskClientFinalization =
1216
1217
  typeof FinalizationRegistry === "undefined"
1217
1218
  ? { register: () => {}, unregister: () => {} }
@@ -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
 
@@ -1320,24 +1321,6 @@ export class CiphersClient {
1320
1321
  const ptr = this.__destroy_into_raw();
1321
1322
  wasm.__wbg_ciphersclient_free(ptr, 0);
1322
1323
  }
1323
- /**
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
1324
  /**
1342
1325
  * Moves a cipher into an organization, adds it to collections, and calls the share_cipher API.
1343
1326
  * @param {CipherView} cipher_view
@@ -1382,79 +1365,6 @@ export class CiphersClient {
1382
1365
  );
1383
1366
  return takeObject(ret);
1384
1367
  }
1385
- /**
1386
- * @param {CipherView} cipher_view
1387
- * @returns {EncryptionContext}
1388
- */
1389
- encrypt(cipher_view) {
1390
- try {
1391
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1392
- wasm.ciphersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
1393
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1394
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1395
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1396
- if (r2) {
1397
- throw takeObject(r1);
1398
- }
1399
- return takeObject(r0);
1400
- } finally {
1401
- wasm.__wbindgen_add_to_stack_pointer(16);
1402
- }
1403
- }
1404
- /**
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
- * @param {CipherView} cipher_view
1416
- * @param {B64} new_key
1417
- * @returns {EncryptionContext}
1418
- */
1419
- encrypt_cipher_for_rotation(cipher_view, new_key) {
1420
- try {
1421
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1422
- wasm.ciphersclient_encrypt_cipher_for_rotation(
1423
- retptr,
1424
- this.__wbg_ptr,
1425
- addHeapObject(cipher_view),
1426
- addHeapObject(new_key),
1427
- );
1428
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1429
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1430
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1431
- if (r2) {
1432
- throw takeObject(r1);
1433
- }
1434
- return takeObject(r0);
1435
- } finally {
1436
- wasm.__wbindgen_add_to_stack_pointer(16);
1437
- }
1438
- }
1439
- /**
1440
- * @param {Cipher} cipher
1441
- * @returns {CipherView}
1442
- */
1443
- decrypt(cipher) {
1444
- try {
1445
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1446
- wasm.ciphersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
1447
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1448
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1449
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1450
- if (r2) {
1451
- throw takeObject(r1);
1452
- }
1453
- return takeObject(r0);
1454
- } finally {
1455
- wasm.__wbindgen_add_to_stack_pointer(16);
1456
- }
1457
- }
1458
1368
  /**
1459
1369
  * @param {Cipher[]} ciphers
1460
1370
  * @returns {CipherListView[]}
@@ -1479,40 +1389,27 @@ export class CiphersClient {
1479
1389
  wasm.__wbindgen_add_to_stack_pointer(16);
1480
1390
  }
1481
1391
  }
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
1392
  /**
1495
1393
  * @param {CipherView} cipher_view
1496
- * @returns {Fido2CredentialView[]}
1394
+ * @param {OrganizationId} organization_id
1395
+ * @returns {CipherView}
1497
1396
  */
1498
- decrypt_fido2_credentials(cipher_view) {
1397
+ move_to_organization(cipher_view, organization_id) {
1499
1398
  try {
1500
1399
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1501
- wasm.ciphersclient_decrypt_fido2_credentials(
1400
+ wasm.ciphersclient_move_to_organization(
1502
1401
  retptr,
1503
1402
  this.__wbg_ptr,
1504
1403
  addHeapObject(cipher_view),
1404
+ addHeapObject(organization_id),
1505
1405
  );
1506
1406
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1507
1407
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1508
1408
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1509
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1510
- if (r3) {
1511
- throw takeObject(r2);
1409
+ if (r2) {
1410
+ throw takeObject(r1);
1512
1411
  }
1513
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1514
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1515
- return v1;
1412
+ return takeObject(r0);
1516
1413
  } finally {
1517
1414
  wasm.__wbindgen_add_to_stack_pointer(16);
1518
1415
  }
@@ -1552,25 +1449,26 @@ export class CiphersClient {
1552
1449
  }
1553
1450
  /**
1554
1451
  * @param {CipherView} cipher_view
1555
- * @param {OrganizationId} organization_id
1556
- * @returns {CipherView}
1452
+ * @returns {Fido2CredentialView[]}
1557
1453
  */
1558
- move_to_organization(cipher_view, organization_id) {
1454
+ decrypt_fido2_credentials(cipher_view) {
1559
1455
  try {
1560
1456
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1561
- wasm.ciphersclient_move_to_organization(
1457
+ wasm.ciphersclient_decrypt_fido2_credentials(
1562
1458
  retptr,
1563
1459
  this.__wbg_ptr,
1564
1460
  addHeapObject(cipher_view),
1565
- addHeapObject(organization_id),
1566
1461
  );
1567
1462
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1568
1463
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1569
1464
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1570
- if (r2) {
1571
- throw takeObject(r1);
1465
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1466
+ if (r3) {
1467
+ throw takeObject(r2);
1572
1468
  }
1573
- return takeObject(r0);
1469
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1470
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1471
+ return v1;
1574
1472
  } finally {
1575
1473
  wasm.__wbindgen_add_to_stack_pointer(16);
1576
1474
  }
@@ -1608,71 +1506,174 @@ export class CiphersClient {
1608
1506
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1609
1507
  }
1610
1508
  }
1611
- }
1612
- if (Symbol.dispose) CiphersClient.prototype[Symbol.dispose] = CiphersClient.prototype.free;
1613
-
1614
- const CollectionViewNodeItemFinalization =
1615
- typeof FinalizationRegistry === "undefined"
1616
- ? { register: () => {}, unregister: () => {} }
1617
- : new FinalizationRegistry((ptr) => wasm.__wbg_collectionviewnodeitem_free(ptr >>> 0, 1));
1618
-
1619
- export class CollectionViewNodeItem {
1620
- static __wrap(ptr) {
1621
- ptr = ptr >>> 0;
1622
- const obj = Object.create(CollectionViewNodeItem.prototype);
1623
- obj.__wbg_ptr = ptr;
1624
- CollectionViewNodeItemFinalization.register(obj, obj.__wbg_ptr, obj);
1625
- return obj;
1626
- }
1627
-
1628
- __destroy_into_raw() {
1629
- const ptr = this.__wbg_ptr;
1630
- this.__wbg_ptr = 0;
1631
- CollectionViewNodeItemFinalization.unregister(this);
1632
- return ptr;
1633
- }
1634
-
1635
- free() {
1636
- const ptr = this.__destroy_into_raw();
1637
- wasm.__wbg_collectionviewnodeitem_free(ptr, 0);
1638
- }
1639
- /**
1640
- * @returns {CollectionView}
1641
- */
1642
- get_item() {
1643
- const ret = wasm.collectionviewnodeitem_get_item(this.__wbg_ptr);
1644
- return takeObject(ret);
1645
- }
1646
1509
  /**
1647
- * @returns {CollectionView | undefined}
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}
1648
1514
  */
1649
- get_parent() {
1650
- const ret = wasm.collectionviewnodeitem_get_parent(this.__wbg_ptr);
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);
1651
1519
  return takeObject(ret);
1652
1520
  }
1653
1521
  /**
1654
- * @returns {CollectionView[]}
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.
1532
+ * @param {CipherView} cipher_view
1533
+ * @param {B64} new_key
1534
+ * @returns {EncryptionContext}
1655
1535
  */
1656
- get_children() {
1536
+ encrypt_cipher_for_rotation(cipher_view, new_key) {
1657
1537
  try {
1658
1538
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1659
- wasm.collectionviewnodeitem_get_children(retptr, this.__wbg_ptr);
1539
+ wasm.ciphersclient_encrypt_cipher_for_rotation(
1540
+ retptr,
1541
+ this.__wbg_ptr,
1542
+ addHeapObject(cipher_view),
1543
+ addHeapObject(new_key),
1544
+ );
1660
1545
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1661
1546
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1662
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1663
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1664
- return v1;
1547
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1548
+ if (r2) {
1549
+ throw takeObject(r1);
1550
+ }
1551
+ return takeObject(r0);
1665
1552
  } finally {
1666
1553
  wasm.__wbindgen_add_to_stack_pointer(16);
1667
1554
  }
1668
1555
  }
1669
1556
  /**
1670
- * @returns {AncestorMap}
1557
+ * @param {Cipher} cipher
1558
+ * @returns {CipherView}
1559
+ */
1560
+ decrypt(cipher) {
1561
+ try {
1562
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1563
+ wasm.ciphersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
1564
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1565
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1566
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1567
+ if (r2) {
1568
+ throw takeObject(r1);
1569
+ }
1570
+ return takeObject(r0);
1571
+ } finally {
1572
+ wasm.__wbindgen_add_to_stack_pointer(16);
1573
+ }
1574
+ }
1575
+ /**
1576
+ * @param {CipherView} cipher_view
1577
+ * @returns {EncryptionContext}
1578
+ */
1579
+ encrypt(cipher_view) {
1580
+ try {
1581
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1582
+ wasm.ciphersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
1583
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1584
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1585
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1586
+ if (r2) {
1587
+ throw takeObject(r1);
1588
+ }
1589
+ return takeObject(r0);
1590
+ } finally {
1591
+ wasm.__wbindgen_add_to_stack_pointer(16);
1592
+ }
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
+ }
1612
+ }
1613
+ if (Symbol.dispose) CiphersClient.prototype[Symbol.dispose] = CiphersClient.prototype.free;
1614
+
1615
+ const CollectionViewNodeItemFinalization =
1616
+ typeof FinalizationRegistry === "undefined"
1617
+ ? { register: () => {}, unregister: () => {} }
1618
+ : new FinalizationRegistry((ptr) => wasm.__wbg_collectionviewnodeitem_free(ptr >>> 0, 1));
1619
+
1620
+ export class CollectionViewNodeItem {
1621
+ static __wrap(ptr) {
1622
+ ptr = ptr >>> 0;
1623
+ const obj = Object.create(CollectionViewNodeItem.prototype);
1624
+ obj.__wbg_ptr = ptr;
1625
+ CollectionViewNodeItemFinalization.register(obj, obj.__wbg_ptr, obj);
1626
+ return obj;
1627
+ }
1628
+
1629
+ __destroy_into_raw() {
1630
+ const ptr = this.__wbg_ptr;
1631
+ this.__wbg_ptr = 0;
1632
+ CollectionViewNodeItemFinalization.unregister(this);
1633
+ return ptr;
1634
+ }
1635
+
1636
+ free() {
1637
+ const ptr = this.__destroy_into_raw();
1638
+ wasm.__wbg_collectionviewnodeitem_free(ptr, 0);
1639
+ }
1640
+ /**
1641
+ * @returns {CollectionView | undefined}
1642
+ */
1643
+ get_parent() {
1644
+ const ret = wasm.collectionviewnodeitem_get_parent(this.__wbg_ptr);
1645
+ return takeObject(ret);
1646
+ }
1647
+ /**
1648
+ * @returns {CollectionView[]}
1649
+ */
1650
+ get_children() {
1651
+ try {
1652
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1653
+ wasm.collectionviewnodeitem_get_children(retptr, this.__wbg_ptr);
1654
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1655
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1656
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1657
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1658
+ return v1;
1659
+ } finally {
1660
+ wasm.__wbindgen_add_to_stack_pointer(16);
1661
+ }
1662
+ }
1663
+ /**
1664
+ * @returns {AncestorMap}
1671
1665
  */
1672
1666
  get_ancestors() {
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,6 +1735,17 @@ export class CollectionViewTree {
1745
1735
  wasm.__wbindgen_add_to_stack_pointer(16);
1746
1736
  }
1747
1737
  }
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
+ }
1748
1749
  }
1749
1750
  if (Symbol.dispose)
1750
1751
  CollectionViewTree.prototype[Symbol.dispose] = CollectionViewTree.prototype.free;
@@ -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
 
@@ -1932,35 +1933,18 @@ export class CryptoClient {
1932
1933
  wasm.__wbg_cryptoclient_free(ptr, 0);
1933
1934
  }
1934
1935
  /**
1935
- * Initialization method for the user crypto. Needs to be called before any other crypto
1936
- * operations.
1937
- * @param {InitUserCryptoRequest} req
1938
- * @returns {Promise<void>}
1939
- */
1940
- initialize_user_crypto(req) {
1941
- const ret = wasm.cryptoclient_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
1942
- return takeObject(ret);
1943
- }
1944
- /**
1945
- * Initialization method for the organization crypto. Needs to be called after
1946
- * `initialize_user_crypto` but before any other crypto operations.
1947
- * @param {InitOrgCryptoRequest} req
1948
- * @returns {Promise<void>}
1949
- */
1950
- initialize_org_crypto(req) {
1951
- const ret = wasm.cryptoclient_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
1952
- return takeObject(ret);
1953
- }
1954
- /**
1955
- * Generates a new key pair and encrypts the private key with the provided user key.
1956
- * Crypto initialization not required.
1957
- * @param {B64} user_key
1958
- * @returns {MakeKeyPairResponse}
1936
+ * Protects the current user key with the provided PIN. The result can be stored and later
1937
+ * used to initialize another client instance by using the PIN and the PIN key with
1938
+ * `initialize_user_crypto`.
1939
+ * @param {string} pin
1940
+ * @returns {EnrollPinResponse}
1959
1941
  */
1960
- make_key_pair(user_key) {
1942
+ enroll_pin(pin) {
1961
1943
  try {
1962
1944
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1963
- wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, addHeapObject(user_key));
1945
+ const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1946
+ const len0 = WASM_VECTOR_LEN;
1947
+ wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
1964
1948
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1965
1949
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1966
1950
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1973,16 +1957,15 @@ export class CryptoClient {
1973
1957
  }
1974
1958
  }
1975
1959
  /**
1976
- * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1977
- * key. Returns if the private key is decryptable and if it is a valid matching key.
1960
+ * Generates a new key pair and encrypts the private key with the provided user key.
1978
1961
  * Crypto initialization not required.
1979
- * @param {VerifyAsymmetricKeysRequest} request
1980
- * @returns {VerifyAsymmetricKeysResponse}
1962
+ * @param {B64} user_key
1963
+ * @returns {MakeKeyPairResponse}
1981
1964
  */
1982
- verify_asymmetric_keys(request) {
1965
+ make_key_pair(user_key) {
1983
1966
  try {
1984
1967
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1985
- wasm.cryptoclient_verify_asymmetric_keys(retptr, this.__wbg_ptr, addHeapObject(request));
1968
+ wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, addHeapObject(user_key));
1986
1969
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1987
1970
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1988
1971
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1995,13 +1978,19 @@ export class CryptoClient {
1995
1978
  }
1996
1979
  }
1997
1980
  /**
1998
- * Makes a new signing key pair and signs the public key for the user
1999
- * @returns {UserCryptoV2KeysResponse}
1981
+ * Create the data necessary to update the user's kdf settings. The user's encryption key is
1982
+ * re-encrypted for the password under the new kdf settings. This returns the re-encrypted
1983
+ * user key and the new password hash but does not update sdk state.
1984
+ * @param {string} password
1985
+ * @param {Kdf} kdf
1986
+ * @returns {UpdateKdfResponse}
2000
1987
  */
2001
- make_keys_for_user_crypto_v2() {
1988
+ make_update_kdf(password, kdf) {
2002
1989
  try {
2003
1990
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2004
- wasm.cryptoclient_make_keys_for_user_crypto_v2(retptr, this.__wbg_ptr);
1991
+ const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1992
+ const len0 = WASM_VECTOR_LEN;
1993
+ wasm.cryptoclient_make_update_kdf(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(kdf));
2005
1994
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2006
1995
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2007
1996
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2014,16 +2003,39 @@ export class CryptoClient {
2014
2003
  }
2015
2004
  }
2016
2005
  /**
2017
- * Creates a rotated set of account keys for the current state
2018
- * @returns {UserCryptoV2KeysResponse}
2006
+ * Initialization method for the organization crypto. Needs to be called after
2007
+ * `initialize_user_crypto` but before any other crypto operations.
2008
+ * @param {InitOrgCryptoRequest} req
2009
+ * @returns {Promise<void>}
2019
2010
  */
2020
- get_v2_rotated_account_keys() {
2021
- try {
2022
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2023
- wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr);
2024
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2025
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2026
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2011
+ initialize_org_crypto(req) {
2012
+ const ret = wasm.cryptoclient_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
2013
+ return takeObject(ret);
2014
+ }
2015
+ /**
2016
+ * Initialization method for the user crypto. Needs to be called before any other crypto
2017
+ * operations.
2018
+ * @param {InitUserCryptoRequest} req
2019
+ * @returns {Promise<void>}
2020
+ */
2021
+ initialize_user_crypto(req) {
2022
+ const ret = wasm.cryptoclient_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
2023
+ return takeObject(ret);
2024
+ }
2025
+ /**
2026
+ * Verifies a user's asymmetric keys by decrypting the private key with the provided user
2027
+ * key. Returns if the private key is decryptable and if it is a valid matching key.
2028
+ * Crypto initialization not required.
2029
+ * @param {VerifyAsymmetricKeysRequest} request
2030
+ * @returns {VerifyAsymmetricKeysResponse}
2031
+ */
2032
+ verify_asymmetric_keys(request) {
2033
+ try {
2034
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2035
+ wasm.cryptoclient_verify_asymmetric_keys(retptr, this.__wbg_ptr, addHeapObject(request));
2036
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2037
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2038
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2027
2039
  if (r2) {
2028
2040
  throw takeObject(r1);
2029
2041
  }
@@ -2033,19 +2045,13 @@ export class CryptoClient {
2033
2045
  }
2034
2046
  }
2035
2047
  /**
2036
- * Create the data necessary to update the user's kdf settings. The user's encryption key is
2037
- * re-encrypted for the password under the new kdf settings. This returns the re-encrypted
2038
- * user key and the new password hash but does not update sdk state.
2039
- * @param {string} password
2040
- * @param {Kdf} kdf
2041
- * @returns {UpdateKdfResponse}
2048
+ * Creates a rotated set of account keys for the current state
2049
+ * @returns {UserCryptoV2KeysResponse}
2042
2050
  */
2043
- make_update_kdf(password, kdf) {
2051
+ get_v2_rotated_account_keys() {
2044
2052
  try {
2045
2053
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2046
- const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2047
- const len0 = WASM_VECTOR_LEN;
2048
- wasm.cryptoclient_make_update_kdf(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(kdf));
2054
+ wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr);
2049
2055
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2050
2056
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2051
2057
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2058,18 +2064,13 @@ export class CryptoClient {
2058
2064
  }
2059
2065
  }
2060
2066
  /**
2061
- * Protects the current user key with the provided PIN. The result can be stored and later
2062
- * used to initialize another client instance by using the PIN and the PIN key with
2063
- * `initialize_user_crypto`.
2064
- * @param {string} pin
2065
- * @returns {EnrollPinResponse}
2067
+ * Makes a new signing key pair and signs the public key for the user
2068
+ * @returns {UserCryptoV2KeysResponse}
2066
2069
  */
2067
- enroll_pin(pin) {
2070
+ make_keys_for_user_crypto_v2() {
2068
2071
  try {
2069
2072
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2070
- const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2071
- const len0 = WASM_VECTOR_LEN;
2072
- wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
2073
+ wasm.cryptoclient_make_keys_for_user_crypto_v2(retptr, this.__wbg_ptr);
2073
2074
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2074
2075
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2075
2076
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2173,6 +2174,74 @@ export class ExporterClient {
2173
2174
  const ptr = this.__destroy_into_raw();
2174
2175
  wasm.__wbg_exporterclient_free(ptr, 0);
2175
2176
  }
2177
+ /**
2178
+ * Credential Exchange Format (CXF)
2179
+ *
2180
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2181
+ *
2182
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2183
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2184
+ * @param {Account} account
2185
+ * @param {Cipher[]} ciphers
2186
+ * @returns {string}
2187
+ */
2188
+ export_cxf(account, ciphers) {
2189
+ let deferred3_0;
2190
+ let deferred3_1;
2191
+ try {
2192
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2193
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2194
+ const len0 = WASM_VECTOR_LEN;
2195
+ wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), ptr0, len0);
2196
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2197
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2198
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2199
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2200
+ var ptr2 = r0;
2201
+ var len2 = r1;
2202
+ if (r3) {
2203
+ ptr2 = 0;
2204
+ len2 = 0;
2205
+ throw takeObject(r2);
2206
+ }
2207
+ deferred3_0 = ptr2;
2208
+ deferred3_1 = len2;
2209
+ return getStringFromWasm0(ptr2, len2);
2210
+ } finally {
2211
+ wasm.__wbindgen_add_to_stack_pointer(16);
2212
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2213
+ }
2214
+ }
2215
+ /**
2216
+ * Credential Exchange Format (CXF)
2217
+ *
2218
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2219
+ *
2220
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2221
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2222
+ * @param {string} payload
2223
+ * @returns {Cipher[]}
2224
+ */
2225
+ import_cxf(payload) {
2226
+ try {
2227
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2228
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2229
+ const len0 = WASM_VECTOR_LEN;
2230
+ wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
2231
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2232
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2233
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2234
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2235
+ if (r3) {
2236
+ throw takeObject(r2);
2237
+ }
2238
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2239
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
2240
+ return v2;
2241
+ } finally {
2242
+ wasm.__wbindgen_add_to_stack_pointer(16);
2243
+ }
2244
+ }
2176
2245
  /**
2177
2246
  * @param {Folder[]} folders
2178
2247
  * @param {Cipher[]} ciphers
@@ -2259,74 +2328,6 @@ export class ExporterClient {
2259
2328
  wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2260
2329
  }
2261
2330
  }
2262
- /**
2263
- * Credential Exchange Format (CXF)
2264
- *
2265
- * *Warning:* Expect this API to be unstable, and it will change in the future.
2266
- *
2267
- * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2268
- * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2269
- * @param {Account} account
2270
- * @param {Cipher[]} ciphers
2271
- * @returns {string}
2272
- */
2273
- export_cxf(account, ciphers) {
2274
- let deferred3_0;
2275
- let deferred3_1;
2276
- try {
2277
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2278
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2279
- const len0 = WASM_VECTOR_LEN;
2280
- wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), ptr0, len0);
2281
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2282
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2283
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2284
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2285
- var ptr2 = r0;
2286
- var len2 = r1;
2287
- if (r3) {
2288
- ptr2 = 0;
2289
- len2 = 0;
2290
- throw takeObject(r2);
2291
- }
2292
- deferred3_0 = ptr2;
2293
- deferred3_1 = len2;
2294
- return getStringFromWasm0(ptr2, len2);
2295
- } finally {
2296
- wasm.__wbindgen_add_to_stack_pointer(16);
2297
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2298
- }
2299
- }
2300
- /**
2301
- * Credential Exchange Format (CXF)
2302
- *
2303
- * *Warning:* Expect this API to be unstable, and it will change in the future.
2304
- *
2305
- * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2306
- * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2307
- * @param {string} payload
2308
- * @returns {Cipher[]}
2309
- */
2310
- import_cxf(payload) {
2311
- try {
2312
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2313
- const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2314
- const len0 = WASM_VECTOR_LEN;
2315
- wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
2316
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2317
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2318
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2319
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2320
- if (r3) {
2321
- throw takeObject(r2);
2322
- }
2323
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2324
- wasm.__wbindgen_free(r0, r1 * 4, 4);
2325
- return v2;
2326
- } finally {
2327
- wasm.__wbindgen_add_to_stack_pointer(16);
2328
- }
2329
- }
2330
2331
  }
2331
2332
  if (Symbol.dispose) ExporterClient.prototype[Symbol.dispose] = ExporterClient.prototype.free;
2332
2333
 
@@ -2357,46 +2358,6 @@ export class FoldersClient {
2357
2358
  const ptr = this.__destroy_into_raw();
2358
2359
  wasm.__wbg_foldersclient_free(ptr, 0);
2359
2360
  }
2360
- /**
2361
- * Encrypt a [FolderView] to a [Folder].
2362
- * @param {FolderView} folder_view
2363
- * @returns {Folder}
2364
- */
2365
- encrypt(folder_view) {
2366
- try {
2367
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2368
- wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
2369
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2370
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2371
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2372
- if (r2) {
2373
- throw takeObject(r1);
2374
- }
2375
- return takeObject(r0);
2376
- } finally {
2377
- wasm.__wbindgen_add_to_stack_pointer(16);
2378
- }
2379
- }
2380
- /**
2381
- * Encrypt a [Folder] to [FolderView].
2382
- * @param {Folder} folder
2383
- * @returns {FolderView}
2384
- */
2385
- decrypt(folder) {
2386
- try {
2387
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2388
- wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
2389
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2390
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2391
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2392
- if (r2) {
2393
- throw takeObject(r1);
2394
- }
2395
- return takeObject(r0);
2396
- } finally {
2397
- wasm.__wbindgen_add_to_stack_pointer(16);
2398
- }
2399
- }
2400
2361
  /**
2401
2362
  * Decrypt a list of [Folder]s to a list of [FolderView]s.
2402
2363
  * @param {Folder[]} folders
@@ -2422,14 +2383,6 @@ export class FoldersClient {
2422
2383
  wasm.__wbindgen_add_to_stack_pointer(16);
2423
2384
  }
2424
2385
  }
2425
- /**
2426
- * Get all folders from state and decrypt them to a list of [FolderView].
2427
- * @returns {Promise<FolderView[]>}
2428
- */
2429
- list() {
2430
- const ret = wasm.foldersclient_list(this.__wbg_ptr);
2431
- return takeObject(ret);
2432
- }
2433
2386
  /**
2434
2387
  * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
2435
2388
  * @param {FolderId} folder_id
@@ -2439,15 +2392,6 @@ export class FoldersClient {
2439
2392
  const ret = wasm.foldersclient_get(this.__wbg_ptr, addHeapObject(folder_id));
2440
2393
  return takeObject(ret);
2441
2394
  }
2442
- /**
2443
- * Create a new [Folder] and save it to the server.
2444
- * @param {FolderAddEditRequest} request
2445
- * @returns {Promise<FolderView>}
2446
- */
2447
- create(request) {
2448
- const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
2449
- return takeObject(ret);
2450
- }
2451
2395
  /**
2452
2396
  * Edit the [Folder] and save it to the server.
2453
2397
  * @param {FolderId} folder_id
@@ -2462,14 +2406,71 @@ export class FoldersClient {
2462
2406
  );
2463
2407
  return takeObject(ret);
2464
2408
  }
2465
- }
2466
- if (Symbol.dispose) FoldersClient.prototype[Symbol.dispose] = FoldersClient.prototype.free;
2467
-
2468
- const GeneratorClientFinalization =
2469
- typeof FinalizationRegistry === "undefined"
2470
- ? { register: () => {}, unregister: () => {} }
2471
- : new FinalizationRegistry((ptr) => wasm.__wbg_generatorclient_free(ptr >>> 0, 1));
2472
-
2409
+ /**
2410
+ * Get all folders from state and decrypt them to a list of [FolderView].
2411
+ * @returns {Promise<FolderView[]>}
2412
+ */
2413
+ list() {
2414
+ const ret = wasm.foldersclient_list(this.__wbg_ptr);
2415
+ return takeObject(ret);
2416
+ }
2417
+ /**
2418
+ * Create a new [Folder] and save it to the server.
2419
+ * @param {FolderAddEditRequest} request
2420
+ * @returns {Promise<FolderView>}
2421
+ */
2422
+ create(request) {
2423
+ const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
2424
+ return takeObject(ret);
2425
+ }
2426
+ /**
2427
+ * Encrypt a [Folder] to [FolderView].
2428
+ * @param {Folder} folder
2429
+ * @returns {FolderView}
2430
+ */
2431
+ decrypt(folder) {
2432
+ try {
2433
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2434
+ wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
2435
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2436
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2437
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2438
+ if (r2) {
2439
+ throw takeObject(r1);
2440
+ }
2441
+ return takeObject(r0);
2442
+ } finally {
2443
+ wasm.__wbindgen_add_to_stack_pointer(16);
2444
+ }
2445
+ }
2446
+ /**
2447
+ * Encrypt a [FolderView] to a [Folder].
2448
+ * @param {FolderView} folder_view
2449
+ * @returns {Folder}
2450
+ */
2451
+ encrypt(folder_view) {
2452
+ try {
2453
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2454
+ wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
2455
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2456
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2457
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2458
+ if (r2) {
2459
+ throw takeObject(r1);
2460
+ }
2461
+ return takeObject(r0);
2462
+ } finally {
2463
+ wasm.__wbindgen_add_to_stack_pointer(16);
2464
+ }
2465
+ }
2466
+ }
2467
+ if (Symbol.dispose) FoldersClient.prototype[Symbol.dispose] = FoldersClient.prototype.free;
2468
+
2469
+ const GeneratorClientFinalization =
2470
+ typeof FinalizationRegistry === "undefined"
2471
+ ? { register: () => {}, unregister: () => {} }
2472
+ : new FinalizationRegistry((ptr) => wasm.__wbg_generatorclient_free(ptr >>> 0, 1));
2473
+
2473
2474
  export class GeneratorClient {
2474
2475
  static __wrap(ptr) {
2475
2476
  ptr = ptr >>> 0;
@@ -2491,38 +2492,38 @@ export class GeneratorClient {
2491
2492
  wasm.__wbg_generatorclient_free(ptr, 0);
2492
2493
  }
2493
2494
  /**
2494
- * Generates a random password.
2495
+ * Generates a random passphrase.
2496
+ * A passphrase is a combination of random words separated by a character.
2497
+ * An example of passphrase is `correct horse battery staple`.
2495
2498
  *
2496
- * The character sets and password length can be customized using the `input` parameter.
2499
+ * The number of words and their case, the word separator, and the inclusion of
2500
+ * a number in the passphrase can be customized using the `input` parameter.
2497
2501
  *
2498
2502
  * # Examples
2499
2503
  *
2500
2504
  * ```
2501
2505
  * use bitwarden_core::Client;
2502
- * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2506
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
2503
2507
  *
2504
2508
  * async fn test() -> Result<(), PassphraseError> {
2505
- * let input = PasswordGeneratorRequest {
2506
- * lowercase: true,
2507
- * uppercase: true,
2508
- * numbers: true,
2509
- * length: 20,
2509
+ * let input = PassphraseGeneratorRequest {
2510
+ * num_words: 4,
2510
2511
  * ..Default::default()
2511
2512
  * };
2512
- * let password = Client::new(None).generator().password(input).unwrap();
2513
- * println!("{}", password);
2513
+ * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
2514
+ * println!("{}", passphrase);
2514
2515
  * Ok(())
2515
2516
  * }
2516
2517
  * ```
2517
- * @param {PasswordGeneratorRequest} input
2518
+ * @param {PassphraseGeneratorRequest} input
2518
2519
  * @returns {string}
2519
2520
  */
2520
- password(input) {
2521
+ passphrase(input) {
2521
2522
  let deferred2_0;
2522
2523
  let deferred2_1;
2523
2524
  try {
2524
2525
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2525
- wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
2526
+ wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
2526
2527
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2527
2528
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2528
2529
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2543,38 +2544,38 @@ export class GeneratorClient {
2543
2544
  }
2544
2545
  }
2545
2546
  /**
2546
- * Generates a random passphrase.
2547
- * A passphrase is a combination of random words separated by a character.
2548
- * An example of passphrase is `correct horse battery staple`.
2547
+ * Generates a random password.
2549
2548
  *
2550
- * The number of words and their case, the word separator, and the inclusion of
2551
- * a number in the passphrase can be customized using the `input` parameter.
2549
+ * The character sets and password length can be customized using the `input` parameter.
2552
2550
  *
2553
2551
  * # Examples
2554
2552
  *
2555
2553
  * ```
2556
2554
  * use bitwarden_core::Client;
2557
- * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
2555
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2558
2556
  *
2559
2557
  * async fn test() -> Result<(), PassphraseError> {
2560
- * let input = PassphraseGeneratorRequest {
2561
- * num_words: 4,
2558
+ * let input = PasswordGeneratorRequest {
2559
+ * lowercase: true,
2560
+ * uppercase: true,
2561
+ * numbers: true,
2562
+ * length: 20,
2562
2563
  * ..Default::default()
2563
2564
  * };
2564
- * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
2565
- * println!("{}", passphrase);
2565
+ * let password = Client::new(None).generator().password(input).unwrap();
2566
+ * println!("{}", password);
2566
2567
  * Ok(())
2567
2568
  * }
2568
2569
  * ```
2569
- * @param {PassphraseGeneratorRequest} input
2570
+ * @param {PasswordGeneratorRequest} input
2570
2571
  * @returns {string}
2571
2572
  */
2572
- passphrase(input) {
2573
+ password(input) {
2573
2574
  let deferred2_0;
2574
2575
  let deferred2_1;
2575
2576
  try {
2576
2577
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2577
- wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
2578
+ wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
2578
2579
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2579
2580
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2580
2581
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2652,6 +2653,39 @@ export class IncomingMessage {
2652
2653
  const ptr = this.__destroy_into_raw();
2653
2654
  wasm.__wbg_incomingmessage_free(ptr, 0);
2654
2655
  }
2656
+ /**
2657
+ * Try to parse the payload as JSON.
2658
+ * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2659
+ */
2660
+ parse_payload_as_json() {
2661
+ const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2662
+ return takeObject(ret);
2663
+ }
2664
+ /**
2665
+ * @param {Uint8Array} payload
2666
+ * @param {Endpoint} destination
2667
+ * @param {Endpoint} source
2668
+ * @param {string | null} [topic]
2669
+ */
2670
+ constructor(payload, destination, source, topic) {
2671
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2672
+ const len0 = WASM_VECTOR_LEN;
2673
+ var ptr1 = isLikeNone(topic)
2674
+ ? 0
2675
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2676
+ var len1 = WASM_VECTOR_LEN;
2677
+ const ret = wasm.incomingmessage_new(
2678
+ ptr0,
2679
+ len0,
2680
+ addHeapObject(destination),
2681
+ addHeapObject(source),
2682
+ ptr1,
2683
+ len1,
2684
+ );
2685
+ this.__wbg_ptr = ret >>> 0;
2686
+ IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
2687
+ return this;
2688
+ }
2655
2689
  /**
2656
2690
  * @returns {Uint8Array}
2657
2691
  */
@@ -2731,39 +2765,6 @@ export class IncomingMessage {
2731
2765
  var len0 = WASM_VECTOR_LEN;
2732
2766
  wasm.__wbg_set_incomingmessage_topic(this.__wbg_ptr, ptr0, len0);
2733
2767
  }
2734
- /**
2735
- * @param {Uint8Array} payload
2736
- * @param {Endpoint} destination
2737
- * @param {Endpoint} source
2738
- * @param {string | null} [topic]
2739
- */
2740
- constructor(payload, destination, source, topic) {
2741
- const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2742
- const len0 = WASM_VECTOR_LEN;
2743
- var ptr1 = isLikeNone(topic)
2744
- ? 0
2745
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2746
- var len1 = WASM_VECTOR_LEN;
2747
- const ret = wasm.incomingmessage_new(
2748
- ptr0,
2749
- len0,
2750
- addHeapObject(destination),
2751
- addHeapObject(source),
2752
- ptr1,
2753
- len1,
2754
- );
2755
- this.__wbg_ptr = ret >>> 0;
2756
- IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
2757
- return this;
2758
- }
2759
- /**
2760
- * Try to parse the payload as JSON.
2761
- * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2762
- */
2763
- parse_payload_as_json() {
2764
- const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2765
- return takeObject(ret);
2766
- }
2767
2768
  }
2768
2769
  if (Symbol.dispose) IncomingMessage.prototype[Symbol.dispose] = IncomingMessage.prototype.free;
2769
2770
 
@@ -2795,6 +2796,13 @@ export class IpcClient {
2795
2796
  const ptr = this.__destroy_into_raw();
2796
2797
  wasm.__wbg_ipcclient_free(ptr, 0);
2797
2798
  }
2799
+ /**
2800
+ * @returns {Promise<boolean>}
2801
+ */
2802
+ isRunning() {
2803
+ const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2804
+ return takeObject(ret);
2805
+ }
2798
2806
  /**
2799
2807
  * Create a new `IpcClient` instance with an in-memory session repository for saving
2800
2808
  * sessions within the SDK.
@@ -2821,20 +2829,6 @@ export class IpcClient {
2821
2829
  );
2822
2830
  return IpcClient.__wrap(ret);
2823
2831
  }
2824
- /**
2825
- * @returns {Promise<void>}
2826
- */
2827
- start() {
2828
- const ret = wasm.ipcclient_start(this.__wbg_ptr);
2829
- return takeObject(ret);
2830
- }
2831
- /**
2832
- * @returns {Promise<boolean>}
2833
- */
2834
- isRunning() {
2835
- const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2836
- return takeObject(ret);
2837
- }
2838
2832
  /**
2839
2833
  * @param {OutgoingMessage} message
2840
2834
  * @returns {Promise<void>}
@@ -2845,6 +2839,13 @@ export class IpcClient {
2845
2839
  const ret = wasm.ipcclient_send(this.__wbg_ptr, ptr0);
2846
2840
  return takeObject(ret);
2847
2841
  }
2842
+ /**
2843
+ * @returns {Promise<void>}
2844
+ */
2845
+ start() {
2846
+ const ret = wasm.ipcclient_start(this.__wbg_ptr);
2847
+ return takeObject(ret);
2848
+ }
2848
2849
  /**
2849
2850
  * @returns {Promise<IpcClientSubscription>}
2850
2851
  */
@@ -2976,28 +2977,77 @@ export class OutgoingMessage {
2976
2977
  wasm.__wbg_outgoingmessage_free(ptr, 0);
2977
2978
  }
2978
2979
  /**
2979
- * @returns {Uint8Array}
2980
+ * Create a new message and encode the payload as JSON.
2981
+ * @param {any} payload
2982
+ * @param {Endpoint} destination
2983
+ * @param {string | null} [topic]
2984
+ * @returns {OutgoingMessage}
2980
2985
  */
2981
- get payload() {
2986
+ static new_json_payload(payload, destination, topic) {
2982
2987
  try {
2983
2988
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2984
- wasm.__wbg_get_outgoingmessage_payload(retptr, this.__wbg_ptr);
2989
+ var ptr0 = isLikeNone(topic)
2990
+ ? 0
2991
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2992
+ var len0 = WASM_VECTOR_LEN;
2993
+ wasm.outgoingmessage_new_json_payload(
2994
+ retptr,
2995
+ addHeapObject(payload),
2996
+ addHeapObject(destination),
2997
+ ptr0,
2998
+ len0,
2999
+ );
2985
3000
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2986
3001
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2987
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
2988
- wasm.__wbindgen_free(r0, r1 * 1, 1);
2989
- return v1;
3002
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3003
+ if (r2) {
3004
+ throw takeObject(r1);
3005
+ }
3006
+ return OutgoingMessage.__wrap(r0);
2990
3007
  } finally {
2991
3008
  wasm.__wbindgen_add_to_stack_pointer(16);
2992
3009
  }
2993
3010
  }
2994
3011
  /**
2995
- * @param {Uint8Array} arg0
3012
+ * @param {Uint8Array} payload
3013
+ * @param {Endpoint} destination
3014
+ * @param {string | null} [topic]
2996
3015
  */
2997
- set payload(arg0) {
2998
- const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
3016
+ constructor(payload, destination, topic) {
3017
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2999
3018
  const len0 = WASM_VECTOR_LEN;
3000
- wasm.__wbg_set_outgoingmessage_payload(this.__wbg_ptr, ptr0, len0);
3019
+ var ptr1 = isLikeNone(topic)
3020
+ ? 0
3021
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3022
+ var len1 = WASM_VECTOR_LEN;
3023
+ const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
3024
+ this.__wbg_ptr = ret >>> 0;
3025
+ OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
3026
+ return this;
3027
+ }
3028
+ /**
3029
+ * @returns {Uint8Array}
3030
+ */
3031
+ get payload() {
3032
+ try {
3033
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3034
+ wasm.__wbg_get_outgoingmessage_payload(retptr, this.__wbg_ptr);
3035
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3036
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3037
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3038
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3039
+ return v1;
3040
+ } finally {
3041
+ wasm.__wbindgen_add_to_stack_pointer(16);
3042
+ }
3043
+ }
3044
+ /**
3045
+ * @param {Uint8Array} arg0
3046
+ */
3047
+ set payload(arg0) {
3048
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
3049
+ const len0 = WASM_VECTOR_LEN;
3050
+ wasm.__wbg_set_outgoingmessage_payload(this.__wbg_ptr, ptr0, len0);
3001
3051
  }
3002
3052
  /**
3003
3053
  * @returns {Endpoint}
@@ -3041,55 +3091,6 @@ export class OutgoingMessage {
3041
3091
  var len0 = WASM_VECTOR_LEN;
3042
3092
  wasm.__wbg_set_outgoingmessage_topic(this.__wbg_ptr, ptr0, len0);
3043
3093
  }
3044
- /**
3045
- * @param {Uint8Array} payload
3046
- * @param {Endpoint} destination
3047
- * @param {string | null} [topic]
3048
- */
3049
- constructor(payload, destination, topic) {
3050
- const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
3051
- const len0 = WASM_VECTOR_LEN;
3052
- var ptr1 = isLikeNone(topic)
3053
- ? 0
3054
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3055
- var len1 = WASM_VECTOR_LEN;
3056
- const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
3057
- this.__wbg_ptr = ret >>> 0;
3058
- OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
3059
- return this;
3060
- }
3061
- /**
3062
- * Create a new message and encode the payload as JSON.
3063
- * @param {any} payload
3064
- * @param {Endpoint} destination
3065
- * @param {string | null} [topic]
3066
- * @returns {OutgoingMessage}
3067
- */
3068
- static new_json_payload(payload, destination, topic) {
3069
- try {
3070
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3071
- var ptr0 = isLikeNone(topic)
3072
- ? 0
3073
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3074
- var len0 = WASM_VECTOR_LEN;
3075
- wasm.outgoingmessage_new_json_payload(
3076
- retptr,
3077
- addHeapObject(payload),
3078
- addHeapObject(destination),
3079
- ptr0,
3080
- len0,
3081
- );
3082
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3083
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3084
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3085
- if (r2) {
3086
- throw takeObject(r1);
3087
- }
3088
- return OutgoingMessage.__wrap(r0);
3089
- } finally {
3090
- wasm.__wbindgen_add_to_stack_pointer(16);
3091
- }
3092
- }
3093
3094
  }
3094
3095
  if (Symbol.dispose) OutgoingMessage.prototype[Symbol.dispose] = OutgoingMessage.prototype.free;
3095
3096
 
@@ -3112,6 +3113,14 @@ export class PasswordManagerClient {
3112
3113
  const ptr = this.__destroy_into_raw();
3113
3114
  wasm.__wbg_passwordmanagerclient_free(ptr, 0);
3114
3115
  }
3116
+ /**
3117
+ * Bitwarden licensed operations.
3118
+ * @returns {CommercialPasswordManagerClient}
3119
+ */
3120
+ commercial() {
3121
+ const ret = wasm.passwordmanagerclient_commercial(this.__wbg_ptr);
3122
+ return CommercialPasswordManagerClient.__wrap(ret);
3123
+ }
3115
3124
  /**
3116
3125
  * Initialize a new instance of the SDK client
3117
3126
  * @param {any} token_provider
@@ -3126,6 +3135,14 @@ export class PasswordManagerClient {
3126
3135
  PasswordManagerClientFinalization.register(this, this.__wbg_ptr, this);
3127
3136
  return this;
3128
3137
  }
3138
+ /**
3139
+ * Auth related operations.
3140
+ * @returns {AuthClient}
3141
+ */
3142
+ auth() {
3143
+ const ret = wasm.passwordmanagerclient_auth(this.__wbg_ptr);
3144
+ return AuthClient.__wrap(ret);
3145
+ }
3129
3146
  /**
3130
3147
  * Test method, echoes back the input
3131
3148
  * @param {string} msg
@@ -3149,26 +3166,6 @@ export class PasswordManagerClient {
3149
3166
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
3150
3167
  }
3151
3168
  }
3152
- /**
3153
- * Returns the current SDK version
3154
- * @returns {string}
3155
- */
3156
- version() {
3157
- let deferred1_0;
3158
- let deferred1_1;
3159
- try {
3160
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3161
- wasm.passwordmanagerclient_version(retptr, this.__wbg_ptr);
3162
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3163
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3164
- deferred1_0 = r0;
3165
- deferred1_1 = r1;
3166
- return getStringFromWasm0(r0, r1);
3167
- } finally {
3168
- wasm.__wbindgen_add_to_stack_pointer(16);
3169
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3170
- }
3171
- }
3172
3169
  /**
3173
3170
  * Test method, always throws an error
3174
3171
  * @param {string} msg
@@ -3189,31 +3186,12 @@ export class PasswordManagerClient {
3189
3186
  }
3190
3187
  }
3191
3188
  /**
3192
- * Test method, calls http endpoint
3193
- * @param {string} url
3194
- * @returns {Promise<string>}
3195
- */
3196
- http_get(url) {
3197
- const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3198
- const len0 = WASM_VECTOR_LEN;
3199
- const ret = wasm.passwordmanagerclient_http_get(this.__wbg_ptr, ptr0, len0);
3200
- return takeObject(ret);
3201
- }
3202
- /**
3203
- * Auth related operations.
3204
- * @returns {AuthClient}
3205
- */
3206
- auth() {
3207
- const ret = wasm.passwordmanagerclient_auth(this.__wbg_ptr);
3208
- return AuthClient.__wrap(ret);
3209
- }
3210
- /**
3211
- * Bitwarden licensed operations.
3212
- * @returns {CommercialPasswordManagerClient}
3189
+ * Vault item related operations.
3190
+ * @returns {VaultClient}
3213
3191
  */
3214
- commercial() {
3215
- const ret = wasm.passwordmanagerclient_commercial(this.__wbg_ptr);
3216
- return CommercialPasswordManagerClient.__wrap(ret);
3192
+ vault() {
3193
+ const ret = wasm.passwordmanagerclient_vault(this.__wbg_ptr);
3194
+ return VaultClient.__wrap(ret);
3217
3195
  }
3218
3196
  /**
3219
3197
  * Crypto related operations.
@@ -3224,12 +3202,35 @@ export class PasswordManagerClient {
3224
3202
  return CryptoClient.__wrap(ret);
3225
3203
  }
3226
3204
  /**
3227
- * Vault item related operations.
3228
- * @returns {VaultClient}
3205
+ * Returns the current SDK version
3206
+ * @returns {string}
3229
3207
  */
3230
- vault() {
3231
- const ret = wasm.passwordmanagerclient_vault(this.__wbg_ptr);
3232
- return VaultClient.__wrap(ret);
3208
+ version() {
3209
+ let deferred1_0;
3210
+ let deferred1_1;
3211
+ try {
3212
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3213
+ wasm.passwordmanagerclient_version(retptr, this.__wbg_ptr);
3214
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3215
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3216
+ deferred1_0 = r0;
3217
+ deferred1_1 = r1;
3218
+ return getStringFromWasm0(r0, r1);
3219
+ } finally {
3220
+ wasm.__wbindgen_add_to_stack_pointer(16);
3221
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3222
+ }
3223
+ }
3224
+ /**
3225
+ * Test method, calls http endpoint
3226
+ * @param {string} url
3227
+ * @returns {Promise<string>}
3228
+ */
3229
+ http_get(url) {
3230
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3231
+ const len0 = WASM_VECTOR_LEN;
3232
+ const ret = wasm.passwordmanagerclient_http_get(this.__wbg_ptr, ptr0, len0);
3233
+ return takeObject(ret);
3233
3234
  }
3234
3235
  /**
3235
3236
  * Constructs a specific client for platform-specific functionality
@@ -3239,14 +3240,6 @@ export class PasswordManagerClient {
3239
3240
  const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3240
3241
  return PlatformClient.__wrap(ret);
3241
3242
  }
3242
- /**
3243
- * Constructs a specific client for generating passwords and passphrases
3244
- * @returns {GeneratorClient}
3245
- */
3246
- generator() {
3247
- const ret = wasm.passwordmanagerclient_generator(this.__wbg_ptr);
3248
- return GeneratorClient.__wrap(ret);
3249
- }
3250
3243
  /**
3251
3244
  * Exporter related operations.
3252
3245
  * @returns {ExporterClient}
@@ -3255,6 +3248,14 @@ export class PasswordManagerClient {
3255
3248
  const ret = wasm.passwordmanagerclient_exporters(this.__wbg_ptr);
3256
3249
  return ExporterClient.__wrap(ret);
3257
3250
  }
3251
+ /**
3252
+ * Constructs a specific client for generating passwords and passphrases
3253
+ * @returns {GeneratorClient}
3254
+ */
3255
+ generator() {
3256
+ const ret = wasm.passwordmanagerclient_generator(this.__wbg_ptr);
3257
+ return GeneratorClient.__wrap(ret);
3258
+ }
3258
3259
  }
3259
3260
  if (Symbol.dispose)
3260
3261
  PasswordManagerClient.prototype[Symbol.dispose] = PasswordManagerClient.prototype.free;
@@ -3284,13 +3285,6 @@ export class PlatformClient {
3284
3285
  const ptr = this.__destroy_into_raw();
3285
3286
  wasm.__wbg_platformclient_free(ptr, 0);
3286
3287
  }
3287
- /**
3288
- * @returns {StateClient}
3289
- */
3290
- state() {
3291
- const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3292
- return StateClient.__wrap(ret);
3293
- }
3294
3288
  /**
3295
3289
  * Load feature flags into the client
3296
3290
  * @param {FeatureFlags} flags
@@ -3308,6 +3302,13 @@ export class PlatformClient {
3308
3302
  wasm.__wbindgen_add_to_stack_pointer(16);
3309
3303
  }
3310
3304
  }
3305
+ /**
3306
+ * @returns {StateClient}
3307
+ */
3308
+ state() {
3309
+ const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3310
+ return StateClient.__wrap(ret);
3311
+ }
3311
3312
  }
3312
3313
  if (Symbol.dispose) PlatformClient.prototype[Symbol.dispose] = PlatformClient.prototype.free;
3313
3314
 
@@ -3334,144 +3335,150 @@ export class PureCrypto {
3334
3335
  wasm.__wbg_purecrypto_free(ptr, 0);
3335
3336
  }
3336
3337
  /**
3337
- * DEPRECATED: Use `symmetric_decrypt_string` instead.
3338
- * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3339
- * @param {string} enc_string
3340
- * @param {Uint8Array} key
3341
- * @returns {string}
3338
+ * Decrypts data using RSAES-OAEP with SHA-1
3339
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3340
+ * @param {Uint8Array} encrypted_data
3341
+ * @param {Uint8Array} private_key
3342
+ * @returns {Uint8Array}
3342
3343
  */
3343
- static symmetric_decrypt(enc_string, key) {
3344
- let deferred4_0;
3345
- let deferred4_1;
3344
+ static rsa_decrypt_data(encrypted_data, private_key) {
3346
3345
  try {
3347
3346
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3348
- const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3347
+ const ptr0 = passArray8ToWasm0(encrypted_data, wasm.__wbindgen_malloc);
3349
3348
  const len0 = WASM_VECTOR_LEN;
3350
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3349
+ const ptr1 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
3351
3350
  const len1 = WASM_VECTOR_LEN;
3352
- wasm.purecrypto_symmetric_decrypt(retptr, ptr0, len0, ptr1, len1);
3351
+ wasm.purecrypto_rsa_decrypt_data(retptr, ptr0, len0, ptr1, len1);
3353
3352
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3354
3353
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3355
3354
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3356
3355
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3357
- var ptr3 = r0;
3358
- var len3 = r1;
3359
3356
  if (r3) {
3360
- ptr3 = 0;
3361
- len3 = 0;
3362
3357
  throw takeObject(r2);
3363
3358
  }
3364
- deferred4_0 = ptr3;
3365
- deferred4_1 = len3;
3366
- return getStringFromWasm0(ptr3, len3);
3359
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3360
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3361
+ return v3;
3367
3362
  } finally {
3368
3363
  wasm.__wbindgen_add_to_stack_pointer(16);
3369
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3370
3364
  }
3371
3365
  }
3372
3366
  /**
3373
- * @param {string} enc_string
3374
- * @param {Uint8Array} key
3375
- * @returns {string}
3367
+ * Encrypts data using RSAES-OAEP with SHA-1
3368
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3369
+ * @param {Uint8Array} plain_data
3370
+ * @param {Uint8Array} public_key
3371
+ * @returns {Uint8Array}
3376
3372
  */
3377
- static symmetric_decrypt_string(enc_string, key) {
3378
- let deferred4_0;
3379
- let deferred4_1;
3373
+ static rsa_encrypt_data(plain_data, public_key) {
3380
3374
  try {
3381
3375
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3382
- const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3376
+ const ptr0 = passArray8ToWasm0(plain_data, wasm.__wbindgen_malloc);
3383
3377
  const len0 = WASM_VECTOR_LEN;
3384
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3378
+ const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
3385
3379
  const len1 = WASM_VECTOR_LEN;
3386
- wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
3380
+ wasm.purecrypto_rsa_encrypt_data(retptr, ptr0, len0, ptr1, len1);
3387
3381
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3388
3382
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3389
3383
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3390
3384
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3391
- var ptr3 = r0;
3392
- var len3 = r1;
3393
3385
  if (r3) {
3394
- ptr3 = 0;
3395
- len3 = 0;
3396
3386
  throw takeObject(r2);
3397
3387
  }
3398
- deferred4_0 = ptr3;
3399
- deferred4_1 = len3;
3400
- return getStringFromWasm0(ptr3, len3);
3388
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3389
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3390
+ return v3;
3401
3391
  } finally {
3402
3392
  wasm.__wbindgen_add_to_stack_pointer(16);
3403
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3404
3393
  }
3405
3394
  }
3406
3395
  /**
3396
+ * DEPRECATED: Use `symmetric_decrypt_string` instead.
3397
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3407
3398
  * @param {string} enc_string
3408
3399
  * @param {Uint8Array} key
3409
- * @returns {Uint8Array}
3400
+ * @returns {string}
3410
3401
  */
3411
- static symmetric_decrypt_bytes(enc_string, key) {
3402
+ static symmetric_decrypt(enc_string, key) {
3403
+ let deferred4_0;
3404
+ let deferred4_1;
3412
3405
  try {
3413
3406
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3414
3407
  const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3415
3408
  const len0 = WASM_VECTOR_LEN;
3416
3409
  const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3417
3410
  const len1 = WASM_VECTOR_LEN;
3418
- wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3411
+ wasm.purecrypto_symmetric_decrypt(retptr, ptr0, len0, ptr1, len1);
3419
3412
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3420
3413
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3421
3414
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3422
3415
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3416
+ var ptr3 = r0;
3417
+ var len3 = r1;
3423
3418
  if (r3) {
3419
+ ptr3 = 0;
3420
+ len3 = 0;
3424
3421
  throw takeObject(r2);
3425
3422
  }
3426
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3427
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3428
- return v3;
3423
+ deferred4_0 = ptr3;
3424
+ deferred4_1 = len3;
3425
+ return getStringFromWasm0(ptr3, len3);
3429
3426
  } finally {
3430
3427
  wasm.__wbindgen_add_to_stack_pointer(16);
3428
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3431
3429
  }
3432
3430
  }
3433
3431
  /**
3434
- * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
3435
- * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3436
- * @param {Uint8Array} enc_bytes
3437
- * @param {Uint8Array} key
3438
- * @returns {Uint8Array}
3432
+ * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
3433
+ * as an EncString.
3434
+ * @param {Uint8Array} key_to_be_wrapped
3435
+ * @param {Uint8Array} wrapping_key
3436
+ * @returns {string}
3439
3437
  */
3440
- static symmetric_decrypt_array_buffer(enc_bytes, key) {
3438
+ static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
3439
+ let deferred4_0;
3440
+ let deferred4_1;
3441
3441
  try {
3442
3442
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3443
- const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3443
+ const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
3444
3444
  const len0 = WASM_VECTOR_LEN;
3445
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3445
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3446
3446
  const len1 = WASM_VECTOR_LEN;
3447
- wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
3447
+ wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3448
3448
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3449
3449
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3450
3450
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3451
3451
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3452
+ var ptr3 = r0;
3453
+ var len3 = r1;
3452
3454
  if (r3) {
3455
+ ptr3 = 0;
3456
+ len3 = 0;
3453
3457
  throw takeObject(r2);
3454
3458
  }
3455
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3456
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3457
- return v3;
3459
+ deferred4_0 = ptr3;
3460
+ deferred4_1 = len3;
3461
+ return getStringFromWasm0(ptr3, len3);
3458
3462
  } finally {
3459
3463
  wasm.__wbindgen_add_to_stack_pointer(16);
3464
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3460
3465
  }
3461
3466
  }
3462
3467
  /**
3463
- * @param {Uint8Array} enc_bytes
3464
- * @param {Uint8Array} key
3468
+ * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
3469
+ * @param {Uint8Array} password
3470
+ * @param {Uint8Array} salt
3471
+ * @param {Kdf} kdf
3465
3472
  * @returns {Uint8Array}
3466
3473
  */
3467
- static symmetric_decrypt_filedata(enc_bytes, key) {
3474
+ static derive_kdf_material(password, salt, kdf) {
3468
3475
  try {
3469
3476
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3470
- const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3477
+ const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
3471
3478
  const len0 = WASM_VECTOR_LEN;
3472
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3479
+ const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
3473
3480
  const len1 = WASM_VECTOR_LEN;
3474
- wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3481
+ wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
3475
3482
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3476
3483
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3477
3484
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3487,87 +3494,70 @@ export class PureCrypto {
3487
3494
  }
3488
3495
  }
3489
3496
  /**
3490
- * @param {string} plain
3491
- * @param {Uint8Array} key
3492
- * @returns {string}
3497
+ * Generates a new RSA key pair and returns the private key
3498
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3499
+ * @returns {Uint8Array}
3493
3500
  */
3494
- static symmetric_encrypt_string(plain, key) {
3495
- let deferred4_0;
3496
- let deferred4_1;
3501
+ static rsa_generate_keypair() {
3497
3502
  try {
3498
3503
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3499
- const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3500
- const len0 = WASM_VECTOR_LEN;
3501
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3502
- const len1 = WASM_VECTOR_LEN;
3503
- wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
3504
+ wasm.purecrypto_rsa_generate_keypair(retptr);
3504
3505
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3505
3506
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3506
3507
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3507
3508
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3508
- var ptr3 = r0;
3509
- var len3 = r1;
3510
3509
  if (r3) {
3511
- ptr3 = 0;
3512
- len3 = 0;
3513
3510
  throw takeObject(r2);
3514
3511
  }
3515
- deferred4_0 = ptr3;
3516
- deferred4_1 = len3;
3517
- return getStringFromWasm0(ptr3, len3);
3512
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3513
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3514
+ return v1;
3518
3515
  } finally {
3519
3516
  wasm.__wbindgen_add_to_stack_pointer(16);
3520
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3521
3517
  }
3522
3518
  }
3523
3519
  /**
3524
- * DEPRECATED: Only used by send keys
3525
- * @param {Uint8Array} plain
3526
- * @param {Uint8Array} key
3527
- * @returns {string}
3520
+ * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
3521
+ * unwrapped key as a serialized byte array.
3522
+ * @param {string} wrapped_key
3523
+ * @param {Uint8Array} wrapping_key
3524
+ * @returns {Uint8Array}
3528
3525
  */
3529
- static symmetric_encrypt_bytes(plain, key) {
3530
- let deferred4_0;
3531
- let deferred4_1;
3526
+ static unwrap_symmetric_key(wrapped_key, wrapping_key) {
3532
3527
  try {
3533
3528
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3534
- const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3529
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3535
3530
  const len0 = WASM_VECTOR_LEN;
3536
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3531
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3537
3532
  const len1 = WASM_VECTOR_LEN;
3538
- wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3533
+ wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3539
3534
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3540
3535
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3541
3536
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3542
3537
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3543
- var ptr3 = r0;
3544
- var len3 = r1;
3545
3538
  if (r3) {
3546
- ptr3 = 0;
3547
- len3 = 0;
3548
3539
  throw takeObject(r2);
3549
3540
  }
3550
- deferred4_0 = ptr3;
3551
- deferred4_1 = len3;
3552
- return getStringFromWasm0(ptr3, len3);
3541
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3542
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3543
+ return v3;
3553
3544
  } finally {
3554
3545
  wasm.__wbindgen_add_to_stack_pointer(16);
3555
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3556
3546
  }
3557
3547
  }
3558
3548
  /**
3559
- * @param {Uint8Array} plain
3560
- * @param {Uint8Array} key
3549
+ * Given a decrypted private RSA key PKCS8 DER this
3550
+ * returns the corresponding public RSA key in DER format.
3551
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3552
+ * @param {Uint8Array} private_key
3561
3553
  * @returns {Uint8Array}
3562
3554
  */
3563
- static symmetric_encrypt_filedata(plain, key) {
3555
+ static rsa_extract_public_key(private_key) {
3564
3556
  try {
3565
3557
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3566
- const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3558
+ const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
3567
3559
  const len0 = WASM_VECTOR_LEN;
3568
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3569
- const len1 = WASM_VECTOR_LEN;
3570
- wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3560
+ wasm.purecrypto_rsa_extract_public_key(retptr, ptr0, len0);
3571
3561
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3572
3562
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3573
3563
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3575,161 +3565,131 @@ export class PureCrypto {
3575
3565
  if (r3) {
3576
3566
  throw takeObject(r2);
3577
3567
  }
3578
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3568
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
3579
3569
  wasm.__wbindgen_free(r0, r1 * 1, 1);
3580
- return v3;
3570
+ return v2;
3581
3571
  } finally {
3582
3572
  wasm.__wbindgen_add_to_stack_pointer(16);
3583
3573
  }
3584
3574
  }
3585
3575
  /**
3586
- * @param {string} encrypted_user_key
3587
- * @param {string} master_password
3588
- * @param {string} email
3589
- * @param {Kdf} kdf
3590
- * @returns {Uint8Array}
3576
+ * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
3577
+ * key,
3578
+ * @param {Uint8Array} decapsulation_key
3579
+ * @param {Uint8Array} wrapping_key
3580
+ * @returns {string}
3591
3581
  */
3592
- static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
3582
+ static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
3583
+ let deferred4_0;
3584
+ let deferred4_1;
3593
3585
  try {
3594
3586
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3595
- const ptr0 = passStringToWasm0(
3596
- encrypted_user_key,
3597
- wasm.__wbindgen_malloc,
3598
- wasm.__wbindgen_realloc,
3599
- );
3587
+ const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3600
3588
  const len0 = WASM_VECTOR_LEN;
3601
- const ptr1 = passStringToWasm0(
3602
- master_password,
3603
- wasm.__wbindgen_malloc,
3604
- wasm.__wbindgen_realloc,
3605
- );
3589
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3606
3590
  const len1 = WASM_VECTOR_LEN;
3607
- const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3608
- const len2 = WASM_VECTOR_LEN;
3609
- wasm.purecrypto_decrypt_user_key_with_master_password(
3610
- retptr,
3611
- ptr0,
3612
- len0,
3613
- ptr1,
3614
- len1,
3615
- ptr2,
3616
- len2,
3617
- addHeapObject(kdf),
3618
- );
3591
+ wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3619
3592
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3620
3593
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3621
3594
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3622
3595
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3596
+ var ptr3 = r0;
3597
+ var len3 = r1;
3623
3598
  if (r3) {
3599
+ ptr3 = 0;
3600
+ len3 = 0;
3624
3601
  throw takeObject(r2);
3625
3602
  }
3626
- var v4 = getArrayU8FromWasm0(r0, r1).slice();
3627
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3628
- return v4;
3603
+ deferred4_0 = ptr3;
3604
+ deferred4_1 = len3;
3605
+ return getStringFromWasm0(ptr3, len3);
3629
3606
  } finally {
3630
3607
  wasm.__wbindgen_add_to_stack_pointer(16);
3608
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3631
3609
  }
3632
3610
  }
3633
3611
  /**
3634
- * @param {Uint8Array} user_key
3635
- * @param {string} master_password
3636
- * @param {string} email
3637
- * @param {Kdf} kdf
3612
+ * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
3613
+ * key. Note: Usually, a public key is - by definition - public, so this should not be
3614
+ * used. The specific use-case for this function is to enable rotateable key sets, where
3615
+ * the "public key" is not public, with the intent of preventing the server from being able
3616
+ * to overwrite the user key unlocked by the rotateable keyset.
3617
+ * @param {Uint8Array} encapsulation_key
3618
+ * @param {Uint8Array} wrapping_key
3638
3619
  * @returns {string}
3639
3620
  */
3640
- static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
3641
- let deferred5_0;
3642
- let deferred5_1;
3621
+ static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
3622
+ let deferred4_0;
3623
+ let deferred4_1;
3643
3624
  try {
3644
3625
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3645
- const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
3626
+ const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3646
3627
  const len0 = WASM_VECTOR_LEN;
3647
- const ptr1 = passStringToWasm0(
3648
- master_password,
3649
- wasm.__wbindgen_malloc,
3650
- wasm.__wbindgen_realloc,
3651
- );
3628
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3652
3629
  const len1 = WASM_VECTOR_LEN;
3653
- const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3654
- const len2 = WASM_VECTOR_LEN;
3655
- wasm.purecrypto_encrypt_user_key_with_master_password(
3656
- retptr,
3657
- ptr0,
3658
- len0,
3659
- ptr1,
3660
- len1,
3661
- ptr2,
3662
- len2,
3663
- addHeapObject(kdf),
3664
- );
3630
+ wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
3665
3631
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3666
3632
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3667
3633
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3668
3634
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3669
- var ptr4 = r0;
3670
- var len4 = r1;
3635
+ var ptr3 = r0;
3636
+ var len3 = r1;
3671
3637
  if (r3) {
3672
- ptr4 = 0;
3673
- len4 = 0;
3638
+ ptr3 = 0;
3639
+ len3 = 0;
3674
3640
  throw takeObject(r2);
3675
3641
  }
3676
- deferred5_0 = ptr4;
3677
- deferred5_1 = len4;
3678
- return getStringFromWasm0(ptr4, len4);
3679
- } finally {
3680
- wasm.__wbindgen_add_to_stack_pointer(16);
3681
- wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
3682
- }
3683
- }
3684
- /**
3685
- * @returns {Uint8Array}
3686
- */
3687
- static make_user_key_aes256_cbc_hmac() {
3688
- try {
3689
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3690
- wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
3691
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3692
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3693
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
3694
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3695
- return v1;
3642
+ deferred4_0 = ptr3;
3643
+ deferred4_1 = len3;
3644
+ return getStringFromWasm0(ptr3, len3);
3696
3645
  } finally {
3697
3646
  wasm.__wbindgen_add_to_stack_pointer(16);
3647
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3698
3648
  }
3699
3649
  }
3700
3650
  /**
3651
+ * @param {string} enc_string
3652
+ * @param {Uint8Array} key
3701
3653
  * @returns {Uint8Array}
3702
3654
  */
3703
- static make_user_key_xchacha20_poly1305() {
3655
+ static symmetric_decrypt_bytes(enc_string, key) {
3704
3656
  try {
3705
3657
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3706
- wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
3658
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3659
+ const len0 = WASM_VECTOR_LEN;
3660
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3661
+ const len1 = WASM_VECTOR_LEN;
3662
+ wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3707
3663
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3708
3664
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3709
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
3665
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3666
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3667
+ if (r3) {
3668
+ throw takeObject(r2);
3669
+ }
3670
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3710
3671
  wasm.__wbindgen_free(r0, r1 * 1, 1);
3711
- return v1;
3672
+ return v3;
3712
3673
  } finally {
3713
3674
  wasm.__wbindgen_add_to_stack_pointer(16);
3714
3675
  }
3715
3676
  }
3716
3677
  /**
3717
- * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
3718
- * as an EncString.
3719
- * @param {Uint8Array} key_to_be_wrapped
3720
- * @param {Uint8Array} wrapping_key
3678
+ * DEPRECATED: Only used by send keys
3679
+ * @param {Uint8Array} plain
3680
+ * @param {Uint8Array} key
3721
3681
  * @returns {string}
3722
3682
  */
3723
- static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
3683
+ static symmetric_encrypt_bytes(plain, key) {
3724
3684
  let deferred4_0;
3725
3685
  let deferred4_1;
3726
3686
  try {
3727
3687
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3728
- const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
3688
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3729
3689
  const len0 = WASM_VECTOR_LEN;
3730
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3690
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3731
3691
  const len1 = WASM_VECTOR_LEN;
3732
- wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3692
+ wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3733
3693
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3734
3694
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3735
3695
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3750,20 +3710,25 @@ export class PureCrypto {
3750
3710
  }
3751
3711
  }
3752
3712
  /**
3753
- * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
3754
- * unwrapped key as a serialized byte array.
3755
- * @param {string} wrapped_key
3756
- * @param {Uint8Array} wrapping_key
3713
+ * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
3714
+ * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
3715
+ * recipient.
3716
+ * @param {string} encapsulated_key
3717
+ * @param {Uint8Array} decapsulation_key
3757
3718
  * @returns {Uint8Array}
3758
3719
  */
3759
- static unwrap_symmetric_key(wrapped_key, wrapping_key) {
3720
+ static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
3760
3721
  try {
3761
3722
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3762
- const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3723
+ const ptr0 = passStringToWasm0(
3724
+ encapsulated_key,
3725
+ wasm.__wbindgen_malloc,
3726
+ wasm.__wbindgen_realloc,
3727
+ );
3763
3728
  const len0 = WASM_VECTOR_LEN;
3764
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3729
+ const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3765
3730
  const len1 = WASM_VECTOR_LEN;
3766
- wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3731
+ wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3767
3732
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3768
3733
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3769
3734
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3779,25 +3744,23 @@ export class PureCrypto {
3779
3744
  }
3780
3745
  }
3781
3746
  /**
3782
- * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
3783
- * key. Note: Usually, a public key is - by definition - public, so this should not be
3784
- * used. The specific use-case for this function is to enable rotateable key sets, where
3785
- * the "public key" is not public, with the intent of preventing the server from being able
3786
- * to overwrite the user key unlocked by the rotateable keyset.
3747
+ * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
3748
+ * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
3749
+ * the sender's authenticity cannot be verified by the recipient.
3750
+ * @param {Uint8Array} shared_key
3787
3751
  * @param {Uint8Array} encapsulation_key
3788
- * @param {Uint8Array} wrapping_key
3789
3752
  * @returns {string}
3790
3753
  */
3791
- static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
3754
+ static encapsulate_key_unsigned(shared_key, encapsulation_key) {
3792
3755
  let deferred4_0;
3793
3756
  let deferred4_1;
3794
3757
  try {
3795
3758
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3796
- const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3759
+ const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
3797
3760
  const len0 = WASM_VECTOR_LEN;
3798
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3761
+ const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3799
3762
  const len1 = WASM_VECTOR_LEN;
3800
- wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
3763
+ wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3801
3764
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3802
3765
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3803
3766
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3818,51 +3781,54 @@ export class PureCrypto {
3818
3781
  }
3819
3782
  }
3820
3783
  /**
3821
- * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
3822
- * wrapping key.
3823
- * @param {string} wrapped_key
3824
- * @param {Uint8Array} wrapping_key
3825
- * @returns {Uint8Array}
3784
+ * @param {string} enc_string
3785
+ * @param {Uint8Array} key
3786
+ * @returns {string}
3826
3787
  */
3827
- static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
3788
+ static symmetric_decrypt_string(enc_string, key) {
3789
+ let deferred4_0;
3790
+ let deferred4_1;
3828
3791
  try {
3829
3792
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3830
- const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3793
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3831
3794
  const len0 = WASM_VECTOR_LEN;
3832
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3795
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3833
3796
  const len1 = WASM_VECTOR_LEN;
3834
- wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3797
+ wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
3835
3798
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3836
3799
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3837
3800
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3838
3801
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3802
+ var ptr3 = r0;
3803
+ var len3 = r1;
3839
3804
  if (r3) {
3805
+ ptr3 = 0;
3806
+ len3 = 0;
3840
3807
  throw takeObject(r2);
3841
3808
  }
3842
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3843
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3844
- return v3;
3809
+ deferred4_0 = ptr3;
3810
+ deferred4_1 = len3;
3811
+ return getStringFromWasm0(ptr3, len3);
3845
3812
  } finally {
3846
3813
  wasm.__wbindgen_add_to_stack_pointer(16);
3814
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3847
3815
  }
3848
3816
  }
3849
3817
  /**
3850
- * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
3851
- * key,
3852
- * @param {Uint8Array} decapsulation_key
3853
- * @param {Uint8Array} wrapping_key
3818
+ * @param {string} plain
3819
+ * @param {Uint8Array} key
3854
3820
  * @returns {string}
3855
3821
  */
3856
- static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
3822
+ static symmetric_encrypt_string(plain, key) {
3857
3823
  let deferred4_0;
3858
3824
  let deferred4_1;
3859
3825
  try {
3860
3826
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3861
- const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3827
+ const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3862
3828
  const len0 = WASM_VECTOR_LEN;
3863
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3829
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3864
3830
  const len1 = WASM_VECTOR_LEN;
3865
- wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3831
+ wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
3866
3832
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3867
3833
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3868
3834
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3912,62 +3878,47 @@ export class PureCrypto {
3912
3878
  }
3913
3879
  }
3914
3880
  /**
3915
- * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
3916
- * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
3917
- * the sender's authenticity cannot be verified by the recipient.
3918
- * @param {Uint8Array} shared_key
3919
- * @param {Uint8Array} encapsulation_key
3920
- * @returns {string}
3881
+ * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
3882
+ * wrapping key.
3883
+ * @param {string} wrapped_key
3884
+ * @param {Uint8Array} wrapping_key
3885
+ * @returns {Uint8Array}
3921
3886
  */
3922
- static encapsulate_key_unsigned(shared_key, encapsulation_key) {
3923
- let deferred4_0;
3924
- let deferred4_1;
3887
+ static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
3925
3888
  try {
3926
3889
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3927
- const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
3890
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3928
3891
  const len0 = WASM_VECTOR_LEN;
3929
- const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3892
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3930
3893
  const len1 = WASM_VECTOR_LEN;
3931
- wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3894
+ wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3932
3895
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3933
3896
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3934
3897
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3935
3898
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3936
- var ptr3 = r0;
3937
- var len3 = r1;
3938
3899
  if (r3) {
3939
- ptr3 = 0;
3940
- len3 = 0;
3941
3900
  throw takeObject(r2);
3942
3901
  }
3943
- deferred4_0 = ptr3;
3944
- deferred4_1 = len3;
3945
- return getStringFromWasm0(ptr3, len3);
3902
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3903
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3904
+ return v3;
3946
3905
  } finally {
3947
3906
  wasm.__wbindgen_add_to_stack_pointer(16);
3948
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3949
3907
  }
3950
3908
  }
3951
3909
  /**
3952
- * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
3953
- * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
3954
- * recipient.
3955
- * @param {string} encapsulated_key
3956
- * @param {Uint8Array} decapsulation_key
3910
+ * @param {Uint8Array} enc_bytes
3911
+ * @param {Uint8Array} key
3957
3912
  * @returns {Uint8Array}
3958
3913
  */
3959
- static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
3914
+ static symmetric_decrypt_filedata(enc_bytes, key) {
3960
3915
  try {
3961
3916
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3962
- const ptr0 = passStringToWasm0(
3963
- encapsulated_key,
3964
- wasm.__wbindgen_malloc,
3965
- wasm.__wbindgen_realloc,
3966
- );
3917
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3967
3918
  const len0 = WASM_VECTOR_LEN;
3968
- const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3919
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3969
3920
  const len1 = WASM_VECTOR_LEN;
3970
- wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3921
+ wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3971
3922
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3972
3923
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3973
3924
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3983,20 +3934,18 @@ export class PureCrypto {
3983
3934
  }
3984
3935
  }
3985
3936
  /**
3986
- * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
3987
- * the corresponding verifying key.
3988
- * @param {string} signing_key
3989
- * @param {Uint8Array} wrapping_key
3937
+ * @param {Uint8Array} plain
3938
+ * @param {Uint8Array} key
3990
3939
  * @returns {Uint8Array}
3991
3940
  */
3992
- static verifying_key_for_signing_key(signing_key, wrapping_key) {
3941
+ static symmetric_encrypt_filedata(plain, key) {
3993
3942
  try {
3994
3943
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3995
- const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3944
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3996
3945
  const len0 = WASM_VECTOR_LEN;
3997
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3946
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3998
3947
  const len1 = WASM_VECTOR_LEN;
3999
- wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
3948
+ wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
4000
3949
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4001
3950
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4002
3951
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4012,44 +3961,36 @@ export class PureCrypto {
4012
3961
  }
4013
3962
  }
4014
3963
  /**
4015
- * Returns the algorithm used for the given verifying key.
4016
- * @param {Uint8Array} verifying_key
4017
- * @returns {SignatureAlgorithm}
3964
+ * @returns {Uint8Array}
4018
3965
  */
4019
- static key_algorithm_for_verifying_key(verifying_key) {
3966
+ static make_user_key_aes256_cbc_hmac() {
4020
3967
  try {
4021
3968
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4022
- const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
4023
- const len0 = WASM_VECTOR_LEN;
4024
- wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
3969
+ wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
4025
3970
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4026
3971
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4027
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4028
- if (r2) {
4029
- throw takeObject(r1);
4030
- }
4031
- return takeObject(r0);
3972
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3973
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3974
+ return v1;
4032
3975
  } finally {
4033
3976
  wasm.__wbindgen_add_to_stack_pointer(16);
4034
3977
  }
4035
3978
  }
4036
3979
  /**
4037
- * For a given signing identity (verifying key), this function verifies that the signing
4038
- * identity claimed ownership of the public key. This is a one-sided claim and merely shows
4039
- * that the signing identity has the intent to receive messages encrypted to the public
4040
- * key.
4041
- * @param {Uint8Array} signed_public_key
4042
- * @param {Uint8Array} verifying_key
3980
+ * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
3981
+ * the corresponding verifying key.
3982
+ * @param {string} signing_key
3983
+ * @param {Uint8Array} wrapping_key
4043
3984
  * @returns {Uint8Array}
4044
3985
  */
4045
- static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
3986
+ static verifying_key_for_signing_key(signing_key, wrapping_key) {
4046
3987
  try {
4047
3988
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4048
- const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
3989
+ const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4049
3990
  const len0 = WASM_VECTOR_LEN;
4050
- const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
3991
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
4051
3992
  const len1 = WASM_VECTOR_LEN;
4052
- wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
3993
+ wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
4053
3994
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4054
3995
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4055
3996
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4065,20 +4006,20 @@ export class PureCrypto {
4065
4006
  }
4066
4007
  }
4067
4008
  /**
4068
- * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
4069
- * @param {Uint8Array} password
4070
- * @param {Uint8Array} salt
4071
- * @param {Kdf} kdf
4009
+ * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
4010
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
4011
+ * @param {Uint8Array} enc_bytes
4012
+ * @param {Uint8Array} key
4072
4013
  * @returns {Uint8Array}
4073
4014
  */
4074
- static derive_kdf_material(password, salt, kdf) {
4015
+ static symmetric_decrypt_array_buffer(enc_bytes, key) {
4075
4016
  try {
4076
4017
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4077
- const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
4018
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
4078
4019
  const len0 = WASM_VECTOR_LEN;
4079
- const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
4020
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
4080
4021
  const len1 = WASM_VECTOR_LEN;
4081
- wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
4022
+ wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
4082
4023
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4083
4024
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4084
4025
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4093,6 +4034,28 @@ export class PureCrypto {
4093
4034
  wasm.__wbindgen_add_to_stack_pointer(16);
4094
4035
  }
4095
4036
  }
4037
+ /**
4038
+ * Returns the algorithm used for the given verifying key.
4039
+ * @param {Uint8Array} verifying_key
4040
+ * @returns {SignatureAlgorithm}
4041
+ */
4042
+ static key_algorithm_for_verifying_key(verifying_key) {
4043
+ try {
4044
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4045
+ const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
4046
+ const len0 = WASM_VECTOR_LEN;
4047
+ wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
4048
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4049
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4050
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4051
+ if (r2) {
4052
+ throw takeObject(r1);
4053
+ }
4054
+ return takeObject(r0);
4055
+ } finally {
4056
+ wasm.__wbindgen_add_to_stack_pointer(16);
4057
+ }
4058
+ }
4096
4059
  /**
4097
4060
  * @param {string} encrypted_user_key
4098
4061
  * @param {Uint8Array} master_key
@@ -4125,41 +4088,38 @@ export class PureCrypto {
4125
4088
  }
4126
4089
  }
4127
4090
  /**
4128
- * Given a decrypted private RSA key PKCS8 DER this
4129
- * returns the corresponding public RSA key in DER format.
4130
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4131
- * @param {Uint8Array} private_key
4132
4091
  * @returns {Uint8Array}
4133
4092
  */
4134
- static rsa_extract_public_key(private_key) {
4093
+ static make_user_key_xchacha20_poly1305() {
4135
4094
  try {
4136
4095
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4137
- const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
4138
- const len0 = WASM_VECTOR_LEN;
4139
- wasm.purecrypto_rsa_extract_public_key(retptr, ptr0, len0);
4140
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4141
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4142
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4143
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
4144
- if (r3) {
4145
- throw takeObject(r2);
4146
- }
4147
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
4096
+ wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
4097
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4098
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4099
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4148
4100
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4149
- return v2;
4101
+ return v1;
4150
4102
  } finally {
4151
4103
  wasm.__wbindgen_add_to_stack_pointer(16);
4152
4104
  }
4153
4105
  }
4154
4106
  /**
4155
- * Generates a new RSA key pair and returns the private key
4156
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4107
+ * For a given signing identity (verifying key), this function verifies that the signing
4108
+ * identity claimed ownership of the public key. This is a one-sided claim and merely shows
4109
+ * that the signing identity has the intent to receive messages encrypted to the public
4110
+ * key.
4111
+ * @param {Uint8Array} signed_public_key
4112
+ * @param {Uint8Array} verifying_key
4157
4113
  * @returns {Uint8Array}
4158
4114
  */
4159
- static rsa_generate_keypair() {
4115
+ static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
4160
4116
  try {
4161
4117
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4162
- wasm.purecrypto_rsa_generate_keypair(retptr);
4118
+ const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
4119
+ const len0 = WASM_VECTOR_LEN;
4120
+ const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
4121
+ const len1 = WASM_VECTOR_LEN;
4122
+ wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
4163
4123
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4164
4124
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4165
4125
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4167,28 +4127,47 @@ export class PureCrypto {
4167
4127
  if (r3) {
4168
4128
  throw takeObject(r2);
4169
4129
  }
4170
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
4130
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
4171
4131
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4172
- return v1;
4132
+ return v3;
4173
4133
  } finally {
4174
4134
  wasm.__wbindgen_add_to_stack_pointer(16);
4175
4135
  }
4176
4136
  }
4177
4137
  /**
4178
- * Decrypts data using RSAES-OAEP with SHA-1
4179
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4180
- * @param {Uint8Array} encrypted_data
4181
- * @param {Uint8Array} private_key
4138
+ * @param {string} encrypted_user_key
4139
+ * @param {string} master_password
4140
+ * @param {string} email
4141
+ * @param {Kdf} kdf
4182
4142
  * @returns {Uint8Array}
4183
4143
  */
4184
- static rsa_decrypt_data(encrypted_data, private_key) {
4144
+ static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
4185
4145
  try {
4186
4146
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4187
- const ptr0 = passArray8ToWasm0(encrypted_data, wasm.__wbindgen_malloc);
4147
+ const ptr0 = passStringToWasm0(
4148
+ encrypted_user_key,
4149
+ wasm.__wbindgen_malloc,
4150
+ wasm.__wbindgen_realloc,
4151
+ );
4188
4152
  const len0 = WASM_VECTOR_LEN;
4189
- const ptr1 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
4153
+ const ptr1 = passStringToWasm0(
4154
+ master_password,
4155
+ wasm.__wbindgen_malloc,
4156
+ wasm.__wbindgen_realloc,
4157
+ );
4190
4158
  const len1 = WASM_VECTOR_LEN;
4191
- wasm.purecrypto_rsa_decrypt_data(retptr, ptr0, len0, ptr1, len1);
4159
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4160
+ const len2 = WASM_VECTOR_LEN;
4161
+ wasm.purecrypto_decrypt_user_key_with_master_password(
4162
+ retptr,
4163
+ ptr0,
4164
+ len0,
4165
+ ptr1,
4166
+ len1,
4167
+ ptr2,
4168
+ len2,
4169
+ addHeapObject(kdf),
4170
+ );
4192
4171
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4193
4172
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4194
4173
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4196,40 +4175,62 @@ export class PureCrypto {
4196
4175
  if (r3) {
4197
4176
  throw takeObject(r2);
4198
4177
  }
4199
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
4178
+ var v4 = getArrayU8FromWasm0(r0, r1).slice();
4200
4179
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4201
- return v3;
4180
+ return v4;
4202
4181
  } finally {
4203
4182
  wasm.__wbindgen_add_to_stack_pointer(16);
4204
4183
  }
4205
4184
  }
4206
4185
  /**
4207
- * Encrypts data using RSAES-OAEP with SHA-1
4208
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4209
- * @param {Uint8Array} plain_data
4210
- * @param {Uint8Array} public_key
4211
- * @returns {Uint8Array}
4186
+ * @param {Uint8Array} user_key
4187
+ * @param {string} master_password
4188
+ * @param {string} email
4189
+ * @param {Kdf} kdf
4190
+ * @returns {string}
4212
4191
  */
4213
- static rsa_encrypt_data(plain_data, public_key) {
4192
+ static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
4193
+ let deferred5_0;
4194
+ let deferred5_1;
4214
4195
  try {
4215
4196
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4216
- const ptr0 = passArray8ToWasm0(plain_data, wasm.__wbindgen_malloc);
4197
+ const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
4217
4198
  const len0 = WASM_VECTOR_LEN;
4218
- const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
4199
+ const ptr1 = passStringToWasm0(
4200
+ master_password,
4201
+ wasm.__wbindgen_malloc,
4202
+ wasm.__wbindgen_realloc,
4203
+ );
4219
4204
  const len1 = WASM_VECTOR_LEN;
4220
- wasm.purecrypto_rsa_encrypt_data(retptr, ptr0, len0, ptr1, len1);
4205
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4206
+ const len2 = WASM_VECTOR_LEN;
4207
+ wasm.purecrypto_encrypt_user_key_with_master_password(
4208
+ retptr,
4209
+ ptr0,
4210
+ len0,
4211
+ ptr1,
4212
+ len1,
4213
+ ptr2,
4214
+ len2,
4215
+ addHeapObject(kdf),
4216
+ );
4221
4217
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4222
4218
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4223
4219
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4224
4220
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
4221
+ var ptr4 = r0;
4222
+ var len4 = r1;
4225
4223
  if (r3) {
4224
+ ptr4 = 0;
4225
+ len4 = 0;
4226
4226
  throw takeObject(r2);
4227
4227
  }
4228
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
4229
- wasm.__wbindgen_free(r0, r1 * 1, 1);
4230
- return v3;
4228
+ deferred5_0 = ptr4;
4229
+ deferred5_1 = len4;
4230
+ return getStringFromWasm0(ptr4, len4);
4231
4231
  } finally {
4232
4232
  wasm.__wbindgen_add_to_stack_pointer(16);
4233
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
4233
4234
  }
4234
4235
  }
4235
4236
  }
@@ -4333,6 +4334,15 @@ export class StateClient {
4333
4334
  const ptr = this.__destroy_into_raw();
4334
4335
  wasm.__wbg_stateclient_free(ptr, 0);
4335
4336
  }
4337
+ /**
4338
+ * Initialize the database for SDK managed repositories.
4339
+ * @param {IndexedDbConfiguration} configuration
4340
+ * @returns {Promise<void>}
4341
+ */
4342
+ initialize_state(configuration) {
4343
+ const ret = wasm.stateclient_initialize_state(this.__wbg_ptr, addHeapObject(configuration));
4344
+ return takeObject(ret);
4345
+ }
4336
4346
  /**
4337
4347
  * @param {any} cipher_repository
4338
4348
  */
@@ -4354,15 +4364,6 @@ export class StateClient {
4354
4364
  addHeapObject(repositories),
4355
4365
  );
4356
4366
  }
4357
- /**
4358
- * Initialize the database for SDK managed repositories.
4359
- * @param {IndexedDbConfiguration} configuration
4360
- * @returns {Promise<void>}
4361
- */
4362
- initialize_state(configuration) {
4363
- const ret = wasm.stateclient_initialize_state(this.__wbg_ptr, addHeapObject(configuration));
4364
- return takeObject(ret);
4365
- }
4366
4367
  }
4367
4368
  if (Symbol.dispose) StateClient.prototype[Symbol.dispose] = StateClient.prototype.free;
4368
4369
 
@@ -4465,20 +4466,20 @@ export class VaultClient {
4465
4466
  return AttachmentsClient.__wrap(ret);
4466
4467
  }
4467
4468
  /**
4468
- * Cipher related operations.
4469
- * @returns {CiphersClient}
4469
+ * Cipher risk evaluation operations.
4470
+ * @returns {CipherRiskClient}
4470
4471
  */
4471
- ciphers() {
4472
+ cipher_risk() {
4472
4473
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4473
- return CiphersClient.__wrap(ret);
4474
+ return CipherRiskClient.__wrap(ret);
4474
4475
  }
4475
4476
  /**
4476
- * Folder related operations.
4477
- * @returns {FoldersClient}
4477
+ * Collection related operations.
4478
+ * @returns {CollectionsClient}
4478
4479
  */
4479
- folders() {
4480
+ collections() {
4480
4481
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4481
- return FoldersClient.__wrap(ret);
4482
+ return CollectionsClient.__wrap(ret);
4482
4483
  }
4483
4484
  /**
4484
4485
  * TOTP related operations.
@@ -4489,20 +4490,20 @@ export class VaultClient {
4489
4490
  return TotpClient.__wrap(ret);
4490
4491
  }
4491
4492
  /**
4492
- * Collection related operations.
4493
- * @returns {CollectionsClient}
4493
+ * Cipher related operations.
4494
+ * @returns {CiphersClient}
4494
4495
  */
4495
- collections() {
4496
+ ciphers() {
4496
4497
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4497
- return CollectionsClient.__wrap(ret);
4498
+ return CiphersClient.__wrap(ret);
4498
4499
  }
4499
4500
  /**
4500
- * Cipher risk evaluation operations.
4501
- * @returns {CipherRiskClient}
4501
+ * Folder related operations.
4502
+ * @returns {FoldersClient}
4502
4503
  */
4503
- cipher_risk() {
4504
+ folders() {
4504
4505
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4505
- return CipherRiskClient.__wrap(ret);
4506
+ return FoldersClient.__wrap(ret);
4506
4507
  }
4507
4508
  }
4508
4509
  if (Symbol.dispose) VaultClient.prototype[Symbol.dispose] = VaultClient.prototype.free;
@@ -4680,7 +4681,7 @@ export function __wbg_call_e762c39fa8ea36bf() {
4680
4681
  }, arguments);
4681
4682
  }
4682
4683
 
4683
- export function __wbg_cipher_f01ad37fe153c74a(arg0) {
4684
+ export function __wbg_cipher_d41365b5935ef9f6(arg0) {
4684
4685
  const ret = getObject(arg0).cipher;
4685
4686
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4686
4687
  }
@@ -4773,7 +4774,7 @@ export function __wbg_fetch_f8ba0e29a9d6de0d(arg0, arg1) {
4773
4774
  return addHeapObject(ret);
4774
4775
  }
4775
4776
 
4776
- export function __wbg_folder_b2f27ca5801406fe(arg0) {
4777
+ export function __wbg_folder_70cb2b2470bd6fb3(arg0) {
4777
4778
  const ret = getObject(arg0).folder;
4778
4779
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4779
4780
  }
@@ -4806,12 +4807,7 @@ export function __wbg_getTime_14776bfb48a1bff9(arg0) {
4806
4807
  return ret;
4807
4808
  }
4808
4809
 
4809
- export function __wbg_get_7bed016f185add81(arg0, arg1) {
4810
- const ret = getObject(arg0)[arg1 >>> 0];
4811
- return addHeapObject(ret);
4812
- }
4813
-
4814
- export function __wbg_get_7d24a56df19d62f6() {
4810
+ export function __wbg_get_02506dc16a509e18() {
4815
4811
  return handleError(function (arg0, arg1, arg2) {
4816
4812
  let deferred0_0;
4817
4813
  let deferred0_1;
@@ -4826,12 +4822,7 @@ export function __wbg_get_7d24a56df19d62f6() {
4826
4822
  }, arguments);
4827
4823
  }
4828
4824
 
4829
- export function __wbg_get_access_token_f4e462d38899439f(arg0) {
4830
- const ret = getObject(arg0).get_access_token();
4831
- return addHeapObject(ret);
4832
- }
4833
-
4834
- export function __wbg_get_cf7a5a169adcb6d4() {
4825
+ export function __wbg_get_27ecddc404eb5960() {
4835
4826
  return handleError(function (arg0, arg1, arg2) {
4836
4827
  let deferred0_0;
4837
4828
  let deferred0_1;
@@ -4846,6 +4837,16 @@ export function __wbg_get_cf7a5a169adcb6d4() {
4846
4837
  }, arguments);
4847
4838
  }
4848
4839
 
4840
+ export function __wbg_get_7bed016f185add81(arg0, arg1) {
4841
+ const ret = getObject(arg0)[arg1 >>> 0];
4842
+ return addHeapObject(ret);
4843
+ }
4844
+
4845
+ export function __wbg_get_access_token_4c11d5b6b88e273c(arg0) {
4846
+ const ret = getObject(arg0).get_access_token();
4847
+ return addHeapObject(ret);
4848
+ }
4849
+
4849
4850
  export function __wbg_get_efcb449f58ec27c2() {
4850
4851
  return handleError(function (arg0, arg1) {
4851
4852
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
@@ -5037,14 +5038,14 @@ export function __wbg_length_cdd215e10d9dd507(arg0) {
5037
5038
  return ret;
5038
5039
  }
5039
5040
 
5040
- export function __wbg_list_9632da36688eb013() {
5041
+ export function __wbg_list_30b9a7bffa62c29d() {
5041
5042
  return handleError(function (arg0) {
5042
5043
  const ret = getObject(arg0).list();
5043
5044
  return addHeapObject(ret);
5044
5045
  }, arguments);
5045
5046
  }
5046
5047
 
5047
- export function __wbg_list_971afaee385941da() {
5048
+ export function __wbg_list_3e3162ec99984853() {
5048
5049
  return handleError(function (arg0) {
5049
5050
  const ret = getObject(arg0).list();
5050
5051
  return addHeapObject(ret);
@@ -5116,7 +5117,7 @@ export function __wbg_new_3c3d849046688a66(arg0, arg1) {
5116
5117
  const a = state0.a;
5117
5118
  state0.a = 0;
5118
5119
  try {
5119
- return wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(
5120
+ return wasm_bindgen__convert__closures_____invoke__h0cb536241502fe83(
5120
5121
  a,
5121
5122
  state0.b,
5122
5123
  arg0,
@@ -5288,7 +5289,7 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
5288
5289
  }, arguments);
5289
5290
  }
5290
5291
 
5291
- export function __wbg_remove_0c50f1a372592522() {
5292
+ export function __wbg_remove_6f13f6b2aeaea191() {
5292
5293
  return handleError(function (arg0, arg1, arg2) {
5293
5294
  let deferred0_0;
5294
5295
  let deferred0_1;
@@ -5303,7 +5304,7 @@ export function __wbg_remove_0c50f1a372592522() {
5303
5304
  }, arguments);
5304
5305
  }
5305
5306
 
5306
- export function __wbg_remove_d52ba16f05c98799() {
5307
+ export function __wbg_remove_b941496fdbe98774() {
5307
5308
  return handleError(function (arg0, arg1, arg2) {
5308
5309
  let deferred0_0;
5309
5310
  let deferred0_1;
@@ -5353,6 +5354,21 @@ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
5353
5354
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5354
5355
  }
5355
5356
 
5357
+ export function __wbg_set_83ea0a967b99b5d2() {
5358
+ return handleError(function (arg0, arg1, arg2, arg3) {
5359
+ let deferred0_0;
5360
+ let deferred0_1;
5361
+ try {
5362
+ deferred0_0 = arg1;
5363
+ deferred0_1 = arg2;
5364
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
5365
+ return addHeapObject(ret);
5366
+ } finally {
5367
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5368
+ }
5369
+ }, arguments);
5370
+ }
5371
+
5356
5372
  export function __wbg_set_907fb406c34a251d(arg0, arg1, arg2) {
5357
5373
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5358
5374
  return addHeapObject(ret);
@@ -5373,7 +5389,7 @@ export function __wbg_set_c2abbebe8b9ebee1() {
5373
5389
  }, arguments);
5374
5390
  }
5375
5391
 
5376
- export function __wbg_set_cf238f02b0469517() {
5392
+ export function __wbg_set_c93d3183f4c04f25() {
5377
5393
  return handleError(function (arg0, arg1, arg2, arg3) {
5378
5394
  let deferred0_0;
5379
5395
  let deferred0_1;
@@ -5392,21 +5408,6 @@ export function __wbg_set_credentials_f621cd2d85c0c228(arg0, arg1) {
5392
5408
  getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
5393
5409
  }
5394
5410
 
5395
- export function __wbg_set_e87a8a3d69deff6e() {
5396
- return handleError(function (arg0, arg1, arg2, arg3) {
5397
- let deferred0_0;
5398
- let deferred0_1;
5399
- try {
5400
- deferred0_0 = arg1;
5401
- deferred0_1 = arg2;
5402
- const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
5403
- return addHeapObject(ret);
5404
- } finally {
5405
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5406
- }
5407
- }, arguments);
5408
- }
5409
-
5410
5411
  export function __wbg_set_headers_6926da238cd32ee4(arg0, arg1) {
5411
5412
  getObject(arg0).headers = getObject(arg1);
5412
5413
  }
@@ -5571,37 +5572,26 @@ export function __wbg_warn_8f5b5437666d0885(arg0, arg1, arg2, arg3) {
5571
5572
  console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
5572
5573
  }
5573
5574
 
5574
- export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
5575
- // Cast intrinsic for `Ref(String) -> Externref`.
5576
- const ret = getStringFromWasm0(arg0, arg1);
5577
- return addHeapObject(ret);
5578
- }
5579
-
5580
- export function __wbindgen_cast_4042b341512ce63a(arg0, arg1) {
5581
- // 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`.
5575
+ export function __wbindgen_cast_0f3a80f9c6c81c16(arg0, arg1) {
5576
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 40, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 43, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5582
5577
  const ret = makeMutClosure(
5583
5578
  arg0,
5584
5579
  arg1,
5585
- wasm.wasm_bindgen__closure__destroy__hba496874d56e8206,
5586
- wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff,
5580
+ wasm.wasm_bindgen__closure__destroy__h0a76ff7104f80505,
5581
+ wasm_bindgen__convert__closures_____invoke__ha3eecaeccbf508bc,
5587
5582
  );
5588
5583
  return addHeapObject(ret);
5589
5584
  }
5590
5585
 
5591
- export function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
5592
- // Cast intrinsic for `U64 -> Externref`.
5593
- const ret = BigInt.asUintN(64, arg0);
5586
+ export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
5587
+ // Cast intrinsic for `Ref(String) -> Externref`.
5588
+ const ret = getStringFromWasm0(arg0, arg1);
5594
5589
  return addHeapObject(ret);
5595
5590
  }
5596
5591
 
5597
- export function __wbindgen_cast_567ce6425eb96825(arg0, arg1) {
5598
- // Cast intrinsic for `Closure(Closure { dtor_idx: 551, function: Function { arguments: [], shim_idx: 305, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5599
- const ret = makeMutClosure(
5600
- arg0,
5601
- arg1,
5602
- wasm.wasm_bindgen__closure__destroy__hfcb631b72e5e985c,
5603
- wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e,
5604
- );
5592
+ export function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
5593
+ // Cast intrinsic for `U64 -> Externref`.
5594
+ const ret = BigInt.asUintN(64, arg0);
5605
5595
  return addHeapObject(ret);
5606
5596
  }
5607
5597
 
@@ -5613,6 +5603,17 @@ export function __wbindgen_cast_5fea77eff9dd275c(arg0, arg1) {
5613
5603
  return addHeapObject(ret);
5614
5604
  }
5615
5605
 
5606
+ export function __wbindgen_cast_67d165bf11ca912a(arg0, arg1) {
5607
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 303, function: Function { arguments: [Externref], shim_idx: 43, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5608
+ const ret = makeMutClosure(
5609
+ arg0,
5610
+ arg1,
5611
+ wasm.wasm_bindgen__closure__destroy__h591e0f2efd143068,
5612
+ wasm_bindgen__convert__closures_____invoke__ha3eecaeccbf508bc,
5613
+ );
5614
+ return addHeapObject(ret);
5615
+ }
5616
+
5616
5617
  export function __wbindgen_cast_7a6d185652cd8149(arg0, arg1) {
5617
5618
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
5618
5619
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
@@ -5621,57 +5622,57 @@ export function __wbindgen_cast_7a6d185652cd8149(arg0, arg1) {
5621
5622
  return addHeapObject(ret);
5622
5623
  }
5623
5624
 
5624
- export function __wbindgen_cast_8340b5b160d85933(arg0, arg1) {
5625
- // Cast intrinsic for `Closure(Closure { dtor_idx: 304, function: Function { arguments: [], shim_idx: 305, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5625
+ export function __wbindgen_cast_9ae0607507abb057(arg0) {
5626
+ // Cast intrinsic for `I64 -> Externref`.
5627
+ const ret = arg0;
5628
+ return addHeapObject(ret);
5629
+ }
5630
+
5631
+ export function __wbindgen_cast_9b35fe50b76611f9(arg0, arg1) {
5632
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 552, function: Function { arguments: [], shim_idx: 304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5626
5633
  const ret = makeMutClosure(
5627
5634
  arg0,
5628
5635
  arg1,
5629
- wasm.wasm_bindgen__closure__destroy__h5bf455f3385c4f71,
5630
- wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e,
5636
+ wasm.wasm_bindgen__closure__destroy__he41cbbdbe831f2ac,
5637
+ wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2,
5631
5638
  );
5632
5639
  return addHeapObject(ret);
5633
5640
  }
5634
5641
 
5635
- export function __wbindgen_cast_9654b59eb60e619d(arg0, arg1) {
5636
- // Cast intrinsic for `Closure(Closure { dtor_idx: 304, function: Function { arguments: [Externref], shim_idx: 44, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5642
+ export function __wbindgen_cast_bfa5a190b0f2e981(arg0, arg1) {
5643
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 303, function: Function { arguments: [], shim_idx: 304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5637
5644
  const ret = makeMutClosure(
5638
5645
  arg0,
5639
5646
  arg1,
5640
- wasm.wasm_bindgen__closure__destroy__h5bf455f3385c4f71,
5641
- wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff,
5647
+ wasm.wasm_bindgen__closure__destroy__h591e0f2efd143068,
5648
+ wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2,
5642
5649
  );
5643
5650
  return addHeapObject(ret);
5644
5651
  }
5645
5652
 
5646
- export function __wbindgen_cast_9ae0607507abb057(arg0) {
5647
- // Cast intrinsic for `I64 -> Externref`.
5648
- const ret = arg0;
5649
- return addHeapObject(ret);
5650
- }
5651
-
5652
5653
  export function __wbindgen_cast_cb9088102bce6b30(arg0, arg1) {
5653
5654
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
5654
5655
  const ret = getArrayU8FromWasm0(arg0, arg1);
5655
5656
  return addHeapObject(ret);
5656
5657
  }
5657
5658
 
5658
- export function __wbindgen_cast_d49c305f67640cb1(arg0, arg1) {
5659
- // 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`.
5659
+ export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
5660
+ // Cast intrinsic for `F64 -> Externref`.
5661
+ const ret = arg0;
5662
+ return addHeapObject(ret);
5663
+ }
5664
+
5665
+ export function __wbindgen_cast_e12aaa4ecde9c999(arg0, arg1) {
5666
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 40, function: Function { arguments: [NamedExternref("Event")], shim_idx: 41, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
5660
5667
  const ret = makeMutClosure(
5661
5668
  arg0,
5662
5669
  arg1,
5663
- wasm.wasm_bindgen__closure__destroy__hba496874d56e8206,
5664
- wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe,
5670
+ wasm.wasm_bindgen__closure__destroy__h0a76ff7104f80505,
5671
+ wasm_bindgen__convert__closures_____invoke__h86320ba04bc5bce5,
5665
5672
  );
5666
5673
  return addHeapObject(ret);
5667
5674
  }
5668
5675
 
5669
- export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
5670
- // Cast intrinsic for `F64 -> Externref`.
5671
- const ret = arg0;
5672
- return addHeapObject(ret);
5673
- }
5674
-
5675
5676
  export function __wbindgen_cast_ef90a087adb7475d(arg0, arg1) {
5676
5677
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
5677
5678
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);