From 70f55020d3eea9e42f615d63ead86b1c8a0a36c4 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Mon, 3 Oct 2022 13:35:35 +0200 Subject: [PATCH] doc,crypto: add null length to crypto.subtle.deriveBits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/44876 Reviewed-By: Tobias Nießen Reviewed-By: Luigi Pinca --- doc/api/webcrypto.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/api/webcrypto.md b/doc/api/webcrypto.md index 3a91d0d5e1c63a..892e285c9b7777 100644 --- a/doc/api/webcrypto.md +++ b/doc/api/webcrypto.md @@ -562,16 +562,24 @@ changes: * `algorithm`: {AlgorithmIdentifier|EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params} * `baseKey`: {CryptoKey} -* `length`: {number} +* `length`: {number|null} * Returns: {Promise} containing {ArrayBuffer} Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`, `subtle.deriveBits()` attempts to generate -`length` bits. The Node.js implementation requires that `length` is a -multiple of `8`. If successful, the returned promise will be resolved with -an {ArrayBuffer} containing the generated data. +`length` bits. + +The Node.js implementation requires that when `length` is a +number it must be multiple of `8`. + +When `length` is `null` the maximum number of bits for a given algorithm is +generated. This is allowed for the `'ECDH'`, `'X25519'`[^1], and `'X448'`[^1] +algorithms. + +If successful, the returned promise will be resolved with an {ArrayBuffer} +containing the generated data. The algorithms currently supported include: