@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.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 7e4b2cc698a0166046cf0550e8a3893d82db2987
1
+ ab7ae369f07ecbcce8db5512f076881ff8cc8f7b
@@ -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,10 @@ export function isEncryptFileError(error) {
868
881
  }
869
882
  }
870
883
 
884
+ function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
885
+ wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
886
+ }
887
+
871
888
  function wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(arg0, arg1, arg2) {
872
889
  wasm.wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(
873
890
  arg0,
@@ -876,10 +893,6 @@ function wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa(arg0, arg
876
893
  );
877
894
  }
878
895
 
879
- function wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1) {
880
- wasm.wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e(arg0, arg1);
881
- }
882
-
883
896
  function wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf(arg0, arg1, arg2) {
884
897
  try {
885
898
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
@@ -4588,7 +4601,7 @@ export function __wbg_call_e762c39fa8ea36bf() {
4588
4601
  }, arguments);
4589
4602
  }
4590
4603
 
4591
- export function __wbg_cipher_f62bf70f044b3d45(arg0) {
4604
+ export function __wbg_cipher_36ca200ffa394aff(arg0) {
4592
4605
  const ret = getObject(arg0).cipher;
4593
4606
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4594
4607
  }
@@ -4681,7 +4694,7 @@ export function __wbg_fetch_f8ba0e29a9d6de0d(arg0, arg1) {
4681
4694
  return addHeapObject(ret);
4682
4695
  }
4683
4696
 
4684
- export function __wbg_folder_b2647abe8ccaa979(arg0) {
4697
+ export function __wbg_folder_3c40ff563bebbf4d(arg0) {
4685
4698
  const ret = getObject(arg0).folder;
4686
4699
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
4687
4700
  }
@@ -4714,7 +4727,7 @@ export function __wbg_getTime_14776bfb48a1bff9(arg0) {
4714
4727
  return ret;
4715
4728
  }
4716
4729
 
4717
- export function __wbg_get_4e3650385d7407c5() {
4730
+ export function __wbg_get_7b829f8c26f7c83d() {
4718
4731
  return handleError(function (arg0, arg1, arg2) {
4719
4732
  let deferred0_0;
4720
4733
  let deferred0_1;
@@ -4729,7 +4742,12 @@ export function __wbg_get_4e3650385d7407c5() {
4729
4742
  }, arguments);
4730
4743
  }
4731
4744
 
4732
- export function __wbg_get_5d348cd2322d9dcb() {
4745
+ export function __wbg_get_7bed016f185add81(arg0, arg1) {
4746
+ const ret = getObject(arg0)[arg1 >>> 0];
4747
+ return addHeapObject(ret);
4748
+ }
4749
+
4750
+ export function __wbg_get_89216faf00e53685() {
4733
4751
  return handleError(function (arg0, arg1, arg2) {
4734
4752
  let deferred0_0;
4735
4753
  let deferred0_1;
@@ -4744,12 +4762,7 @@ export function __wbg_get_5d348cd2322d9dcb() {
4744
4762
  }, arguments);
4745
4763
  }
4746
4764
 
4747
- export function __wbg_get_7bed016f185add81(arg0, arg1) {
4748
- const ret = getObject(arg0)[arg1 >>> 0];
4749
- return addHeapObject(ret);
4750
- }
4751
-
4752
- export function __wbg_get_access_token_e1ae00959dff169c(arg0) {
4765
+ export function __wbg_get_access_token_7d219bb95b728b99(arg0) {
4753
4766
  const ret = getObject(arg0).get_access_token();
4754
4767
  return addHeapObject(ret);
4755
4768
  }
@@ -4945,14 +4958,14 @@ export function __wbg_length_cdd215e10d9dd507(arg0) {
4945
4958
  return ret;
4946
4959
  }
4947
4960
 
4948
- export function __wbg_list_aadb272449db21e8() {
4961
+ export function __wbg_list_144ee93b8ba81d02() {
4949
4962
  return handleError(function (arg0) {
4950
4963
  const ret = getObject(arg0).list();
4951
4964
  return addHeapObject(ret);
4952
4965
  }, arguments);
4953
4966
  }
4954
4967
 
4955
- export function __wbg_list_e4838ffa85142db1() {
4968
+ export function __wbg_list_239cef5c115c1faa() {
4956
4969
  return handleError(function (arg0) {
4957
4970
  const ret = getObject(arg0).list();
4958
4971
  return addHeapObject(ret);
@@ -5196,7 +5209,7 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
5196
5209
  }, arguments);
5197
5210
  }
5198
5211
 
5199
- export function __wbg_remove_1dda6b5d117a41ab() {
5212
+ export function __wbg_remove_10cb42bbbe564282() {
5200
5213
  return handleError(function (arg0, arg1, arg2) {
5201
5214
  let deferred0_0;
5202
5215
  let deferred0_1;
@@ -5211,7 +5224,7 @@ export function __wbg_remove_1dda6b5d117a41ab() {
5211
5224
  }, arguments);
5212
5225
  }
5213
5226
 
5214
- export function __wbg_remove_953de1641e4a5d83() {
5227
+ export function __wbg_remove_d480594d8d8e87d8() {
5215
5228
  return handleError(function (arg0, arg1, arg2) {
5216
5229
  let deferred0_0;
5217
5230
  let deferred0_1;
@@ -5257,11 +5270,22 @@ export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
5257
5270
  return addHeapObject(ret);
5258
5271
  }
5259
5272
 
5260
- export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
5261
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5273
+ export function __wbg_set_115f150f30a697ce() {
5274
+ return handleError(function (arg0, arg1, arg2, arg3) {
5275
+ let deferred0_0;
5276
+ let deferred0_1;
5277
+ try {
5278
+ deferred0_0 = arg1;
5279
+ deferred0_1 = arg2;
5280
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
5281
+ return addHeapObject(ret);
5282
+ } finally {
5283
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5284
+ }
5285
+ }, arguments);
5262
5286
  }
5263
5287
 
5264
- export function __wbg_set_8f4bd39d6e8b06c1() {
5288
+ export function __wbg_set_117bcb0d1fb51da5() {
5265
5289
  return handleError(function (arg0, arg1, arg2, arg3) {
5266
5290
  let deferred0_0;
5267
5291
  let deferred0_1;
@@ -5276,6 +5300,10 @@ export function __wbg_set_8f4bd39d6e8b06c1() {
5276
5300
  }, arguments);
5277
5301
  }
5278
5302
 
5303
+ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
5304
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5305
+ }
5306
+
5279
5307
  export function __wbg_set_907fb406c34a251d(arg0, arg1, arg2) {
5280
5308
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
5281
5309
  return addHeapObject(ret);
@@ -5296,21 +5324,6 @@ export function __wbg_set_c2abbebe8b9ebee1() {
5296
5324
  }, arguments);
5297
5325
  }
5298
5326
 
5299
- export function __wbg_set_c9a17952625c1485() {
5300
- return handleError(function (arg0, arg1, arg2, arg3) {
5301
- let deferred0_0;
5302
- let deferred0_1;
5303
- try {
5304
- deferred0_0 = arg1;
5305
- deferred0_1 = arg2;
5306
- const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
5307
- return addHeapObject(ret);
5308
- } finally {
5309
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5310
- }
5311
- }, arguments);
5312
- }
5313
-
5314
5327
  export function __wbg_set_credentials_f621cd2d85c0c228(arg0, arg1) {
5315
5328
  getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
5316
5329
  }
Binary file
@@ -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;
@@ -449,6 +450,11 @@ export const __wbg_totpclient_free: (a: number, b: number) => void;
449
450
  export const __wbg_get_outgoingmessage_destination: (a: number) => number;
450
451
  export const __wbg_set_outgoingmessage_destination: (a: number, b: number) => void;
451
452
  export const __wbg_cryptoclient_free: (a: number, b: number) => void;
453
+ export const wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e: (
454
+ a: number,
455
+ b: number,
456
+ ) => void;
457
+ export const wasm_bindgen__closure__destroy__hfcb631b72e5e985c: (a: number, b: number) => void;
452
458
  export const wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa: (
453
459
  a: number,
454
460
  b: number,
@@ -456,11 +462,6 @@ export const wasm_bindgen__convert__closures_____invoke__h5c75b123e343f7aa: (
456
462
  ) => void;
457
463
  export const wasm_bindgen__closure__destroy__h5bf455f3385c4f71: (a: number, b: number) => void;
458
464
  export const wasm_bindgen__closure__destroy__h09d4e676b918dc23: (a: number, b: number) => void;
459
- export const wasm_bindgen__convert__closures_____invoke__h092300064b8afb1e: (
460
- a: number,
461
- b: number,
462
- ) => void;
463
- export const wasm_bindgen__closure__destroy__hfcb631b72e5e985c: (a: number, b: number) => void;
464
465
  export const wasm_bindgen__convert__closures_____invoke__hb20fdca52a2a2cdf: (
465
466
  a: number,
466
467
  b: number,