@bitwarden/commercial-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"
@@ -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,10 +881,6 @@ export function isEncryptFileError(error) {
868
881
  }
869
882
  }
870
883
 
871
- function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
872
- wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
873
- }
874
-
875
884
  function wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(arg0, arg1, arg2) {
876
885
  wasm.wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(
877
886
  arg0,
@@ -880,6 +889,10 @@ function wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(arg0, arg
880
889
  );
881
890
  }
882
891
 
892
+ function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
893
+ wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
894
+ }
895
+
883
896
  function wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe(arg0, arg1, arg2) {
884
897
  try {
885
898
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -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_36ca200ffa394aff(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_3c40ff563bebbf4d(arg0) {
4764
4777
  const ret = getObject(arg0).folder;
4765
4778
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4766
4779
  }
@@ -4793,7 +4806,7 @@ 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_7b829f8c26f7c83d() {
4797
4810
  return handleError(function (arg0, arg1, arg2) {
4798
4811
  let deferred0_0;
4799
4812
  let deferred0_1;
@@ -4808,7 +4821,12 @@ export function __wbg_get_4e3650385d7407c5() {
4808
4821
  }, arguments);
4809
4822
  }
4810
4823
 
4811
- export function __wbg_get_5d348cd2322d9dcb() {
4824
+ export function __wbg_get_7bed016f185add81(arg0, arg1) {
4825
+ const ret = getObject(arg0)[arg1 >>> 0];
4826
+ return addHeapObject(ret);
4827
+ }
4828
+
4829
+ export function __wbg_get_89216faf00e53685() {
4812
4830
  return handleError(function (arg0, arg1, arg2) {
4813
4831
  let deferred0_0;
4814
4832
  let deferred0_1;
@@ -4823,12 +4841,7 @@ export function __wbg_get_5d348cd2322d9dcb() {
4823
4841
  }, arguments);
4824
4842
  }
4825
4843
 
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) {
4844
+ export function __wbg_get_access_token_7d219bb95b728b99(arg0) {
4832
4845
  const ret = getObject(arg0).get_access_token();
4833
4846
  return addHeapObject(ret);
4834
4847
  }
@@ -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_144ee93b8ba81d02() {
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_239cef5c115c1faa() {
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_10cb42bbbe564282() {
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_d480594d8d8e87d8() {
5294
5307
  return handleError(function (arg0, arg1, arg2) {
5295
5308
  let deferred0_0;
5296
5309
  let deferred0_1;
@@ -5336,11 +5349,22 @@ export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
5336
5349
  return addHeapObject(ret);
5337
5350
  }
5338
5351
 
5339
- export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
5340
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5352
+ export function __wbg_set_115f150f30a697ce() {
5353
+ return handleError(function (arg0, arg1, arg2, arg3) {
5354
+ let deferred0_0;
5355
+ let deferred0_1;
5356
+ try {
5357
+ deferred0_0 = arg1;
5358
+ deferred0_1 = arg2;
5359
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
5360
+ return addHeapObject(ret);
5361
+ } finally {
5362
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5363
+ }
5364
+ }, arguments);
5341
5365
  }
5342
5366
 
5343
- export function __wbg_set_8f4bd39d6e8b06c1() {
5367
+ export function __wbg_set_117bcb0d1fb51da5() {
5344
5368
  return handleError(function (arg0, arg1, arg2, arg3) {
5345
5369
  let deferred0_0;
5346
5370
  let deferred0_1;
@@ -5355,6 +5379,10 @@ export function __wbg_set_8f4bd39d6e8b06c1() {
5355
5379
  }, arguments);
5356
5380
  }
5357
5381
 
5382
+ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
5383
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5384
+ }
5385
+
5358
5386
  export function __wbg_set_907fb406c34a251d(arg0, arg1, arg2) {
5359
5387
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5360
5388
  return addHeapObject(ret);
@@ -5375,21 +5403,6 @@ export function __wbg_set_c2abbebe8b9ebee1() {
5375
5403
  }, arguments);
5376
5404
  }
5377
5405
 
5378
- export function __wbg_set_c9a17952625c1485() {
5379
- return handleError(function (arg0, arg1, arg2, arg3) {
5380
- let deferred0_0;
5381
- let deferred0_1;
5382
- try {
5383
- deferred0_0 = arg1;
5384
- deferred0_1 = arg2;
5385
- const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
5386
- return addHeapObject(ret);
5387
- } finally {
5388
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5389
- }
5390
- }, arguments);
5391
- }
5392
-
5393
5406
  export function __wbg_set_credentials_f621cd2d85c0c228(arg0, arg1) {
5394
5407
  getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
5395
5408
  }
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;
@@ -453,18 +454,18 @@ 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__h092300064b8afb1e: (
457
- a: number,
458
- b: number,
459
- ) => void;
460
- export const wasm_bindgen__closure__destroy__hfcb631b72e5e985c: (a: number, b: number) => void;
461
457
  export const wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff: (
462
458
  a: number,
463
459
  b: number,
464
460
  c: number,
465
461
  ) => void;
466
462
  export const wasm_bindgen__closure__destroy__hba496874d56e8206: (a: number, b: number) => void;
463
+ export const wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e: (
464
+ a: number,
465
+ b: number,
466
+ ) => void;
467
467
  export const wasm_bindgen__closure__destroy__h5bf455f3385c4f71: (a: number, b: number) => void;
468
+ export const wasm_bindgen__closure__destroy__hfcb631b72e5e985c: (a: number, b: number) => void;
468
469
  export const wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe: (
469
470
  a: number,
470
471
  b: number,