@bitwarden/sdk-internal 0.2.0-main.268 → 0.2.0-main.269

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.
@@ -256,7 +256,7 @@ export type InitUserCryptoMethod =
256
256
  | { password: { password: string; user_key: EncString } }
257
257
  | { decryptedKey: { decrypted_user_key: string } }
258
258
  | { pin: { pin: string; pin_protected_user_key: EncString } }
259
- | { authRequest: { request_private_key: string; method: AuthRequestMethod } }
259
+ | { authRequest: { request_private_key: B64; method: AuthRequestMethod } }
260
260
  | {
261
261
  deviceKey: {
262
262
  device_key: string;
@@ -264,7 +264,7 @@ export type InitUserCryptoMethod =
264
264
  device_protected_user_key: UnsignedSharedKey;
265
265
  };
266
266
  }
267
- | { keyConnector: { master_key: string; user_key: EncString } };
267
+ | { keyConnector: { master_key: B64; user_key: EncString } };
268
268
 
269
269
  /**
270
270
  * Auth requests supports multiple initialization methods.
@@ -290,7 +290,7 @@ export interface UpdatePasswordResponse {
290
290
  /**
291
291
  * Hash of the new password
292
292
  */
293
- passwordHash: string;
293
+ passwordHash: B64;
294
294
  /**
295
295
  * User key, encrypted with the new password
296
296
  */
@@ -340,7 +340,7 @@ export interface MakeKeyPairResponse {
340
340
  /**
341
341
  * The user\'s public key
342
342
  */
343
- userPublicKey: string;
343
+ userPublicKey: B64;
344
344
  /**
345
345
  * User\'s private key, encrypted with the user key
346
346
  */
@@ -354,11 +354,11 @@ export interface VerifyAsymmetricKeysRequest {
354
354
  /**
355
355
  * The user\'s user key
356
356
  */
357
- userKey: string;
357
+ userKey: B64;
358
358
  /**
359
359
  * The user\'s public key
360
360
  */
361
- userPublicKey: string;
361
+ userPublicKey: B64;
362
362
  /**
363
363
  * User\'s private key, encrypted with the user key
364
364
  */
@@ -386,7 +386,7 @@ export interface UserCryptoV2KeysResponse {
386
386
  /**
387
387
  * User key
388
388
  */
389
- userKey: string;
389
+ userKey: B64;
390
390
  /**
391
391
  * Wrapped private key
392
392
  */
@@ -394,7 +394,7 @@ export interface UserCryptoV2KeysResponse {
394
394
  /**
395
395
  * Public key
396
396
  */
397
- publicKey: string;
397
+ publicKey: B64;
398
398
  /**
399
399
  * The user\'s public key, signed by the signing key
400
400
  */
@@ -406,7 +406,7 @@ export interface UserCryptoV2KeysResponse {
406
406
  /**
407
407
  * Base64 encoded verifying key
408
408
  */
409
- verifyingKey: string;
409
+ verifyingKey: B64;
410
410
  /**
411
411
  * The user\'s signed security state
412
412
  */
@@ -443,7 +443,7 @@ export function isDeriveKeyConnectorError(error: any): error is DeriveKeyConnect
443
443
 
444
444
  export interface EnrollAdminPasswordResetError extends Error {
445
445
  name: "EnrollAdminPasswordResetError";
446
- variant: "VaultLocked" | "Crypto" | "InvalidBase64";
446
+ variant: "VaultLocked" | "Crypto";
447
447
  }
448
448
 
449
449
  export function isEnrollAdminPasswordResetError(error: any): error is EnrollAdminPasswordResetError;
@@ -466,7 +466,6 @@ export interface EncryptionSettingsError extends Error {
466
466
  name: "EncryptionSettingsError";
467
467
  variant:
468
468
  | "Crypto"
469
- | "InvalidBase64"
470
469
  | "VaultLocked"
471
470
  | "InvalidPrivateKey"
472
471
  | "InvalidSigningKey"
@@ -592,6 +591,13 @@ export interface CryptoError extends Error {
592
591
 
593
592
  export function isCryptoError(error: any): error is CryptoError;
594
593
 
594
+ /**
595
+ * Base64 encoded data
596
+ *
597
+ * Is indifferent about padding when decoding, but always produces padding when encoding.
598
+ */
599
+ export type B64 = String;
600
+
595
601
  /**
596
602
  * Temporary struct to hold metadata related to current account
597
603
  *
@@ -1453,7 +1459,7 @@ export class CiphersClient {
1453
1459
  * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1454
1460
  * key directly.
1455
1461
  */
1456
- encrypt_cipher_for_rotation(cipher_view: CipherView, new_key_b64: string): EncryptionContext;
1462
+ encrypt_cipher_for_rotation(cipher_view: CipherView, new_key: B64): EncryptionContext;
1457
1463
  decrypt(cipher: Cipher): CipherView;
1458
1464
  decrypt_list(ciphers: Cipher[]): CipherListView[];
1459
1465
  /**
@@ -1523,7 +1529,7 @@ export class CryptoClient {
1523
1529
  * Generates a new key pair and encrypts the private key with the provided user key.
1524
1530
  * Crypto initialization not required.
1525
1531
  */
1526
- make_key_pair(user_key: string): MakeKeyPairResponse;
1532
+ make_key_pair(user_key: B64): MakeKeyPairResponse;
1527
1533
  /**
1528
1534
  * Verifies a user's asymmetric keys by decrypting the private key with the provided user
1529
1535
  * key. Returns if the private key is decryptable and if it is a valid matching key.
@@ -1279,20 +1279,17 @@ class CiphersClient {
1279
1279
  * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1280
1280
  * key directly.
1281
1281
  * @param {CipherView} cipher_view
1282
- * @param {string} new_key_b64
1282
+ * @param {B64} new_key
1283
1283
  * @returns {EncryptionContext}
1284
1284
  */
1285
- encrypt_cipher_for_rotation(cipher_view, new_key_b64) {
1285
+ encrypt_cipher_for_rotation(cipher_view, new_key) {
1286
1286
  try {
1287
1287
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1288
- const ptr0 = passStringToWasm0(new_key_b64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1289
- const len0 = WASM_VECTOR_LEN;
1290
1288
  wasm.ciphersclient_encrypt_cipher_for_rotation(
1291
1289
  retptr,
1292
1290
  this.__wbg_ptr,
1293
1291
  addHeapObject(cipher_view),
1294
- ptr0,
1295
- len0,
1292
+ addHeapObject(new_key),
1296
1293
  );
1297
1294
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1298
1295
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
@@ -1750,15 +1747,13 @@ class CryptoClient {
1750
1747
  /**
1751
1748
  * Generates a new key pair and encrypts the private key with the provided user key.
1752
1749
  * Crypto initialization not required.
1753
- * @param {string} user_key
1750
+ * @param {B64} user_key
1754
1751
  * @returns {MakeKeyPairResponse}
1755
1752
  */
1756
1753
  make_key_pair(user_key) {
1757
1754
  try {
1758
1755
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1759
- const ptr0 = passStringToWasm0(user_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1760
- const len0 = WASM_VECTOR_LEN;
1761
- wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, ptr0, len0);
1756
+ wasm.cryptoclient_make_key_pair(retptr, this.__wbg_ptr, addHeapObject(user_key));
1762
1757
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1763
1758
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1764
1759
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3910,7 +3905,7 @@ module.exports.__wbg_getTime_46267b1c24877e30 = function (arg0) {
3910
3905
  return ret;
3911
3906
  };
3912
3907
 
3913
- module.exports.__wbg_get_28fd94e3c795ac55 = function () {
3908
+ module.exports.__wbg_get_31aa32a26748ec8a = function () {
3914
3909
  return handleError(function (arg0, arg1, arg2) {
3915
3910
  let deferred0_0;
3916
3911
  let deferred0_1;
@@ -3925,19 +3920,7 @@ module.exports.__wbg_get_28fd94e3c795ac55 = function () {
3925
3920
  }, arguments);
3926
3921
  };
3927
3922
 
3928
- module.exports.__wbg_get_67b2ba62fc30de12 = function () {
3929
- return handleError(function (arg0, arg1) {
3930
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
3931
- return addHeapObject(ret);
3932
- }, arguments);
3933
- };
3934
-
3935
- module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
3936
- const ret = getObject(arg0)[arg1 >>> 0];
3937
- return addHeapObject(ret);
3938
- };
3939
-
3940
- module.exports.__wbg_get_e19b1d8d89e25425 = function () {
3923
+ module.exports.__wbg_get_47834f608c28e2ef = function () {
3941
3924
  return handleError(function (arg0, arg1, arg2) {
3942
3925
  let deferred0_0;
3943
3926
  let deferred0_1;
@@ -3952,7 +3935,19 @@ module.exports.__wbg_get_e19b1d8d89e25425 = function () {
3952
3935
  }, arguments);
3953
3936
  };
3954
3937
 
3955
- module.exports.__wbg_getaccesstoken_706e7fce46c5f9e2 = function (arg0) {
3938
+ module.exports.__wbg_get_67b2ba62fc30de12 = function () {
3939
+ return handleError(function (arg0, arg1) {
3940
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
3941
+ return addHeapObject(ret);
3942
+ }, arguments);
3943
+ };
3944
+
3945
+ module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
3946
+ const ret = getObject(arg0)[arg1 >>> 0];
3947
+ return addHeapObject(ret);
3948
+ };
3949
+
3950
+ module.exports.__wbg_getaccesstoken_4bbc1b6cb72b38e5 = function (arg0) {
3956
3951
  const ret = getObject(arg0).get_access_token();
3957
3952
  return addHeapObject(ret);
3958
3953
  };
@@ -4057,14 +4052,14 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function (arg0) {
4057
4052
  return ret;
4058
4053
  };
4059
4054
 
4060
- module.exports.__wbg_list_61f2f53e9cb47e39 = function () {
4055
+ module.exports.__wbg_list_796c7a27b66bb10d = function () {
4061
4056
  return handleError(function (arg0) {
4062
4057
  const ret = getObject(arg0).list();
4063
4058
  return addHeapObject(ret);
4064
4059
  }, arguments);
4065
4060
  };
4066
4061
 
4067
- module.exports.__wbg_list_c3d163357f39d871 = function () {
4062
+ module.exports.__wbg_list_da710ca964173491 = function () {
4068
4063
  return handleError(function (arg0) {
4069
4064
  const ret = getObject(arg0).list();
4070
4065
  return addHeapObject(ret);
@@ -4246,7 +4241,7 @@ module.exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
4246
4241
  }, arguments);
4247
4242
  };
4248
4243
 
4249
- module.exports.__wbg_remove_c44a619c9a417bbb = function () {
4244
+ module.exports.__wbg_remove_3129bda82100f0a2 = function () {
4250
4245
  return handleError(function (arg0, arg1, arg2) {
4251
4246
  let deferred0_0;
4252
4247
  let deferred0_1;
@@ -4261,7 +4256,7 @@ module.exports.__wbg_remove_c44a619c9a417bbb = function () {
4261
4256
  }, arguments);
4262
4257
  };
4263
4258
 
4264
- module.exports.__wbg_remove_c4df6af35b072be3 = function () {
4259
+ module.exports.__wbg_remove_4975ed78d2562376 = function () {
4265
4260
  return handleError(function (arg0, arg1, arg2) {
4266
4261
  let deferred0_0;
4267
4262
  let deferred0_1;
@@ -4300,7 +4295,19 @@ module.exports.__wbg_setTimeout_ca12ead8b48245e2 = function (arg0, arg1) {
4300
4295
  return addHeapObject(ret);
4301
4296
  };
4302
4297
 
4303
- module.exports.__wbg_set_17f45a030c7e5bcf = function () {
4298
+ module.exports.__wbg_set_37837023f3d740e8 = function (arg0, arg1, arg2) {
4299
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
4300
+ };
4301
+
4302
+ module.exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
4303
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
4304
+ };
4305
+
4306
+ module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
4307
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4308
+ };
4309
+
4310
+ module.exports.__wbg_set_8394acfd3cac67a4 = function () {
4304
4311
  return handleError(function (arg0, arg1, arg2, arg3) {
4305
4312
  let deferred0_0;
4306
4313
  let deferred0_1;
@@ -4315,24 +4322,12 @@ module.exports.__wbg_set_17f45a030c7e5bcf = function () {
4315
4322
  }, arguments);
4316
4323
  };
4317
4324
 
4318
- module.exports.__wbg_set_37837023f3d740e8 = function (arg0, arg1, arg2) {
4319
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
4320
- };
4321
-
4322
- module.exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
4323
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
4324
- };
4325
-
4326
- module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
4327
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4328
- };
4329
-
4330
4325
  module.exports.__wbg_set_8fc6bf8a5b1071d1 = function (arg0, arg1, arg2) {
4331
4326
  const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
4332
4327
  return addHeapObject(ret);
4333
4328
  };
4334
4329
 
4335
- module.exports.__wbg_set_e2ef333ec860913d = function () {
4330
+ module.exports.__wbg_set_9397834d5293a974 = function () {
4336
4331
  return handleError(function (arg0, arg1, arg2, arg3) {
4337
4332
  let deferred0_0;
4338
4333
  let deferred0_1;
@@ -4535,18 +4530,18 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
4535
4530
  return ret;
4536
4531
  };
4537
4532
 
4538
- module.exports.__wbindgen_closure_wrapper3340 = function (arg0, arg1, arg2) {
4539
- const ret = makeMutClosure(arg0, arg1, 275, __wbg_adapter_54);
4533
+ module.exports.__wbindgen_closure_wrapper3336 = function (arg0, arg1, arg2) {
4534
+ const ret = makeMutClosure(arg0, arg1, 276, __wbg_adapter_54);
4540
4535
  return addHeapObject(ret);
4541
4536
  };
4542
4537
 
4543
- module.exports.__wbindgen_closure_wrapper5707 = function (arg0, arg1, arg2) {
4544
- const ret = makeMutClosure(arg0, arg1, 300, __wbg_adapter_54);
4538
+ module.exports.__wbindgen_closure_wrapper5710 = function (arg0, arg1, arg2) {
4539
+ const ret = makeMutClosure(arg0, arg1, 301, __wbg_adapter_54);
4545
4540
  return addHeapObject(ret);
4546
4541
  };
4547
4542
 
4548
- module.exports.__wbindgen_closure_wrapper6061 = function (arg0, arg1, arg2) {
4549
- const ret = makeMutClosure(arg0, arg1, 325, __wbg_adapter_59);
4543
+ module.exports.__wbindgen_closure_wrapper6065 = function (arg0, arg1, arg2) {
4544
+ const ret = makeMutClosure(arg0, arg1, 326, __wbg_adapter_59);
4550
4545
  return addHeapObject(ret);
4551
4546
  };
4552
4547
 
@@ -182,7 +182,7 @@ export const sendaccessclient_request_send_access_token: (
182
182
  export const isCollectionDecryptError: (a: number) => number;
183
183
  export const cryptoclient_initialize_user_crypto: (a: number, b: number) => number;
184
184
  export const cryptoclient_initialize_org_crypto: (a: number, b: number) => number;
185
- export const cryptoclient_make_key_pair: (a: number, b: number, c: number, d: number) => void;
185
+ export const cryptoclient_make_key_pair: (a: number, b: number, c: number) => void;
186
186
  export const cryptoclient_verify_asymmetric_keys: (a: number, b: number, c: number) => void;
187
187
  export const cryptoclient_make_keys_for_user_crypto_v2: (a: number, b: number) => void;
188
188
  export const cryptoclient_get_v2_rotated_account_keys: (a: number, b: number) => void;
@@ -295,7 +295,6 @@ export const ciphersclient_encrypt_cipher_for_rotation: (
295
295
  b: number,
296
296
  c: number,
297
297
  d: number,
298
- e: number,
299
298
  ) => void;
300
299
  export const ciphersclient_decrypt: (a: number, b: number, c: number) => void;
301
300
  export const ciphersclient_decrypt_list: (a: number, b: number, c: number, d: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.268",
3
+ "version": "0.2.0-main.269",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",