@bitwarden/sdk-internal 0.2.0-main.407 → 0.2.0-main.409

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.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 069d78293ee15074678900109cff76eb116121ae
1
+ ab7ae369f07ecbcce8db5512f076881ff8cc8f7b
@@ -383,19 +383,12 @@ export interface InitUserCryptoRequest {
383
383
  */
384
384
  email: string;
385
385
  /**
386
- * The user\'s encrypted private key
386
+ * The user\'s account cryptographic state, containing their signature and
387
+ * public-key-encryption keys, along with the signed security state, protected by the user key
387
388
  */
388
- privateKey: EncString;
389
- /**
390
- * The user\'s signing key
391
- */
392
- signingKey: EncString | undefined;
389
+ accountCryptographicState: WrappedAccountCryptographicState;
393
390
  /**
394
- * The user\'s security state
395
- */
396
- securityState: SignedSecurityState | undefined;
397
- /**
398
- * The initialization method to use
391
+ * The method to decrypt the user\'s account symmetric key (user key)
399
392
  */
400
393
  method: InitUserCryptoMethod;
401
394
  }
@@ -674,6 +667,36 @@ export interface CryptoClientError extends Error {
674
667
 
675
668
  export function isCryptoClientError(error: any): error is CryptoClientError;
676
669
 
670
+ /**
671
+ * Any keys / cryptographic protection \"downstream\" from the account symmetric key (user key).
672
+ * Private keys are protected by the user key.
673
+ */
674
+ export type WrappedAccountCryptographicState =
675
+ | { V1: { private_key: EncString } }
676
+ | {
677
+ V2: {
678
+ private_key: EncString;
679
+ signed_public_key: SignedPublicKey | undefined;
680
+ signing_key: EncString;
681
+ security_state: SignedSecurityState;
682
+ };
683
+ };
684
+
685
+ export interface AccountCryptographyInitializationError extends Error {
686
+ name: "AccountCryptographyInitializationError";
687
+ variant:
688
+ | "WrongUserKeyType"
689
+ | "WrongUserKey"
690
+ | "CorruptData"
691
+ | "TamperedData"
692
+ | "KeyStoreAlreadyInitialized"
693
+ | "GenericCrypto";
694
+ }
695
+
696
+ export function isAccountCryptographyInitializationError(
697
+ error: any,
698
+ ): error is AccountCryptographyInitializationError;
699
+
677
700
  export interface StatefulCryptoError extends Error {
678
701
  name: "StatefulCryptoError";
679
702
  variant: "MissingSecurityState" | "WrongAccountCryptoVersion" | "Crypto";
@@ -685,9 +708,7 @@ export interface EncryptionSettingsError extends Error {
685
708
  name: "EncryptionSettingsError";
686
709
  variant:
687
710
  | "Crypto"
688
- | "InvalidPrivateKey"
689
- | "InvalidSigningKey"
690
- | "InvalidSecurityState"
711
+ | "CryptoInitialization"
691
712
  | "MissingPrivateKey"
692
713
  | "UserIdAlreadySet"
693
714
  | "WrongPin";
@@ -804,6 +825,7 @@ export interface CryptoError extends Error {
804
825
  | "MissingKeyId"
805
826
  | "KeyOperationNotSupported"
806
827
  | "ReadOnlyKeyStore"
828
+ | "InvalidKeyStoreOperation"
807
829
  | "InsufficientKdfParameters"
808
830
  | "EncString"
809
831
  | "Rsa"
@@ -422,6 +422,19 @@ export function isCryptoClientError(error) {
422
422
  }
423
423
  }
424
424
 
425
+ /**
426
+ * @param {any} error
427
+ * @returns {boolean}
428
+ */
429
+ export function isAccountCryptographyInitializationError(error) {
430
+ try {
431
+ const ret = wasm.isAccountCryptographyInitializationError(addBorrowedObject(error));
432
+ return ret !== 0;
433
+ } finally {
434
+ heap[stack_pointer++] = undefined;
435
+ }
436
+ }
437
+
425
438
  /**
426
439
  * @param {any} error
427
440
  * @returns {boolean}
@@ -868,6 +881,10 @@ export function isEncryptFileError(error) {
868
881
  }
869
882
  }
870
883
 
884
+ function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
885
+ wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
886
+ }
887
+
871
888
  function wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(arg0, arg1, arg2) {
872
889
  wasm.wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(
873
890
  arg0,
@@ -895,10 +912,6 @@ function wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf(arg0, arg
895
912
  }
896
913
  }
897
914
 
898
- function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
899
- wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
900
- }
901
-
902
915
  function wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(arg0, arg1, arg2, arg3) {
903
916
  wasm.wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(
904
917
  arg0,
@@ -4588,7 +4601,7 @@ export function __wbg_call_e762c39fa8ea36bf() {
4588
4601
  }, arguments);
4589
4602
  }
4590
4603
 
4591
- export function __wbg_cipher_024a86a8b118ddac(arg0) {
4604
+ export function __wbg_cipher_36ca200ffa394aff(arg0) {
4592
4605
  const ret = getObject(arg0).cipher;
4593
4606
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4594
4607
  }
@@ -4681,7 +4694,7 @@ export function __wbg_fetch_f8ba0e29a9d6de0d(arg0, arg1) {
4681
4694
  return addHeapObject(ret);
4682
4695
  }
4683
4696
 
4684
- export function __wbg_folder_9cea799de324dd1e(arg0) {
4697
+ export function __wbg_folder_3c40ff563bebbf4d(arg0) {
4685
4698
  const ret = getObject(arg0).folder;
4686
4699
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4687
4700
  }
@@ -4714,7 +4727,7 @@ export function __wbg_getTime_14776bfb48a1bff9(arg0) {
4714
4727
  return ret;
4715
4728
  }
4716
4729
 
4717
- export function __wbg_get_129fd7e95b5f7904() {
4730
+ export function __wbg_get_7b829f8c26f7c83d() {
4718
4731
  return handleError(function (arg0, arg1, arg2) {
4719
4732
  let deferred0_0;
4720
4733
  let deferred0_1;
@@ -4734,12 +4747,7 @@ export function __wbg_get_7bed016f185add81(arg0, arg1) {
4734
4747
  return addHeapObject(ret);
4735
4748
  }
4736
4749
 
4737
- export function __wbg_get_access_token_abef009db5fa750c(arg0) {
4738
- const ret = getObject(arg0).get_access_token();
4739
- return addHeapObject(ret);
4740
- }
4741
-
4742
- export function __wbg_get_eee8ecedab041535() {
4750
+ export function __wbg_get_89216faf00e53685() {
4743
4751
  return handleError(function (arg0, arg1, arg2) {
4744
4752
  let deferred0_0;
4745
4753
  let deferred0_1;
@@ -4754,6 +4762,11 @@ export function __wbg_get_eee8ecedab041535() {
4754
4762
  }, arguments);
4755
4763
  }
4756
4764
 
4765
+ export function __wbg_get_access_token_7d219bb95b728b99(arg0) {
4766
+ const ret = getObject(arg0).get_access_token();
4767
+ return addHeapObject(ret);
4768
+ }
4769
+
4757
4770
  export function __wbg_get_efcb449f58ec27c2() {
4758
4771
  return handleError(function (arg0, arg1) {
4759
4772
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
@@ -4945,14 +4958,14 @@ export function __wbg_length_cdd215e10d9dd507(arg0) {
4945
4958
  return ret;
4946
4959
  }
4947
4960
 
4948
- export function __wbg_list_33b035298e503422() {
4961
+ export function __wbg_list_144ee93b8ba81d02() {
4949
4962
  return handleError(function (arg0) {
4950
4963
  const ret = getObject(arg0).list();
4951
4964
  return addHeapObject(ret);
4952
4965
  }, arguments);
4953
4966
  }
4954
4967
 
4955
- export function __wbg_list_dac0fdb39533e45c() {
4968
+ export function __wbg_list_239cef5c115c1faa() {
4956
4969
  return handleError(function (arg0) {
4957
4970
  const ret = getObject(arg0).list();
4958
4971
  return addHeapObject(ret);
@@ -5196,7 +5209,7 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
5196
5209
  }, arguments);
5197
5210
  }
5198
5211
 
5199
- export function __wbg_remove_1b8d8ab47af664e0() {
5212
+ export function __wbg_remove_10cb42bbbe564282() {
5200
5213
  return handleError(function (arg0, arg1, arg2) {
5201
5214
  let deferred0_0;
5202
5215
  let deferred0_1;
@@ -5211,7 +5224,7 @@ export function __wbg_remove_1b8d8ab47af664e0() {
5211
5224
  }, arguments);
5212
5225
  }
5213
5226
 
5214
- export function __wbg_remove_6f00aa5f40dfd37c() {
5227
+ export function __wbg_remove_d480594d8d8e87d8() {
5215
5228
  return handleError(function (arg0, arg1, arg2) {
5216
5229
  let deferred0_0;
5217
5230
  let deferred0_1;
@@ -5257,11 +5270,7 @@ export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
5257
5270
  return addHeapObject(ret);
5258
5271
  }
5259
5272
 
5260
- export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
5261
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5262
- }
5263
-
5264
- export function __wbg_set_4d0fb27359ddae64() {
5273
+ export function __wbg_set_115f150f30a697ce() {
5265
5274
  return handleError(function (arg0, arg1, arg2, arg3) {
5266
5275
  let deferred0_0;
5267
5276
  let deferred0_1;
@@ -5276,12 +5285,7 @@ export function __wbg_set_4d0fb27359ddae64() {
5276
5285
  }, arguments);
5277
5286
  }
5278
5287
 
5279
- export function __wbg_set_907fb406c34a251d(arg0, arg1, arg2) {
5280
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5281
- return addHeapObject(ret);
5282
- }
5283
-
5284
- export function __wbg_set_a1854a59e5ec2573() {
5288
+ export function __wbg_set_117bcb0d1fb51da5() {
5285
5289
  return handleError(function (arg0, arg1, arg2, arg3) {
5286
5290
  let deferred0_0;
5287
5291
  let deferred0_1;
@@ -5296,6 +5300,15 @@ export function __wbg_set_a1854a59e5ec2573() {
5296
5300
  }, arguments);
5297
5301
  }
5298
5302
 
5303
+ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
5304
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5305
+ }
5306
+
5307
+ export function __wbg_set_907fb406c34a251d(arg0, arg1, arg2) {
5308
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5309
+ return addHeapObject(ret);
5310
+ }
5311
+
5299
5312
  export function __wbg_set_body_3c365989753d61f4(arg0, arg1) {
5300
5313
  getObject(arg0).body = getObject(arg1);
5301
5314
  }
Binary file
@@ -233,6 +233,7 @@ export const isMasterPasswordError: (a: number) => number;
233
233
  export const isDeriveKeyConnectorError: (a: number) => number;
234
234
  export const isEnrollAdminPasswordResetError: (a: number) => number;
235
235
  export const isCryptoClientError: (a: number) => number;
236
+ export const isAccountCryptographyInitializationError: (a: number) => number;
236
237
  export const isStatefulCryptoError: (a: number) => number;
237
238
  export const isEncryptionSettingsError: (a: number) => number;
238
239
  export const isCryptoError: (a: number) => number;
@@ -449,24 +450,24 @@ export const __wbg_totpclient_free: (a: number, b: number) => void;
449
450
  export const __wbg_get_outgoingmessage_destination: (a: number) => number;
450
451
  export const __wbg_set_outgoingmessage_destination: (a: number, b: number) => void;
451
452
  export const __wbg_cryptoclient_free: (a: number, b: number) => void;
453
+ export const wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e: (
454
+ a: number,
455
+ b: number,
456
+ ) => void;
457
+ export const wasm_bindgen__closure__destroy__hfcb631b72e5e985c: (a: number, b: number) => void;
452
458
  export const wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa: (
453
459
  a: number,
454
460
  b: number,
455
461
  c: number,
456
462
  ) => void;
457
463
  export const wasm_bindgen__closure__destroy__h5bf455f3385c4f71: (a: number, b: number) => void;
464
+ export const wasm_bindgen__closure__destroy__h09d4e676b918dc23: (a: number, b: number) => void;
458
465
  export const wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf: (
459
466
  a: number,
460
467
  b: number,
461
468
  c: number,
462
469
  d: number,
463
470
  ) => void;
464
- export const wasm_bindgen__closure__destroy__h09d4e676b918dc23: (a: number, b: number) => void;
465
- export const wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e: (
466
- a: number,
467
- b: number,
468
- ) => void;
469
- export const wasm_bindgen__closure__destroy__hfcb631b72e5e985c: (a: number, b: number) => void;
470
471
  export const wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f: (
471
472
  a: number,
472
473
  b: number,