@bitwarden/sdk-internal 0.2.0-main.166 → 0.2.0-main.168

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.
@@ -1256,15 +1256,52 @@ export class PureCrypto {
1256
1256
  email: string,
1257
1257
  kdf: Kdf,
1258
1258
  ): string;
1259
- static generate_user_key_aes256_cbc_hmac(): Uint8Array;
1260
- static generate_user_key_xchacha20_poly1305(): Uint8Array;
1259
+ static make_user_key_aes256_cbc_hmac(): Uint8Array;
1260
+ static make_user_key_xchacha20_poly1305(): Uint8Array;
1261
+ /**
1262
+ * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
1263
+ * as an EncString.
1264
+ */
1261
1265
  static wrap_symmetric_key(key_to_be_wrapped: Uint8Array, wrapping_key: Uint8Array): string;
1266
+ /**
1267
+ * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
1268
+ * unwrapped key as a serialized byte array.
1269
+ */
1262
1270
  static unwrap_symmetric_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
1271
+ /**
1272
+ * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
1273
+ * key. Note: Usually, a public key is - by definition - public, so this should not be
1274
+ * used. The specific use-case for this function is to enable rotateable key sets, where
1275
+ * the "public key" is not public, with the intent of preventing the server from being able
1276
+ * to overwrite the user key unlocked by the rotateable keyset.
1277
+ */
1263
1278
  static wrap_encapsulation_key(encapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
1279
+ /**
1280
+ * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
1281
+ * wrapping key.
1282
+ */
1264
1283
  static unwrap_encapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
1284
+ /**
1285
+ * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
1286
+ * key,
1287
+ */
1265
1288
  static wrap_decapsulation_key(decapsulation_key: Uint8Array, wrapping_key: Uint8Array): string;
1289
+ /**
1290
+ * Unwraps (decrypts) a wrapped PKCS8 DER encoded decapsulation (private) key using a symmetric
1291
+ * wrapping key.
1292
+ */
1266
1293
  static unwrap_decapsulation_key(wrapped_key: string, wrapping_key: Uint8Array): Uint8Array;
1294
+ /**
1295
+ * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
1296
+ * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
1297
+ * the sender's authenticity cannot be verified by the recipient.
1298
+ */
1267
1299
  static encapsulate_key_unsigned(shared_key: Uint8Array, encapsulation_key: Uint8Array): string;
1300
+ /**
1301
+ * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
1302
+ * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
1303
+ * recipient.
1304
+ */
1268
1305
  static decapsulate_key_unsigned(
1269
1306
  encapsulated_key: string,
1270
1307
  decapsulation_key: Uint8Array,
@@ -2390,10 +2390,10 @@ class PureCrypto {
2390
2390
  /**
2391
2391
  * @returns {Uint8Array}
2392
2392
  */
2393
- static generate_user_key_aes256_cbc_hmac() {
2393
+ static make_user_key_aes256_cbc_hmac() {
2394
2394
  try {
2395
2395
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2396
- wasm.purecrypto_generate_user_key_aes256_cbc_hmac(retptr);
2396
+ wasm.purecrypto_make_user_key_aes256_cbc_hmac(retptr);
2397
2397
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2398
2398
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2399
2399
  var v1 = getArrayU8FromWasm0(r0, r1).slice();
@@ -2406,10 +2406,10 @@ class PureCrypto {
2406
2406
  /**
2407
2407
  * @returns {Uint8Array}
2408
2408
  */
2409
- static generate_user_key_xchacha20_poly1305() {
2409
+ static make_user_key_xchacha20_poly1305() {
2410
2410
  try {
2411
2411
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2412
- wasm.purecrypto_generate_user_key_xchacha20_poly1305(retptr);
2412
+ wasm.purecrypto_make_user_key_xchacha20_poly1305(retptr);
2413
2413
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2414
2414
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2415
2415
  var v1 = getArrayU8FromWasm0(r0, r1).slice();
@@ -2420,6 +2420,8 @@ class PureCrypto {
2420
2420
  }
2421
2421
  }
2422
2422
  /**
2423
+ * Wraps (encrypts) a symmetric key using a symmetric wrapping key, returning the wrapped key
2424
+ * as an EncString.
2423
2425
  * @param {Uint8Array} key_to_be_wrapped
2424
2426
  * @param {Uint8Array} wrapping_key
2425
2427
  * @returns {string}
@@ -2454,6 +2456,8 @@ class PureCrypto {
2454
2456
  }
2455
2457
  }
2456
2458
  /**
2459
+ * Unwraps (decrypts) a wrapped symmetric key using a symmetric wrapping key, returning the
2460
+ * unwrapped key as a serialized byte array.
2457
2461
  * @param {string} wrapped_key
2458
2462
  * @param {Uint8Array} wrapping_key
2459
2463
  * @returns {Uint8Array}
@@ -2481,6 +2485,11 @@ class PureCrypto {
2481
2485
  }
2482
2486
  }
2483
2487
  /**
2488
+ * Wraps (encrypts) an SPKI DER encoded encapsulation (public) key using a symmetric wrapping
2489
+ * key. Note: Usually, a public key is - by definition - public, so this should not be
2490
+ * used. The specific use-case for this function is to enable rotateable key sets, where
2491
+ * the "public key" is not public, with the intent of preventing the server from being able
2492
+ * to overwrite the user key unlocked by the rotateable keyset.
2484
2493
  * @param {Uint8Array} encapsulation_key
2485
2494
  * @param {Uint8Array} wrapping_key
2486
2495
  * @returns {string}
@@ -2515,6 +2524,8 @@ class PureCrypto {
2515
2524
  }
2516
2525
  }
2517
2526
  /**
2527
+ * Unwraps (decrypts) a wrapped SPKI DER encoded encapsulation (public) key using a symmetric
2528
+ * wrapping key.
2518
2529
  * @param {string} wrapped_key
2519
2530
  * @param {Uint8Array} wrapping_key
2520
2531
  * @returns {Uint8Array}
@@ -2542,6 +2553,8 @@ class PureCrypto {
2542
2553
  }
2543
2554
  }
2544
2555
  /**
2556
+ * Wraps (encrypts) a PKCS8 DER encoded decapsulation (private) key using a symmetric wrapping
2557
+ * key,
2545
2558
  * @param {Uint8Array} decapsulation_key
2546
2559
  * @param {Uint8Array} wrapping_key
2547
2560
  * @returns {string}
@@ -2576,6 +2589,8 @@ class PureCrypto {
2576
2589
  }
2577
2590
  }
2578
2591
  /**
2592
+ * Unwraps (decrypts) a wrapped PKCS8 DER encoded decapsulation (private) key using a symmetric
2593
+ * wrapping key.
2579
2594
  * @param {string} wrapped_key
2580
2595
  * @param {Uint8Array} wrapping_key
2581
2596
  * @returns {Uint8Array}
@@ -2603,6 +2618,9 @@ class PureCrypto {
2603
2618
  }
2604
2619
  }
2605
2620
  /**
2621
+ * Encapsulates (encrypts) a symmetric key using an asymmetric encapsulation key (public key)
2622
+ * in SPKI format, returning the encapsulated key as a string. Note: This is unsigned, so
2623
+ * the sender's authenticity cannot be verified by the recipient.
2606
2624
  * @param {Uint8Array} shared_key
2607
2625
  * @param {Uint8Array} encapsulation_key
2608
2626
  * @returns {string}
@@ -2637,6 +2655,9 @@ class PureCrypto {
2637
2655
  }
2638
2656
  }
2639
2657
  /**
2658
+ * Decapsulates (decrypts) a symmetric key using an decapsulation key (private key) in PKCS8
2659
+ * DER format. Note: This is unsigned, so the sender's authenticity cannot be verified by the
2660
+ * recipient.
2640
2661
  * @param {string} encapsulated_key
2641
2662
  * @param {Uint8Array} decapsulation_key
2642
2663
  * @returns {Uint8Array}
@@ -192,8 +192,8 @@ export const purecrypto_encrypt_user_key_with_master_password: (
192
192
  g: number,
193
193
  h: number,
194
194
  ) => void;
195
- export const purecrypto_generate_user_key_aes256_cbc_hmac: (a: number) => void;
196
- export const purecrypto_generate_user_key_xchacha20_poly1305: (a: number) => void;
195
+ export const purecrypto_make_user_key_aes256_cbc_hmac: (a: number) => void;
196
+ export const purecrypto_make_user_key_xchacha20_poly1305: (a: number) => void;
197
197
  export const purecrypto_wrap_symmetric_key: (
198
198
  a: number,
199
199
  b: number,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.166",
3
+ "version": "0.2.0-main.168",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",