@bitwarden/commercial-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,14 +871,6 @@ exports.isEncryptFileError = function (error) {
858
871
  }
859
872
  };
860
873
 
861
- function wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(arg0, arg1, arg2) {
862
- wasm.wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(
863
- arg0,
864
- arg1,
865
- addHeapObject(arg2),
866
- );
867
- }
868
-
869
874
  function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
870
875
  wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
871
876
  }
@@ -889,6 +894,14 @@ function wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe(arg0, arg
889
894
  }
890
895
  }
891
896
 
897
+ function wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(arg0, arg1, arg2) {
898
+ wasm.wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(
899
+ arg0,
900
+ arg1,
901
+ addHeapObject(arg2),
902
+ );
903
+ }
904
+
892
905
  function wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(arg0, arg1, arg2, arg3) {
893
906
  wasm.wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(
894
907
  arg0,
@@ -4711,7 +4724,7 @@ exports.__wbg_call_e762c39fa8ea36bf = function () {
4711
4724
  }, arguments);
4712
4725
  };
4713
4726
 
4714
- exports.__wbg_cipher_024a86a8b118ddac = function (arg0) {
4727
+ exports.__wbg_cipher_36ca200ffa394aff = function (arg0) {
4715
4728
  const ret = getObject(arg0).cipher;
4716
4729
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4717
4730
  };
@@ -4804,7 +4817,7 @@ exports.__wbg_fetch_f8ba0e29a9d6de0d = function (arg0, arg1) {
4804
4817
  return addHeapObject(ret);
4805
4818
  };
4806
4819
 
4807
- exports.__wbg_folder_9cea799de324dd1e = function (arg0) {
4820
+ exports.__wbg_folder_3c40ff563bebbf4d = function (arg0) {
4808
4821
  const ret = getObject(arg0).folder;
4809
4822
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4810
4823
  };
@@ -4837,7 +4850,7 @@ exports.__wbg_getTime_14776bfb48a1bff9 = function (arg0) {
4837
4850
  return ret;
4838
4851
  };
4839
4852
 
4840
- exports.__wbg_get_129fd7e95b5f7904 = function () {
4853
+ exports.__wbg_get_7b829f8c26f7c83d = function () {
4841
4854
  return handleError(function (arg0, arg1, arg2) {
4842
4855
  let deferred0_0;
4843
4856
  let deferred0_1;
@@ -4857,12 +4870,7 @@ exports.__wbg_get_7bed016f185add81 = function (arg0, arg1) {
4857
4870
  return addHeapObject(ret);
4858
4871
  };
4859
4872
 
4860
- exports.__wbg_get_access_token_abef009db5fa750c = function (arg0) {
4861
- const ret = getObject(arg0).get_access_token();
4862
- return addHeapObject(ret);
4863
- };
4864
-
4865
- exports.__wbg_get_eee8ecedab041535 = function () {
4873
+ exports.__wbg_get_89216faf00e53685 = function () {
4866
4874
  return handleError(function (arg0, arg1, arg2) {
4867
4875
  let deferred0_0;
4868
4876
  let deferred0_1;
@@ -4877,6 +4885,11 @@ exports.__wbg_get_eee8ecedab041535 = function () {
4877
4885
  }, arguments);
4878
4886
  };
4879
4887
 
4888
+ exports.__wbg_get_access_token_7d219bb95b728b99 = function (arg0) {
4889
+ const ret = getObject(arg0).get_access_token();
4890
+ return addHeapObject(ret);
4891
+ };
4892
+
4880
4893
  exports.__wbg_get_efcb449f58ec27c2 = function () {
4881
4894
  return handleError(function (arg0, arg1) {
4882
4895
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
@@ -5068,14 +5081,14 @@ exports.__wbg_length_cdd215e10d9dd507 = function (arg0) {
5068
5081
  return ret;
5069
5082
  };
5070
5083
 
5071
- exports.__wbg_list_33b035298e503422 = function () {
5084
+ exports.__wbg_list_144ee93b8ba81d02 = function () {
5072
5085
  return handleError(function (arg0) {
5073
5086
  const ret = getObject(arg0).list();
5074
5087
  return addHeapObject(ret);
5075
5088
  }, arguments);
5076
5089
  };
5077
5090
 
5078
- exports.__wbg_list_dac0fdb39533e45c = function () {
5091
+ exports.__wbg_list_239cef5c115c1faa = function () {
5079
5092
  return handleError(function (arg0) {
5080
5093
  const ret = getObject(arg0).list();
5081
5094
  return addHeapObject(ret);
@@ -5319,7 +5332,7 @@ exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
5319
5332
  }, arguments);
5320
5333
  };
5321
5334
 
5322
- exports.__wbg_remove_1b8d8ab47af664e0 = function () {
5335
+ exports.__wbg_remove_10cb42bbbe564282 = function () {
5323
5336
  return handleError(function (arg0, arg1, arg2) {
5324
5337
  let deferred0_0;
5325
5338
  let deferred0_1;
@@ -5334,7 +5347,7 @@ exports.__wbg_remove_1b8d8ab47af664e0 = function () {
5334
5347
  }, arguments);
5335
5348
  };
5336
5349
 
5337
- exports.__wbg_remove_6f00aa5f40dfd37c = function () {
5350
+ exports.__wbg_remove_d480594d8d8e87d8 = function () {
5338
5351
  return handleError(function (arg0, arg1, arg2) {
5339
5352
  let deferred0_0;
5340
5353
  let deferred0_1;
@@ -5380,11 +5393,7 @@ exports.__wbg_setTimeout_ca12ead8b48245e2 = function (arg0, arg1) {
5380
5393
  return addHeapObject(ret);
5381
5394
  };
5382
5395
 
5383
- exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
5384
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5385
- };
5386
-
5387
- exports.__wbg_set_4d0fb27359ddae64 = function () {
5396
+ exports.__wbg_set_115f150f30a697ce = function () {
5388
5397
  return handleError(function (arg0, arg1, arg2, arg3) {
5389
5398
  let deferred0_0;
5390
5399
  let deferred0_1;
@@ -5399,12 +5408,7 @@ exports.__wbg_set_4d0fb27359ddae64 = function () {
5399
5408
  }, arguments);
5400
5409
  };
5401
5410
 
5402
- exports.__wbg_set_907fb406c34a251d = function (arg0, arg1, arg2) {
5403
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5404
- return addHeapObject(ret);
5405
- };
5406
-
5407
- exports.__wbg_set_a1854a59e5ec2573 = function () {
5411
+ exports.__wbg_set_117bcb0d1fb51da5 = function () {
5408
5412
  return handleError(function (arg0, arg1, arg2, arg3) {
5409
5413
  let deferred0_0;
5410
5414
  let deferred0_1;
@@ -5419,6 +5423,15 @@ exports.__wbg_set_a1854a59e5ec2573 = function () {
5419
5423
  }, arguments);
5420
5424
  };
5421
5425
 
5426
+ exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
5427
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5428
+ };
5429
+
5430
+ exports.__wbg_set_907fb406c34a251d = function (arg0, arg1, arg2) {
5431
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5432
+ return addHeapObject(ret);
5433
+ };
5434
+
5422
5435
  exports.__wbg_set_body_3c365989753d61f4 = function (arg0, arg1) {
5423
5436
  getObject(arg0).body = getObject(arg1);
5424
5437
  };
@@ -235,6 +235,7 @@ export const isMasterPasswordError: (a: number) => number;
235
235
  export const isDeriveKeyConnectorError: (a: number) => number;
236
236
  export const isEnrollAdminPasswordResetError: (a: number) => number;
237
237
  export const isCryptoClientError: (a: number) => number;
238
+ export const isAccountCryptographyInitializationError: (a: number) => number;
238
239
  export const isStatefulCryptoError: (a: number) => number;
239
240
  export const isEncryptionSettingsError: (a: number) => number;
240
241
  export const isCryptoError: (a: number) => number;
@@ -453,24 +454,24 @@ export const __wbg_totpclient_free: (a: number, b: number) => void;
453
454
  export const __wbg_get_outgoingmessage_destination: (a: number) => number;
454
455
  export const __wbg_set_outgoingmessage_destination: (a: number, b: number) => void;
455
456
  export const __wbg_cryptoclient_free: (a: number, b: number) => void;
456
- export const wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff: (
457
- a: number,
458
- b: number,
459
- c: number,
460
- ) => void;
461
- export const wasm_bindgen__closure__destroy__hba496874d56e8206: (a: number, b: number) => void;
462
457
  export const wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e: (
463
458
  a: number,
464
459
  b: number,
465
460
  ) => void;
466
461
  export const wasm_bindgen__closure__destroy__hfcb631b72e5e985c: (a: number, b: number) => void;
467
- export const wasm_bindgen__closure__destroy__h5bf455f3385c4f71: (a: number, b: number) => void;
468
462
  export const wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe: (
469
463
  a: number,
470
464
  b: number,
471
465
  c: number,
472
466
  d: number,
473
467
  ) => void;
468
+ export const wasm_bindgen__closure__destroy__hba496874d56e8206: (a: number, b: number) => void;
469
+ export const wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff: (
470
+ a: number,
471
+ b: number,
472
+ c: number,
473
+ ) => void;
474
+ export const wasm_bindgen__closure__destroy__h5bf455f3385c4f71: (a: number, b: number) => void;
474
475
  export const wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f: (
475
476
  a: number,
476
477
  b: number,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/commercial-sdk-internal",
3
- "version": "0.2.0-main.407",
3
+ "version": "0.2.0-main.409",
4
4
  "license": "BITWARDEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT",
5
5
  "repository": {
6
6
  "type": "git",