Skip to content

Commit 1e99175

Browse files
Trottdanielleadams
authored andcommitted
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: #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>
1 parent 392c86d commit 1e99175

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

doc/api/crypto.md

+38-38
Original file line numberDiff line numberDiff line change
@@ -2622,31 +2622,6 @@ generateKey('hmac', { length: 64 }, (err, key) => {
26222622
});
26232623
```
26242624

2625-
### `crypto.generateKeySync(type, options)`
2626-
<!-- YAML
2627-
added: v15.0.0
2628-
-->
2629-
2630-
* `type`: {string} The intended use of the generated secret key. Currently
2631-
accepted values are `'hmac'` and `'aes'`.
2632-
* `options`: {Object}
2633-
* `length`: {number} The bit length of the key to generate.
2634-
* If `type` is `'hmac'`, the minimum is 1, and the maximum length is
2635-
2<sup>31</sup>-1. If the value is not a multiple of 8, the generated
2636-
key will be truncated to `Math.floor(length / 8)`.
2637-
* If `type` is `'aes'`, the length must be one of `128`, `192`, or `256`.
2638-
* Returns: {KeyObject}
2639-
2640-
Synchronously generates a new random secret key of the given `length`. The
2641-
`type` will determine which validations will be performed on the `length`.
2642-
2643-
```js
2644-
const { generateKeySync } = require('crypto');
2645-
2646-
const key = generateKeySync('hmac', 64);
2647-
console.log(key.export().toString('hex')); // e89..........41e
2648-
```
2649-
26502625
### `crypto.generateKeyPair(type, options, callback)`
26512626
<!-- YAML
26522627
added: v10.12.0
@@ -2790,6 +2765,31 @@ The return value `{ publicKey, privateKey }` represents the generated key pair.
27902765
When PEM encoding was selected, the respective key will be a string, otherwise
27912766
it will be a buffer containing the data encoded as DER.
27922767

2768+
### `crypto.generateKeySync(type, options)`
2769+
<!-- YAML
2770+
added: v15.0.0
2771+
-->
2772+
2773+
* `type`: {string} The intended use of the generated secret key. Currently
2774+
accepted values are `'hmac'` and `'aes'`.
2775+
* `options`: {Object}
2776+
* `length`: {number} The bit length of the key to generate.
2777+
* If `type` is `'hmac'`, the minimum is 1, and the maximum length is
2778+
2<sup>31</sup>-1. If the value is not a multiple of 8, the generated
2779+
key will be truncated to `Math.floor(length / 8)`.
2780+
* If `type` is `'aes'`, the length must be one of `128`, `192`, or `256`.
2781+
* Returns: {KeyObject}
2782+
2783+
Synchronously generates a new random secret key of the given `length`. The
2784+
`type` will determine which validations will be performed on the `length`.
2785+
2786+
```js
2787+
const { generateKeySync } = require('crypto');
2788+
2789+
const key = generateKeySync('hmac', 64);
2790+
console.log(key.export().toString('hex')); // e89..........41e
2791+
```
2792+
27932793
### `crypto.generatePrime(size[, options[, callback]])`
27942794
<!-- YAML
27952795
added: v15.8.0
@@ -2872,19 +2872,6 @@ By default, the prime is encoded as a big-endian sequence of octets
28722872
in an {ArrayBuffer}. If the `bigint` option is `true`, then a {bigint}
28732873
is provided.
28742874

2875-
### `crypto.getCiphers()`
2876-
<!-- YAML
2877-
added: v0.9.3
2878-
-->
2879-
2880-
* Returns: {string[]} An array with the names of the supported cipher
2881-
algorithms.
2882-
2883-
```js
2884-
const ciphers = crypto.getCiphers();
2885-
console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...]
2886-
```
2887-
28882875
### `crypto.getCipherInfo(nameOrNid[, options])`
28892876
<!-- YAML
28902877
added: v15.0.0
@@ -2914,6 +2901,19 @@ ciphers. To test if a given key length or iv length is acceptable for given
29142901
cipher, use the `keyLenth` and `ivLenth` options. If the given values are
29152902
unacceptable, `undefined` will be returned.
29162903

2904+
### `crypto.getCiphers()`
2905+
<!-- YAML
2906+
added: v0.9.3
2907+
-->
2908+
2909+
* Returns: {string[]} An array with the names of the supported cipher
2910+
algorithms.
2911+
2912+
```js
2913+
const ciphers = crypto.getCiphers();
2914+
console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...]
2915+
```
2916+
29172917
### `crypto.getCurves()`
29182918
<!-- YAML
29192919
added: v2.3.0

0 commit comments

Comments
 (0)