@bitwarden/sdk-internal 0.2.0-main.408 → 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}
@@ -4628,7 +4641,7 @@ exports.__wbg_call_e762c39fa8ea36bf = function () {
4628
4641
  }, arguments);
4629
4642
  };
4630
4643
 
4631
- exports.__wbg_cipher_f62bf70f044b3d45 = 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_b2647abe8ccaa979 = 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_4e3650385d7407c5 = 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;
@@ -4769,7 +4782,12 @@ exports.__wbg_get_4e3650385d7407c5 = function () {
4769
4782
  }, arguments);
4770
4783
  };
4771
4784
 
4772
- exports.__wbg_get_5d348cd2322d9dcb = function () {
4785
+ exports.__wbg_get_7bed016f185add81 = function (arg0, arg1) {
4786
+ const ret = getObject(arg0)[arg1 >>> 0];
4787
+ return addHeapObject(ret);
4788
+ };
4789
+
4790
+ exports.__wbg_get_89216faf00e53685 = function () {
4773
4791
  return handleError(function (arg0, arg1, arg2) {
4774
4792
  let deferred0_0;
4775
4793
  let deferred0_1;
@@ -4784,12 +4802,7 @@ exports.__wbg_get_5d348cd2322d9dcb = function () {
4784
4802
  }, arguments);
4785
4803
  };
4786
4804
 
4787
- exports.__wbg_get_7bed016f185add81 = function (arg0, arg1) {
4788
- const ret = getObject(arg0)[arg1 >>> 0];
4789
- return addHeapObject(ret);
4790
- };
4791
-
4792
- exports.__wbg_get_access_token_e1ae00959dff169c = function (arg0) {
4805
+ exports.__wbg_get_access_token_7d219bb95b728b99 = function (arg0) {
4793
4806
  const ret = getObject(arg0).get_access_token();
4794
4807
  return addHeapObject(ret);
4795
4808
  };
@@ -4985,14 +4998,14 @@ exports.__wbg_length_cdd215e10d9dd507 = function (arg0) {
4985
4998
  return ret;
4986
4999
  };
4987
5000
 
4988
- exports.__wbg_list_aadb272449db21e8 = 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_e4838ffa85142db1 = 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_1dda6b5d117a41ab = 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_1dda6b5d117a41ab = function () {
5251
5264
  }, arguments);
5252
5265
  };
5253
5266
 
5254
- exports.__wbg_remove_953de1641e4a5d83 = 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,22 @@ 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);
5313
+ exports.__wbg_set_115f150f30a697ce = function () {
5314
+ return handleError(function (arg0, arg1, arg2, arg3) {
5315
+ let deferred0_0;
5316
+ let deferred0_1;
5317
+ try {
5318
+ deferred0_0 = arg1;
5319
+ deferred0_1 = arg2;
5320
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
5321
+ return addHeapObject(ret);
5322
+ } finally {
5323
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5324
+ }
5325
+ }, arguments);
5302
5326
  };
5303
5327
 
5304
- exports.__wbg_set_8f4bd39d6e8b06c1 = function () {
5328
+ exports.__wbg_set_117bcb0d1fb51da5 = function () {
5305
5329
  return handleError(function (arg0, arg1, arg2, arg3) {
5306
5330
  let deferred0_0;
5307
5331
  let deferred0_1;
@@ -5316,6 +5340,10 @@ exports.__wbg_set_8f4bd39d6e8b06c1 = function () {
5316
5340
  }, arguments);
5317
5341
  };
5318
5342
 
5343
+ exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
5344
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5345
+ };
5346
+
5319
5347
  exports.__wbg_set_907fb406c34a251d = function (arg0, arg1, arg2) {
5320
5348
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5321
5349
  return addHeapObject(ret);
@@ -5336,21 +5364,6 @@ exports.__wbg_set_c2abbebe8b9ebee1 = function () {
5336
5364
  }, arguments);
5337
5365
  };
5338
5366
 
5339
- exports.__wbg_set_c9a17952625c1485 = function () {
5340
- return handleError(function (arg0, arg1, arg2, arg3) {
5341
- let deferred0_0;
5342
- let deferred0_1;
5343
- try {
5344
- deferred0_0 = arg1;
5345
- deferred0_1 = arg2;
5346
- const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
5347
- return addHeapObject(ret);
5348
- } finally {
5349
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5350
- }
5351
- }, arguments);
5352
- };
5353
-
5354
5367
  exports.__wbg_set_credentials_f621cd2d85c0c228 = function (arg0, arg1) {
5355
5368
  getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
5356
5369
  };
@@ -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;
@@ -460,13 +461,13 @@ export const wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa: (
460
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.408",
3
+ "version": "0.2.0-main.409",
4
4
  "license": "GPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",