@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"
@@ -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,6 +881,14 @@ export function isEncryptFileError(error) {
868
881
  }
869
882
  }
870
883
 
884
+ function wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(arg0, arg1, arg2) {
885
+ wasm.wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(
886
+ arg0,
887
+ arg1,
888
+ addHeapObject(arg2),
889
+ );
890
+ }
891
+
871
892
  function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
872
893
  wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
873
894
  }
@@ -891,14 +912,6 @@ function wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe(arg0, arg
891
912
  }
892
913
  }
893
914
 
894
- function wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(arg0, arg1, arg2) {
895
- wasm.wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff(
896
- arg0,
897
- arg1,
898
- addHeapObject(arg2),
899
- );
900
- }
901
-
902
915
  function wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(arg0, arg1, arg2, arg3) {
903
916
  wasm.wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f(
904
917
  arg0,
@@ -4667,7 +4680,7 @@ export function __wbg_call_e762c39fa8ea36bf() {
4667
4680
  }, arguments);
4668
4681
  }
4669
4682
 
4670
- export function __wbg_cipher_024a86a8b118ddac(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_9cea799de324dd1e(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_129fd7e95b5f7904() {
4809
+ export function __wbg_get_7b829f8c26f7c83d() {
4797
4810
  return handleError(function (arg0, arg1, arg2) {
4798
4811
  let deferred0_0;
4799
4812
  let deferred0_1;
@@ -4813,12 +4826,7 @@ export function __wbg_get_7bed016f185add81(arg0, arg1) {
4813
4826
  return addHeapObject(ret);
4814
4827
  }
4815
4828
 
4816
- export function __wbg_get_access_token_abef009db5fa750c(arg0) {
4817
- const ret = getObject(arg0).get_access_token();
4818
- return addHeapObject(ret);
4819
- }
4820
-
4821
- export function __wbg_get_eee8ecedab041535() {
4829
+ export function __wbg_get_89216faf00e53685() {
4822
4830
  return handleError(function (arg0, arg1, arg2) {
4823
4831
  let deferred0_0;
4824
4832
  let deferred0_1;
@@ -4833,6 +4841,11 @@ export function __wbg_get_eee8ecedab041535() {
4833
4841
  }, arguments);
4834
4842
  }
4835
4843
 
4844
+ export function __wbg_get_access_token_7d219bb95b728b99(arg0) {
4845
+ const ret = getObject(arg0).get_access_token();
4846
+ return addHeapObject(ret);
4847
+ }
4848
+
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_33b035298e503422() {
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_dac0fdb39533e45c() {
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_1b8d8ab47af664e0() {
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_1b8d8ab47af664e0() {
5290
5303
  }, arguments);
5291
5304
  }
5292
5305
 
5293
- export function __wbg_remove_6f00aa5f40dfd37c() {
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,7 @@ 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);
5341
- }
5342
-
5343
- export function __wbg_set_4d0fb27359ddae64() {
5352
+ export function __wbg_set_115f150f30a697ce() {
5344
5353
  return handleError(function (arg0, arg1, arg2, arg3) {
5345
5354
  let deferred0_0;
5346
5355
  let deferred0_1;
@@ -5355,12 +5364,7 @@ export function __wbg_set_4d0fb27359ddae64() {
5355
5364
  }, arguments);
5356
5365
  }
5357
5366
 
5358
- export function __wbg_set_907fb406c34a251d(arg0, arg1, arg2) {
5359
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5360
- return addHeapObject(ret);
5361
- }
5362
-
5363
- export function __wbg_set_a1854a59e5ec2573() {
5367
+ export function __wbg_set_117bcb0d1fb51da5() {
5364
5368
  return handleError(function (arg0, arg1, arg2, arg3) {
5365
5369
  let deferred0_0;
5366
5370
  let deferred0_1;
@@ -5375,6 +5379,15 @@ export function __wbg_set_a1854a59e5ec2573() {
5375
5379
  }, arguments);
5376
5380
  }
5377
5381
 
5382
+ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
5383
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5384
+ }
5385
+
5386
+ export function __wbg_set_907fb406c34a251d(arg0, arg1, arg2) {
5387
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5388
+ return addHeapObject(ret);
5389
+ }
5390
+
5378
5391
  export function __wbg_set_body_3c365989753d61f4(arg0, arg1) {
5379
5392
  getObject(arg0).body = getObject(arg1);
5380
5393
  }
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,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;
457
+ export const wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff: (
458
+ a: number,
459
+ b: number,
460
+ c: number,
461
+ ) => void;
462
+ export const wasm_bindgen__closure__destroy__hba496874d56e8206: (a: number, b: number) => void;
456
463
  export const wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e: (
457
464
  a: number,
458
465
  b: number,
459
466
  ) => void;
460
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;
461
469
  export const wasm_bindgen__convert__closures_____invoke__h35a8188fc7e541fe: (
462
470
  a: number,
463
471
  b: number,
464
472
  c: number,
465
473
  d: number,
466
474
  ) => void;
467
- export const wasm_bindgen__closure__destroy__hba496874d56e8206: (a: number, b: number) => void;
468
- export const wasm_bindgen__convert__closures_____invoke__h3f3903322ff045ff: (
469
- a: number,
470
- b: number,
471
- c: number,
472
- ) => void;
473
- export const wasm_bindgen__closure__destroy__hfcb631b72e5e985c: (a: number, b: number) => void;
474
475
  export const wasm_bindgen__convert__closures_____invoke__h43dfd80678632d6f: (
475
476
  a: number,
476
477
  b: number,