@bitwarden/sdk-internal 0.2.0-main.230 → 0.2.0-main.231

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.
@@ -136,6 +136,10 @@ export interface InitUserCryptoRequest {
136
136
  * The user\'s signing key
137
137
  */
138
138
  signingKey: EncString | undefined;
139
+ /**
140
+ * The user\'s security state
141
+ */
142
+ securityState: SignedSecurityState | undefined;
139
143
  /**
140
144
  * The initialization method to use
141
145
  */
@@ -273,49 +277,45 @@ export interface VerifyAsymmetricKeysResponse {
273
277
  }
274
278
 
275
279
  /**
276
- * A new signing key pair along with the signed public key
280
+ * Response for the `make_keys_for_user_crypto_v2`, containing a set of keys for a user
277
281
  */
278
- export interface MakeUserSigningKeysResponse {
282
+ export interface UserCryptoV2KeysResponse {
279
283
  /**
280
- * Base64 encoded verifying key
284
+ * User key
281
285
  */
282
- verifyingKey: string;
286
+ userKey: string;
283
287
  /**
284
- * Signing key, encrypted with the user\'s symmetric key
288
+ * Wrapped private key
285
289
  */
286
- signingKey: EncString;
290
+ privateKey: EncString;
287
291
  /**
288
- * The user\'s public key, signed by the signing key
292
+ * Public key
289
293
  */
290
- signedPublicKey: SignedPublicKey;
291
- }
292
-
293
- /**
294
- * A rotated set of account keys for a user
295
- */
296
- export interface RotateUserKeysResponse {
294
+ publicKey: string;
297
295
  /**
298
- * The verifying key
296
+ * The user\'s public key, signed by the signing key
299
297
  */
300
- verifyingKey: string;
298
+ signedPublicKey: SignedPublicKey;
301
299
  /**
302
- * Signing key, encrypted with a symmetric key (user key, org key)
300
+ * Signing key, encrypted with the user\'s symmetric key
303
301
  */
304
302
  signingKey: EncString;
305
303
  /**
306
- * The user\'s public key, signed by the signing key
304
+ * Base64 encoded verifying key
307
305
  */
308
- signedPublicKey: string;
306
+ verifyingKey: string;
309
307
  /**
310
- * The user\'s public key, without signature
308
+ * The user\'s signed security state
311
309
  */
312
- publicKey: string;
310
+ securityState: SignedSecurityState;
313
311
  /**
314
- * The user\'s private key, encrypted with the user key
312
+ * The security state\'s version
315
313
  */
316
- privateKey: EncString;
314
+ securityVersion: number;
317
315
  }
318
316
 
317
+ export type SignedSecurityState = string;
318
+
319
319
  /**
320
320
  * NewType wrapper for `OrganizationId`
321
321
  */
@@ -342,6 +342,13 @@ export interface CryptoClientError extends Error {
342
342
 
343
343
  export function isCryptoClientError(error: any): error is CryptoClientError;
344
344
 
345
+ export interface StatefulCryptoError extends Error {
346
+ name: "StatefulCryptoError";
347
+ variant: "MissingSecurityState" | "WrongAccountCryptoVersion" | "CryptoError";
348
+ }
349
+
350
+ export function isStatefulCryptoError(error: any): error is StatefulCryptoError;
351
+
345
352
  export interface EncryptionSettingsError extends Error {
346
353
  name: "EncryptionSettingsError";
347
354
  variant:
@@ -350,6 +357,7 @@ export interface EncryptionSettingsError extends Error {
350
357
  | "VaultLocked"
351
358
  | "InvalidPrivateKey"
352
359
  | "InvalidSigningKey"
360
+ | "InvalidSecurityState"
353
361
  | "MissingPrivateKey"
354
362
  | "UserIdAlreadySetError";
355
363
  }
@@ -1359,11 +1367,11 @@ export class CryptoClient {
1359
1367
  /**
1360
1368
  * Makes a new signing key pair and signs the public key for the user
1361
1369
  */
1362
- make_user_signing_keys_for_enrollment(): MakeUserSigningKeysResponse;
1370
+ make_keys_for_user_crypto_v2(): UserCryptoV2KeysResponse;
1363
1371
  /**
1364
1372
  * Creates a rotated set of account keys for the current state
1365
1373
  */
1366
- get_v2_rotated_account_keys(user_key: string): RotateUserKeysResponse;
1374
+ get_v2_rotated_account_keys(): UserCryptoV2KeysResponse;
1367
1375
  }
1368
1376
  export class ExporterClient {
1369
1377
  private constructor();
@@ -284,6 +284,19 @@ module.exports.isCryptoClientError = function (error) {
284
284
  }
285
285
  };
286
286
 
287
+ /**
288
+ * @param {any} error
289
+ * @returns {boolean}
290
+ */
291
+ module.exports.isStatefulCryptoError = function (error) {
292
+ try {
293
+ const ret = wasm.isStatefulCryptoError(addBorrowedObject(error));
294
+ return ret !== 0;
295
+ } finally {
296
+ heap[stack_pointer++] = undefined;
297
+ }
298
+ };
299
+
287
300
  /**
288
301
  * @param {any} error
289
302
  * @returns {boolean}
@@ -747,7 +760,7 @@ function __wbg_adapter_56(arg0, arg1, arg2) {
747
760
  );
748
761
  }
749
762
 
750
- function __wbg_adapter_280(arg0, arg1, arg2, arg3) {
763
+ function __wbg_adapter_281(arg0, arg1, arg2, arg3) {
751
764
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h8776500d04a3e634(
752
765
  arg0,
753
766
  arg1,
@@ -1421,12 +1434,12 @@ class CryptoClient {
1421
1434
  }
1422
1435
  /**
1423
1436
  * Makes a new signing key pair and signs the public key for the user
1424
- * @returns {MakeUserSigningKeysResponse}
1437
+ * @returns {UserCryptoV2KeysResponse}
1425
1438
  */
1426
- make_user_signing_keys_for_enrollment() {
1439
+ make_keys_for_user_crypto_v2() {
1427
1440
  try {
1428
1441
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1429
- wasm.cryptoclient_make_user_signing_keys_for_enrollment(retptr, this.__wbg_ptr);
1442
+ wasm.cryptoclient_make_keys_for_user_crypto_v2(retptr, this.__wbg_ptr);
1430
1443
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1431
1444
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1432
1445
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1440,15 +1453,12 @@ class CryptoClient {
1440
1453
  }
1441
1454
  /**
1442
1455
  * Creates a rotated set of account keys for the current state
1443
- * @param {string} user_key
1444
- * @returns {RotateUserKeysResponse}
1456
+ * @returns {UserCryptoV2KeysResponse}
1445
1457
  */
1446
- get_v2_rotated_account_keys(user_key) {
1458
+ get_v2_rotated_account_keys() {
1447
1459
  try {
1448
1460
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1449
- const ptr0 = passStringToWasm0(user_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1450
- const len0 = WASM_VECTOR_LEN;
1451
- wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr, ptr0, len0);
1461
+ wasm.cryptoclient_get_v2_rotated_account_keys(retptr, this.__wbg_ptr);
1452
1462
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1453
1463
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1454
1464
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3420,19 +3430,7 @@ module.exports.__wbg_getTime_46267b1c24877e30 = function (arg0) {
3420
3430
  return ret;
3421
3431
  };
3422
3432
 
3423
- module.exports.__wbg_get_67b2ba62fc30de12 = function () {
3424
- return handleError(function (arg0, arg1) {
3425
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
3426
- return addHeapObject(ret);
3427
- }, arguments);
3428
- };
3429
-
3430
- module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
3431
- const ret = getObject(arg0)[arg1 >>> 0];
3432
- return addHeapObject(ret);
3433
- };
3434
-
3435
- module.exports.__wbg_get_fe8b1fc2a9351d29 = function () {
3433
+ module.exports.__wbg_get_29fa07573edd0414 = function () {
3436
3434
  return handleError(function (arg0, arg1, arg2) {
3437
3435
  let deferred0_0;
3438
3436
  let deferred0_1;
@@ -3447,7 +3445,19 @@ module.exports.__wbg_get_fe8b1fc2a9351d29 = function () {
3447
3445
  }, arguments);
3448
3446
  };
3449
3447
 
3450
- module.exports.__wbg_getaccesstoken_add1fa985a1fcf9b = function (arg0) {
3448
+ module.exports.__wbg_get_67b2ba62fc30de12 = function () {
3449
+ return handleError(function (arg0, arg1) {
3450
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
3451
+ return addHeapObject(ret);
3452
+ }, arguments);
3453
+ };
3454
+
3455
+ module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
3456
+ const ret = getObject(arg0)[arg1 >>> 0];
3457
+ return addHeapObject(ret);
3458
+ };
3459
+
3460
+ module.exports.__wbg_getaccesstoken_c1ea3be055452912 = function (arg0) {
3451
3461
  const ret = getObject(arg0).get_access_token();
3452
3462
  return addHeapObject(ret);
3453
3463
  };
@@ -3552,7 +3562,7 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function (arg0) {
3552
3562
  return ret;
3553
3563
  };
3554
3564
 
3555
- module.exports.__wbg_list_e78f0f65f8a26cd6 = function () {
3565
+ module.exports.__wbg_list_b393427351b308b4 = function () {
3556
3566
  return handleError(function (arg0) {
3557
3567
  const ret = getObject(arg0).list();
3558
3568
  return addHeapObject(ret);
@@ -3587,7 +3597,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function (arg0, arg1) {
3587
3597
  const a = state0.a;
3588
3598
  state0.a = 0;
3589
3599
  try {
3590
- return __wbg_adapter_280(a, state0.b, arg0, arg1);
3600
+ return __wbg_adapter_281(a, state0.b, arg0, arg1);
3591
3601
  } finally {
3592
3602
  state0.a = a;
3593
3603
  }
@@ -3729,7 +3739,7 @@ module.exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
3729
3739
  }, arguments);
3730
3740
  };
3731
3741
 
3732
- module.exports.__wbg_remove_ea8cb7fadc70e111 = function () {
3742
+ module.exports.__wbg_remove_39bec51fb6464483 = function () {
3733
3743
  return handleError(function (arg0, arg1, arg2) {
3734
3744
  let deferred0_0;
3735
3745
  let deferred0_1;
@@ -3780,7 +3790,7 @@ module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
3780
3790
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
3781
3791
  };
3782
3792
 
3783
- module.exports.__wbg_set_84a98f482fda77e5 = function () {
3793
+ module.exports.__wbg_set_dac2905b348768e9 = function () {
3784
3794
  return handleError(function (arg0, arg1, arg2, arg3) {
3785
3795
  let deferred0_0;
3786
3796
  let deferred0_1;
@@ -3974,18 +3984,18 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
3974
3984
  return ret;
3975
3985
  };
3976
3986
 
3977
- module.exports.__wbindgen_closure_wrapper2913 = function (arg0, arg1, arg2) {
3978
- const ret = makeMutClosure(arg0, arg1, 920, __wbg_adapter_50);
3987
+ module.exports.__wbindgen_closure_wrapper2952 = function (arg0, arg1, arg2) {
3988
+ const ret = makeMutClosure(arg0, arg1, 928, __wbg_adapter_50);
3979
3989
  return addHeapObject(ret);
3980
3990
  };
3981
3991
 
3982
- module.exports.__wbindgen_closure_wrapper3753 = function (arg0, arg1, arg2) {
3983
- const ret = makeMutClosure(arg0, arg1, 1004, __wbg_adapter_53);
3992
+ module.exports.__wbindgen_closure_wrapper3792 = function (arg0, arg1, arg2) {
3993
+ const ret = makeMutClosure(arg0, arg1, 1012, __wbg_adapter_53);
3984
3994
  return addHeapObject(ret);
3985
3995
  };
3986
3996
 
3987
- module.exports.__wbindgen_closure_wrapper4171 = function (arg0, arg1, arg2) {
3988
- const ret = makeMutClosure(arg0, arg1, 1127, __wbg_adapter_56);
3997
+ module.exports.__wbindgen_closure_wrapper4211 = function (arg0, arg1, arg2) {
3998
+ const ret = makeMutClosure(arg0, arg1, 1134, __wbg_adapter_56);
3989
3999
  return addHeapObject(ret);
3990
4000
  };
3991
4001
 
@@ -6,16 +6,12 @@ export const cryptoclient_initialize_user_crypto: (a: number, b: number) => numb
6
6
  export const cryptoclient_initialize_org_crypto: (a: number, b: number) => number;
7
7
  export const cryptoclient_make_key_pair: (a: number, b: number, c: number, d: number) => void;
8
8
  export const cryptoclient_verify_asymmetric_keys: (a: number, b: number, c: number) => void;
9
- export const cryptoclient_make_user_signing_keys_for_enrollment: (a: number, b: number) => void;
10
- export const cryptoclient_get_v2_rotated_account_keys: (
11
- a: number,
12
- b: number,
13
- c: number,
14
- d: number,
15
- ) => void;
9
+ export const cryptoclient_make_keys_for_user_crypto_v2: (a: number, b: number) => void;
10
+ export const cryptoclient_get_v2_rotated_account_keys: (a: number, b: number) => void;
16
11
  export const isDeriveKeyConnectorError: (a: number) => number;
17
12
  export const isEnrollAdminPasswordResetError: (a: number) => number;
18
13
  export const isCryptoClientError: (a: number) => number;
14
+ export const isStatefulCryptoError: (a: number) => number;
19
15
  export const isEncryptionSettingsError: (a: number) => number;
20
16
  export const isCryptoError: (a: number) => number;
21
17
  export const __wbg_exporterclient_free: (a: number, b: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.230",
3
+ "version": "0.2.0-main.231",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",