Skip to content

Commit 70f5502

Browse files
panvadanielleadams
authored andcommitted
doc,crypto: add null length to crypto.subtle.deriveBits
PR-URL: #44876 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent daf3152 commit 70f5502

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

doc/api/webcrypto.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -562,16 +562,24 @@ changes:
562562

563563
* `algorithm`: {AlgorithmIdentifier|EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params}
564564
* `baseKey`: {CryptoKey}
565-
* `length`: {number}
565+
* `length`: {number|null}
566566
* Returns: {Promise} containing {ArrayBuffer}
567567

568568
<!--lint enable maximum-line-length remark-lint-->
569569

570570
Using the method and parameters specified in `algorithm` and the keying
571571
material provided by `baseKey`, `subtle.deriveBits()` attempts to generate
572-
`length` bits. The Node.js implementation requires that `length` is a
573-
multiple of `8`. If successful, the returned promise will be resolved with
574-
an {ArrayBuffer} containing the generated data.
572+
`length` bits.
573+
574+
The Node.js implementation requires that when `length` is a
575+
number it must be multiple of `8`.
576+
577+
When `length` is `null` the maximum number of bits for a given algorithm is
578+
generated. This is allowed for the `'ECDH'`, `'X25519'`[^1], and `'X448'`[^1]
579+
algorithms.
580+
581+
If successful, the returned promise will be resolved with an {ArrayBuffer}
582+
containing the generated data.
575583

576584
The algorithms currently supported include:
577585

0 commit comments

Comments
 (0)