@bitwarden/sdk-internal 0.2.0-main.236 → 0.2.0-main.237

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.
@@ -1250,7 +1250,12 @@ export interface CipherPermissions {
1250
1250
 
1251
1251
  export interface CipherError extends Error {
1252
1252
  name: "CipherError";
1253
- variant: "MissingFieldError" | "VaultLocked" | "CryptoError" | "AttachmentsWithoutKeys";
1253
+ variant:
1254
+ | "MissingFieldError"
1255
+ | "VaultLocked"
1256
+ | "CryptoError"
1257
+ | "EncryptError"
1258
+ | "AttachmentsWithoutKeys";
1254
1259
  }
1255
1260
 
1256
1261
  export function isCipherError(error: any): error is CipherError;
@@ -1384,6 +1389,19 @@ export class CiphersClient {
1384
1389
  private constructor();
1385
1390
  free(): void;
1386
1391
  encrypt(cipher_view: CipherView): EncryptionContext;
1392
+ /**
1393
+ * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1394
+ * keys in the Web client.
1395
+ *
1396
+ * Until key rotation is fully implemented in the SDK, this method must be provided the new
1397
+ * symmetric key in base64 format. See PM-23084
1398
+ *
1399
+ * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1400
+ * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1401
+ * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1402
+ * key directly.
1403
+ */
1404
+ encrypt_cipher_for_rotation(cipher_view: CipherView, new_key_b64: string): EncryptionContext;
1387
1405
  decrypt(cipher: Cipher): CipherView;
1388
1406
  decrypt_list(ciphers: Cipher[]): CipherListView[];
1389
1407
  /**
@@ -790,7 +790,7 @@ function __wbg_adapter_59(arg0, arg1, arg2) {
790
790
  );
791
791
  }
792
792
 
793
- function __wbg_adapter_303(arg0, arg1, arg2, arg3) {
793
+ function __wbg_adapter_304(arg0, arg1, arg2, arg3) {
794
794
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h54a8613170fef18e(
795
795
  arg0,
796
796
  arg1,
@@ -1254,6 +1254,44 @@ class CiphersClient {
1254
1254
  wasm.__wbindgen_add_to_stack_pointer(16);
1255
1255
  }
1256
1256
  }
1257
+ /**
1258
+ * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1259
+ * keys in the Web client.
1260
+ *
1261
+ * Until key rotation is fully implemented in the SDK, this method must be provided the new
1262
+ * symmetric key in base64 format. See PM-23084
1263
+ *
1264
+ * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1265
+ * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1266
+ * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1267
+ * key directly.
1268
+ * @param {CipherView} cipher_view
1269
+ * @param {string} new_key_b64
1270
+ * @returns {EncryptionContext}
1271
+ */
1272
+ encrypt_cipher_for_rotation(cipher_view, new_key_b64) {
1273
+ try {
1274
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1275
+ const ptr0 = passStringToWasm0(new_key_b64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1276
+ const len0 = WASM_VECTOR_LEN;
1277
+ wasm.ciphersclient_encrypt_cipher_for_rotation(
1278
+ retptr,
1279
+ this.__wbg_ptr,
1280
+ addHeapObject(cipher_view),
1281
+ ptr0,
1282
+ len0,
1283
+ );
1284
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1285
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1286
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1287
+ if (r2) {
1288
+ throw takeObject(r1);
1289
+ }
1290
+ return takeObject(r0);
1291
+ } finally {
1292
+ wasm.__wbindgen_add_to_stack_pointer(16);
1293
+ }
1294
+ }
1257
1295
  /**
1258
1296
  * @param {Cipher} cipher
1259
1297
  * @returns {CipherView}
@@ -3609,7 +3647,7 @@ module.exports.__wbg_getTime_46267b1c24877e30 = function (arg0) {
3609
3647
  return ret;
3610
3648
  };
3611
3649
 
3612
- module.exports.__wbg_get_3a1427c0878724ca = function () {
3650
+ module.exports.__wbg_get_029dab190d7deb0d = function () {
3613
3651
  return handleError(function (arg0, arg1, arg2) {
3614
3652
  let deferred0_0;
3615
3653
  let deferred0_1;
@@ -3624,19 +3662,7 @@ module.exports.__wbg_get_3a1427c0878724ca = function () {
3624
3662
  }, arguments);
3625
3663
  };
3626
3664
 
3627
- module.exports.__wbg_get_67b2ba62fc30de12 = function () {
3628
- return handleError(function (arg0, arg1) {
3629
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
3630
- return addHeapObject(ret);
3631
- }, arguments);
3632
- };
3633
-
3634
- module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
3635
- const ret = getObject(arg0)[arg1 >>> 0];
3636
- return addHeapObject(ret);
3637
- };
3638
-
3639
- module.exports.__wbg_get_d3918b747669680e = function () {
3665
+ module.exports.__wbg_get_2447b2577c5f416b = function () {
3640
3666
  return handleError(function (arg0, arg1, arg2) {
3641
3667
  let deferred0_0;
3642
3668
  let deferred0_1;
@@ -3651,7 +3677,19 @@ module.exports.__wbg_get_d3918b747669680e = function () {
3651
3677
  }, arguments);
3652
3678
  };
3653
3679
 
3654
- module.exports.__wbg_getaccesstoken_368ac8de578928a1 = function (arg0) {
3680
+ module.exports.__wbg_get_67b2ba62fc30de12 = function () {
3681
+ return handleError(function (arg0, arg1) {
3682
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
3683
+ return addHeapObject(ret);
3684
+ }, arguments);
3685
+ };
3686
+
3687
+ module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
3688
+ const ret = getObject(arg0)[arg1 >>> 0];
3689
+ return addHeapObject(ret);
3690
+ };
3691
+
3692
+ module.exports.__wbg_getaccesstoken_097bb4787976f5a6 = function (arg0) {
3655
3693
  const ret = getObject(arg0).get_access_token();
3656
3694
  return addHeapObject(ret);
3657
3695
  };
@@ -3756,14 +3794,14 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function (arg0) {
3756
3794
  return ret;
3757
3795
  };
3758
3796
 
3759
- module.exports.__wbg_list_0bc2f30bffa46b6b = function () {
3797
+ module.exports.__wbg_list_917a775e2518366c = function () {
3760
3798
  return handleError(function (arg0) {
3761
3799
  const ret = getObject(arg0).list();
3762
3800
  return addHeapObject(ret);
3763
3801
  }, arguments);
3764
3802
  };
3765
3803
 
3766
- module.exports.__wbg_list_4281332352a38a9b = function () {
3804
+ module.exports.__wbg_list_96ec1370e888b757 = function () {
3767
3805
  return handleError(function (arg0) {
3768
3806
  const ret = getObject(arg0).list();
3769
3807
  return addHeapObject(ret);
@@ -3798,7 +3836,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function (arg0, arg1) {
3798
3836
  const a = state0.a;
3799
3837
  state0.a = 0;
3800
3838
  try {
3801
- return __wbg_adapter_303(a, state0.b, arg0, arg1);
3839
+ return __wbg_adapter_304(a, state0.b, arg0, arg1);
3802
3840
  } finally {
3803
3841
  state0.a = a;
3804
3842
  }
@@ -3940,7 +3978,7 @@ module.exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
3940
3978
  }, arguments);
3941
3979
  };
3942
3980
 
3943
- module.exports.__wbg_remove_13f511741431214a = function () {
3981
+ module.exports.__wbg_remove_6711a278a02081d9 = function () {
3944
3982
  return handleError(function (arg0, arg1, arg2) {
3945
3983
  let deferred0_0;
3946
3984
  let deferred0_1;
@@ -3955,7 +3993,7 @@ module.exports.__wbg_remove_13f511741431214a = function () {
3955
3993
  }, arguments);
3956
3994
  };
3957
3995
 
3958
- module.exports.__wbg_remove_c8cddb25ca91329c = function () {
3996
+ module.exports.__wbg_remove_a10f49430b91c346 = function () {
3959
3997
  return handleError(function (arg0, arg1, arg2) {
3960
3998
  let deferred0_0;
3961
3999
  let deferred0_1;
@@ -3994,7 +4032,7 @@ module.exports.__wbg_setTimeout_ca12ead8b48245e2 = function (arg0, arg1) {
3994
4032
  return addHeapObject(ret);
3995
4033
  };
3996
4034
 
3997
- module.exports.__wbg_set_0b7a3fe7f70573c5 = function () {
4035
+ module.exports.__wbg_set_28f266b0ff844628 = function () {
3998
4036
  return handleError(function (arg0, arg1, arg2, arg3) {
3999
4037
  let deferred0_0;
4000
4038
  let deferred0_1;
@@ -4021,7 +4059,7 @@ module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
4021
4059
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4022
4060
  };
4023
4061
 
4024
- module.exports.__wbg_set_c3bb1dc8c40a7b27 = function () {
4062
+ module.exports.__wbg_set_9e865f13e7194ab8 = function () {
4025
4063
  return handleError(function (arg0, arg1, arg2, arg3) {
4026
4064
  let deferred0_0;
4027
4065
  let deferred0_1;
@@ -4224,17 +4262,17 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
4224
4262
  return ret;
4225
4263
  };
4226
4264
 
4227
- module.exports.__wbindgen_closure_wrapper3188 = function (arg0, arg1, arg2) {
4265
+ module.exports.__wbindgen_closure_wrapper3189 = function (arg0, arg1, arg2) {
4228
4266
  const ret = makeMutClosure(arg0, arg1, 254, __wbg_adapter_54);
4229
4267
  return addHeapObject(ret);
4230
4268
  };
4231
4269
 
4232
- module.exports.__wbindgen_closure_wrapper5430 = function (arg0, arg1, arg2) {
4270
+ module.exports.__wbindgen_closure_wrapper5440 = function (arg0, arg1, arg2) {
4233
4271
  const ret = makeMutClosure(arg0, arg1, 279, __wbg_adapter_54);
4234
4272
  return addHeapObject(ret);
4235
4273
  };
4236
4274
 
4237
- module.exports.__wbindgen_closure_wrapper5789 = function (arg0, arg1, arg2) {
4275
+ module.exports.__wbindgen_closure_wrapper5799 = function (arg0, arg1, arg2) {
4238
4276
  const ret = makeMutClosure(arg0, arg1, 304, __wbg_adapter_59);
4239
4277
  return addHeapObject(ret);
4240
4278
  };
@@ -289,6 +289,13 @@ export const attachmentsclient_decrypt_buffer: (
289
289
  f: number,
290
290
  ) => void;
291
291
  export const ciphersclient_encrypt: (a: number, b: number, c: number) => void;
292
+ export const ciphersclient_encrypt_cipher_for_rotation: (
293
+ a: number,
294
+ b: number,
295
+ c: number,
296
+ d: number,
297
+ e: number,
298
+ ) => void;
292
299
  export const ciphersclient_decrypt: (a: number, b: number, c: number) => void;
293
300
  export const ciphersclient_decrypt_list: (a: number, b: number, c: number, d: number) => void;
294
301
  export const ciphersclient_decrypt_list_with_failures: (a: number, b: number, c: number) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.236",
3
+ "version": "0.2.0-main.237",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",