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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -246,12 +246,6 @@ function getArrayJsValueFromWasm0(ptr, len) {
246
246
  }
247
247
  return result;
248
248
  }
249
- /**
250
- * @param {LogLevel | null} [log_level]
251
- */
252
- exports.init_sdk = function (log_level) {
253
- wasm.init_sdk(isLikeNone(log_level) ? 5 : log_level);
254
- };
255
249
 
256
250
  function passArray8ToWasm0(arg, malloc) {
257
251
  const ptr = malloc(arg.length * 1, 1) >>> 0;
@@ -260,21 +254,33 @@ function passArray8ToWasm0(arg, malloc) {
260
254
  return ptr;
261
255
  }
262
256
  /**
263
- * Generate a new SSH key pair
257
+ * Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
258
+ * to an OpenSSH private key with public key and fingerprint
264
259
  *
265
260
  * # Arguments
266
- * - `key_algorithm` - The algorithm to use for the key pair
261
+ * - `imported_key` - The private key to convert
262
+ * - `password` - The password to use for decrypting the key
267
263
  *
268
264
  * # Returns
269
- * - `Ok(SshKey)` if the key was successfully generated
270
- * - `Err(KeyGenerationError)` if the key could not be generated
271
- * @param {KeyAlgorithm} key_algorithm
265
+ * - `Ok(SshKey)` if the key was successfully coneverted
266
+ * - `Err(PasswordRequired)` if the key is encrypted and no password was provided
267
+ * - `Err(WrongPassword)` if the password provided is incorrect
268
+ * - `Err(ParsingError)` if the key could not be parsed
269
+ * - `Err(UnsupportedKeyType)` if the key type is not supported
270
+ * @param {string} imported_key
271
+ * @param {string | null} [password]
272
272
  * @returns {SshKeyView}
273
273
  */
274
- exports.generate_ssh_key = function (key_algorithm) {
274
+ exports.import_ssh_key = function (imported_key, password) {
275
275
  try {
276
276
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
277
- wasm.generate_ssh_key(retptr, addHeapObject(key_algorithm));
277
+ const ptr0 = passStringToWasm0(imported_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
278
+ const len0 = WASM_VECTOR_LEN;
279
+ var ptr1 = isLikeNone(password)
280
+ ? 0
281
+ : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
282
+ var len1 = WASM_VECTOR_LEN;
283
+ wasm.import_ssh_key(retptr, ptr0, len0, ptr1, len1);
278
284
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
279
285
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
280
286
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -288,33 +294,21 @@ exports.generate_ssh_key = function (key_algorithm) {
288
294
  };
289
295
 
290
296
  /**
291
- * Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
292
- * to an OpenSSH private key with public key and fingerprint
297
+ * Generate a new SSH key pair
293
298
  *
294
299
  * # Arguments
295
- * - `imported_key` - The private key to convert
296
- * - `password` - The password to use for decrypting the key
300
+ * - `key_algorithm` - The algorithm to use for the key pair
297
301
  *
298
302
  * # Returns
299
- * - `Ok(SshKey)` if the key was successfully coneverted
300
- * - `Err(PasswordRequired)` if the key is encrypted and no password was provided
301
- * - `Err(WrongPassword)` if the password provided is incorrect
302
- * - `Err(ParsingError)` if the key could not be parsed
303
- * - `Err(UnsupportedKeyType)` if the key type is not supported
304
- * @param {string} imported_key
305
- * @param {string | null} [password]
303
+ * - `Ok(SshKey)` if the key was successfully generated
304
+ * - `Err(KeyGenerationError)` if the key could not be generated
305
+ * @param {KeyAlgorithm} key_algorithm
306
306
  * @returns {SshKeyView}
307
307
  */
308
- exports.import_ssh_key = function (imported_key, password) {
308
+ exports.generate_ssh_key = function (key_algorithm) {
309
309
  try {
310
310
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
311
- const ptr0 = passStringToWasm0(imported_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
312
- const len0 = WASM_VECTOR_LEN;
313
- var ptr1 = isLikeNone(password)
314
- ? 0
315
- : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
316
- var len1 = WASM_VECTOR_LEN;
317
- wasm.import_ssh_key(retptr, ptr0, len0, ptr1, len1);
311
+ wasm.generate_ssh_key(retptr, addHeapObject(key_algorithm));
318
312
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
319
313
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
320
314
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -327,6 +321,13 @@ exports.import_ssh_key = function (imported_key, password) {
327
321
  }
328
322
  };
329
323
 
324
+ /**
325
+ * @param {LogLevel | null} [log_level]
326
+ */
327
+ exports.init_sdk = function (log_level) {
328
+ wasm.init_sdk(isLikeNone(log_level) ? 5 : log_level);
329
+ };
330
+
330
331
  let stack_pointer = 128;
331
332
 
332
333
  function addBorrowedObject(obj) {
@@ -377,9 +378,9 @@ exports.isMasterPasswordError = function (error) {
377
378
  * @param {any} error
378
379
  * @returns {boolean}
379
380
  */
380
- exports.isDeriveKeyConnectorError = function (error) {
381
+ exports.isAccountCryptographyInitializationError = function (error) {
381
382
  try {
382
- const ret = wasm.isDeriveKeyConnectorError(addBorrowedObject(error));
383
+ const ret = wasm.isAccountCryptographyInitializationError(addBorrowedObject(error));
383
384
  return ret !== 0;
384
385
  } finally {
385
386
  heap[stack_pointer++] = undefined;
@@ -390,9 +391,9 @@ exports.isDeriveKeyConnectorError = function (error) {
390
391
  * @param {any} error
391
392
  * @returns {boolean}
392
393
  */
393
- exports.isEnrollAdminPasswordResetError = function (error) {
394
+ exports.isCryptoClientError = function (error) {
394
395
  try {
395
- const ret = wasm.isEnrollAdminPasswordResetError(addBorrowedObject(error));
396
+ const ret = wasm.isCryptoClientError(addBorrowedObject(error));
396
397
  return ret !== 0;
397
398
  } finally {
398
399
  heap[stack_pointer++] = undefined;
@@ -403,9 +404,9 @@ exports.isEnrollAdminPasswordResetError = function (error) {
403
404
  * @param {any} error
404
405
  * @returns {boolean}
405
406
  */
406
- exports.isCryptoClientError = function (error) {
407
+ exports.isDeriveKeyConnectorError = function (error) {
407
408
  try {
408
- const ret = wasm.isCryptoClientError(addBorrowedObject(error));
409
+ const ret = wasm.isDeriveKeyConnectorError(addBorrowedObject(error));
409
410
  return ret !== 0;
410
411
  } finally {
411
412
  heap[stack_pointer++] = undefined;
@@ -416,9 +417,9 @@ exports.isCryptoClientError = function (error) {
416
417
  * @param {any} error
417
418
  * @returns {boolean}
418
419
  */
419
- exports.isAccountCryptographyInitializationError = function (error) {
420
+ exports.isEnrollAdminPasswordResetError = function (error) {
420
421
  try {
421
- const ret = wasm.isAccountCryptographyInitializationError(addBorrowedObject(error));
422
+ const ret = wasm.isEnrollAdminPasswordResetError(addBorrowedObject(error));
422
423
  return ret !== 0;
423
424
  } finally {
424
425
  heap[stack_pointer++] = undefined;
@@ -490,9 +491,9 @@ exports.isExportError = function (error) {
490
491
  * @param {any} error
491
492
  * @returns {boolean}
492
493
  */
493
- exports.isUsernameError = function (error) {
494
+ exports.isPasswordError = function (error) {
494
495
  try {
495
- const ret = wasm.isUsernameError(addBorrowedObject(error));
496
+ const ret = wasm.isPasswordError(addBorrowedObject(error));
496
497
  return ret !== 0;
497
498
  } finally {
498
499
  heap[stack_pointer++] = undefined;
@@ -503,56 +504,22 @@ exports.isUsernameError = function (error) {
503
504
  * @param {any} error
504
505
  * @returns {boolean}
505
506
  */
506
- exports.isPasswordError = function (error) {
507
+ exports.isUsernameError = function (error) {
507
508
  try {
508
- const ret = wasm.isPasswordError(addBorrowedObject(error));
509
+ const ret = wasm.isUsernameError(addBorrowedObject(error));
509
510
  return ret !== 0;
510
511
  } finally {
511
512
  heap[stack_pointer++] = undefined;
512
513
  }
513
514
  };
514
515
 
515
- function _assertClass(instance, klass) {
516
- if (!(instance instanceof klass)) {
517
- throw new Error(`expected instance of ${klass.name}`);
518
- }
519
- }
520
- /**
521
- * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
522
- * @param {IpcClient} ipc_client
523
- * @param {DiscoverResponse} response
524
- * @returns {Promise<void>}
525
- */
526
- exports.ipcRegisterDiscoverHandler = function (ipc_client, response) {
527
- _assertClass(ipc_client, IpcClient);
528
- const ret = wasm.ipcRegisterDiscoverHandler(ipc_client.__wbg_ptr, addHeapObject(response));
529
- return takeObject(ret);
530
- };
531
-
532
- /**
533
- * Sends a DiscoverRequest to the specified destination and returns the response.
534
- * @param {IpcClient} ipc_client
535
- * @param {Endpoint} destination
536
- * @param {AbortSignal | null} [abort_signal]
537
- * @returns {Promise<DiscoverResponse>}
538
- */
539
- exports.ipcRequestDiscover = function (ipc_client, destination, abort_signal) {
540
- _assertClass(ipc_client, IpcClient);
541
- const ret = wasm.ipcRequestDiscover(
542
- ipc_client.__wbg_ptr,
543
- addHeapObject(destination),
544
- isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
545
- );
546
- return takeObject(ret);
547
- };
548
-
549
516
  /**
550
517
  * @param {any} error
551
518
  * @returns {boolean}
552
519
  */
553
- exports.isChannelError = function (error) {
520
+ exports.isRequestError = function (error) {
554
521
  try {
555
- const ret = wasm.isChannelError(addBorrowedObject(error));
522
+ const ret = wasm.isRequestError(addBorrowedObject(error));
556
523
  return ret !== 0;
557
524
  } finally {
558
525
  heap[stack_pointer++] = undefined;
@@ -563,9 +530,9 @@ exports.isChannelError = function (error) {
563
530
  * @param {any} error
564
531
  * @returns {boolean}
565
532
  */
566
- exports.isDeserializeError = function (error) {
533
+ exports.isTypedReceiveError = function (error) {
567
534
  try {
568
- const ret = wasm.isDeserializeError(addBorrowedObject(error));
535
+ const ret = wasm.isTypedReceiveError(addBorrowedObject(error));
569
536
  return ret !== 0;
570
537
  } finally {
571
538
  heap[stack_pointer++] = undefined;
@@ -576,9 +543,9 @@ exports.isDeserializeError = function (error) {
576
543
  * @param {any} error
577
544
  * @returns {boolean}
578
545
  */
579
- exports.isRequestError = function (error) {
546
+ exports.isSubscribeError = function (error) {
580
547
  try {
581
- const ret = wasm.isRequestError(addBorrowedObject(error));
548
+ const ret = wasm.isSubscribeError(addBorrowedObject(error));
582
549
  return ret !== 0;
583
550
  } finally {
584
551
  heap[stack_pointer++] = undefined;
@@ -589,22 +556,27 @@ exports.isRequestError = function (error) {
589
556
  * @param {any} error
590
557
  * @returns {boolean}
591
558
  */
592
- exports.isTypedReceiveError = function (error) {
559
+ exports.isReceiveError = function (error) {
593
560
  try {
594
- const ret = wasm.isTypedReceiveError(addBorrowedObject(error));
561
+ const ret = wasm.isReceiveError(addBorrowedObject(error));
595
562
  return ret !== 0;
596
563
  } finally {
597
564
  heap[stack_pointer++] = undefined;
598
565
  }
599
566
  };
600
567
 
568
+ function _assertClass(instance, klass) {
569
+ if (!(instance instanceof klass)) {
570
+ throw new Error(`expected instance of ${klass.name}`);
571
+ }
572
+ }
601
573
  /**
602
574
  * @param {any} error
603
575
  * @returns {boolean}
604
576
  */
605
- exports.isReceiveError = function (error) {
577
+ exports.isDeserializeError = function (error) {
606
578
  try {
607
- const ret = wasm.isReceiveError(addBorrowedObject(error));
579
+ const ret = wasm.isDeserializeError(addBorrowedObject(error));
608
580
  return ret !== 0;
609
581
  } finally {
610
582
  heap[stack_pointer++] = undefined;
@@ -615,22 +587,51 @@ exports.isReceiveError = function (error) {
615
587
  * @param {any} error
616
588
  * @returns {boolean}
617
589
  */
618
- exports.isSubscribeError = function (error) {
590
+ exports.isChannelError = function (error) {
619
591
  try {
620
- const ret = wasm.isSubscribeError(addBorrowedObject(error));
592
+ const ret = wasm.isChannelError(addBorrowedObject(error));
621
593
  return ret !== 0;
622
594
  } finally {
623
595
  heap[stack_pointer++] = undefined;
624
596
  }
625
597
  };
626
598
 
599
+ /**
600
+ * Sends a DiscoverRequest to the specified destination and returns the response.
601
+ * @param {IpcClient} ipc_client
602
+ * @param {Endpoint} destination
603
+ * @param {AbortSignal | null} [abort_signal]
604
+ * @returns {Promise<DiscoverResponse>}
605
+ */
606
+ exports.ipcRequestDiscover = function (ipc_client, destination, abort_signal) {
607
+ _assertClass(ipc_client, IpcClient);
608
+ const ret = wasm.ipcRequestDiscover(
609
+ ipc_client.__wbg_ptr,
610
+ addHeapObject(destination),
611
+ isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
612
+ );
613
+ return takeObject(ret);
614
+ };
615
+
616
+ /**
617
+ * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
618
+ * @param {IpcClient} ipc_client
619
+ * @param {DiscoverResponse} response
620
+ * @returns {Promise<void>}
621
+ */
622
+ exports.ipcRegisterDiscoverHandler = function (ipc_client, response) {
623
+ _assertClass(ipc_client, IpcClient);
624
+ const ret = wasm.ipcRegisterDiscoverHandler(ipc_client.__wbg_ptr, addHeapObject(response));
625
+ return takeObject(ret);
626
+ };
627
+
627
628
  /**
628
629
  * @param {any} error
629
630
  * @returns {boolean}
630
631
  */
631
- exports.isSshKeyExportError = function (error) {
632
+ exports.isKeyGenerationError = function (error) {
632
633
  try {
633
- const ret = wasm.isSshKeyExportError(addBorrowedObject(error));
634
+ const ret = wasm.isKeyGenerationError(addBorrowedObject(error));
634
635
  return ret !== 0;
635
636
  } finally {
636
637
  heap[stack_pointer++] = undefined;
@@ -641,9 +642,9 @@ exports.isSshKeyExportError = function (error) {
641
642
  * @param {any} error
642
643
  * @returns {boolean}
643
644
  */
644
- exports.isSshKeyImportError = function (error) {
645
+ exports.isSshKeyExportError = function (error) {
645
646
  try {
646
- const ret = wasm.isSshKeyImportError(addBorrowedObject(error));
647
+ const ret = wasm.isSshKeyExportError(addBorrowedObject(error));
647
648
  return ret !== 0;
648
649
  } finally {
649
650
  heap[stack_pointer++] = undefined;
@@ -654,9 +655,9 @@ exports.isSshKeyImportError = function (error) {
654
655
  * @param {any} error
655
656
  * @returns {boolean}
656
657
  */
657
- exports.isKeyGenerationError = function (error) {
658
+ exports.isSshKeyImportError = function (error) {
658
659
  try {
659
- const ret = wasm.isKeyGenerationError(addBorrowedObject(error));
660
+ const ret = wasm.isSshKeyImportError(addBorrowedObject(error));
660
661
  return ret !== 0;
661
662
  } finally {
662
663
  heap[stack_pointer++] = undefined;
@@ -706,9 +707,9 @@ exports.isCallError = function (error) {
706
707
  * @param {any} error
707
708
  * @returns {boolean}
708
709
  */
709
- exports.isDecryptError = function (error) {
710
+ exports.isCipherRiskError = function (error) {
710
711
  try {
711
- const ret = wasm.isDecryptError(addBorrowedObject(error));
712
+ const ret = wasm.isCipherRiskError(addBorrowedObject(error));
712
713
  return ret !== 0;
713
714
  } finally {
714
715
  heap[stack_pointer++] = undefined;
@@ -719,9 +720,9 @@ exports.isDecryptError = function (error) {
719
720
  * @param {any} error
720
721
  * @returns {boolean}
721
722
  */
722
- exports.isEncryptError = function (error) {
723
+ exports.isTotpError = function (error) {
723
724
  try {
724
- const ret = wasm.isEncryptError(addBorrowedObject(error));
725
+ const ret = wasm.isTotpError(addBorrowedObject(error));
725
726
  return ret !== 0;
726
727
  } finally {
727
728
  heap[stack_pointer++] = undefined;
@@ -732,9 +733,9 @@ exports.isEncryptError = function (error) {
732
733
  * @param {any} error
733
734
  * @returns {boolean}
734
735
  */
735
- exports.isTotpError = function (error) {
736
+ exports.isEncryptError = function (error) {
736
737
  try {
737
- const ret = wasm.isTotpError(addBorrowedObject(error));
738
+ const ret = wasm.isEncryptError(addBorrowedObject(error));
738
739
  return ret !== 0;
739
740
  } finally {
740
741
  heap[stack_pointer++] = undefined;
@@ -745,9 +746,9 @@ exports.isTotpError = function (error) {
745
746
  * @param {any} error
746
747
  * @returns {boolean}
747
748
  */
748
- exports.isGetFolderError = function (error) {
749
+ exports.isDecryptError = function (error) {
749
750
  try {
750
- const ret = wasm.isGetFolderError(addBorrowedObject(error));
751
+ const ret = wasm.isDecryptError(addBorrowedObject(error));
751
752
  return ret !== 0;
752
753
  } finally {
753
754
  heap[stack_pointer++] = undefined;
@@ -758,9 +759,9 @@ exports.isGetFolderError = function (error) {
758
759
  * @param {any} error
759
760
  * @returns {boolean}
760
761
  */
761
- exports.isEditFolderError = function (error) {
762
+ exports.isGetCipherError = function (error) {
762
763
  try {
763
- const ret = wasm.isEditFolderError(addBorrowedObject(error));
764
+ const ret = wasm.isGetCipherError(addBorrowedObject(error));
764
765
  return ret !== 0;
765
766
  } finally {
766
767
  heap[stack_pointer++] = undefined;
@@ -771,9 +772,9 @@ exports.isEditFolderError = function (error) {
771
772
  * @param {any} error
772
773
  * @returns {boolean}
773
774
  */
774
- exports.isCreateFolderError = function (error) {
775
+ exports.isEditCipherError = function (error) {
775
776
  try {
776
- const ret = wasm.isCreateFolderError(addBorrowedObject(error));
777
+ const ret = wasm.isEditCipherError(addBorrowedObject(error));
777
778
  return ret !== 0;
778
779
  } finally {
779
780
  heap[stack_pointer++] = undefined;
@@ -784,9 +785,9 @@ exports.isCreateFolderError = function (error) {
784
785
  * @param {any} error
785
786
  * @returns {boolean}
786
787
  */
787
- exports.isCipherRiskError = function (error) {
788
+ exports.isCreateCipherError = function (error) {
788
789
  try {
789
- const ret = wasm.isCipherRiskError(addBorrowedObject(error));
790
+ const ret = wasm.isCreateCipherError(addBorrowedObject(error));
790
791
  return ret !== 0;
791
792
  } finally {
792
793
  heap[stack_pointer++] = undefined;
@@ -797,9 +798,9 @@ exports.isCipherRiskError = function (error) {
797
798
  * @param {any} error
798
799
  * @returns {boolean}
799
800
  */
800
- exports.isGetCipherError = function (error) {
801
+ exports.isEncryptFileError = function (error) {
801
802
  try {
802
- const ret = wasm.isGetCipherError(addBorrowedObject(error));
803
+ const ret = wasm.isEncryptFileError(addBorrowedObject(error));
803
804
  return ret !== 0;
804
805
  } finally {
805
806
  heap[stack_pointer++] = undefined;
@@ -810,9 +811,9 @@ exports.isGetCipherError = function (error) {
810
811
  * @param {any} error
811
812
  * @returns {boolean}
812
813
  */
813
- exports.isEditCipherError = function (error) {
814
+ exports.isDecryptFileError = function (error) {
814
815
  try {
815
- const ret = wasm.isEditCipherError(addBorrowedObject(error));
816
+ const ret = wasm.isDecryptFileError(addBorrowedObject(error));
816
817
  return ret !== 0;
817
818
  } finally {
818
819
  heap[stack_pointer++] = undefined;
@@ -823,9 +824,9 @@ exports.isEditCipherError = function (error) {
823
824
  * @param {any} error
824
825
  * @returns {boolean}
825
826
  */
826
- exports.isCreateCipherError = function (error) {
827
+ exports.isCipherError = function (error) {
827
828
  try {
828
- const ret = wasm.isCreateCipherError(addBorrowedObject(error));
829
+ const ret = wasm.isCipherError(addBorrowedObject(error));
829
830
  return ret !== 0;
830
831
  } finally {
831
832
  heap[stack_pointer++] = undefined;
@@ -836,9 +837,9 @@ exports.isCreateCipherError = function (error) {
836
837
  * @param {any} error
837
838
  * @returns {boolean}
838
839
  */
839
- exports.isCipherError = function (error) {
840
+ exports.isEditFolderError = function (error) {
840
841
  try {
841
- const ret = wasm.isCipherError(addBorrowedObject(error));
842
+ const ret = wasm.isEditFolderError(addBorrowedObject(error));
842
843
  return ret !== 0;
843
844
  } finally {
844
845
  heap[stack_pointer++] = undefined;
@@ -849,9 +850,9 @@ exports.isCipherError = function (error) {
849
850
  * @param {any} error
850
851
  * @returns {boolean}
851
852
  */
852
- exports.isDecryptFileError = function (error) {
853
+ exports.isCreateFolderError = function (error) {
853
854
  try {
854
- const ret = wasm.isDecryptFileError(addBorrowedObject(error));
855
+ const ret = wasm.isCreateFolderError(addBorrowedObject(error));
855
856
  return ret !== 0;
856
857
  } finally {
857
858
  heap[stack_pointer++] = undefined;
@@ -862,23 +863,31 @@ exports.isDecryptFileError = function (error) {
862
863
  * @param {any} error
863
864
  * @returns {boolean}
864
865
  */
865
- exports.isEncryptFileError = function (error) {
866
+ exports.isGetFolderError = function (error) {
866
867
  try {
867
- const ret = wasm.isEncryptFileError(addBorrowedObject(error));
868
+ const ret = wasm.isGetFolderError(addBorrowedObject(error));
868
869
  return ret !== 0;
869
870
  } finally {
870
871
  heap[stack_pointer++] = undefined;
871
872
  }
872
873
  };
873
874
 
874
- function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
875
- wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
875
+ function wasm_bindgen__convert__closures_____invoke__ha3eecaeccbf508bc(arg0, arg1, arg2) {
876
+ wasm.wasm_bindgen__convert__closures_____invoke__ha3eecaeccbf508bc(
877
+ arg0,
878
+ arg1,
879
+ addHeapObject(arg2),
880
+ );
881
+ }
882
+
883
+ function wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2(arg0, arg1) {
884
+ wasm.wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2(arg0, arg1);
876
885
  }
877
886
 
878
- function wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe(arg0, arg1, arg2) {
887
+ function wasm_bindgen__convert__closures_____invoke__h86320ba04bc5bce5(arg0, arg1, arg2) {
879
888
  try {
880
889
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
881
- wasm.wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe(
890
+ wasm.wasm_bindgen__convert__closures_____invoke__h86320ba04bc5bce5(
882
891
  retptr,
883
892
  arg0,
884
893
  arg1,
@@ -894,20 +903,12 @@ function wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe(arg0, arg
894
903
  }
895
904
  }
896
905
 
897
- function wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(arg0, arg1, arg2) {
898
- wasm.wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(
906
+ function wasm_bindgen__convert__closures_____invoke__h0cb536241502fe83(arg0, arg1, arg2, arg3) {
907
+ wasm.wasm_bindgen__convert__closures_____invoke__h0cb536241502fe83(
899
908
  arg0,
900
909
  arg1,
901
910
  addHeapObject(arg2),
902
- );
903
- }
904
-
905
- function wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(arg0, arg1, arg2, arg3) {
906
- wasm.wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(
907
- arg0,
908
- arg1,
909
- addHeapObject(arg2),
910
- addHeapObject(arg3),
911
+ addHeapObject(arg3),
911
912
  );
912
913
  }
913
914
 
@@ -1177,14 +1178,6 @@ class AuthClient {
1177
1178
  const ptr = this.__destroy_into_raw();
1178
1179
  wasm.__wbg_authclient_free(ptr, 0);
1179
1180
  }
1180
- /**
1181
- * Client for identity functionality
1182
- * @returns {IdentityClient}
1183
- */
1184
- identity() {
1185
- const ret = wasm.authclient_identity(this.__wbg_ptr);
1186
- return IdentityClient.__wrap(ret);
1187
- }
1188
1181
  /**
1189
1182
  * Client for send access functionality
1190
1183
  * @returns {SendAccessClient}
@@ -1201,6 +1194,14 @@ class AuthClient {
1201
1194
  const ret = wasm.authclient_identity(this.__wbg_ptr);
1202
1195
  return RegistrationClient.__wrap(ret);
1203
1196
  }
1197
+ /**
1198
+ * Client for identity functionality
1199
+ * @returns {IdentityClient}
1200
+ */
1201
+ identity() {
1202
+ const ret = wasm.authclient_identity(this.__wbg_ptr);
1203
+ return IdentityClient.__wrap(ret);
1204
+ }
1204
1205
  }
1205
1206
  if (Symbol.dispose) AuthClient.prototype[Symbol.dispose] = AuthClient.prototype.free;
1206
1207
 
@@ -1233,21 +1234,6 @@ class CipherRiskClient {
1233
1234
  const ptr = this.__destroy_into_raw();
1234
1235
  wasm.__wbg_cipherriskclient_free(ptr, 0);
1235
1236
  }
1236
- /**
1237
- * Build password reuse map for a list of login ciphers.
1238
- *
1239
- * Returns a map where keys are passwords and values are the number of times
1240
- * each password appears in the provided list. This map can be passed to `compute_risk()`
1241
- * to enable password reuse detection.
1242
- * @param {CipherLoginDetails[]} login_details
1243
- * @returns {PasswordReuseMap}
1244
- */
1245
- password_reuse_map(login_details) {
1246
- const ptr0 = passArrayJsValueToWasm0(login_details, wasm.__wbindgen_malloc);
1247
- const len0 = WASM_VECTOR_LEN;
1248
- const ret = wasm.cipherriskclient_password_reuse_map(this.__wbg_ptr, ptr0, len0);
1249
- return takeObject(ret);
1250
- }
1251
1237
  /**
1252
1238
  * Evaluate security risks for multiple login ciphers concurrently.
1253
1239
  *
@@ -1286,6 +1272,21 @@ class CipherRiskClient {
1286
1272
  );
1287
1273
  return takeObject(ret);
1288
1274
  }
1275
+ /**
1276
+ * Build password reuse map for a list of login ciphers.
1277
+ *
1278
+ * Returns a map where keys are passwords and values are the number of times
1279
+ * each password appears in the provided list. This map can be passed to `compute_risk()`
1280
+ * to enable password reuse detection.
1281
+ * @param {CipherLoginDetails[]} login_details
1282
+ * @returns {PasswordReuseMap}
1283
+ */
1284
+ password_reuse_map(login_details) {
1285
+ const ptr0 = passArrayJsValueToWasm0(login_details, wasm.__wbindgen_malloc);
1286
+ const len0 = WASM_VECTOR_LEN;
1287
+ const ret = wasm.cipherriskclient_password_reuse_map(this.__wbg_ptr, ptr0, len0);
1288
+ return takeObject(ret);
1289
+ }
1289
1290
  }
1290
1291
  if (Symbol.dispose) CipherRiskClient.prototype[Symbol.dispose] = CipherRiskClient.prototype.free;
1291
1292
 
@@ -1316,24 +1317,6 @@ class CiphersClient {
1316
1317
  const ptr = this.__destroy_into_raw();
1317
1318
  wasm.__wbg_ciphersclient_free(ptr, 0);
1318
1319
  }
1319
- /**
1320
- * Create a new [Cipher] and save it to the server.
1321
- * @param {CipherCreateRequest} request
1322
- * @returns {Promise<CipherView>}
1323
- */
1324
- create(request) {
1325
- const ret = wasm.ciphersclient_create(this.__wbg_ptr, addHeapObject(request));
1326
- return takeObject(ret);
1327
- }
1328
- /**
1329
- * Edit an existing [Cipher] and save it to the server.
1330
- * @param {CipherEditRequest} request
1331
- * @returns {Promise<CipherView>}
1332
- */
1333
- edit(request) {
1334
- const ret = wasm.ciphersclient_edit(this.__wbg_ptr, addHeapObject(request));
1335
- return takeObject(ret);
1336
- }
1337
1320
  /**
1338
1321
  * Moves a cipher into an organization, adds it to collections, and calls the share_cipher API.
1339
1322
  * @param {CipherView} cipher_view
@@ -1379,47 +1362,42 @@ class CiphersClient {
1379
1362
  return takeObject(ret);
1380
1363
  }
1381
1364
  /**
1382
- * @param {CipherView} cipher_view
1383
- * @returns {EncryptionContext}
1365
+ * @param {Cipher[]} ciphers
1366
+ * @returns {CipherListView[]}
1384
1367
  */
1385
- encrypt(cipher_view) {
1368
+ decrypt_list(ciphers) {
1386
1369
  try {
1387
1370
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1388
- wasm.ciphersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
1371
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1372
+ const len0 = WASM_VECTOR_LEN;
1373
+ wasm.ciphersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1389
1374
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1390
1375
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1391
1376
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1392
- if (r2) {
1393
- throw takeObject(r1);
1377
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1378
+ if (r3) {
1379
+ throw takeObject(r2);
1394
1380
  }
1395
- return takeObject(r0);
1381
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1382
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
1383
+ return v2;
1396
1384
  } finally {
1397
1385
  wasm.__wbindgen_add_to_stack_pointer(16);
1398
1386
  }
1399
1387
  }
1400
1388
  /**
1401
- * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1402
- * keys in the Web client.
1403
- *
1404
- * Until key rotation is fully implemented in the SDK, this method must be provided the new
1405
- * symmetric key in base64 format. See PM-23084
1406
- *
1407
- * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1408
- * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1409
- * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1410
- * key directly.
1411
1389
  * @param {CipherView} cipher_view
1412
- * @param {B64} new_key
1413
- * @returns {EncryptionContext}
1390
+ * @param {OrganizationId} organization_id
1391
+ * @returns {CipherView}
1414
1392
  */
1415
- encrypt_cipher_for_rotation(cipher_view, new_key) {
1393
+ move_to_organization(cipher_view, organization_id) {
1416
1394
  try {
1417
1395
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1418
- wasm.ciphersclient_encrypt_cipher_for_rotation(
1396
+ wasm.ciphersclient_move_to_organization(
1419
1397
  retptr,
1420
1398
  this.__wbg_ptr,
1421
1399
  addHeapObject(cipher_view),
1422
- addHeapObject(new_key),
1400
+ addHeapObject(organization_id),
1423
1401
  );
1424
1402
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1425
1403
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
@@ -1433,13 +1411,27 @@ class CiphersClient {
1433
1411
  }
1434
1412
  }
1435
1413
  /**
1436
- * @param {Cipher} cipher
1414
+ * Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
1415
+ * Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
1416
+ * TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
1417
+ * encrypting the rest of the CipherView.
1418
+ * TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
1419
+ * @param {CipherView} cipher_view
1420
+ * @param {Fido2CredentialFullView[]} fido2_credentials
1437
1421
  * @returns {CipherView}
1438
1422
  */
1439
- decrypt(cipher) {
1423
+ set_fido2_credentials(cipher_view, fido2_credentials) {
1440
1424
  try {
1441
1425
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1442
- wasm.ciphersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
1426
+ const ptr0 = passArrayJsValueToWasm0(fido2_credentials, wasm.__wbindgen_malloc);
1427
+ const len0 = WASM_VECTOR_LEN;
1428
+ wasm.ciphersclient_set_fido2_credentials(
1429
+ retptr,
1430
+ this.__wbg_ptr,
1431
+ addHeapObject(cipher_view),
1432
+ ptr0,
1433
+ len0,
1434
+ );
1443
1435
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1444
1436
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1445
1437
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1452,15 +1444,17 @@ class CiphersClient {
1452
1444
  }
1453
1445
  }
1454
1446
  /**
1455
- * @param {Cipher[]} ciphers
1456
- * @returns {CipherListView[]}
1447
+ * @param {CipherView} cipher_view
1448
+ * @returns {Fido2CredentialView[]}
1457
1449
  */
1458
- decrypt_list(ciphers) {
1450
+ decrypt_fido2_credentials(cipher_view) {
1459
1451
  try {
1460
1452
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1461
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1462
- const len0 = WASM_VECTOR_LEN;
1463
- wasm.ciphersclient_decrypt_list(retptr, this.__wbg_ptr, ptr0, len0);
1453
+ wasm.ciphersclient_decrypt_fido2_credentials(
1454
+ retptr,
1455
+ this.__wbg_ptr,
1456
+ addHeapObject(cipher_view),
1457
+ );
1464
1458
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1465
1459
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1466
1460
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1468,33 +1462,23 @@ class CiphersClient {
1468
1462
  if (r3) {
1469
1463
  throw takeObject(r2);
1470
1464
  }
1471
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1465
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1472
1466
  wasm.__wbindgen_free(r0, r1 * 4, 4);
1473
- return v2;
1467
+ return v1;
1474
1468
  } finally {
1475
1469
  wasm.__wbindgen_add_to_stack_pointer(16);
1476
1470
  }
1477
1471
  }
1478
- /**
1479
- * Decrypt cipher list with failures
1480
- * Returns both successfully decrypted ciphers and any that failed to decrypt
1481
- * @param {Cipher[]} ciphers
1482
- * @returns {DecryptCipherListResult}
1483
- */
1484
- decrypt_list_with_failures(ciphers) {
1485
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1486
- const len0 = WASM_VECTOR_LEN;
1487
- const ret = wasm.ciphersclient_decrypt_list_with_failures(this.__wbg_ptr, ptr0, len0);
1488
- return takeObject(ret);
1489
- }
1490
1472
  /**
1491
1473
  * @param {CipherView} cipher_view
1492
- * @returns {Fido2CredentialView[]}
1474
+ * @returns {string}
1493
1475
  */
1494
- decrypt_fido2_credentials(cipher_view) {
1476
+ decrypt_fido2_private_key(cipher_view) {
1477
+ let deferred2_0;
1478
+ let deferred2_1;
1495
1479
  try {
1496
1480
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1497
- wasm.ciphersclient_decrypt_fido2_credentials(
1481
+ wasm.ciphersclient_decrypt_fido2_private_key(
1498
1482
  retptr,
1499
1483
  this.__wbg_ptr,
1500
1484
  addHeapObject(cipher_view),
@@ -1503,37 +1487,56 @@ class CiphersClient {
1503
1487
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1504
1488
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1505
1489
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1490
+ var ptr1 = r0;
1491
+ var len1 = r1;
1506
1492
  if (r3) {
1493
+ ptr1 = 0;
1494
+ len1 = 0;
1507
1495
  throw takeObject(r2);
1508
1496
  }
1509
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
1510
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1511
- return v1;
1497
+ deferred2_0 = ptr1;
1498
+ deferred2_1 = len1;
1499
+ return getStringFromWasm0(ptr1, len1);
1512
1500
  } finally {
1513
1501
  wasm.__wbindgen_add_to_stack_pointer(16);
1502
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1514
1503
  }
1515
1504
  }
1516
1505
  /**
1517
- * Temporary method used to re-encrypt FIDO2 credentials for a cipher view.
1518
- * Necessary until the TS clients utilize the SDK entirely for FIDO2 credentials management.
1519
- * TS clients create decrypted FIDO2 credentials that need to be encrypted manually when
1520
- * encrypting the rest of the CipherView.
1521
- * TODO: Remove once TS passkey provider implementation uses SDK - PM-8313
1506
+ * Decrypt cipher list with failures
1507
+ * Returns both successfully decrypted ciphers and any that failed to decrypt
1508
+ * @param {Cipher[]} ciphers
1509
+ * @returns {DecryptCipherListResult}
1510
+ */
1511
+ decrypt_list_with_failures(ciphers) {
1512
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
1513
+ const len0 = WASM_VECTOR_LEN;
1514
+ const ret = wasm.ciphersclient_decrypt_list_with_failures(this.__wbg_ptr, ptr0, len0);
1515
+ return takeObject(ret);
1516
+ }
1517
+ /**
1518
+ * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1519
+ * keys in the Web client.
1520
+ *
1521
+ * Until key rotation is fully implemented in the SDK, this method must be provided the new
1522
+ * symmetric key in base64 format. See PM-23084
1523
+ *
1524
+ * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1525
+ * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1526
+ * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1527
+ * key directly.
1522
1528
  * @param {CipherView} cipher_view
1523
- * @param {Fido2CredentialFullView[]} fido2_credentials
1524
- * @returns {CipherView}
1529
+ * @param {B64} new_key
1530
+ * @returns {EncryptionContext}
1525
1531
  */
1526
- set_fido2_credentials(cipher_view, fido2_credentials) {
1532
+ encrypt_cipher_for_rotation(cipher_view, new_key) {
1527
1533
  try {
1528
1534
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1529
- const ptr0 = passArrayJsValueToWasm0(fido2_credentials, wasm.__wbindgen_malloc);
1530
- const len0 = WASM_VECTOR_LEN;
1531
- wasm.ciphersclient_set_fido2_credentials(
1535
+ wasm.ciphersclient_encrypt_cipher_for_rotation(
1532
1536
  retptr,
1533
1537
  this.__wbg_ptr,
1534
1538
  addHeapObject(cipher_view),
1535
- ptr0,
1536
- len0,
1539
+ addHeapObject(new_key),
1537
1540
  );
1538
1541
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1539
1542
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
@@ -1547,19 +1550,13 @@ class CiphersClient {
1547
1550
  }
1548
1551
  }
1549
1552
  /**
1550
- * @param {CipherView} cipher_view
1551
- * @param {OrganizationId} organization_id
1553
+ * @param {Cipher} cipher
1552
1554
  * @returns {CipherView}
1553
1555
  */
1554
- move_to_organization(cipher_view, organization_id) {
1556
+ decrypt(cipher) {
1555
1557
  try {
1556
1558
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1557
- wasm.ciphersclient_move_to_organization(
1558
- retptr,
1559
- this.__wbg_ptr,
1560
- addHeapObject(cipher_view),
1561
- addHeapObject(organization_id),
1562
- );
1559
+ wasm.ciphersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(cipher));
1563
1560
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1564
1561
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1565
1562
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1573,40 +1570,44 @@ class CiphersClient {
1573
1570
  }
1574
1571
  /**
1575
1572
  * @param {CipherView} cipher_view
1576
- * @returns {string}
1573
+ * @returns {EncryptionContext}
1577
1574
  */
1578
- decrypt_fido2_private_key(cipher_view) {
1579
- let deferred2_0;
1580
- let deferred2_1;
1575
+ encrypt(cipher_view) {
1581
1576
  try {
1582
1577
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1583
- wasm.ciphersclient_decrypt_fido2_private_key(
1584
- retptr,
1585
- this.__wbg_ptr,
1586
- addHeapObject(cipher_view),
1587
- );
1578
+ wasm.ciphersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(cipher_view));
1588
1579
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1589
1580
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1590
1581
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1591
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1592
- var ptr1 = r0;
1593
- var len1 = r1;
1594
- if (r3) {
1595
- ptr1 = 0;
1596
- len1 = 0;
1597
- throw takeObject(r2);
1582
+ if (r2) {
1583
+ throw takeObject(r1);
1598
1584
  }
1599
- deferred2_0 = ptr1;
1600
- deferred2_1 = len1;
1601
- return getStringFromWasm0(ptr1, len1);
1585
+ return takeObject(r0);
1602
1586
  } finally {
1603
1587
  wasm.__wbindgen_add_to_stack_pointer(16);
1604
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1605
1588
  }
1606
1589
  }
1607
- }
1608
- if (Symbol.dispose) CiphersClient.prototype[Symbol.dispose] = CiphersClient.prototype.free;
1609
-
1590
+ /**
1591
+ * Edit an existing [Cipher] and save it to the server.
1592
+ * @param {CipherEditRequest} request
1593
+ * @returns {Promise<CipherView>}
1594
+ */
1595
+ edit(request) {
1596
+ const ret = wasm.ciphersclient_edit(this.__wbg_ptr, addHeapObject(request));
1597
+ return takeObject(ret);
1598
+ }
1599
+ /**
1600
+ * Create a new [Cipher] and save it to the server.
1601
+ * @param {CipherCreateRequest} request
1602
+ * @returns {Promise<CipherView>}
1603
+ */
1604
+ create(request) {
1605
+ const ret = wasm.ciphersclient_create(this.__wbg_ptr, addHeapObject(request));
1606
+ return takeObject(ret);
1607
+ }
1608
+ }
1609
+ if (Symbol.dispose) CiphersClient.prototype[Symbol.dispose] = CiphersClient.prototype.free;
1610
+
1610
1611
  exports.CiphersClient = CiphersClient;
1611
1612
 
1612
1613
  const CollectionViewNodeItemFinalization =
@@ -1634,13 +1635,6 @@ class CollectionViewNodeItem {
1634
1635
  const ptr = this.__destroy_into_raw();
1635
1636
  wasm.__wbg_collectionviewnodeitem_free(ptr, 0);
1636
1637
  }
1637
- /**
1638
- * @returns {CollectionView}
1639
- */
1640
- get_item() {
1641
- const ret = wasm.collectionviewnodeitem_get_item(this.__wbg_ptr);
1642
- return takeObject(ret);
1643
- }
1644
1638
  /**
1645
1639
  * @returns {CollectionView | undefined}
1646
1640
  */
@@ -1671,6 +1665,13 @@ class CollectionViewNodeItem {
1671
1665
  const ret = wasm.collectionviewnodeitem_get_ancestors(this.__wbg_ptr);
1672
1666
  return takeObject(ret);
1673
1667
  }
1668
+ /**
1669
+ * @returns {CollectionView}
1670
+ */
1671
+ get_item() {
1672
+ const ret = wasm.collectionviewnodeitem_get_item(this.__wbg_ptr);
1673
+ return takeObject(ret);
1674
+ }
1674
1675
  }
1675
1676
  if (Symbol.dispose)
1676
1677
  CollectionViewNodeItem.prototype[Symbol.dispose] = CollectionViewNodeItem.prototype.free;
@@ -1702,24 +1703,13 @@ class CollectionViewTree {
1702
1703
  const ptr = this.__destroy_into_raw();
1703
1704
  wasm.__wbg_collectionviewtree_free(ptr, 0);
1704
1705
  }
1705
- /**
1706
- * @param {CollectionView} collection_view
1707
- * @returns {CollectionViewNodeItem | undefined}
1708
- */
1709
- get_item_for_view(collection_view) {
1710
- const ret = wasm.collectionviewtree_get_item_for_view(
1711
- this.__wbg_ptr,
1712
- addHeapObject(collection_view),
1713
- );
1714
- return ret === 0 ? undefined : CollectionViewNodeItem.__wrap(ret);
1715
- }
1716
1706
  /**
1717
1707
  * @returns {CollectionViewNodeItem[]}
1718
1708
  */
1719
- get_root_items() {
1709
+ get_flat_items() {
1720
1710
  try {
1721
1711
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1722
- wasm.collectionviewtree_get_root_items(retptr, this.__wbg_ptr);
1712
+ wasm.collectionviewtree_get_flat_items(retptr, this.__wbg_ptr);
1723
1713
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1724
1714
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1725
1715
  var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
@@ -1732,10 +1722,10 @@ class CollectionViewTree {
1732
1722
  /**
1733
1723
  * @returns {CollectionViewNodeItem[]}
1734
1724
  */
1735
- get_flat_items() {
1725
+ get_root_items() {
1736
1726
  try {
1737
1727
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1738
- wasm.collectionviewtree_get_flat_items(retptr, this.__wbg_ptr);
1728
+ wasm.collectionviewtree_get_root_items(retptr, this.__wbg_ptr);
1739
1729
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1740
1730
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1741
1731
  var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
@@ -1745,6 +1735,17 @@ 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;
@@ -1776,25 +1777,6 @@ class CollectionsClient {
1776
1777
  const ptr = this.__destroy_into_raw();
1777
1778
  wasm.__wbg_collectionsclient_free(ptr, 0);
1778
1779
  }
1779
- /**
1780
- * @param {Collection} collection
1781
- * @returns {CollectionView}
1782
- */
1783
- decrypt(collection) {
1784
- try {
1785
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1786
- wasm.collectionsclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(collection));
1787
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1788
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1789
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1790
- if (r2) {
1791
- throw takeObject(r1);
1792
- }
1793
- return takeObject(r0);
1794
- } finally {
1795
- wasm.__wbindgen_add_to_stack_pointer(16);
1796
- }
1797
- }
1798
1780
  /**
1799
1781
  * @param {Collection[]} collections
1800
1782
  * @returns {CollectionView[]}
@@ -1832,6 +1814,25 @@ class CollectionsClient {
1832
1814
  const ret = wasm.collectionsclient_get_collection_tree(this.__wbg_ptr, ptr0, len0);
1833
1815
  return CollectionViewTree.__wrap(ret);
1834
1816
  }
1817
+ /**
1818
+ * @param {Collection} collection
1819
+ * @returns {CollectionView}
1820
+ */
1821
+ decrypt(collection) {
1822
+ try {
1823
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1824
+ wasm.collectionsclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(collection));
1825
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1826
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1827
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1828
+ if (r2) {
1829
+ throw takeObject(r1);
1830
+ }
1831
+ return takeObject(r0);
1832
+ } finally {
1833
+ wasm.__wbindgen_add_to_stack_pointer(16);
1834
+ }
1835
+ }
1835
1836
  }
1836
1837
  if (Symbol.dispose) CollectionsClient.prototype[Symbol.dispose] = CollectionsClient.prototype.free;
1837
1838
 
@@ -1940,35 +1941,18 @@ class CryptoClient {
1940
1941
  wasm.__wbg_cryptoclient_free(ptr, 0);
1941
1942
  }
1942
1943
  /**
1943
- * Initialization method for the user crypto. Needs to be called before any other crypto
1944
- * operations.
1945
- * @param {InitUserCryptoRequest} req
1946
- * @returns {Promise<void>}
1947
- */
1948
- initialize_user_crypto(req) {
1949
- const ret = wasm.cryptoclient_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
1950
- return takeObject(ret);
1951
- }
1952
- /**
1953
- * Initialization method for the organization crypto. Needs to be called after
1954
- * `initialize_user_crypto` but before any other crypto operations.
1955
- * @param {InitOrgCryptoRequest} req
1956
- * @returns {Promise<void>}
1957
- */
1958
- initialize_org_crypto(req) {
1959
- const ret = wasm.cryptoclient_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
1960
- return takeObject(ret);
1961
- }
1962
- /**
1963
- * Generates a new key pair and encrypts the private key with the provided user key.
1964
- * Crypto initialization not required.
1965
- * @param {B64} user_key
1966
- * @returns {MakeKeyPairResponse}
1944
+ * Protects the current user key with the provided PIN. The result can be stored and later
1945
+ * used to initialize another client instance by using the PIN and the PIN key with
1946
+ * `initialize_user_crypto`.
1947
+ * @param {string} pin
1948
+ * @returns {EnrollPinResponse}
1967
1949
  */
1968
- make_key_pair(user_key) {
1950
+ enroll_pin(pin) {
1969
1951
  try {
1970
1952
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1971
- wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, addHeapObject(user_key));
1953
+ const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1954
+ const len0 = WASM_VECTOR_LEN;
1955
+ wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
1972
1956
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1973
1957
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1974
1958
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1981,16 +1965,15 @@ class CryptoClient {
1981
1965
  }
1982
1966
  }
1983
1967
  /**
1984
- * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1985
- * key. Returns if the private key is decryptable and if it is a valid matching key.
1968
+ * Generates a new key pair and encrypts the private key with the provided user key.
1986
1969
  * Crypto initialization not required.
1987
- * @param {VerifyAsymmetricKeysRequest} request
1988
- * @returns {VerifyAsymmetricKeysResponse}
1970
+ * @param {B64} user_key
1971
+ * @returns {MakeKeyPairResponse}
1989
1972
  */
1990
- verify_asymmetric_keys(request) {
1973
+ make_key_pair(user_key) {
1991
1974
  try {
1992
1975
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1993
- wasm.cryptoclient_verify_asymmetric_keys(retptr, this.__wbg_ptr, addHeapObject(request));
1976
+ wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, addHeapObject(user_key));
1994
1977
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1995
1978
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1996
1979
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2003,13 +1986,19 @@ class CryptoClient {
2003
1986
  }
2004
1987
  }
2005
1988
  /**
2006
- * Makes a new signing key pair and signs the public key for the user
2007
- * @returns {UserCryptoV2KeysResponse}
1989
+ * Create the data necessary to update the user's kdf settings. The user's encryption key is
1990
+ * re-encrypted for the password under the new kdf settings. This returns the re-encrypted
1991
+ * user key and the new password hash but does not update sdk state.
1992
+ * @param {string} password
1993
+ * @param {Kdf} kdf
1994
+ * @returns {UpdateKdfResponse}
2008
1995
  */
2009
- make_keys_for_user_crypto_v2() {
1996
+ make_update_kdf(password, kdf) {
2010
1997
  try {
2011
1998
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2012
- wasm.cryptoclient_make_keys_for_user_crypto_v2(retptr, this.__wbg_ptr);
1999
+ const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2000
+ const len0 = WASM_VECTOR_LEN;
2001
+ wasm.cryptoclient_make_update_kdf(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(kdf));
2013
2002
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2014
2003
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2015
2004
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2022,13 +2011,36 @@ class CryptoClient {
2022
2011
  }
2023
2012
  }
2024
2013
  /**
2025
- * Creates a rotated set of account keys for the current state
2026
- * @returns {UserCryptoV2KeysResponse}
2014
+ * Initialization method for the organization crypto. Needs to be called after
2015
+ * `initialize_user_crypto` but before any other crypto operations.
2016
+ * @param {InitOrgCryptoRequest} req
2017
+ * @returns {Promise<void>}
2027
2018
  */
2028
- get_v2_rotated_account_keys() {
2019
+ initialize_org_crypto(req) {
2020
+ const ret = wasm.cryptoclient_initialize_org_crypto(this.__wbg_ptr, addHeapObject(req));
2021
+ return takeObject(ret);
2022
+ }
2023
+ /**
2024
+ * Initialization method for the user crypto. Needs to be called before any other crypto
2025
+ * operations.
2026
+ * @param {InitUserCryptoRequest} req
2027
+ * @returns {Promise<void>}
2028
+ */
2029
+ initialize_user_crypto(req) {
2030
+ const ret = wasm.cryptoclient_initialize_user_crypto(this.__wbg_ptr, addHeapObject(req));
2031
+ return takeObject(ret);
2032
+ }
2033
+ /**
2034
+ * Verifies a user's asymmetric keys by decrypting the private key with the provided user
2035
+ * key. Returns if the private key is decryptable and if it is a valid matching key.
2036
+ * Crypto initialization not required.
2037
+ * @param {VerifyAsymmetricKeysRequest} request
2038
+ * @returns {VerifyAsymmetricKeysResponse}
2039
+ */
2040
+ verify_asymmetric_keys(request) {
2029
2041
  try {
2030
2042
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2031
- wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr);
2043
+ wasm.cryptoclient_verify_asymmetric_keys(retptr, this.__wbg_ptr, addHeapObject(request));
2032
2044
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2033
2045
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2034
2046
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2041,19 +2053,13 @@ class CryptoClient {
2041
2053
  }
2042
2054
  }
2043
2055
  /**
2044
- * Create the data necessary to update the user's kdf settings. The user's encryption key is
2045
- * re-encrypted for the password under the new kdf settings. This returns the re-encrypted
2046
- * user key and the new password hash but does not update sdk state.
2047
- * @param {string} password
2048
- * @param {Kdf} kdf
2049
- * @returns {UpdateKdfResponse}
2056
+ * Creates a rotated set of account keys for the current state
2057
+ * @returns {UserCryptoV2KeysResponse}
2050
2058
  */
2051
- make_update_kdf(password, kdf) {
2059
+ get_v2_rotated_account_keys() {
2052
2060
  try {
2053
2061
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2054
- const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2055
- const len0 = WASM_VECTOR_LEN;
2056
- wasm.cryptoclient_make_update_kdf(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(kdf));
2062
+ wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr);
2057
2063
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2058
2064
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2059
2065
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2066,18 +2072,13 @@ class CryptoClient {
2066
2072
  }
2067
2073
  }
2068
2074
  /**
2069
- * Protects the current user key with the provided PIN. The result can be stored and later
2070
- * used to initialize another client instance by using the PIN and the PIN key with
2071
- * `initialize_user_crypto`.
2072
- * @param {string} pin
2073
- * @returns {EnrollPinResponse}
2075
+ * Makes a new signing key pair and signs the public key for the user
2076
+ * @returns {UserCryptoV2KeysResponse}
2074
2077
  */
2075
- enroll_pin(pin) {
2078
+ make_keys_for_user_crypto_v2() {
2076
2079
  try {
2077
2080
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2078
- const ptr0 = passStringToWasm0(pin, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2079
- const len0 = WASM_VECTOR_LEN;
2080
- wasm.cryptoclient_enroll_pin(retptr, this.__wbg_ptr, ptr0, len0);
2081
+ wasm.cryptoclient_make_keys_for_user_crypto_v2(retptr, this.__wbg_ptr);
2081
2082
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2082
2083
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2083
2084
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2184,64 +2185,89 @@ class ExporterClient {
2184
2185
  wasm.__wbg_exporterclient_free(ptr, 0);
2185
2186
  }
2186
2187
  /**
2187
- * @param {Folder[]} folders
2188
+ * Credential Exchange Format (CXF)
2189
+ *
2190
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2191
+ *
2192
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2193
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2194
+ * @param {Account} account
2188
2195
  * @param {Cipher[]} ciphers
2189
- * @param {ExportFormat} format
2190
2196
  * @returns {string}
2191
2197
  */
2192
- export_vault(folders, ciphers, format) {
2193
- let deferred4_0;
2194
- let deferred4_1;
2198
+ export_cxf(account, ciphers) {
2199
+ let deferred3_0;
2200
+ let deferred3_1;
2195
2201
  try {
2196
2202
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2197
- const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
2203
+ const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2198
2204
  const len0 = WASM_VECTOR_LEN;
2199
- const ptr1 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2200
- const len1 = WASM_VECTOR_LEN;
2201
- wasm.exporterclient_export_vault(
2202
- retptr,
2203
- this.__wbg_ptr,
2204
- ptr0,
2205
- len0,
2206
- ptr1,
2207
- len1,
2208
- addHeapObject(format),
2209
- );
2205
+ wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), ptr0, len0);
2210
2206
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2211
2207
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2212
2208
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2213
2209
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2214
- var ptr3 = r0;
2215
- var len3 = r1;
2210
+ var ptr2 = r0;
2211
+ var len2 = r1;
2216
2212
  if (r3) {
2217
- ptr3 = 0;
2218
- len3 = 0;
2213
+ ptr2 = 0;
2214
+ len2 = 0;
2219
2215
  throw takeObject(r2);
2220
2216
  }
2221
- deferred4_0 = ptr3;
2222
- deferred4_1 = len3;
2223
- return getStringFromWasm0(ptr3, len3);
2217
+ deferred3_0 = ptr2;
2218
+ deferred3_1 = len2;
2219
+ return getStringFromWasm0(ptr2, len2);
2224
2220
  } finally {
2225
2221
  wasm.__wbindgen_add_to_stack_pointer(16);
2226
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2222
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2227
2223
  }
2228
2224
  }
2229
2225
  /**
2230
- * @param {Collection[]} collections
2226
+ * Credential Exchange Format (CXF)
2227
+ *
2228
+ * *Warning:* Expect this API to be unstable, and it will change in the future.
2229
+ *
2230
+ * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2231
+ * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2232
+ * @param {string} payload
2233
+ * @returns {Cipher[]}
2234
+ */
2235
+ import_cxf(payload) {
2236
+ try {
2237
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2238
+ const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2239
+ const len0 = WASM_VECTOR_LEN;
2240
+ wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
2241
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2242
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2243
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2244
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2245
+ if (r3) {
2246
+ throw takeObject(r2);
2247
+ }
2248
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2249
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
2250
+ return v2;
2251
+ } finally {
2252
+ wasm.__wbindgen_add_to_stack_pointer(16);
2253
+ }
2254
+ }
2255
+ /**
2256
+ * @param {Folder[]} folders
2231
2257
  * @param {Cipher[]} ciphers
2232
2258
  * @param {ExportFormat} format
2233
2259
  * @returns {string}
2234
2260
  */
2235
- export_organization_vault(collections, ciphers, format) {
2261
+ export_vault(folders, ciphers, format) {
2236
2262
  let deferred4_0;
2237
2263
  let deferred4_1;
2238
2264
  try {
2239
2265
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2240
- const ptr0 = passArrayJsValueToWasm0(collections, wasm.__wbindgen_malloc);
2266
+ const ptr0 = passArrayJsValueToWasm0(folders, wasm.__wbindgen_malloc);
2241
2267
  const len0 = WASM_VECTOR_LEN;
2242
2268
  const ptr1 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2243
2269
  const len1 = WASM_VECTOR_LEN;
2244
- wasm.exporterclient_export_organization_vault(
2270
+ wasm.exporterclient_export_vault(
2245
2271
  retptr,
2246
2272
  this.__wbg_ptr,
2247
2273
  ptr0,
@@ -2270,71 +2296,46 @@ class ExporterClient {
2270
2296
  }
2271
2297
  }
2272
2298
  /**
2273
- * Credential Exchange Format (CXF)
2274
- *
2275
- * *Warning:* Expect this API to be unstable, and it will change in the future.
2276
- *
2277
- * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2278
- * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2279
- * @param {Account} account
2299
+ * @param {Collection[]} collections
2280
2300
  * @param {Cipher[]} ciphers
2301
+ * @param {ExportFormat} format
2281
2302
  * @returns {string}
2282
2303
  */
2283
- export_cxf(account, ciphers) {
2284
- let deferred3_0;
2285
- let deferred3_1;
2286
- try {
2287
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2288
- const ptr0 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2289
- const len0 = WASM_VECTOR_LEN;
2290
- wasm.exporterclient_export_cxf(retptr, this.__wbg_ptr, addHeapObject(account), ptr0, len0);
2291
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2292
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2293
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2294
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2295
- var ptr2 = r0;
2296
- var len2 = r1;
2297
- if (r3) {
2298
- ptr2 = 0;
2299
- len2 = 0;
2300
- throw takeObject(r2);
2301
- }
2302
- deferred3_0 = ptr2;
2303
- deferred3_1 = len2;
2304
- return getStringFromWasm0(ptr2, len2);
2305
- } finally {
2306
- wasm.__wbindgen_add_to_stack_pointer(16);
2307
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2308
- }
2309
- }
2310
- /**
2311
- * Credential Exchange Format (CXF)
2312
- *
2313
- * *Warning:* Expect this API to be unstable, and it will change in the future.
2314
- *
2315
- * For use with Apple using [ASCredentialExportManager](https://developer.apple.com/documentation/authenticationservices/ascredentialexportmanager).
2316
- * Ideally, the input should be immediately serialized from [ASImportableAccount](https://developer.apple.com/documentation/authenticationservices/asimportableaccount).
2317
- * @param {string} payload
2318
- * @returns {Cipher[]}
2319
- */
2320
- import_cxf(payload) {
2304
+ export_organization_vault(collections, ciphers, format) {
2305
+ let deferred4_0;
2306
+ let deferred4_1;
2321
2307
  try {
2322
2308
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2323
- const ptr0 = passStringToWasm0(payload, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2309
+ const ptr0 = passArrayJsValueToWasm0(collections, wasm.__wbindgen_malloc);
2324
2310
  const len0 = WASM_VECTOR_LEN;
2325
- wasm.exporterclient_import_cxf(retptr, this.__wbg_ptr, ptr0, len0);
2311
+ const ptr1 = passArrayJsValueToWasm0(ciphers, wasm.__wbindgen_malloc);
2312
+ const len1 = WASM_VECTOR_LEN;
2313
+ wasm.exporterclient_export_organization_vault(
2314
+ retptr,
2315
+ this.__wbg_ptr,
2316
+ ptr0,
2317
+ len0,
2318
+ ptr1,
2319
+ len1,
2320
+ addHeapObject(format),
2321
+ );
2326
2322
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2327
2323
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2328
2324
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2329
2325
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2326
+ var ptr3 = r0;
2327
+ var len3 = r1;
2330
2328
  if (r3) {
2329
+ ptr3 = 0;
2330
+ len3 = 0;
2331
2331
  throw takeObject(r2);
2332
2332
  }
2333
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
2334
- wasm.__wbindgen_free(r0, r1 * 4, 4);
2335
- return v2;
2333
+ deferred4_0 = ptr3;
2334
+ deferred4_1 = len3;
2335
+ return getStringFromWasm0(ptr3, len3);
2336
2336
  } finally {
2337
2337
  wasm.__wbindgen_add_to_stack_pointer(16);
2338
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2338
2339
  }
2339
2340
  }
2340
2341
  }
@@ -2369,46 +2370,6 @@ class FoldersClient {
2369
2370
  const ptr = this.__destroy_into_raw();
2370
2371
  wasm.__wbg_foldersclient_free(ptr, 0);
2371
2372
  }
2372
- /**
2373
- * Encrypt a [FolderView] to a [Folder].
2374
- * @param {FolderView} folder_view
2375
- * @returns {Folder}
2376
- */
2377
- encrypt(folder_view) {
2378
- try {
2379
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2380
- wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
2381
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2382
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2383
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2384
- if (r2) {
2385
- throw takeObject(r1);
2386
- }
2387
- return takeObject(r0);
2388
- } finally {
2389
- wasm.__wbindgen_add_to_stack_pointer(16);
2390
- }
2391
- }
2392
- /**
2393
- * Encrypt a [Folder] to [FolderView].
2394
- * @param {Folder} folder
2395
- * @returns {FolderView}
2396
- */
2397
- decrypt(folder) {
2398
- try {
2399
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2400
- wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
2401
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2402
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2403
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2404
- if (r2) {
2405
- throw takeObject(r1);
2406
- }
2407
- return takeObject(r0);
2408
- } finally {
2409
- wasm.__wbindgen_add_to_stack_pointer(16);
2410
- }
2411
- }
2412
2373
  /**
2413
2374
  * Decrypt a list of [Folder]s to a list of [FolderView]s.
2414
2375
  * @param {Folder[]} folders
@@ -2434,14 +2395,6 @@ class FoldersClient {
2434
2395
  wasm.__wbindgen_add_to_stack_pointer(16);
2435
2396
  }
2436
2397
  }
2437
- /**
2438
- * Get all folders from state and decrypt them to a list of [FolderView].
2439
- * @returns {Promise<FolderView[]>}
2440
- */
2441
- list() {
2442
- const ret = wasm.foldersclient_list(this.__wbg_ptr);
2443
- return takeObject(ret);
2444
- }
2445
2398
  /**
2446
2399
  * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
2447
2400
  * @param {FolderId} folder_id
@@ -2451,15 +2404,6 @@ class FoldersClient {
2451
2404
  const ret = wasm.foldersclient_get(this.__wbg_ptr, addHeapObject(folder_id));
2452
2405
  return takeObject(ret);
2453
2406
  }
2454
- /**
2455
- * Create a new [Folder] and save it to the server.
2456
- * @param {FolderAddEditRequest} request
2457
- * @returns {Promise<FolderView>}
2458
- */
2459
- create(request) {
2460
- const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
2461
- return takeObject(ret);
2462
- }
2463
2407
  /**
2464
2408
  * Edit the [Folder] and save it to the server.
2465
2409
  * @param {FolderId} folder_id
@@ -2474,6 +2418,63 @@ class FoldersClient {
2474
2418
  );
2475
2419
  return takeObject(ret);
2476
2420
  }
2421
+ /**
2422
+ * Get all folders from state and decrypt them to a list of [FolderView].
2423
+ * @returns {Promise<FolderView[]>}
2424
+ */
2425
+ list() {
2426
+ const ret = wasm.foldersclient_list(this.__wbg_ptr);
2427
+ return takeObject(ret);
2428
+ }
2429
+ /**
2430
+ * Create a new [Folder] and save it to the server.
2431
+ * @param {FolderAddEditRequest} request
2432
+ * @returns {Promise<FolderView>}
2433
+ */
2434
+ create(request) {
2435
+ const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
2436
+ return takeObject(ret);
2437
+ }
2438
+ /**
2439
+ * Encrypt a [Folder] to [FolderView].
2440
+ * @param {Folder} folder
2441
+ * @returns {FolderView}
2442
+ */
2443
+ decrypt(folder) {
2444
+ try {
2445
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2446
+ wasm.foldersclient_decrypt(retptr, this.__wbg_ptr, addHeapObject(folder));
2447
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2448
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2449
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2450
+ if (r2) {
2451
+ throw takeObject(r1);
2452
+ }
2453
+ return takeObject(r0);
2454
+ } finally {
2455
+ wasm.__wbindgen_add_to_stack_pointer(16);
2456
+ }
2457
+ }
2458
+ /**
2459
+ * Encrypt a [FolderView] to a [Folder].
2460
+ * @param {FolderView} folder_view
2461
+ * @returns {Folder}
2462
+ */
2463
+ encrypt(folder_view) {
2464
+ try {
2465
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2466
+ wasm.foldersclient_encrypt(retptr, this.__wbg_ptr, addHeapObject(folder_view));
2467
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2468
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2469
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2470
+ if (r2) {
2471
+ throw takeObject(r1);
2472
+ }
2473
+ return takeObject(r0);
2474
+ } finally {
2475
+ wasm.__wbindgen_add_to_stack_pointer(16);
2476
+ }
2477
+ }
2477
2478
  }
2478
2479
  if (Symbol.dispose) FoldersClient.prototype[Symbol.dispose] = FoldersClient.prototype.free;
2479
2480
 
@@ -2505,38 +2506,38 @@ class GeneratorClient {
2505
2506
  wasm.__wbg_generatorclient_free(ptr, 0);
2506
2507
  }
2507
2508
  /**
2508
- * Generates a random password.
2509
+ * Generates a random passphrase.
2510
+ * A passphrase is a combination of random words separated by a character.
2511
+ * An example of passphrase is `correct horse battery staple`.
2509
2512
  *
2510
- * The character sets and password length can be customized using the `input` parameter.
2513
+ * The number of words and their case, the word separator, and the inclusion of
2514
+ * a number in the passphrase can be customized using the `input` parameter.
2511
2515
  *
2512
2516
  * # Examples
2513
2517
  *
2514
2518
  * ```
2515
2519
  * use bitwarden_core::Client;
2516
- * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2520
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
2517
2521
  *
2518
2522
  * async fn test() -> Result<(), PassphraseError> {
2519
- * let input = PasswordGeneratorRequest {
2520
- * lowercase: true,
2521
- * uppercase: true,
2522
- * numbers: true,
2523
- * length: 20,
2523
+ * let input = PassphraseGeneratorRequest {
2524
+ * num_words: 4,
2524
2525
  * ..Default::default()
2525
2526
  * };
2526
- * let password = Client::new(None).generator().password(input).unwrap();
2527
- * println!("{}", password);
2528
- * Ok(())
2527
+ * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
2528
+ * println!("{}", passphrase);
2529
+ * Ok(())
2529
2530
  * }
2530
2531
  * ```
2531
- * @param {PasswordGeneratorRequest} input
2532
+ * @param {PassphraseGeneratorRequest} input
2532
2533
  * @returns {string}
2533
2534
  */
2534
- password(input) {
2535
+ passphrase(input) {
2535
2536
  let deferred2_0;
2536
2537
  let deferred2_1;
2537
2538
  try {
2538
2539
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2539
- wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
2540
+ wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
2540
2541
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2541
2542
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2542
2543
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2557,38 +2558,38 @@ class GeneratorClient {
2557
2558
  }
2558
2559
  }
2559
2560
  /**
2560
- * Generates a random passphrase.
2561
- * A passphrase is a combination of random words separated by a character.
2562
- * An example of passphrase is `correct horse battery staple`.
2561
+ * Generates a random password.
2563
2562
  *
2564
- * The number of words and their case, the word separator, and the inclusion of
2565
- * a number in the passphrase can be customized using the `input` parameter.
2563
+ * The character sets and password length can be customized using the `input` parameter.
2566
2564
  *
2567
2565
  * # Examples
2568
2566
  *
2569
2567
  * ```
2570
2568
  * use bitwarden_core::Client;
2571
- * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
2569
+ * use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2572
2570
  *
2573
2571
  * async fn test() -> Result<(), PassphraseError> {
2574
- * let input = PassphraseGeneratorRequest {
2575
- * num_words: 4,
2572
+ * let input = PasswordGeneratorRequest {
2573
+ * lowercase: true,
2574
+ * uppercase: true,
2575
+ * numbers: true,
2576
+ * length: 20,
2576
2577
  * ..Default::default()
2577
2578
  * };
2578
- * let passphrase = Client::new(None).generator().passphrase(input).unwrap();
2579
- * println!("{}", passphrase);
2579
+ * let password = Client::new(None).generator().password(input).unwrap();
2580
+ * println!("{}", password);
2580
2581
  * Ok(())
2581
2582
  * }
2582
2583
  * ```
2583
- * @param {PassphraseGeneratorRequest} input
2584
+ * @param {PasswordGeneratorRequest} input
2584
2585
  * @returns {string}
2585
2586
  */
2586
- passphrase(input) {
2587
+ password(input) {
2587
2588
  let deferred2_0;
2588
2589
  let deferred2_1;
2589
2590
  try {
2590
2591
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2591
- wasm.generatorclient_passphrase(retptr, this.__wbg_ptr, addHeapObject(input));
2592
+ wasm.generatorclient_password(retptr, this.__wbg_ptr, addHeapObject(input));
2592
2593
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2593
2594
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2594
2595
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2670,6 +2671,39 @@ class IncomingMessage {
2670
2671
  const ptr = this.__destroy_into_raw();
2671
2672
  wasm.__wbg_incomingmessage_free(ptr, 0);
2672
2673
  }
2674
+ /**
2675
+ * Try to parse the payload as JSON.
2676
+ * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2677
+ */
2678
+ parse_payload_as_json() {
2679
+ const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2680
+ return takeObject(ret);
2681
+ }
2682
+ /**
2683
+ * @param {Uint8Array} payload
2684
+ * @param {Endpoint} destination
2685
+ * @param {Endpoint} source
2686
+ * @param {string | null} [topic]
2687
+ */
2688
+ constructor(payload, destination, source, topic) {
2689
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2690
+ const len0 = WASM_VECTOR_LEN;
2691
+ var ptr1 = isLikeNone(topic)
2692
+ ? 0
2693
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2694
+ var len1 = WASM_VECTOR_LEN;
2695
+ const ret = wasm.incomingmessage_new(
2696
+ ptr0,
2697
+ len0,
2698
+ addHeapObject(destination),
2699
+ addHeapObject(source),
2700
+ ptr1,
2701
+ len1,
2702
+ );
2703
+ this.__wbg_ptr = ret >>> 0;
2704
+ IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
2705
+ return this;
2706
+ }
2673
2707
  /**
2674
2708
  * @returns {Uint8Array}
2675
2709
  */
@@ -2749,39 +2783,6 @@ class IncomingMessage {
2749
2783
  var len0 = WASM_VECTOR_LEN;
2750
2784
  wasm.__wbg_set_incomingmessage_topic(this.__wbg_ptr, ptr0, len0);
2751
2785
  }
2752
- /**
2753
- * @param {Uint8Array} payload
2754
- * @param {Endpoint} destination
2755
- * @param {Endpoint} source
2756
- * @param {string | null} [topic]
2757
- */
2758
- constructor(payload, destination, source, topic) {
2759
- const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2760
- const len0 = WASM_VECTOR_LEN;
2761
- var ptr1 = isLikeNone(topic)
2762
- ? 0
2763
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2764
- var len1 = WASM_VECTOR_LEN;
2765
- const ret = wasm.incomingmessage_new(
2766
- ptr0,
2767
- len0,
2768
- addHeapObject(destination),
2769
- addHeapObject(source),
2770
- ptr1,
2771
- len1,
2772
- );
2773
- this.__wbg_ptr = ret >>> 0;
2774
- IncomingMessageFinalization.register(this, this.__wbg_ptr, this);
2775
- return this;
2776
- }
2777
- /**
2778
- * Try to parse the payload as JSON.
2779
- * @returns {any} The parsed JSON value, or undefined if the payload is not valid JSON.
2780
- */
2781
- parse_payload_as_json() {
2782
- const ret = wasm.incomingmessage_parse_payload_as_json(this.__wbg_ptr);
2783
- return takeObject(ret);
2784
- }
2785
2786
  }
2786
2787
  if (Symbol.dispose) IncomingMessage.prototype[Symbol.dispose] = IncomingMessage.prototype.free;
2787
2788
 
@@ -2815,6 +2816,13 @@ class IpcClient {
2815
2816
  const ptr = this.__destroy_into_raw();
2816
2817
  wasm.__wbg_ipcclient_free(ptr, 0);
2817
2818
  }
2819
+ /**
2820
+ * @returns {Promise<boolean>}
2821
+ */
2822
+ isRunning() {
2823
+ const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2824
+ return takeObject(ret);
2825
+ }
2818
2826
  /**
2819
2827
  * Create a new `IpcClient` instance with an in-memory session repository for saving
2820
2828
  * sessions within the SDK.
@@ -2841,20 +2849,6 @@ class IpcClient {
2841
2849
  );
2842
2850
  return IpcClient.__wrap(ret);
2843
2851
  }
2844
- /**
2845
- * @returns {Promise<void>}
2846
- */
2847
- start() {
2848
- const ret = wasm.ipcclient_start(this.__wbg_ptr);
2849
- return takeObject(ret);
2850
- }
2851
- /**
2852
- * @returns {Promise<boolean>}
2853
- */
2854
- isRunning() {
2855
- const ret = wasm.ipcclient_isRunning(this.__wbg_ptr);
2856
- return takeObject(ret);
2857
- }
2858
2852
  /**
2859
2853
  * @param {OutgoingMessage} message
2860
2854
  * @returns {Promise<void>}
@@ -2865,6 +2859,13 @@ class IpcClient {
2865
2859
  const ret = wasm.ipcclient_send(this.__wbg_ptr, ptr0);
2866
2860
  return takeObject(ret);
2867
2861
  }
2862
+ /**
2863
+ * @returns {Promise<void>}
2864
+ */
2865
+ start() {
2866
+ const ret = wasm.ipcclient_start(this.__wbg_ptr);
2867
+ return takeObject(ret);
2868
+ }
2868
2869
  /**
2869
2870
  * @returns {Promise<IpcClientSubscription>}
2870
2871
  */
@@ -3001,6 +3002,55 @@ class OutgoingMessage {
3001
3002
  const ptr = this.__destroy_into_raw();
3002
3003
  wasm.__wbg_outgoingmessage_free(ptr, 0);
3003
3004
  }
3005
+ /**
3006
+ * Create a new message and encode the payload as JSON.
3007
+ * @param {any} payload
3008
+ * @param {Endpoint} destination
3009
+ * @param {string | null} [topic]
3010
+ * @returns {OutgoingMessage}
3011
+ */
3012
+ static new_json_payload(payload, destination, topic) {
3013
+ try {
3014
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3015
+ var ptr0 = isLikeNone(topic)
3016
+ ? 0
3017
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3018
+ var len0 = WASM_VECTOR_LEN;
3019
+ wasm.outgoingmessage_new_json_payload(
3020
+ retptr,
3021
+ addHeapObject(payload),
3022
+ addHeapObject(destination),
3023
+ ptr0,
3024
+ len0,
3025
+ );
3026
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3027
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3028
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3029
+ if (r2) {
3030
+ throw takeObject(r1);
3031
+ }
3032
+ return OutgoingMessage.__wrap(r0);
3033
+ } finally {
3034
+ wasm.__wbindgen_add_to_stack_pointer(16);
3035
+ }
3036
+ }
3037
+ /**
3038
+ * @param {Uint8Array} payload
3039
+ * @param {Endpoint} destination
3040
+ * @param {string | null} [topic]
3041
+ */
3042
+ constructor(payload, destination, topic) {
3043
+ const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
3044
+ const len0 = WASM_VECTOR_LEN;
3045
+ var ptr1 = isLikeNone(topic)
3046
+ ? 0
3047
+ : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3048
+ var len1 = WASM_VECTOR_LEN;
3049
+ const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
3050
+ this.__wbg_ptr = ret >>> 0;
3051
+ OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
3052
+ return this;
3053
+ }
3004
3054
  /**
3005
3055
  * @returns {Uint8Array}
3006
3056
  */
@@ -3067,55 +3117,6 @@ class OutgoingMessage {
3067
3117
  var len0 = WASM_VECTOR_LEN;
3068
3118
  wasm.__wbg_set_outgoingmessage_topic(this.__wbg_ptr, ptr0, len0);
3069
3119
  }
3070
- /**
3071
- * @param {Uint8Array} payload
3072
- * @param {Endpoint} destination
3073
- * @param {string | null} [topic]
3074
- */
3075
- constructor(payload, destination, topic) {
3076
- const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
3077
- const len0 = WASM_VECTOR_LEN;
3078
- var ptr1 = isLikeNone(topic)
3079
- ? 0
3080
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3081
- var len1 = WASM_VECTOR_LEN;
3082
- const ret = wasm.outgoingmessage_new(ptr0, len0, addHeapObject(destination), ptr1, len1);
3083
- this.__wbg_ptr = ret >>> 0;
3084
- OutgoingMessageFinalization.register(this, this.__wbg_ptr, this);
3085
- return this;
3086
- }
3087
- /**
3088
- * Create a new message and encode the payload as JSON.
3089
- * @param {any} payload
3090
- * @param {Endpoint} destination
3091
- * @param {string | null} [topic]
3092
- * @returns {OutgoingMessage}
3093
- */
3094
- static new_json_payload(payload, destination, topic) {
3095
- try {
3096
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3097
- var ptr0 = isLikeNone(topic)
3098
- ? 0
3099
- : passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3100
- var len0 = WASM_VECTOR_LEN;
3101
- wasm.outgoingmessage_new_json_payload(
3102
- retptr,
3103
- addHeapObject(payload),
3104
- addHeapObject(destination),
3105
- ptr0,
3106
- len0,
3107
- );
3108
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3109
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3110
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3111
- if (r2) {
3112
- throw takeObject(r1);
3113
- }
3114
- return OutgoingMessage.__wrap(r0);
3115
- } finally {
3116
- wasm.__wbindgen_add_to_stack_pointer(16);
3117
- }
3118
- }
3119
3120
  }
3120
3121
  if (Symbol.dispose) OutgoingMessage.prototype[Symbol.dispose] = OutgoingMessage.prototype.free;
3121
3122
 
@@ -3140,6 +3141,14 @@ class PasswordManagerClient {
3140
3141
  const ptr = this.__destroy_into_raw();
3141
3142
  wasm.__wbg_passwordmanagerclient_free(ptr, 0);
3142
3143
  }
3144
+ /**
3145
+ * Bitwarden licensed operations.
3146
+ * @returns {CommercialPasswordManagerClient}
3147
+ */
3148
+ commercial() {
3149
+ const ret = wasm.passwordmanagerclient_commercial(this.__wbg_ptr);
3150
+ return CommercialPasswordManagerClient.__wrap(ret);
3151
+ }
3143
3152
  /**
3144
3153
  * Initialize a new instance of the SDK client
3145
3154
  * @param {any} token_provider
@@ -3154,6 +3163,14 @@ class PasswordManagerClient {
3154
3163
  PasswordManagerClientFinalization.register(this, this.__wbg_ptr, this);
3155
3164
  return this;
3156
3165
  }
3166
+ /**
3167
+ * Auth related operations.
3168
+ * @returns {AuthClient}
3169
+ */
3170
+ auth() {
3171
+ const ret = wasm.passwordmanagerclient_auth(this.__wbg_ptr);
3172
+ return AuthClient.__wrap(ret);
3173
+ }
3157
3174
  /**
3158
3175
  * Test method, echoes back the input
3159
3176
  * @param {string} msg
@@ -3178,42 +3195,58 @@ class PasswordManagerClient {
3178
3195
  }
3179
3196
  }
3180
3197
  /**
3181
- * Returns the current SDK version
3182
- * @returns {string}
3198
+ * Test method, always throws an error
3199
+ * @param {string} msg
3183
3200
  */
3184
- version() {
3185
- let deferred1_0;
3186
- let deferred1_1;
3201
+ throw(msg) {
3187
3202
  try {
3188
3203
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3189
- wasm.passwordmanagerclient_version(retptr, this.__wbg_ptr);
3204
+ const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3205
+ const len0 = WASM_VECTOR_LEN;
3206
+ wasm.passwordmanagerclient_throw(retptr, this.__wbg_ptr, ptr0, len0);
3190
3207
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3191
3208
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3192
- deferred1_0 = r0;
3193
- deferred1_1 = r1;
3194
- return getStringFromWasm0(r0, r1);
3209
+ if (r1) {
3210
+ throw takeObject(r0);
3211
+ }
3195
3212
  } finally {
3196
3213
  wasm.__wbindgen_add_to_stack_pointer(16);
3197
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3198
3214
  }
3199
3215
  }
3200
3216
  /**
3201
- * Test method, always throws an error
3202
- * @param {string} msg
3217
+ * Vault item related operations.
3218
+ * @returns {VaultClient}
3203
3219
  */
3204
- throw(msg) {
3220
+ vault() {
3221
+ const ret = wasm.passwordmanagerclient_vault(this.__wbg_ptr);
3222
+ return VaultClient.__wrap(ret);
3223
+ }
3224
+ /**
3225
+ * Crypto related operations.
3226
+ * @returns {CryptoClient}
3227
+ */
3228
+ crypto() {
3229
+ const ret = wasm.passwordmanagerclient_crypto(this.__wbg_ptr);
3230
+ return CryptoClient.__wrap(ret);
3231
+ }
3232
+ /**
3233
+ * Returns the current SDK version
3234
+ * @returns {string}
3235
+ */
3236
+ version() {
3237
+ let deferred1_0;
3238
+ let deferred1_1;
3205
3239
  try {
3206
3240
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3207
- const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3208
- const len0 = WASM_VECTOR_LEN;
3209
- wasm.passwordmanagerclient_throw(retptr, this.__wbg_ptr, ptr0, len0);
3241
+ wasm.passwordmanagerclient_version(retptr, this.__wbg_ptr);
3210
3242
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3211
3243
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3212
- if (r1) {
3213
- throw takeObject(r0);
3214
- }
3244
+ deferred1_0 = r0;
3245
+ deferred1_1 = r1;
3246
+ return getStringFromWasm0(r0, r1);
3215
3247
  } finally {
3216
3248
  wasm.__wbindgen_add_to_stack_pointer(16);
3249
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3217
3250
  }
3218
3251
  }
3219
3252
  /**
@@ -3227,38 +3260,6 @@ class PasswordManagerClient {
3227
3260
  const ret = wasm.passwordmanagerclient_http_get(this.__wbg_ptr, ptr0, len0);
3228
3261
  return takeObject(ret);
3229
3262
  }
3230
- /**
3231
- * Auth related operations.
3232
- * @returns {AuthClient}
3233
- */
3234
- auth() {
3235
- const ret = wasm.passwordmanagerclient_auth(this.__wbg_ptr);
3236
- return AuthClient.__wrap(ret);
3237
- }
3238
- /**
3239
- * Bitwarden licensed operations.
3240
- * @returns {CommercialPasswordManagerClient}
3241
- */
3242
- commercial() {
3243
- const ret = wasm.passwordmanagerclient_commercial(this.__wbg_ptr);
3244
- return CommercialPasswordManagerClient.__wrap(ret);
3245
- }
3246
- /**
3247
- * Crypto related operations.
3248
- * @returns {CryptoClient}
3249
- */
3250
- crypto() {
3251
- const ret = wasm.passwordmanagerclient_crypto(this.__wbg_ptr);
3252
- return CryptoClient.__wrap(ret);
3253
- }
3254
- /**
3255
- * Vault item related operations.
3256
- * @returns {VaultClient}
3257
- */
3258
- vault() {
3259
- const ret = wasm.passwordmanagerclient_vault(this.__wbg_ptr);
3260
- return VaultClient.__wrap(ret);
3261
- }
3262
3263
  /**
3263
3264
  * Constructs a specific client for platform-specific functionality
3264
3265
  * @returns {PlatformClient}
@@ -3267,14 +3268,6 @@ class PasswordManagerClient {
3267
3268
  const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3268
3269
  return PlatformClient.__wrap(ret);
3269
3270
  }
3270
- /**
3271
- * Constructs a specific client for generating passwords and passphrases
3272
- * @returns {GeneratorClient}
3273
- */
3274
- generator() {
3275
- const ret = wasm.passwordmanagerclient_generator(this.__wbg_ptr);
3276
- return GeneratorClient.__wrap(ret);
3277
- }
3278
3271
  /**
3279
3272
  * Exporter related operations.
3280
3273
  * @returns {ExporterClient}
@@ -3283,6 +3276,14 @@ class PasswordManagerClient {
3283
3276
  const ret = wasm.passwordmanagerclient_exporters(this.__wbg_ptr);
3284
3277
  return ExporterClient.__wrap(ret);
3285
3278
  }
3279
+ /**
3280
+ * Constructs a specific client for generating passwords and passphrases
3281
+ * @returns {GeneratorClient}
3282
+ */
3283
+ generator() {
3284
+ const ret = wasm.passwordmanagerclient_generator(this.__wbg_ptr);
3285
+ return GeneratorClient.__wrap(ret);
3286
+ }
3286
3287
  }
3287
3288
  if (Symbol.dispose)
3288
3289
  PasswordManagerClient.prototype[Symbol.dispose] = PasswordManagerClient.prototype.free;
@@ -3314,13 +3315,6 @@ class PlatformClient {
3314
3315
  const ptr = this.__destroy_into_raw();
3315
3316
  wasm.__wbg_platformclient_free(ptr, 0);
3316
3317
  }
3317
- /**
3318
- * @returns {StateClient}
3319
- */
3320
- state() {
3321
- const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3322
- return StateClient.__wrap(ret);
3323
- }
3324
3318
  /**
3325
3319
  * Load feature flags into the client
3326
3320
  * @param {FeatureFlags} flags
@@ -3338,6 +3332,13 @@ class PlatformClient {
3338
3332
  wasm.__wbindgen_add_to_stack_pointer(16);
3339
3333
  }
3340
3334
  }
3335
+ /**
3336
+ * @returns {StateClient}
3337
+ */
3338
+ state() {
3339
+ const ret = wasm.passwordmanagerclient_platform(this.__wbg_ptr);
3340
+ return StateClient.__wrap(ret);
3341
+ }
3341
3342
  }
3342
3343
  if (Symbol.dispose) PlatformClient.prototype[Symbol.dispose] = PlatformClient.prototype.free;
3343
3344
 
@@ -3365,6 +3366,64 @@ class PureCrypto {
3365
3366
  const ptr = this.__destroy_into_raw();
3366
3367
  wasm.__wbg_purecrypto_free(ptr, 0);
3367
3368
  }
3369
+ /**
3370
+ * Decrypts data using RSAES-OAEP with SHA-1
3371
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3372
+ * @param {Uint8Array} encrypted_data
3373
+ * @param {Uint8Array} private_key
3374
+ * @returns {Uint8Array}
3375
+ */
3376
+ static rsa_decrypt_data(encrypted_data, private_key) {
3377
+ try {
3378
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3379
+ const ptr0 = passArray8ToWasm0(encrypted_data, wasm.__wbindgen_malloc);
3380
+ const len0 = WASM_VECTOR_LEN;
3381
+ const ptr1 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
3382
+ const len1 = WASM_VECTOR_LEN;
3383
+ wasm.purecrypto_rsa_decrypt_data(retptr, ptr0, len0, ptr1, len1);
3384
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3385
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3386
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3387
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3388
+ if (r3) {
3389
+ throw takeObject(r2);
3390
+ }
3391
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3392
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3393
+ return v3;
3394
+ } finally {
3395
+ wasm.__wbindgen_add_to_stack_pointer(16);
3396
+ }
3397
+ }
3398
+ /**
3399
+ * Encrypts data using RSAES-OAEP with SHA-1
3400
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3401
+ * @param {Uint8Array} plain_data
3402
+ * @param {Uint8Array} public_key
3403
+ * @returns {Uint8Array}
3404
+ */
3405
+ static rsa_encrypt_data(plain_data, public_key) {
3406
+ try {
3407
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3408
+ const ptr0 = passArray8ToWasm0(plain_data, wasm.__wbindgen_malloc);
3409
+ const len0 = WASM_VECTOR_LEN;
3410
+ const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
3411
+ const len1 = WASM_VECTOR_LEN;
3412
+ wasm.purecrypto_rsa_encrypt_data(retptr, ptr0, len0, ptr1, len1);
3413
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3414
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3415
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3416
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3417
+ if (r3) {
3418
+ throw takeObject(r2);
3419
+ }
3420
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3421
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3422
+ return v3;
3423
+ } finally {
3424
+ wasm.__wbindgen_add_to_stack_pointer(16);
3425
+ }
3426
+ }
3368
3427
  /**
3369
3428
  * DEPRECATED: Use `symmetric_decrypt_string` instead.
3370
3429
  * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
@@ -3402,20 +3461,22 @@ class PureCrypto {
3402
3461
  }
3403
3462
  }
3404
3463
  /**
3405
- * @param {string} enc_string
3406
- * @param {Uint8Array} key
3464
+ * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
3465
+ * as an EncString.
3466
+ * @param {Uint8Array} key_to_be_wrapped
3467
+ * @param {Uint8Array} wrapping_key
3407
3468
  * @returns {string}
3408
3469
  */
3409
- static symmetric_decrypt_string(enc_string, key) {
3470
+ static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
3410
3471
  let deferred4_0;
3411
3472
  let deferred4_1;
3412
3473
  try {
3413
3474
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3414
- const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3475
+ const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
3415
3476
  const len0 = WASM_VECTOR_LEN;
3416
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3477
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3417
3478
  const len1 = WASM_VECTOR_LEN;
3418
- wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
3479
+ wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3419
3480
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3420
3481
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3421
3482
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3436,18 +3497,20 @@ class PureCrypto {
3436
3497
  }
3437
3498
  }
3438
3499
  /**
3439
- * @param {string} enc_string
3440
- * @param {Uint8Array} key
3500
+ * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
3501
+ * @param {Uint8Array} password
3502
+ * @param {Uint8Array} salt
3503
+ * @param {Kdf} kdf
3441
3504
  * @returns {Uint8Array}
3442
3505
  */
3443
- static symmetric_decrypt_bytes(enc_string, key) {
3506
+ static derive_kdf_material(password, salt, kdf) {
3444
3507
  try {
3445
3508
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3446
- const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3509
+ const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
3447
3510
  const len0 = WASM_VECTOR_LEN;
3448
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3511
+ const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
3449
3512
  const len1 = WASM_VECTOR_LEN;
3450
- wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3513
+ wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
3451
3514
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3452
3515
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3453
3516
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3463,20 +3526,14 @@ class PureCrypto {
3463
3526
  }
3464
3527
  }
3465
3528
  /**
3466
- * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
3467
- * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
3468
- * @param {Uint8Array} enc_bytes
3469
- * @param {Uint8Array} key
3529
+ * Generates a new RSA key pair and returns the private key
3530
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3470
3531
  * @returns {Uint8Array}
3471
3532
  */
3472
- static symmetric_decrypt_array_buffer(enc_bytes, key) {
3533
+ static rsa_generate_keypair() {
3473
3534
  try {
3474
3535
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3475
- const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3476
- const len0 = WASM_VECTOR_LEN;
3477
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3478
- const len1 = WASM_VECTOR_LEN;
3479
- wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
3536
+ wasm.purecrypto_rsa_generate_keypair(retptr);
3480
3537
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3481
3538
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3482
3539
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3484,26 +3541,28 @@ class PureCrypto {
3484
3541
  if (r3) {
3485
3542
  throw takeObject(r2);
3486
3543
  }
3487
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3544
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
3488
3545
  wasm.__wbindgen_free(r0, r1 * 1, 1);
3489
- return v3;
3546
+ return v1;
3490
3547
  } finally {
3491
3548
  wasm.__wbindgen_add_to_stack_pointer(16);
3492
3549
  }
3493
3550
  }
3494
3551
  /**
3495
- * @param {Uint8Array} enc_bytes
3496
- * @param {Uint8Array} key
3552
+ * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
3553
+ * unwrapped key as a serialized byte array.
3554
+ * @param {string} wrapped_key
3555
+ * @param {Uint8Array} wrapping_key
3497
3556
  * @returns {Uint8Array}
3498
3557
  */
3499
- static symmetric_decrypt_filedata(enc_bytes, key) {
3558
+ static unwrap_symmetric_key(wrapped_key, wrapping_key) {
3500
3559
  try {
3501
3560
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3502
- const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3561
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3503
3562
  const len0 = WASM_VECTOR_LEN;
3504
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3563
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3505
3564
  const len1 = WASM_VECTOR_LEN;
3506
- wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3565
+ wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3507
3566
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3508
3567
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3509
3568
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3519,55 +3578,49 @@ class PureCrypto {
3519
3578
  }
3520
3579
  }
3521
3580
  /**
3522
- * @param {string} plain
3523
- * @param {Uint8Array} key
3524
- * @returns {string}
3581
+ * Given a decrypted private RSA key PKCS8 DER this
3582
+ * returns the corresponding public RSA key in DER format.
3583
+ * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
3584
+ * @param {Uint8Array} private_key
3585
+ * @returns {Uint8Array}
3525
3586
  */
3526
- static symmetric_encrypt_string(plain, key) {
3527
- let deferred4_0;
3528
- let deferred4_1;
3587
+ static rsa_extract_public_key(private_key) {
3529
3588
  try {
3530
3589
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3531
- const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3590
+ const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
3532
3591
  const len0 = WASM_VECTOR_LEN;
3533
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3534
- const len1 = WASM_VECTOR_LEN;
3535
- wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
3592
+ wasm.purecrypto_rsa_extract_public_key(retptr, ptr0, len0);
3536
3593
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3537
3594
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3538
3595
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3539
3596
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3540
- var ptr3 = r0;
3541
- var len3 = r1;
3542
3597
  if (r3) {
3543
- ptr3 = 0;
3544
- len3 = 0;
3545
3598
  throw takeObject(r2);
3546
3599
  }
3547
- deferred4_0 = ptr3;
3548
- deferred4_1 = len3;
3549
- return getStringFromWasm0(ptr3, len3);
3600
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
3601
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3602
+ return v2;
3550
3603
  } finally {
3551
3604
  wasm.__wbindgen_add_to_stack_pointer(16);
3552
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3553
3605
  }
3554
3606
  }
3555
3607
  /**
3556
- * DEPRECATED: Only used by send keys
3557
- * @param {Uint8Array} plain
3558
- * @param {Uint8Array} key
3608
+ * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
3609
+ * key,
3610
+ * @param {Uint8Array} decapsulation_key
3611
+ * @param {Uint8Array} wrapping_key
3559
3612
  * @returns {string}
3560
3613
  */
3561
- static symmetric_encrypt_bytes(plain, key) {
3614
+ static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
3562
3615
  let deferred4_0;
3563
3616
  let deferred4_1;
3564
3617
  try {
3565
3618
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3566
- const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3619
+ const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3567
3620
  const len0 = WASM_VECTOR_LEN;
3568
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3621
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3569
3622
  const len1 = WASM_VECTOR_LEN;
3570
- wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3623
+ wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3571
3624
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3572
3625
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3573
3626
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3588,180 +3641,87 @@ class PureCrypto {
3588
3641
  }
3589
3642
  }
3590
3643
  /**
3591
- * @param {Uint8Array} plain
3592
- * @param {Uint8Array} key
3593
- * @returns {Uint8Array}
3644
+ * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
3645
+ * key. Note: Usually, a public key is - by definition - public, so this should not be
3646
+ * used. The specific use-case for this function is to enable rotateable key sets, where
3647
+ * the "public key" is not public, with the intent of preventing the server from being able
3648
+ * to overwrite the user key unlocked by the rotateable keyset.
3649
+ * @param {Uint8Array} encapsulation_key
3650
+ * @param {Uint8Array} wrapping_key
3651
+ * @returns {string}
3594
3652
  */
3595
- static symmetric_encrypt_filedata(plain, key) {
3653
+ static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
3654
+ let deferred4_0;
3655
+ let deferred4_1;
3596
3656
  try {
3597
3657
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3598
- const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3658
+ const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3599
3659
  const len0 = WASM_VECTOR_LEN;
3600
- const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3660
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3601
3661
  const len1 = WASM_VECTOR_LEN;
3602
- wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
3662
+ wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
3603
3663
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3604
3664
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3605
3665
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3606
3666
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3667
+ var ptr3 = r0;
3668
+ var len3 = r1;
3607
3669
  if (r3) {
3670
+ ptr3 = 0;
3671
+ len3 = 0;
3608
3672
  throw takeObject(r2);
3609
3673
  }
3610
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3611
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3612
- return v3;
3674
+ deferred4_0 = ptr3;
3675
+ deferred4_1 = len3;
3676
+ return getStringFromWasm0(ptr3, len3);
3613
3677
  } finally {
3614
3678
  wasm.__wbindgen_add_to_stack_pointer(16);
3679
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3615
3680
  }
3616
3681
  }
3617
3682
  /**
3618
- * @param {string} encrypted_user_key
3619
- * @param {string} master_password
3620
- * @param {string} email
3621
- * @param {Kdf} kdf
3683
+ * @param {string} enc_string
3684
+ * @param {Uint8Array} key
3622
3685
  * @returns {Uint8Array}
3623
3686
  */
3624
- static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
3625
- try {
3626
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3627
- const ptr0 = passStringToWasm0(
3628
- encrypted_user_key,
3629
- wasm.__wbindgen_malloc,
3630
- wasm.__wbindgen_realloc,
3631
- );
3632
- const len0 = WASM_VECTOR_LEN;
3633
- const ptr1 = passStringToWasm0(
3634
- master_password,
3635
- wasm.__wbindgen_malloc,
3636
- wasm.__wbindgen_realloc,
3637
- );
3638
- const len1 = WASM_VECTOR_LEN;
3639
- const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3640
- const len2 = WASM_VECTOR_LEN;
3641
- wasm.purecrypto_decrypt_user_key_with_master_password(
3642
- retptr,
3643
- ptr0,
3644
- len0,
3645
- ptr1,
3646
- len1,
3647
- ptr2,
3648
- len2,
3649
- addHeapObject(kdf),
3650
- );
3651
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3652
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3653
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3654
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3655
- if (r3) {
3656
- throw takeObject(r2);
3657
- }
3658
- var v4 = getArrayU8FromWasm0(r0, r1).slice();
3659
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3660
- return v4;
3661
- } finally {
3662
- wasm.__wbindgen_add_to_stack_pointer(16);
3663
- }
3664
- }
3665
- /**
3666
- * @param {Uint8Array} user_key
3667
- * @param {string} master_password
3668
- * @param {string} email
3669
- * @param {Kdf} kdf
3670
- * @returns {string}
3671
- */
3672
- static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
3673
- let deferred5_0;
3674
- let deferred5_1;
3687
+ static symmetric_decrypt_bytes(enc_string, key) {
3675
3688
  try {
3676
3689
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3677
- const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
3690
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3678
3691
  const len0 = WASM_VECTOR_LEN;
3679
- const ptr1 = passStringToWasm0(
3680
- master_password,
3681
- wasm.__wbindgen_malloc,
3682
- wasm.__wbindgen_realloc,
3683
- );
3692
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3684
3693
  const len1 = WASM_VECTOR_LEN;
3685
- const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3686
- const len2 = WASM_VECTOR_LEN;
3687
- wasm.purecrypto_encrypt_user_key_with_master_password(
3688
- retptr,
3689
- ptr0,
3690
- len0,
3691
- ptr1,
3692
- len1,
3693
- ptr2,
3694
- len2,
3695
- addHeapObject(kdf),
3696
- );
3694
+ wasm.purecrypto_symmetric_decrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3697
3695
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3698
3696
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3699
3697
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3700
3698
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3701
- var ptr4 = r0;
3702
- var len4 = r1;
3703
3699
  if (r3) {
3704
- ptr4 = 0;
3705
- len4 = 0;
3706
3700
  throw takeObject(r2);
3707
3701
  }
3708
- deferred5_0 = ptr4;
3709
- deferred5_1 = len4;
3710
- return getStringFromWasm0(ptr4, len4);
3711
- } finally {
3712
- wasm.__wbindgen_add_to_stack_pointer(16);
3713
- wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
3714
- }
3715
- }
3716
- /**
3717
- * @returns {Uint8Array}
3718
- */
3719
- static make_user_key_aes256_cbc_hmac() {
3720
- try {
3721
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3722
- wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
3723
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3724
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3725
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
3726
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3727
- return v1;
3728
- } finally {
3729
- wasm.__wbindgen_add_to_stack_pointer(16);
3730
- }
3731
- }
3732
- /**
3733
- * @returns {Uint8Array}
3734
- */
3735
- static make_user_key_xchacha20_poly1305() {
3736
- try {
3737
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3738
- wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
3739
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3740
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3741
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
3702
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3742
3703
  wasm.__wbindgen_free(r0, r1 * 1, 1);
3743
- return v1;
3704
+ return v3;
3744
3705
  } finally {
3745
3706
  wasm.__wbindgen_add_to_stack_pointer(16);
3746
3707
  }
3747
3708
  }
3748
3709
  /**
3749
- * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
3750
- * as an EncString.
3751
- * @param {Uint8Array} key_to_be_wrapped
3752
- * @param {Uint8Array} wrapping_key
3710
+ * DEPRECATED: Only used by send keys
3711
+ * @param {Uint8Array} plain
3712
+ * @param {Uint8Array} key
3753
3713
  * @returns {string}
3754
3714
  */
3755
- static wrap_symmetric_key(key_to_be_wrapped, wrapping_key) {
3715
+ static symmetric_encrypt_bytes(plain, key) {
3756
3716
  let deferred4_0;
3757
3717
  let deferred4_1;
3758
3718
  try {
3759
3719
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3760
- const ptr0 = passArray8ToWasm0(key_to_be_wrapped, wasm.__wbindgen_malloc);
3720
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
3761
3721
  const len0 = WASM_VECTOR_LEN;
3762
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3722
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3763
3723
  const len1 = WASM_VECTOR_LEN;
3764
- wasm.purecrypto_wrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3724
+ wasm.purecrypto_symmetric_encrypt_bytes(retptr, ptr0, len0, ptr1, len1);
3765
3725
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3766
3726
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3767
3727
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3782,20 +3742,25 @@ class PureCrypto {
3782
3742
  }
3783
3743
  }
3784
3744
  /**
3785
- * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
3786
- * unwrapped key as a serialized byte array.
3787
- * @param {string} wrapped_key
3788
- * @param {Uint8Array} wrapping_key
3745
+ * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
3746
+ * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
3747
+ * recipient.
3748
+ * @param {string} encapsulated_key
3749
+ * @param {Uint8Array} decapsulation_key
3789
3750
  * @returns {Uint8Array}
3790
3751
  */
3791
- static unwrap_symmetric_key(wrapped_key, wrapping_key) {
3752
+ static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
3792
3753
  try {
3793
3754
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3794
- const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3755
+ const ptr0 = passStringToWasm0(
3756
+ encapsulated_key,
3757
+ wasm.__wbindgen_malloc,
3758
+ wasm.__wbindgen_realloc,
3759
+ );
3795
3760
  const len0 = WASM_VECTOR_LEN;
3796
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3761
+ const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3797
3762
  const len1 = WASM_VECTOR_LEN;
3798
- wasm.purecrypto_unwrap_symmetric_key(retptr, ptr0, len0, ptr1, len1);
3763
+ wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3799
3764
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3800
3765
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3801
3766
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3811,25 +3776,23 @@ class PureCrypto {
3811
3776
  }
3812
3777
  }
3813
3778
  /**
3814
- * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
3815
- * key. Note: Usually, a public key is - by definition - public, so this should not be
3816
- * used. The specific use-case for this function is to enable rotateable key sets, where
3817
- * the "public key" is not public, with the intent of preventing the server from being able
3818
- * to overwrite the user key unlocked by the rotateable keyset.
3779
+ * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
3780
+ * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
3781
+ * the sender's authenticity cannot be verified by the recipient.
3782
+ * @param {Uint8Array} shared_key
3819
3783
  * @param {Uint8Array} encapsulation_key
3820
- * @param {Uint8Array} wrapping_key
3821
3784
  * @returns {string}
3822
3785
  */
3823
- static wrap_encapsulation_key(encapsulation_key, wrapping_key) {
3786
+ static encapsulate_key_unsigned(shared_key, encapsulation_key) {
3824
3787
  let deferred4_0;
3825
3788
  let deferred4_1;
3826
3789
  try {
3827
3790
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3828
- const ptr0 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3791
+ const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
3829
3792
  const len0 = WASM_VECTOR_LEN;
3830
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3793
+ const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3831
3794
  const len1 = WASM_VECTOR_LEN;
3832
- wasm.purecrypto_wrap_encapsulation_key(retptr, ptr0, len0, ptr1, len1);
3795
+ wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3833
3796
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3834
3797
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3835
3798
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3850,51 +3813,54 @@ class PureCrypto {
3850
3813
  }
3851
3814
  }
3852
3815
  /**
3853
- * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
3854
- * wrapping key.
3855
- * @param {string} wrapped_key
3856
- * @param {Uint8Array} wrapping_key
3857
- * @returns {Uint8Array}
3816
+ * @param {string} enc_string
3817
+ * @param {Uint8Array} key
3818
+ * @returns {string}
3858
3819
  */
3859
- static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
3820
+ static symmetric_decrypt_string(enc_string, key) {
3821
+ let deferred4_0;
3822
+ let deferred4_1;
3860
3823
  try {
3861
3824
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3862
- const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3825
+ const ptr0 = passStringToWasm0(enc_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3863
3826
  const len0 = WASM_VECTOR_LEN;
3864
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3827
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3865
3828
  const len1 = WASM_VECTOR_LEN;
3866
- wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3829
+ wasm.purecrypto_symmetric_decrypt_string(retptr, ptr0, len0, ptr1, len1);
3867
3830
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3868
3831
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3869
3832
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3870
3833
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3834
+ var ptr3 = r0;
3835
+ var len3 = r1;
3871
3836
  if (r3) {
3837
+ ptr3 = 0;
3838
+ len3 = 0;
3872
3839
  throw takeObject(r2);
3873
3840
  }
3874
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
3875
- wasm.__wbindgen_free(r0, r1 * 1, 1);
3876
- return v3;
3841
+ deferred4_0 = ptr3;
3842
+ deferred4_1 = len3;
3843
+ return getStringFromWasm0(ptr3, len3);
3877
3844
  } finally {
3878
3845
  wasm.__wbindgen_add_to_stack_pointer(16);
3846
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3879
3847
  }
3880
3848
  }
3881
3849
  /**
3882
- * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
3883
- * key,
3884
- * @param {Uint8Array} decapsulation_key
3885
- * @param {Uint8Array} wrapping_key
3850
+ * @param {string} plain
3851
+ * @param {Uint8Array} key
3886
3852
  * @returns {string}
3887
3853
  */
3888
- static wrap_decapsulation_key(decapsulation_key, wrapping_key) {
3854
+ static symmetric_encrypt_string(plain, key) {
3889
3855
  let deferred4_0;
3890
3856
  let deferred4_1;
3891
3857
  try {
3892
3858
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3893
- const ptr0 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3859
+ const ptr0 = passStringToWasm0(plain, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3894
3860
  const len0 = WASM_VECTOR_LEN;
3895
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3861
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
3896
3862
  const len1 = WASM_VECTOR_LEN;
3897
- wasm.purecrypto_wrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3863
+ wasm.purecrypto_symmetric_encrypt_string(retptr, ptr0, len0, ptr1, len1);
3898
3864
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3899
3865
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3900
3866
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3944,62 +3910,47 @@ class PureCrypto {
3944
3910
  }
3945
3911
  }
3946
3912
  /**
3947
- * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
3948
- * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
3949
- * the sender's authenticity cannot be verified by the recipient.
3950
- * @param {Uint8Array} shared_key
3951
- * @param {Uint8Array} encapsulation_key
3952
- * @returns {string}
3913
+ * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
3914
+ * wrapping key.
3915
+ * @param {string} wrapped_key
3916
+ * @param {Uint8Array} wrapping_key
3917
+ * @returns {Uint8Array}
3953
3918
  */
3954
- static encapsulate_key_unsigned(shared_key, encapsulation_key) {
3955
- let deferred4_0;
3956
- let deferred4_1;
3919
+ static unwrap_encapsulation_key(wrapped_key, wrapping_key) {
3957
3920
  try {
3958
3921
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3959
- const ptr0 = passArray8ToWasm0(shared_key, wasm.__wbindgen_malloc);
3922
+ const ptr0 = passStringToWasm0(wrapped_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3960
3923
  const len0 = WASM_VECTOR_LEN;
3961
- const ptr1 = passArray8ToWasm0(encapsulation_key, wasm.__wbindgen_malloc);
3924
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3962
3925
  const len1 = WASM_VECTOR_LEN;
3963
- wasm.purecrypto_encapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3926
+ wasm.purecrypto_unwrap_decapsulation_key(retptr, ptr0, len0, ptr1, len1);
3964
3927
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3965
3928
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3966
3929
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
3967
3930
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
3968
- var ptr3 = r0;
3969
- var len3 = r1;
3970
3931
  if (r3) {
3971
- ptr3 = 0;
3972
- len3 = 0;
3973
3932
  throw takeObject(r2);
3974
3933
  }
3975
- deferred4_0 = ptr3;
3976
- deferred4_1 = len3;
3977
- return getStringFromWasm0(ptr3, len3);
3934
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
3935
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
3936
+ return v3;
3978
3937
  } finally {
3979
3938
  wasm.__wbindgen_add_to_stack_pointer(16);
3980
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
3981
3939
  }
3982
3940
  }
3983
3941
  /**
3984
- * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
3985
- * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
3986
- * recipient.
3987
- * @param {string} encapsulated_key
3988
- * @param {Uint8Array} decapsulation_key
3942
+ * @param {Uint8Array} enc_bytes
3943
+ * @param {Uint8Array} key
3989
3944
  * @returns {Uint8Array}
3990
3945
  */
3991
- static decapsulate_key_unsigned(encapsulated_key, decapsulation_key) {
3946
+ static symmetric_decrypt_filedata(enc_bytes, key) {
3992
3947
  try {
3993
3948
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3994
- const ptr0 = passStringToWasm0(
3995
- encapsulated_key,
3996
- wasm.__wbindgen_malloc,
3997
- wasm.__wbindgen_realloc,
3998
- );
3949
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
3999
3950
  const len0 = WASM_VECTOR_LEN;
4000
- const ptr1 = passArray8ToWasm0(decapsulation_key, wasm.__wbindgen_malloc);
3951
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
4001
3952
  const len1 = WASM_VECTOR_LEN;
4002
- wasm.purecrypto_decapsulate_key_unsigned(retptr, ptr0, len0, ptr1, len1);
3953
+ wasm.purecrypto_symmetric_decrypt_filedata(retptr, ptr0, len0, ptr1, len1);
4003
3954
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4004
3955
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4005
3956
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4015,20 +3966,18 @@ class PureCrypto {
4015
3966
  }
4016
3967
  }
4017
3968
  /**
4018
- * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
4019
- * the corresponding verifying key.
4020
- * @param {string} signing_key
4021
- * @param {Uint8Array} wrapping_key
3969
+ * @param {Uint8Array} plain
3970
+ * @param {Uint8Array} key
4022
3971
  * @returns {Uint8Array}
4023
3972
  */
4024
- static verifying_key_for_signing_key(signing_key, wrapping_key) {
3973
+ static symmetric_encrypt_filedata(plain, key) {
4025
3974
  try {
4026
3975
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4027
- const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3976
+ const ptr0 = passArray8ToWasm0(plain, wasm.__wbindgen_malloc);
4028
3977
  const len0 = WASM_VECTOR_LEN;
4029
- const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
3978
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
4030
3979
  const len1 = WASM_VECTOR_LEN;
4031
- wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
3980
+ wasm.purecrypto_symmetric_encrypt_filedata(retptr, ptr0, len0, ptr1, len1);
4032
3981
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4033
3982
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4034
3983
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4044,44 +3993,36 @@ class PureCrypto {
4044
3993
  }
4045
3994
  }
4046
3995
  /**
4047
- * Returns the algorithm used for the given verifying key.
4048
- * @param {Uint8Array} verifying_key
4049
- * @returns {SignatureAlgorithm}
3996
+ * @returns {Uint8Array}
4050
3997
  */
4051
- static key_algorithm_for_verifying_key(verifying_key) {
3998
+ static make_user_key_aes256_cbc_hmac() {
4052
3999
  try {
4053
4000
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4054
- const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
4055
- const len0 = WASM_VECTOR_LEN;
4056
- wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
4001
+ wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
4057
4002
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4058
4003
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4059
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4060
- if (r2) {
4061
- throw takeObject(r1);
4062
- }
4063
- return takeObject(r0);
4004
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4005
+ wasm.__wbindgen_free(r0, r1 * 1, 1);
4006
+ return v1;
4064
4007
  } finally {
4065
4008
  wasm.__wbindgen_add_to_stack_pointer(16);
4066
4009
  }
4067
4010
  }
4068
4011
  /**
4069
- * For a given signing identity (verifying key), this function verifies that the signing
4070
- * identity claimed ownership of the public key. This is a one-sided claim and merely shows
4071
- * that the signing identity has the intent to receive messages encrypted to the public
4072
- * key.
4073
- * @param {Uint8Array} signed_public_key
4074
- * @param {Uint8Array} verifying_key
4012
+ * Given a wrapped signing key and the symmetric key it is wrapped with, this returns
4013
+ * the corresponding verifying key.
4014
+ * @param {string} signing_key
4015
+ * @param {Uint8Array} wrapping_key
4075
4016
  * @returns {Uint8Array}
4076
4017
  */
4077
- static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
4018
+ static verifying_key_for_signing_key(signing_key, wrapping_key) {
4078
4019
  try {
4079
4020
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4080
- const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
4021
+ const ptr0 = passStringToWasm0(signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4081
4022
  const len0 = WASM_VECTOR_LEN;
4082
- const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
4023
+ const ptr1 = passArray8ToWasm0(wrapping_key, wasm.__wbindgen_malloc);
4083
4024
  const len1 = WASM_VECTOR_LEN;
4084
- wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
4025
+ wasm.purecrypto_verifying_key_for_signing_key(retptr, ptr0, len0, ptr1, len1);
4085
4026
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4086
4027
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4087
4028
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4097,20 +4038,20 @@ class PureCrypto {
4097
4038
  }
4098
4039
  }
4099
4040
  /**
4100
- * Derive output of the KDF for a [bitwarden_crypto::Kdf] configuration.
4101
- * @param {Uint8Array} password
4102
- * @param {Uint8Array} salt
4103
- * @param {Kdf} kdf
4041
+ * DEPRECATED: Use `symmetric_decrypt_filedata` instead.
4042
+ * Cleanup ticket: <https://bitwarden.atlassian.net/browse/PM-21247>
4043
+ * @param {Uint8Array} enc_bytes
4044
+ * @param {Uint8Array} key
4104
4045
  * @returns {Uint8Array}
4105
4046
  */
4106
- static derive_kdf_material(password, salt, kdf) {
4047
+ static symmetric_decrypt_array_buffer(enc_bytes, key) {
4107
4048
  try {
4108
4049
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4109
- const ptr0 = passArray8ToWasm0(password, wasm.__wbindgen_malloc);
4050
+ const ptr0 = passArray8ToWasm0(enc_bytes, wasm.__wbindgen_malloc);
4110
4051
  const len0 = WASM_VECTOR_LEN;
4111
- const ptr1 = passArray8ToWasm0(salt, wasm.__wbindgen_malloc);
4052
+ const ptr1 = passArray8ToWasm0(key, wasm.__wbindgen_malloc);
4112
4053
  const len1 = WASM_VECTOR_LEN;
4113
- wasm.purecrypto_derive_kdf_material(retptr, ptr0, len0, ptr1, len1, addHeapObject(kdf));
4054
+ wasm.purecrypto_symmetric_decrypt_array_buffer(retptr, ptr0, len0, ptr1, len1);
4114
4055
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4115
4056
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4116
4057
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4125,6 +4066,28 @@ class PureCrypto {
4125
4066
  wasm.__wbindgen_add_to_stack_pointer(16);
4126
4067
  }
4127
4068
  }
4069
+ /**
4070
+ * Returns the algorithm used for the given verifying key.
4071
+ * @param {Uint8Array} verifying_key
4072
+ * @returns {SignatureAlgorithm}
4073
+ */
4074
+ static key_algorithm_for_verifying_key(verifying_key) {
4075
+ try {
4076
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4077
+ const ptr0 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
4078
+ const len0 = WASM_VECTOR_LEN;
4079
+ wasm.purecrypto_key_algorithm_for_verifying_key(retptr, ptr0, len0);
4080
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4081
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4082
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4083
+ if (r2) {
4084
+ throw takeObject(r1);
4085
+ }
4086
+ return takeObject(r0);
4087
+ } finally {
4088
+ wasm.__wbindgen_add_to_stack_pointer(16);
4089
+ }
4090
+ }
4128
4091
  /**
4129
4092
  * @param {string} encrypted_user_key
4130
4093
  * @param {Uint8Array} master_key
@@ -4157,41 +4120,38 @@ class PureCrypto {
4157
4120
  }
4158
4121
  }
4159
4122
  /**
4160
- * Given a decrypted private RSA key PKCS8 DER this
4161
- * returns the corresponding public RSA key in DER format.
4162
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4163
- * @param {Uint8Array} private_key
4164
4123
  * @returns {Uint8Array}
4165
4124
  */
4166
- static rsa_extract_public_key(private_key) {
4125
+ static make_user_key_xchacha20_poly1305() {
4167
4126
  try {
4168
4127
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4169
- const ptr0 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
4170
- const len0 = WASM_VECTOR_LEN;
4171
- wasm.purecrypto_rsa_extract_public_key(retptr, ptr0, len0);
4128
+ wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
4172
4129
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4173
4130
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4174
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4175
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
4176
- if (r3) {
4177
- throw takeObject(r2);
4178
- }
4179
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
4131
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4180
4132
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4181
- return v2;
4133
+ return v1;
4182
4134
  } finally {
4183
4135
  wasm.__wbindgen_add_to_stack_pointer(16);
4184
4136
  }
4185
4137
  }
4186
4138
  /**
4187
- * Generates a new RSA key pair and returns the private key
4188
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4139
+ * For a given signing identity (verifying key), this function verifies that the signing
4140
+ * identity claimed ownership of the public key. This is a one-sided claim and merely shows
4141
+ * that the signing identity has the intent to receive messages encrypted to the public
4142
+ * key.
4143
+ * @param {Uint8Array} signed_public_key
4144
+ * @param {Uint8Array} verifying_key
4189
4145
  * @returns {Uint8Array}
4190
4146
  */
4191
- static rsa_generate_keypair() {
4147
+ static verify_and_unwrap_signed_public_key(signed_public_key, verifying_key) {
4192
4148
  try {
4193
4149
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4194
- wasm.purecrypto_rsa_generate_keypair(retptr);
4150
+ const ptr0 = passArray8ToWasm0(signed_public_key, wasm.__wbindgen_malloc);
4151
+ const len0 = WASM_VECTOR_LEN;
4152
+ const ptr1 = passArray8ToWasm0(verifying_key, wasm.__wbindgen_malloc);
4153
+ const len1 = WASM_VECTOR_LEN;
4154
+ wasm.purecrypto_verify_and_unwrap_signed_public_key(retptr, ptr0, len0, ptr1, len1);
4195
4155
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4196
4156
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4197
4157
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4199,28 +4159,47 @@ class PureCrypto {
4199
4159
  if (r3) {
4200
4160
  throw takeObject(r2);
4201
4161
  }
4202
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
4162
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
4203
4163
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4204
- return v1;
4164
+ return v3;
4205
4165
  } finally {
4206
4166
  wasm.__wbindgen_add_to_stack_pointer(16);
4207
4167
  }
4208
4168
  }
4209
4169
  /**
4210
- * Decrypts data using RSAES-OAEP with SHA-1
4211
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4212
- * @param {Uint8Array} encrypted_data
4213
- * @param {Uint8Array} private_key
4170
+ * @param {string} encrypted_user_key
4171
+ * @param {string} master_password
4172
+ * @param {string} email
4173
+ * @param {Kdf} kdf
4214
4174
  * @returns {Uint8Array}
4215
4175
  */
4216
- static rsa_decrypt_data(encrypted_data, private_key) {
4176
+ static decrypt_user_key_with_master_password(encrypted_user_key, master_password, email, kdf) {
4217
4177
  try {
4218
4178
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4219
- const ptr0 = passArray8ToWasm0(encrypted_data, wasm.__wbindgen_malloc);
4179
+ const ptr0 = passStringToWasm0(
4180
+ encrypted_user_key,
4181
+ wasm.__wbindgen_malloc,
4182
+ wasm.__wbindgen_realloc,
4183
+ );
4220
4184
  const len0 = WASM_VECTOR_LEN;
4221
- const ptr1 = passArray8ToWasm0(private_key, wasm.__wbindgen_malloc);
4185
+ const ptr1 = passStringToWasm0(
4186
+ master_password,
4187
+ wasm.__wbindgen_malloc,
4188
+ wasm.__wbindgen_realloc,
4189
+ );
4222
4190
  const len1 = WASM_VECTOR_LEN;
4223
- wasm.purecrypto_rsa_decrypt_data(retptr, ptr0, len0, ptr1, len1);
4191
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4192
+ const len2 = WASM_VECTOR_LEN;
4193
+ wasm.purecrypto_decrypt_user_key_with_master_password(
4194
+ retptr,
4195
+ ptr0,
4196
+ len0,
4197
+ ptr1,
4198
+ len1,
4199
+ ptr2,
4200
+ len2,
4201
+ addHeapObject(kdf),
4202
+ );
4224
4203
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4225
4204
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4226
4205
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4228,40 +4207,62 @@ class PureCrypto {
4228
4207
  if (r3) {
4229
4208
  throw takeObject(r2);
4230
4209
  }
4231
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
4210
+ var v4 = getArrayU8FromWasm0(r0, r1).slice();
4232
4211
  wasm.__wbindgen_free(r0, r1 * 1, 1);
4233
- return v3;
4212
+ return v4;
4234
4213
  } finally {
4235
4214
  wasm.__wbindgen_add_to_stack_pointer(16);
4236
4215
  }
4237
4216
  }
4238
4217
  /**
4239
- * Encrypts data using RSAES-OAEP with SHA-1
4240
- * HAZMAT WARNING: Do not use outside of implementing cryptofunctionservice
4241
- * @param {Uint8Array} plain_data
4242
- * @param {Uint8Array} public_key
4243
- * @returns {Uint8Array}
4218
+ * @param {Uint8Array} user_key
4219
+ * @param {string} master_password
4220
+ * @param {string} email
4221
+ * @param {Kdf} kdf
4222
+ * @returns {string}
4244
4223
  */
4245
- static rsa_encrypt_data(plain_data, public_key) {
4224
+ static encrypt_user_key_with_master_password(user_key, master_password, email, kdf) {
4225
+ let deferred5_0;
4226
+ let deferred5_1;
4246
4227
  try {
4247
4228
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4248
- const ptr0 = passArray8ToWasm0(plain_data, wasm.__wbindgen_malloc);
4229
+ const ptr0 = passArray8ToWasm0(user_key, wasm.__wbindgen_malloc);
4249
4230
  const len0 = WASM_VECTOR_LEN;
4250
- const ptr1 = passArray8ToWasm0(public_key, wasm.__wbindgen_malloc);
4231
+ const ptr1 = passStringToWasm0(
4232
+ master_password,
4233
+ wasm.__wbindgen_malloc,
4234
+ wasm.__wbindgen_realloc,
4235
+ );
4251
4236
  const len1 = WASM_VECTOR_LEN;
4252
- wasm.purecrypto_rsa_encrypt_data(retptr, ptr0, len0, ptr1, len1);
4237
+ const ptr2 = passStringToWasm0(email, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4238
+ const len2 = WASM_VECTOR_LEN;
4239
+ wasm.purecrypto_encrypt_user_key_with_master_password(
4240
+ retptr,
4241
+ ptr0,
4242
+ len0,
4243
+ ptr1,
4244
+ len1,
4245
+ ptr2,
4246
+ len2,
4247
+ addHeapObject(kdf),
4248
+ );
4253
4249
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4254
4250
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4255
4251
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4256
4252
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
4253
+ var ptr4 = r0;
4254
+ var len4 = r1;
4257
4255
  if (r3) {
4256
+ ptr4 = 0;
4257
+ len4 = 0;
4258
4258
  throw takeObject(r2);
4259
4259
  }
4260
- var v3 = getArrayU8FromWasm0(r0, r1).slice();
4261
- wasm.__wbindgen_free(r0, r1 * 1, 1);
4262
- return v3;
4260
+ deferred5_0 = ptr4;
4261
+ deferred5_1 = len4;
4262
+ return getStringFromWasm0(ptr4, len4);
4263
4263
  } finally {
4264
4264
  wasm.__wbindgen_add_to_stack_pointer(16);
4265
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
4265
4266
  }
4266
4267
  }
4267
4268
  }
@@ -4371,6 +4372,15 @@ class StateClient {
4371
4372
  const ptr = this.__destroy_into_raw();
4372
4373
  wasm.__wbg_stateclient_free(ptr, 0);
4373
4374
  }
4375
+ /**
4376
+ * Initialize the database for SDK managed repositories.
4377
+ * @param {IndexedDbConfiguration} configuration
4378
+ * @returns {Promise<void>}
4379
+ */
4380
+ initialize_state(configuration) {
4381
+ const ret = wasm.stateclient_initialize_state(this.__wbg_ptr, addHeapObject(configuration));
4382
+ return takeObject(ret);
4383
+ }
4374
4384
  /**
4375
4385
  * @param {any} cipher_repository
4376
4386
  */
@@ -4392,15 +4402,6 @@ class StateClient {
4392
4402
  addHeapObject(repositories),
4393
4403
  );
4394
4404
  }
4395
- /**
4396
- * Initialize the database for SDK managed repositories.
4397
- * @param {IndexedDbConfiguration} configuration
4398
- * @returns {Promise<void>}
4399
- */
4400
- initialize_state(configuration) {
4401
- const ret = wasm.stateclient_initialize_state(this.__wbg_ptr, addHeapObject(configuration));
4402
- return takeObject(ret);
4403
- }
4404
4405
  }
4405
4406
  if (Symbol.dispose) StateClient.prototype[Symbol.dispose] = StateClient.prototype.free;
4406
4407
 
@@ -4507,20 +4508,20 @@ class VaultClient {
4507
4508
  return AttachmentsClient.__wrap(ret);
4508
4509
  }
4509
4510
  /**
4510
- * Cipher related operations.
4511
- * @returns {CiphersClient}
4511
+ * Cipher risk evaluation operations.
4512
+ * @returns {CipherRiskClient}
4512
4513
  */
4513
- ciphers() {
4514
+ cipher_risk() {
4514
4515
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4515
- return CiphersClient.__wrap(ret);
4516
+ return CipherRiskClient.__wrap(ret);
4516
4517
  }
4517
4518
  /**
4518
- * Folder related operations.
4519
- * @returns {FoldersClient}
4519
+ * Collection related operations.
4520
+ * @returns {CollectionsClient}
4520
4521
  */
4521
- folders() {
4522
+ collections() {
4522
4523
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4523
- return FoldersClient.__wrap(ret);
4524
+ return CollectionsClient.__wrap(ret);
4524
4525
  }
4525
4526
  /**
4526
4527
  * TOTP related operations.
@@ -4531,20 +4532,20 @@ class VaultClient {
4531
4532
  return TotpClient.__wrap(ret);
4532
4533
  }
4533
4534
  /**
4534
- * Collection related operations.
4535
- * @returns {CollectionsClient}
4535
+ * Cipher related operations.
4536
+ * @returns {CiphersClient}
4536
4537
  */
4537
- collections() {
4538
+ ciphers() {
4538
4539
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4539
- return CollectionsClient.__wrap(ret);
4540
+ return CiphersClient.__wrap(ret);
4540
4541
  }
4541
4542
  /**
4542
- * Cipher risk evaluation operations.
4543
- * @returns {CipherRiskClient}
4543
+ * Folder related operations.
4544
+ * @returns {FoldersClient}
4544
4545
  */
4545
- cipher_risk() {
4546
+ folders() {
4546
4547
  const ret = wasm.vaultclient_attachments(this.__wbg_ptr);
4547
- return CipherRiskClient.__wrap(ret);
4548
+ return FoldersClient.__wrap(ret);
4548
4549
  }
4549
4550
  }
4550
4551
  if (Symbol.dispose) VaultClient.prototype[Symbol.dispose] = VaultClient.prototype.free;
@@ -4724,7 +4725,7 @@ exports.__wbg_call_e762c39fa8ea36bf = function () {
4724
4725
  }, arguments);
4725
4726
  };
4726
4727
 
4727
- exports.__wbg_cipher_f01ad37fe153c74a = function (arg0) {
4728
+ exports.__wbg_cipher_ca1a8072783e8524 = function (arg0) {
4728
4729
  const ret = getObject(arg0).cipher;
4729
4730
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4730
4731
  };
@@ -4817,7 +4818,7 @@ exports.__wbg_fetch_f8ba0e29a9d6de0d = function (arg0, arg1) {
4817
4818
  return addHeapObject(ret);
4818
4819
  };
4819
4820
 
4820
- exports.__wbg_folder_b2f27ca5801406fe = function (arg0) {
4821
+ exports.__wbg_folder_c3e4ac6ced93af5a = function (arg0) {
4821
4822
  const ret = getObject(arg0).folder;
4822
4823
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4823
4824
  };
@@ -4850,12 +4851,7 @@ exports.__wbg_getTime_14776bfb48a1bff9 = function (arg0) {
4850
4851
  return ret;
4851
4852
  };
4852
4853
 
4853
- exports.__wbg_get_7bed016f185add81 = function (arg0, arg1) {
4854
- const ret = getObject(arg0)[arg1 >>> 0];
4855
- return addHeapObject(ret);
4856
- };
4857
-
4858
- exports.__wbg_get_7d24a56df19d62f6 = function () {
4854
+ exports.__wbg_get_021b4709a0cd459d = function () {
4859
4855
  return handleError(function (arg0, arg1, arg2) {
4860
4856
  let deferred0_0;
4861
4857
  let deferred0_1;
@@ -4870,12 +4866,17 @@ exports.__wbg_get_7d24a56df19d62f6 = function () {
4870
4866
  }, arguments);
4871
4867
  };
4872
4868
 
4873
- exports.__wbg_get_access_token_f4e462d38899439f = function (arg0) {
4869
+ exports.__wbg_get_7bed016f185add81 = function (arg0, arg1) {
4870
+ const ret = getObject(arg0)[arg1 >>> 0];
4871
+ return addHeapObject(ret);
4872
+ };
4873
+
4874
+ exports.__wbg_get_access_token_1bd76bc1d6872a37 = function (arg0) {
4874
4875
  const ret = getObject(arg0).get_access_token();
4875
4876
  return addHeapObject(ret);
4876
4877
  };
4877
4878
 
4878
- exports.__wbg_get_cf7a5a169adcb6d4 = function () {
4879
+ exports.__wbg_get_bcdf6d1f18330518 = function () {
4879
4880
  return handleError(function (arg0, arg1, arg2) {
4880
4881
  let deferred0_0;
4881
4882
  let deferred0_1;
@@ -5081,14 +5082,14 @@ exports.__wbg_length_cdd215e10d9dd507 = function (arg0) {
5081
5082
  return ret;
5082
5083
  };
5083
5084
 
5084
- exports.__wbg_list_9632da36688eb013 = function () {
5085
+ exports.__wbg_list_e1b7ba42d5e1f9e4 = function () {
5085
5086
  return handleError(function (arg0) {
5086
5087
  const ret = getObject(arg0).list();
5087
5088
  return addHeapObject(ret);
5088
5089
  }, arguments);
5089
5090
  };
5090
5091
 
5091
- exports.__wbg_list_971afaee385941da = function () {
5092
+ exports.__wbg_list_f9b0200b46781635 = function () {
5092
5093
  return handleError(function (arg0) {
5093
5094
  const ret = getObject(arg0).list();
5094
5095
  return addHeapObject(ret);
@@ -5160,7 +5161,7 @@ exports.__wbg_new_3c3d849046688a66 = function (arg0, arg1) {
5160
5161
  const a = state0.a;
5161
5162
  state0.a = 0;
5162
5163
  try {
5163
- return wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(
5164
+ return wasm_bindgen__convert__closures_____invoke__h0cb536241502fe83(
5164
5165
  a,
5165
5166
  state0.b,
5166
5167
  arg0,
@@ -5332,7 +5333,7 @@ exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
5332
5333
  }, arguments);
5333
5334
  };
5334
5335
 
5335
- exports.__wbg_remove_0c50f1a372592522 = function () {
5336
+ exports.__wbg_remove_4b6c74678272e489 = function () {
5336
5337
  return handleError(function (arg0, arg1, arg2) {
5337
5338
  let deferred0_0;
5338
5339
  let deferred0_1;
@@ -5347,7 +5348,7 @@ exports.__wbg_remove_0c50f1a372592522 = function () {
5347
5348
  }, arguments);
5348
5349
  };
5349
5350
 
5350
- exports.__wbg_remove_d52ba16f05c98799 = function () {
5351
+ exports.__wbg_remove_b83e730d13c289dd = function () {
5351
5352
  return handleError(function (arg0, arg1, arg2) {
5352
5353
  let deferred0_0;
5353
5354
  let deferred0_1;
@@ -5393,31 +5394,7 @@ exports.__wbg_setTimeout_ca12ead8b48245e2 = function (arg0, arg1) {
5393
5394
  return addHeapObject(ret);
5394
5395
  };
5395
5396
 
5396
- exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
5397
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5398
- };
5399
-
5400
- exports.__wbg_set_907fb406c34a251d = function (arg0, arg1, arg2) {
5401
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5402
- return addHeapObject(ret);
5403
- };
5404
-
5405
- exports.__wbg_set_body_3c365989753d61f4 = function (arg0, arg1) {
5406
- getObject(arg0).body = getObject(arg1);
5407
- };
5408
-
5409
- exports.__wbg_set_c213c871859d6500 = function (arg0, arg1, arg2) {
5410
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
5411
- };
5412
-
5413
- exports.__wbg_set_c2abbebe8b9ebee1 = function () {
5414
- return handleError(function (arg0, arg1, arg2) {
5415
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
5416
- return ret;
5417
- }, arguments);
5418
- };
5419
-
5420
- exports.__wbg_set_cf238f02b0469517 = function () {
5397
+ exports.__wbg_set_0a163d5675fd3741 = function () {
5421
5398
  return handleError(function (arg0, arg1, arg2, arg3) {
5422
5399
  let deferred0_0;
5423
5400
  let deferred0_1;
@@ -5432,11 +5409,11 @@ exports.__wbg_set_cf238f02b0469517 = function () {
5432
5409
  }, arguments);
5433
5410
  };
5434
5411
 
5435
- exports.__wbg_set_credentials_f621cd2d85c0c228 = function (arg0, arg1) {
5436
- getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
5412
+ exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
5413
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5437
5414
  };
5438
5415
 
5439
- exports.__wbg_set_e87a8a3d69deff6e = function () {
5416
+ exports.__wbg_set_5e51294e627b72fd = function () {
5440
5417
  return handleError(function (arg0, arg1, arg2, arg3) {
5441
5418
  let deferred0_0;
5442
5419
  let deferred0_1;
@@ -5451,6 +5428,30 @@ exports.__wbg_set_e87a8a3d69deff6e = function () {
5451
5428
  }, arguments);
5452
5429
  };
5453
5430
 
5431
+ exports.__wbg_set_907fb406c34a251d = function (arg0, arg1, arg2) {
5432
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5433
+ return addHeapObject(ret);
5434
+ };
5435
+
5436
+ exports.__wbg_set_body_3c365989753d61f4 = function (arg0, arg1) {
5437
+ getObject(arg0).body = getObject(arg1);
5438
+ };
5439
+
5440
+ exports.__wbg_set_c213c871859d6500 = function (arg0, arg1, arg2) {
5441
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
5442
+ };
5443
+
5444
+ exports.__wbg_set_c2abbebe8b9ebee1 = function () {
5445
+ return handleError(function (arg0, arg1, arg2) {
5446
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
5447
+ return ret;
5448
+ }, arguments);
5449
+ };
5450
+
5451
+ exports.__wbg_set_credentials_f621cd2d85c0c228 = function (arg0, arg1) {
5452
+ getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
5453
+ };
5454
+
5454
5455
  exports.__wbg_set_headers_6926da238cd32ee4 = function (arg0, arg1) {
5455
5456
  getObject(arg0).headers = getObject(arg1);
5456
5457
  };
@@ -5615,37 +5616,26 @@ exports.__wbg_warn_8f5b5437666d0885 = function (arg0, arg1, arg2, arg3) {
5615
5616
  console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
5616
5617
  };
5617
5618
 
5618
- exports.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
5619
- // Cast intrinsic for `Ref(String) -> Externref`.
5620
- const ret = getStringFromWasm0(arg0, arg1);
5621
- return addHeapObject(ret);
5622
- };
5623
-
5624
- exports.__wbindgen_cast_4042b341512ce63a = function (arg0, arg1) {
5625
- // 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`.
5619
+ exports.__wbindgen_cast_0f3a80f9c6c81c16 = function (arg0, arg1) {
5620
+ // 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`.
5626
5621
  const ret = makeMutClosure(
5627
5622
  arg0,
5628
5623
  arg1,
5629
- wasm.wasm_bindgen__closure__destroy__hba496874d56e8206,
5630
- wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff,
5624
+ wasm.wasm_bindgen__closure__destroy__h0a76ff7104f80505,
5625
+ wasm_bindgen__convert__closures_____invoke__ha3eecaeccbf508bc,
5631
5626
  );
5632
5627
  return addHeapObject(ret);
5633
5628
  };
5634
5629
 
5635
- exports.__wbindgen_cast_4625c577ab2ec9ee = function (arg0) {
5636
- // Cast intrinsic for `U64 -> Externref`.
5637
- const ret = BigInt.asUintN(64, arg0);
5630
+ exports.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
5631
+ // Cast intrinsic for `Ref(String) -> Externref`.
5632
+ const ret = getStringFromWasm0(arg0, arg1);
5638
5633
  return addHeapObject(ret);
5639
5634
  };
5640
5635
 
5641
- exports.__wbindgen_cast_567ce6425eb96825 = function (arg0, arg1) {
5642
- // Cast intrinsic for `Closure(Closure { dtor_idx: 551, function: Function { arguments: [], shim_idx: 305, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5643
- const ret = makeMutClosure(
5644
- arg0,
5645
- arg1,
5646
- wasm.wasm_bindgen__closure__destroy__hfcb631b72e5e985c,
5647
- wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e,
5648
- );
5636
+ exports.__wbindgen_cast_4625c577ab2ec9ee = function (arg0) {
5637
+ // Cast intrinsic for `U64 -> Externref`.
5638
+ const ret = BigInt.asUintN(64, arg0);
5649
5639
  return addHeapObject(ret);
5650
5640
  };
5651
5641
 
@@ -5657,6 +5647,17 @@ exports.__wbindgen_cast_5fea77eff9dd275c = function (arg0, arg1) {
5657
5647
  return addHeapObject(ret);
5658
5648
  };
5659
5649
 
5650
+ exports.__wbindgen_cast_67d165bf11ca912a = function (arg0, arg1) {
5651
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 303, function: Function { arguments: [Externref], shim_idx: 43, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5652
+ const ret = makeMutClosure(
5653
+ arg0,
5654
+ arg1,
5655
+ wasm.wasm_bindgen__closure__destroy__h591e0f2efd143068,
5656
+ wasm_bindgen__convert__closures_____invoke__ha3eecaeccbf508bc,
5657
+ );
5658
+ return addHeapObject(ret);
5659
+ };
5660
+
5660
5661
  exports.__wbindgen_cast_7a6d185652cd8149 = function (arg0, arg1) {
5661
5662
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
5662
5663
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
@@ -5665,57 +5666,57 @@ exports.__wbindgen_cast_7a6d185652cd8149 = function (arg0, arg1) {
5665
5666
  return addHeapObject(ret);
5666
5667
  };
5667
5668
 
5668
- exports.__wbindgen_cast_8340b5b160d85933 = function (arg0, arg1) {
5669
- // Cast intrinsic for `Closure(Closure { dtor_idx: 304, function: Function { arguments: [], shim_idx: 305, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5669
+ exports.__wbindgen_cast_9ae0607507abb057 = function (arg0) {
5670
+ // Cast intrinsic for `I64 -> Externref`.
5671
+ const ret = arg0;
5672
+ return addHeapObject(ret);
5673
+ };
5674
+
5675
+ exports.__wbindgen_cast_9b35fe50b76611f9 = function (arg0, arg1) {
5676
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 552, function: Function { arguments: [], shim_idx: 304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5670
5677
  const ret = makeMutClosure(
5671
5678
  arg0,
5672
5679
  arg1,
5673
- wasm.wasm_bindgen__closure__destroy__h5bf455f3385c4f71,
5674
- wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e,
5680
+ wasm.wasm_bindgen__closure__destroy__he41cbbdbe831f2ac,
5681
+ wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2,
5675
5682
  );
5676
5683
  return addHeapObject(ret);
5677
5684
  };
5678
5685
 
5679
- exports.__wbindgen_cast_9654b59eb60e619d = function (arg0, arg1) {
5680
- // Cast intrinsic for `Closure(Closure { dtor_idx: 304, function: Function { arguments: [Externref], shim_idx: 44, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5686
+ exports.__wbindgen_cast_bfa5a190b0f2e981 = function (arg0, arg1) {
5687
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 303, function: Function { arguments: [], shim_idx: 304, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
5681
5688
  const ret = makeMutClosure(
5682
5689
  arg0,
5683
5690
  arg1,
5684
- wasm.wasm_bindgen__closure__destroy__h5bf455f3385c4f71,
5685
- wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff,
5691
+ wasm.wasm_bindgen__closure__destroy__h591e0f2efd143068,
5692
+ wasm_bindgen__convert__closures_____invoke__h4eff94a44eff58c2,
5686
5693
  );
5687
5694
  return addHeapObject(ret);
5688
5695
  };
5689
5696
 
5690
- exports.__wbindgen_cast_9ae0607507abb057 = function (arg0) {
5691
- // Cast intrinsic for `I64 -> Externref`.
5692
- const ret = arg0;
5693
- return addHeapObject(ret);
5694
- };
5695
-
5696
5697
  exports.__wbindgen_cast_cb9088102bce6b30 = function (arg0, arg1) {
5697
5698
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
5698
5699
  const ret = getArrayU8FromWasm0(arg0, arg1);
5699
5700
  return addHeapObject(ret);
5700
5701
  };
5701
5702
 
5702
- exports.__wbindgen_cast_d49c305f67640cb1 = function (arg0, arg1) {
5703
- // 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`.
5703
+ exports.__wbindgen_cast_d6cd19b81560fd6e = function (arg0) {
5704
+ // Cast intrinsic for `F64 -> Externref`.
5705
+ const ret = arg0;
5706
+ return addHeapObject(ret);
5707
+ };
5708
+
5709
+ exports.__wbindgen_cast_e12aaa4ecde9c999 = function (arg0, arg1) {
5710
+ // 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`.
5704
5711
  const ret = makeMutClosure(
5705
5712
  arg0,
5706
5713
  arg1,
5707
- wasm.wasm_bindgen__closure__destroy__hba496874d56e8206,
5708
- wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe,
5714
+ wasm.wasm_bindgen__closure__destroy__h0a76ff7104f80505,
5715
+ wasm_bindgen__convert__closures_____invoke__h86320ba04bc5bce5,
5709
5716
  );
5710
5717
  return addHeapObject(ret);
5711
5718
  };
5712
5719
 
5713
- exports.__wbindgen_cast_d6cd19b81560fd6e = function (arg0) {
5714
- // Cast intrinsic for `F64 -> Externref`.
5715
- const ret = arg0;
5716
- return addHeapObject(ret);
5717
- };
5718
-
5719
5720
  exports.__wbindgen_cast_ef90a087adb7475d = function (arg0, arg1) {
5720
5721
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
5721
5722
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);