@@ -552,11 +552,15 @@ The algorithms currently supported include:
552
552
* ` 'AES-CBC' `
553
553
* ` 'AES-GCM ` '
554
554
555
- ### ` subtle.deriveBits(algorithm, baseKey, length) `
555
+ ### ` subtle.deriveBits(algorithm, baseKey[ , length] ) `
556
556
557
557
<!-- YAML
558
558
added: v15.0.0
559
559
changes:
560
+ - version: REPLACEME
561
+ pr-url: https://github.com/nodejs/node/pull/53601
562
+ description: The length parameter is now optional for `'ECDH'`, `'X25519'`,
563
+ and `'X448'`.
560
564
- version: v18.4.0
561
565
pr-url: https://github.com/nodejs/node/pull/42507
562
566
description: Added `'X25519'`, and `'X448'` algorithms.
@@ -566,21 +570,21 @@ changes:
566
570
567
571
* ` algorithm ` : {AlgorithmIdentifier|EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params}
568
572
* ` baseKey ` : {CryptoKey}
569
- * ` length ` : {number|null}
570
- * Returns: {Promise} containing {ArrayBuffer}
573
+ * ` length ` : {number|null} ** Default: ** ` null `
574
+ * Returns: {Promise} Fulfills with an {ArrayBuffer}
571
575
572
576
<!-- lint enable maximum-line-length remark-lint-->
573
577
574
578
Using the method and parameters specified in ` algorithm ` and the keying
575
579
material provided by ` baseKey ` , ` subtle.deriveBits() ` attempts to generate
576
580
` length ` bits.
577
581
578
- The Node.js implementation requires that when ` length ` is a
579
- number it must be multiple of ` 8 ` .
582
+ The Node.js implementation requires that ` length ` , when a number, is a multiple
583
+ of ` 8 ` .
580
584
581
- When ` length ` is ` null ` the maximum number of bits for a given algorithm is
582
- generated. This is allowed for the ` 'ECDH' ` , ` 'X25519' ` , and ` 'X448' `
583
- algorithms.
585
+ When ` length ` is not provided or ` null ` the maximum number of bits for a given
586
+ algorithm is generated. This is allowed for the ` 'ECDH' ` , ` 'X25519' ` , and ` 'X448' `
587
+ algorithms, for other algorithms ` length ` is required to be a number .
584
588
585
589
If successful, the returned promise will be resolved with an {ArrayBuffer}
586
590
containing the generated data.
0 commit comments