@bitwarden/sdk-internal 0.2.0-main.235 → 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_0cadee1906808c79 = 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,7 +3662,7 @@ module.exports.__wbg_get_0cadee1906808c79 = function () {
3624
3662
  }, arguments);
3625
3663
  };
3626
3664
 
3627
- module.exports.__wbg_get_4b0b3ed275354e7d = function () {
3665
+ module.exports.__wbg_get_2447b2577c5f416b = function () {
3628
3666
  return handleError(function (arg0, arg1, arg2) {
3629
3667
  let deferred0_0;
3630
3668
  let deferred0_1;
@@ -3651,7 +3689,7 @@ module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
3651
3689
  return addHeapObject(ret);
3652
3690
  };
3653
3691
 
3654
- module.exports.__wbg_getaccesstoken_b58303a84b075766 = function (arg0) {
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_348eff73734ce88a = 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_5b39b27accd04294 = 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_91cfed2de422d072 = 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_91cfed2de422d072 = function () {
3955
3993
  }, arguments);
3956
3994
  };
3957
3995
 
3958
- module.exports.__wbg_remove_c38e3a2bdb1b4a41 = 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_240df6b209d9fff7 = 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;
@@ -4009,7 +4047,19 @@ module.exports.__wbg_set_240df6b209d9fff7 = function () {
4009
4047
  }, arguments);
4010
4048
  };
4011
4049
 
4012
- module.exports.__wbg_set_371c14d6e3b20a42 = function () {
4050
+ module.exports.__wbg_set_37837023f3d740e8 = function (arg0, arg1, arg2) {
4051
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
4052
+ };
4053
+
4054
+ module.exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
4055
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
4056
+ };
4057
+
4058
+ module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
4059
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4060
+ };
4061
+
4062
+ module.exports.__wbg_set_9e865f13e7194ab8 = function () {
4013
4063
  return handleError(function (arg0, arg1, arg2, arg3) {
4014
4064
  let deferred0_0;
4015
4065
  let deferred0_1;
@@ -4024,18 +4074,6 @@ module.exports.__wbg_set_371c14d6e3b20a42 = function () {
4024
4074
  }, arguments);
4025
4075
  };
4026
4076
 
4027
- module.exports.__wbg_set_37837023f3d740e8 = function (arg0, arg1, arg2) {
4028
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
4029
- };
4030
-
4031
- module.exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
4032
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
4033
- };
4034
-
4035
- module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
4036
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4037
- };
4038
-
4039
4077
  module.exports.__wbg_setbody_5923b78a95eedf29 = function (arg0, arg1) {
4040
4078
  getObject(arg0).body = getObject(arg1);
4041
4079
  };
@@ -4224,18 +4262,18 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
4224
4262
  return ret;
4225
4263
  };
4226
4264
 
4227
- module.exports.__wbindgen_closure_wrapper3227 = function (arg0, arg1, arg2) {
4228
- const ret = makeMutClosure(arg0, arg1, 221, __wbg_adapter_54);
4265
+ module.exports.__wbindgen_closure_wrapper3189 = function (arg0, arg1, arg2) {
4266
+ const ret = makeMutClosure(arg0, arg1, 254, __wbg_adapter_54);
4229
4267
  return addHeapObject(ret);
4230
4268
  };
4231
4269
 
4232
- module.exports.__wbindgen_closure_wrapper5409 = function (arg0, arg1, arg2) {
4233
- const ret = makeMutClosure(arg0, arg1, 246, __wbg_adapter_54);
4270
+ module.exports.__wbindgen_closure_wrapper5440 = function (arg0, arg1, arg2) {
4271
+ const ret = makeMutClosure(arg0, arg1, 279, __wbg_adapter_54);
4234
4272
  return addHeapObject(ret);
4235
4273
  };
4236
4274
 
4237
- module.exports.__wbindgen_closure_wrapper5768 = function (arg0, arg1, arg2) {
4238
- const ret = makeMutClosure(arg0, arg1, 272, __wbg_adapter_59);
4275
+ module.exports.__wbindgen_closure_wrapper5799 = function (arg0, arg1, arg2) {
4276
+ const ret = makeMutClosure(arg0, arg1, 304, __wbg_adapter_59);
4239
4277
  return addHeapObject(ret);
4240
4278
  };
4241
4279
 
@@ -219,6 +219,7 @@ export const exporterclient_export_cxf: (
219
219
  ) => void;
220
220
  export const exporterclient_import_cxf: (a: number, b: number, c: number, d: number) => void;
221
221
  export const isExportError: (a: number) => number;
222
+ export const __wbg_generatorclient_free: (a: number, b: number) => void;
222
223
  export const generatorclient_password: (a: number, b: number, c: number) => void;
223
224
  export const generatorclient_passphrase: (a: number, b: number, c: number) => void;
224
225
  export const isUsernameError: (a: number) => number;
@@ -288,6 +289,13 @@ export const attachmentsclient_decrypt_buffer: (
288
289
  f: number,
289
290
  ) => void;
290
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;
291
299
  export const ciphersclient_decrypt: (a: number, b: number, c: number) => void;
292
300
  export const ciphersclient_decrypt_list: (a: number, b: number, c: number, d: number) => void;
293
301
  export const ciphersclient_decrypt_list_with_failures: (a: number, b: number, c: number) => number;
@@ -351,7 +359,6 @@ export const __wbg_totpclient_free: (a: number, b: number) => void;
351
359
  export const __wbg_get_outgoingmessage_destination: (a: number) => number;
352
360
  export const __wbg_set_outgoingmessage_destination: (a: number, b: number) => void;
353
361
  export const __wbg_cryptoclient_free: (a: number, b: number) => void;
354
- export const __wbg_generatorclient_free: (a: number, b: number) => void;
355
362
  export const __wbindgen_malloc: (a: number, b: number) => number;
356
363
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
357
364
  export const __wbindgen_exn_store: (a: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.235",
3
+ "version": "0.2.0-main.237",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",