@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.
package/VERSION CHANGED
@@ -1 +1 @@
1
- e6b15dc49f77c2cecd54dd96a7b852aacdbf0878
1
+ a3eb9182f12040c1e5be96ef268fde07160f1fe0
@@ -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
  /**
@@ -796,7 +796,7 @@ function __wbg_adapter_59(arg0, arg1, arg2) {
796
796
  );
797
797
  }
798
798
 
799
- function __wbg_adapter_303(arg0, arg1, arg2, arg3) {
799
+ function __wbg_adapter_304(arg0, arg1, arg2, arg3) {
800
800
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h54a8613170fef18e(
801
801
  arg0,
802
802
  arg1,
@@ -1257,6 +1257,44 @@ export class CiphersClient {
1257
1257
  wasm.__wbindgen_add_to_stack_pointer(16);
1258
1258
  }
1259
1259
  }
1260
+ /**
1261
+ * Encrypt a cipher with the provided key. This should only be used when rotating encryption
1262
+ * keys in the Web client.
1263
+ *
1264
+ * Until key rotation is fully implemented in the SDK, this method must be provided the new
1265
+ * symmetric key in base64 format. See PM-23084
1266
+ *
1267
+ * If the cipher has a CipherKey, it will be re-encrypted with the new key.
1268
+ * If the cipher does not have a CipherKey and CipherKeyEncryption is enabled, one will be
1269
+ * generated using the new key. Otherwise, the cipher's data will be encrypted with the new
1270
+ * key directly.
1271
+ * @param {CipherView} cipher_view
1272
+ * @param {string} new_key_b64
1273
+ * @returns {EncryptionContext}
1274
+ */
1275
+ encrypt_cipher_for_rotation(cipher_view, new_key_b64) {
1276
+ try {
1277
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1278
+ const ptr0 = passStringToWasm0(new_key_b64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1279
+ const len0 = WASM_VECTOR_LEN;
1280
+ wasm.ciphersclient_encrypt_cipher_for_rotation(
1281
+ retptr,
1282
+ this.__wbg_ptr,
1283
+ addHeapObject(cipher_view),
1284
+ ptr0,
1285
+ len0,
1286
+ );
1287
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1288
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1289
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1290
+ if (r2) {
1291
+ throw takeObject(r1);
1292
+ }
1293
+ return takeObject(r0);
1294
+ } finally {
1295
+ wasm.__wbindgen_add_to_stack_pointer(16);
1296
+ }
1297
+ }
1260
1298
  /**
1261
1299
  * @param {Cipher} cipher
1262
1300
  * @returns {CipherView}
@@ -3596,7 +3634,7 @@ export function __wbg_getTime_46267b1c24877e30(arg0) {
3596
3634
  return ret;
3597
3635
  }
3598
3636
 
3599
- export function __wbg_get_3a1427c0878724ca() {
3637
+ export function __wbg_get_029dab190d7deb0d() {
3600
3638
  return handleError(function (arg0, arg1, arg2) {
3601
3639
  let deferred0_0;
3602
3640
  let deferred0_1;
@@ -3611,19 +3649,7 @@ export function __wbg_get_3a1427c0878724ca() {
3611
3649
  }, arguments);
3612
3650
  }
3613
3651
 
3614
- export function __wbg_get_67b2ba62fc30de12() {
3615
- return handleError(function (arg0, arg1) {
3616
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
3617
- return addHeapObject(ret);
3618
- }, arguments);
3619
- }
3620
-
3621
- export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
3622
- const ret = getObject(arg0)[arg1 >>> 0];
3623
- return addHeapObject(ret);
3624
- }
3625
-
3626
- export function __wbg_get_d3918b747669680e() {
3652
+ export function __wbg_get_2447b2577c5f416b() {
3627
3653
  return handleError(function (arg0, arg1, arg2) {
3628
3654
  let deferred0_0;
3629
3655
  let deferred0_1;
@@ -3638,7 +3664,19 @@ export function __wbg_get_d3918b747669680e() {
3638
3664
  }, arguments);
3639
3665
  }
3640
3666
 
3641
- export function __wbg_getaccesstoken_368ac8de578928a1(arg0) {
3667
+ export function __wbg_get_67b2ba62fc30de12() {
3668
+ return handleError(function (arg0, arg1) {
3669
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
3670
+ return addHeapObject(ret);
3671
+ }, arguments);
3672
+ }
3673
+
3674
+ export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
3675
+ const ret = getObject(arg0)[arg1 >>> 0];
3676
+ return addHeapObject(ret);
3677
+ }
3678
+
3679
+ export function __wbg_getaccesstoken_097bb4787976f5a6(arg0) {
3642
3680
  const ret = getObject(arg0).get_access_token();
3643
3681
  return addHeapObject(ret);
3644
3682
  }
@@ -3743,14 +3781,14 @@ export function __wbg_length_e2d2a49132c1b256(arg0) {
3743
3781
  return ret;
3744
3782
  }
3745
3783
 
3746
- export function __wbg_list_0bc2f30bffa46b6b() {
3784
+ export function __wbg_list_917a775e2518366c() {
3747
3785
  return handleError(function (arg0) {
3748
3786
  const ret = getObject(arg0).list();
3749
3787
  return addHeapObject(ret);
3750
3788
  }, arguments);
3751
3789
  }
3752
3790
 
3753
- export function __wbg_list_4281332352a38a9b() {
3791
+ export function __wbg_list_96ec1370e888b757() {
3754
3792
  return handleError(function (arg0) {
3755
3793
  const ret = getObject(arg0).list();
3756
3794
  return addHeapObject(ret);
@@ -3785,7 +3823,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
3785
3823
  const a = state0.a;
3786
3824
  state0.a = 0;
3787
3825
  try {
3788
- return __wbg_adapter_303(a, state0.b, arg0, arg1);
3826
+ return __wbg_adapter_304(a, state0.b, arg0, arg1);
3789
3827
  } finally {
3790
3828
  state0.a = a;
3791
3829
  }
@@ -3927,7 +3965,7 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
3927
3965
  }, arguments);
3928
3966
  }
3929
3967
 
3930
- export function __wbg_remove_13f511741431214a() {
3968
+ export function __wbg_remove_6711a278a02081d9() {
3931
3969
  return handleError(function (arg0, arg1, arg2) {
3932
3970
  let deferred0_0;
3933
3971
  let deferred0_1;
@@ -3942,7 +3980,7 @@ export function __wbg_remove_13f511741431214a() {
3942
3980
  }, arguments);
3943
3981
  }
3944
3982
 
3945
- export function __wbg_remove_c8cddb25ca91329c() {
3983
+ export function __wbg_remove_a10f49430b91c346() {
3946
3984
  return handleError(function (arg0, arg1, arg2) {
3947
3985
  let deferred0_0;
3948
3986
  let deferred0_1;
@@ -3981,7 +4019,7 @@ export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
3981
4019
  return addHeapObject(ret);
3982
4020
  }
3983
4021
 
3984
- export function __wbg_set_0b7a3fe7f70573c5() {
4022
+ export function __wbg_set_28f266b0ff844628() {
3985
4023
  return handleError(function (arg0, arg1, arg2, arg3) {
3986
4024
  let deferred0_0;
3987
4025
  let deferred0_1;
@@ -4008,7 +4046,7 @@ export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
4008
4046
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
4009
4047
  }
4010
4048
 
4011
- export function __wbg_set_c3bb1dc8c40a7b27() {
4049
+ export function __wbg_set_9e865f13e7194ab8() {
4012
4050
  return handleError(function (arg0, arg1, arg2, arg3) {
4013
4051
  let deferred0_0;
4014
4052
  let deferred0_1;
@@ -4211,17 +4249,17 @@ export function __wbindgen_cb_drop(arg0) {
4211
4249
  return ret;
4212
4250
  }
4213
4251
 
4214
- export function __wbindgen_closure_wrapper3188(arg0, arg1, arg2) {
4252
+ export function __wbindgen_closure_wrapper3189(arg0, arg1, arg2) {
4215
4253
  const ret = makeMutClosure(arg0, arg1, 254, __wbg_adapter_54);
4216
4254
  return addHeapObject(ret);
4217
4255
  }
4218
4256
 
4219
- export function __wbindgen_closure_wrapper5430(arg0, arg1, arg2) {
4257
+ export function __wbindgen_closure_wrapper5440(arg0, arg1, arg2) {
4220
4258
  const ret = makeMutClosure(arg0, arg1, 279, __wbg_adapter_54);
4221
4259
  return addHeapObject(ret);
4222
4260
  }
4223
4261
 
4224
- export function __wbindgen_closure_wrapper5789(arg0, arg1, arg2) {
4262
+ export function __wbindgen_closure_wrapper5799(arg0, arg1, arg2) {
4225
4263
  const ret = makeMutClosure(arg0, arg1, 304, __wbg_adapter_59);
4226
4264
  return addHeapObject(ret);
4227
4265
  }
Binary file
@@ -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;