@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.
@@ -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"
@@ -412,6 +412,19 @@ exports.isCryptoClientError = function (error) {
412
412
  }
413
413
  };
414
414
 
415
+ /**
416
+ * @param {any} error
417
+ * @returns {boolean}
418
+ */
419
+ exports.isAccountCryptographyInitializationError = function (error) {
420
+ try {
421
+ const ret = wasm.isAccountCryptographyInitializationError(addBorrowedObject(error));
422
+ return ret !== 0;
423
+ } finally {
424
+ heap[stack_pointer++] = undefined;
425
+ }
426
+ };
427
+
415
428
  /**
416
429
  * @param {any} error
417
430
  * @returns {boolean}
@@ -858,6 +871,10 @@ exports.isEncryptFileError = function (error) {
858
871
  }
859
872
  };
860
873
 
874
+ function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
875
+ wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
876
+ }
877
+
861
878
  function wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(arg0, arg1, arg2) {
862
879
  wasm.wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(
863
880
  arg0,
@@ -866,10 +883,6 @@ function wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(arg0, arg
866
883
  );
867
884
  }
868
885
 
869
- function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
870
- wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
871
- }
872
-
873
886
  function wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf(arg0, arg1, arg2) {
874
887
  try {
875
888
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -4628,7 +4641,7 @@ exports.__wbg_call_e762c39fa8ea36bf = function () {
4628
4641
  }, arguments);
4629
4642
  };
4630
4643
 
4631
- exports.__wbg_cipher_024a86a8b118ddac = function (arg0) {
4644
+ exports.__wbg_cipher_36ca200ffa394aff = function (arg0) {
4632
4645
  const ret = getObject(arg0).cipher;
4633
4646
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4634
4647
  };
@@ -4721,7 +4734,7 @@ exports.__wbg_fetch_f8ba0e29a9d6de0d = function (arg0, arg1) {
4721
4734
  return addHeapObject(ret);
4722
4735
  };
4723
4736
 
4724
- exports.__wbg_folder_9cea799de324dd1e = function (arg0) {
4737
+ exports.__wbg_folder_3c40ff563bebbf4d = function (arg0) {
4725
4738
  const ret = getObject(arg0).folder;
4726
4739
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4727
4740
  };
@@ -4754,7 +4767,7 @@ exports.__wbg_getTime_14776bfb48a1bff9 = function (arg0) {
4754
4767
  return ret;
4755
4768
  };
4756
4769
 
4757
- exports.__wbg_get_129fd7e95b5f7904 = function () {
4770
+ exports.__wbg_get_7b829f8c26f7c83d = function () {
4758
4771
  return handleError(function (arg0, arg1, arg2) {
4759
4772
  let deferred0_0;
4760
4773
  let deferred0_1;
@@ -4774,12 +4787,7 @@ exports.__wbg_get_7bed016f185add81 = function (arg0, arg1) {
4774
4787
  return addHeapObject(ret);
4775
4788
  };
4776
4789
 
4777
- exports.__wbg_get_access_token_abef009db5fa750c = function (arg0) {
4778
- const ret = getObject(arg0).get_access_token();
4779
- return addHeapObject(ret);
4780
- };
4781
-
4782
- exports.__wbg_get_eee8ecedab041535 = function () {
4790
+ exports.__wbg_get_89216faf00e53685 = function () {
4783
4791
  return handleError(function (arg0, arg1, arg2) {
4784
4792
  let deferred0_0;
4785
4793
  let deferred0_1;
@@ -4794,6 +4802,11 @@ exports.__wbg_get_eee8ecedab041535 = function () {
4794
4802
  }, arguments);
4795
4803
  };
4796
4804
 
4805
+ exports.__wbg_get_access_token_7d219bb95b728b99 = function (arg0) {
4806
+ const ret = getObject(arg0).get_access_token();
4807
+ return addHeapObject(ret);
4808
+ };
4809
+
4797
4810
  exports.__wbg_get_efcb449f58ec27c2 = function () {
4798
4811
  return handleError(function (arg0, arg1) {
4799
4812
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
@@ -4985,14 +4998,14 @@ exports.__wbg_length_cdd215e10d9dd507 = function (arg0) {
4985
4998
  return ret;
4986
4999
  };
4987
5000
 
4988
- exports.__wbg_list_33b035298e503422 = function () {
5001
+ exports.__wbg_list_144ee93b8ba81d02 = function () {
4989
5002
  return handleError(function (arg0) {
4990
5003
  const ret = getObject(arg0).list();
4991
5004
  return addHeapObject(ret);
4992
5005
  }, arguments);
4993
5006
  };
4994
5007
 
4995
- exports.__wbg_list_dac0fdb39533e45c = function () {
5008
+ exports.__wbg_list_239cef5c115c1faa = function () {
4996
5009
  return handleError(function (arg0) {
4997
5010
  const ret = getObject(arg0).list();
4998
5011
  return addHeapObject(ret);
@@ -5236,7 +5249,7 @@ exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
5236
5249
  }, arguments);
5237
5250
  };
5238
5251
 
5239
- exports.__wbg_remove_1b8d8ab47af664e0 = function () {
5252
+ exports.__wbg_remove_10cb42bbbe564282 = function () {
5240
5253
  return handleError(function (arg0, arg1, arg2) {
5241
5254
  let deferred0_0;
5242
5255
  let deferred0_1;
@@ -5251,7 +5264,7 @@ exports.__wbg_remove_1b8d8ab47af664e0 = function () {
5251
5264
  }, arguments);
5252
5265
  };
5253
5266
 
5254
- exports.__wbg_remove_6f00aa5f40dfd37c = function () {
5267
+ exports.__wbg_remove_d480594d8d8e87d8 = function () {
5255
5268
  return handleError(function (arg0, arg1, arg2) {
5256
5269
  let deferred0_0;
5257
5270
  let deferred0_1;
@@ -5297,11 +5310,7 @@ exports.__wbg_setTimeout_ca12ead8b48245e2 = function (arg0, arg1) {
5297
5310
  return addHeapObject(ret);
5298
5311
  };
5299
5312
 
5300
- exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
5301
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5302
- };
5303
-
5304
- exports.__wbg_set_4d0fb27359ddae64 = function () {
5313
+ exports.__wbg_set_115f150f30a697ce = function () {
5305
5314
  return handleError(function (arg0, arg1, arg2, arg3) {
5306
5315
  let deferred0_0;
5307
5316
  let deferred0_1;
@@ -5316,12 +5325,7 @@ exports.__wbg_set_4d0fb27359ddae64 = function () {
5316
5325
  }, arguments);
5317
5326
  };
5318
5327
 
5319
- exports.__wbg_set_907fb406c34a251d = function (arg0, arg1, arg2) {
5320
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5321
- return addHeapObject(ret);
5322
- };
5323
-
5324
- exports.__wbg_set_a1854a59e5ec2573 = function () {
5328
+ exports.__wbg_set_117bcb0d1fb51da5 = function () {
5325
5329
  return handleError(function (arg0, arg1, arg2, arg3) {
5326
5330
  let deferred0_0;
5327
5331
  let deferred0_1;
@@ -5336,6 +5340,15 @@ exports.__wbg_set_a1854a59e5ec2573 = function () {
5336
5340
  }, arguments);
5337
5341
  };
5338
5342
 
5343
+ exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
5344
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5345
+ };
5346
+
5347
+ exports.__wbg_set_907fb406c34a251d = function (arg0, arg1, arg2) {
5348
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5349
+ return addHeapObject(ret);
5350
+ };
5351
+
5339
5352
  exports.__wbg_set_body_3c365989753d61f4 = function (arg0, arg1) {
5340
5353
  getObject(arg0).body = getObject(arg1);
5341
5354
  };
@@ -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;
452
- export const wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa: (
453
+ export const wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e: (
453
454
  a: number,
454
455
  b: number,
455
- c: number,
456
456
  ) => void;
457
457
  export const wasm_bindgen__closure__destroy__h5bf455f3385c4f71: (a: number, b: number) => void;
458
- export const wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e: (
458
+ export const wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa: (
459
459
  a: number,
460
460
  b: number,
461
+ c: number,
461
462
  ) => void;
462
463
  export const wasm_bindgen__closure__destroy__h09d4e676b918dc23: (a: number, b: number) => void;
463
- export const wasm_bindgen__closure__destroy__hfcb631b72e5e985c: (a: number, b: number) => void;
464
464
  export const wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf: (
465
465
  a: number,
466
466
  b: number,
467
467
  c: number,
468
468
  d: number,
469
469
  ) => void;
470
+ 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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.407",
3
+ "version": "0.2.0-main.409",
4
4
  "license": "GPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",