Skip to content

Commit

Permalink
doc,crypto: add null length to crypto.subtle.deriveBits
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Oct 3, 2022
1 parent f4815fc commit 23c48ec
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions doc/api/webcrypto.md
Expand Up @@ -575,16 +575,24 @@ changes:

* `algorithm`: {AlgorithmIdentifier|EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params}
* `baseKey`: {CryptoKey}
* `length`: {number}
* `length`: {number|null}
* Returns: {Promise} containing {ArrayBuffer}

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

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:

Expand Down

0 comments on commit 23c48ec

Please sign in to comment.