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

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"
@@ -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}
@@ -4667,7 +4680,7 @@ export function __wbg_call_e762c39fa8ea36bf() {
4667
4680
  }, arguments);
4668
4681
  }
4669
4682
 
4670
- export function __wbg_cipher_f62bf70f044b3d45(arg0) {
4683
+ export function __wbg_cipher_f01ad37fe153c74a(arg0) {
4671
4684
  const ret = getObject(arg0).cipher;
4672
4685
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4673
4686
  }
@@ -4760,7 +4773,7 @@ export function __wbg_fetch_f8ba0e29a9d6de0d(arg0, arg1) {
4760
4773
  return addHeapObject(ret);
4761
4774
  }
4762
4775
 
4763
- export function __wbg_folder_b2647abe8ccaa979(arg0) {
4776
+ export function __wbg_folder_b2f27ca5801406fe(arg0) {
4764
4777
  const ret = getObject(arg0).folder;
4765
4778
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4766
4779
  }
@@ -4793,7 +4806,12 @@ export function __wbg_getTime_14776bfb48a1bff9(arg0) {
4793
4806
  return ret;
4794
4807
  }
4795
4808
 
4796
- export function __wbg_get_4e3650385d7407c5() {
4809
+ export function __wbg_get_7bed016f185add81(arg0, arg1) {
4810
+ const ret = getObject(arg0)[arg1 >>> 0];
4811
+ return addHeapObject(ret);
4812
+ }
4813
+
4814
+ export function __wbg_get_7d24a56df19d62f6() {
4797
4815
  return handleError(function (arg0, arg1, arg2) {
4798
4816
  let deferred0_0;
4799
4817
  let deferred0_1;
@@ -4808,7 +4826,12 @@ export function __wbg_get_4e3650385d7407c5() {
4808
4826
  }, arguments);
4809
4827
  }
4810
4828
 
4811
- export function __wbg_get_5d348cd2322d9dcb() {
4829
+ export function __wbg_get_access_token_f4e462d38899439f(arg0) {
4830
+ const ret = getObject(arg0).get_access_token();
4831
+ return addHeapObject(ret);
4832
+ }
4833
+
4834
+ export function __wbg_get_cf7a5a169adcb6d4() {
4812
4835
  return handleError(function (arg0, arg1, arg2) {
4813
4836
  let deferred0_0;
4814
4837
  let deferred0_1;
@@ -4823,16 +4846,6 @@ export function __wbg_get_5d348cd2322d9dcb() {
4823
4846
  }, arguments);
4824
4847
  }
4825
4848
 
4826
- export function __wbg_get_7bed016f185add81(arg0, arg1) {
4827
- const ret = getObject(arg0)[arg1 >>> 0];
4828
- return addHeapObject(ret);
4829
- }
4830
-
4831
- export function __wbg_get_access_token_e1ae00959dff169c(arg0) {
4832
- const ret = getObject(arg0).get_access_token();
4833
- return addHeapObject(ret);
4834
- }
4835
-
4836
4849
  export function __wbg_get_efcb449f58ec27c2() {
4837
4850
  return handleError(function (arg0, arg1) {
4838
4851
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
@@ -5024,14 +5037,14 @@ export function __wbg_length_cdd215e10d9dd507(arg0) {
5024
5037
  return ret;
5025
5038
  }
5026
5039
 
5027
- export function __wbg_list_aadb272449db21e8() {
5040
+ export function __wbg_list_9632da36688eb013() {
5028
5041
  return handleError(function (arg0) {
5029
5042
  const ret = getObject(arg0).list();
5030
5043
  return addHeapObject(ret);
5031
5044
  }, arguments);
5032
5045
  }
5033
5046
 
5034
- export function __wbg_list_e4838ffa85142db1() {
5047
+ export function __wbg_list_971afaee385941da() {
5035
5048
  return handleError(function (arg0) {
5036
5049
  const ret = getObject(arg0).list();
5037
5050
  return addHeapObject(ret);
@@ -5275,7 +5288,7 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
5275
5288
  }, arguments);
5276
5289
  }
5277
5290
 
5278
- export function __wbg_remove_1dda6b5d117a41ab() {
5291
+ export function __wbg_remove_0c50f1a372592522() {
5279
5292
  return handleError(function (arg0, arg1, arg2) {
5280
5293
  let deferred0_0;
5281
5294
  let deferred0_1;
@@ -5290,7 +5303,7 @@ export function __wbg_remove_1dda6b5d117a41ab() {
5290
5303
  }, arguments);
5291
5304
  }
5292
5305
 
5293
- export function __wbg_remove_953de1641e4a5d83() {
5306
+ export function __wbg_remove_d52ba16f05c98799() {
5294
5307
  return handleError(function (arg0, arg1, arg2) {
5295
5308
  let deferred0_0;
5296
5309
  let deferred0_1;
@@ -5340,21 +5353,6 @@ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
5340
5353
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5341
5354
  }
5342
5355
 
5343
- export function __wbg_set_8f4bd39d6e8b06c1() {
5344
- return handleError(function (arg0, arg1, arg2, arg3) {
5345
- let deferred0_0;
5346
- let deferred0_1;
5347
- try {
5348
- deferred0_0 = arg1;
5349
- deferred0_1 = arg2;
5350
- const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
5351
- return addHeapObject(ret);
5352
- } finally {
5353
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5354
- }
5355
- }, arguments);
5356
- }
5357
-
5358
5356
  export function __wbg_set_907fb406c34a251d(arg0, arg1, arg2) {
5359
5357
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5360
5358
  return addHeapObject(ret);
@@ -5375,7 +5373,7 @@ export function __wbg_set_c2abbebe8b9ebee1() {
5375
5373
  }, arguments);
5376
5374
  }
5377
5375
 
5378
- export function __wbg_set_c9a17952625c1485() {
5376
+ export function __wbg_set_cf238f02b0469517() {
5379
5377
  return handleError(function (arg0, arg1, arg2, arg3) {
5380
5378
  let deferred0_0;
5381
5379
  let deferred0_1;
@@ -5394,6 +5392,21 @@ export function __wbg_set_credentials_f621cd2d85c0c228(arg0, arg1) {
5394
5392
  getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
5395
5393
  }
5396
5394
 
5395
+ export function __wbg_set_e87a8a3d69deff6e() {
5396
+ return handleError(function (arg0, arg1, arg2, arg3) {
5397
+ let deferred0_0;
5398
+ let deferred0_1;
5399
+ try {
5400
+ deferred0_0 = arg1;
5401
+ deferred0_1 = arg2;
5402
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
5403
+ return addHeapObject(ret);
5404
+ } finally {
5405
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5406
+ }
5407
+ }, arguments);
5408
+ }
5409
+
5397
5410
  export function __wbg_set_headers_6926da238cd32ee4(arg0, arg1) {
5398
5411
  getObject(arg0).headers = getObject(arg1);
5399
5412
  }
Binary file
@@ -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;