diff options
author | Rich Trott <rtrott@gmail.com> | 2021-02-13 17:23:24 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2021-02-16 17:16:15 +0300 |
commit | 1e99175e0135eed64221219a0366c5667522d5de (patch) | |
tree | f751ded5a98cb07c8572caf37880ff0c41dee596 /doc | |
parent | 392c86d38b53c6f958dcd11ffa8dd14d0e721127 (diff) |
doc: alphabetize crypto.* methods
The list of methods on the `crypto` object is almost in alphabetical
order but not quite. This change alphabetizes the methods.
PR-URL: https://github.com/nodejs/node/pull/37353
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/crypto.md | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 7cd2dd26f2c..701e9766704 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -2622,31 +2622,6 @@ generateKey('hmac', { length: 64 }, (err, key) => { }); ``` -### `crypto.generateKeySync(type, options)` -<!-- YAML -added: v15.0.0 ---> - -* `type`: {string} The intended use of the generated secret key. Currently - accepted values are `'hmac'` and `'aes'`. -* `options`: {Object} - * `length`: {number} The bit length of the key to generate. - * If `type` is `'hmac'`, the minimum is 1, and the maximum length is - 2<sup>31</sup>-1. If the value is not a multiple of 8, the generated - key will be truncated to `Math.floor(length / 8)`. - * If `type` is `'aes'`, the length must be one of `128`, `192`, or `256`. -* Returns: {KeyObject} - -Synchronously generates a new random secret key of the given `length`. The -`type` will determine which validations will be performed on the `length`. - -```js -const { generateKeySync } = require('crypto'); - -const key = generateKeySync('hmac', 64); -console.log(key.export().toString('hex')); // e89..........41e -``` - ### `crypto.generateKeyPair(type, options, callback)` <!-- YAML added: v10.12.0 @@ -2790,6 +2765,31 @@ The return value `{ publicKey, privateKey }` represents the generated key pair. When PEM encoding was selected, the respective key will be a string, otherwise it will be a buffer containing the data encoded as DER. +### `crypto.generateKeySync(type, options)` +<!-- YAML +added: v15.0.0 +--> + +* `type`: {string} The intended use of the generated secret key. Currently + accepted values are `'hmac'` and `'aes'`. +* `options`: {Object} + * `length`: {number} The bit length of the key to generate. + * If `type` is `'hmac'`, the minimum is 1, and the maximum length is + 2<sup>31</sup>-1. If the value is not a multiple of 8, the generated + key will be truncated to `Math.floor(length / 8)`. + * If `type` is `'aes'`, the length must be one of `128`, `192`, or `256`. +* Returns: {KeyObject} + +Synchronously generates a new random secret key of the given `length`. The +`type` will determine which validations will be performed on the `length`. + +```js +const { generateKeySync } = require('crypto'); + +const key = generateKeySync('hmac', 64); +console.log(key.export().toString('hex')); // e89..........41e +``` + ### `crypto.generatePrime(size[, options[, callback]])` <!-- YAML added: v15.8.0 @@ -2872,19 +2872,6 @@ By default, the prime is encoded as a big-endian sequence of octets in an {ArrayBuffer}. If the `bigint` option is `true`, then a {bigint} is provided. -### `crypto.getCiphers()` -<!-- YAML -added: v0.9.3 ---> - -* Returns: {string[]} An array with the names of the supported cipher - algorithms. - -```js -const ciphers = crypto.getCiphers(); -console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] -``` - ### `crypto.getCipherInfo(nameOrNid[, options])` <!-- YAML added: v15.0.0 @@ -2914,6 +2901,19 @@ ciphers. To test if a given key length or iv length is acceptable for given cipher, use the `keyLenth` and `ivLenth` options. If the given values are unacceptable, `undefined` will be returned. +### `crypto.getCiphers()` +<!-- YAML +added: v0.9.3 +--> + +* Returns: {string[]} An array with the names of the supported cipher + algorithms. + +```js +const ciphers = crypto.getCiphers(); +console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] +``` + ### `crypto.getCurves()` <!-- YAML added: v2.3.0 |