Skip to content

Commit

Permalink
doc: alphabetize crypto.* methods
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
Trott authored and danielleadams committed Feb 16, 2021
1 parent 392c86d commit 1e99175
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1e99175

Please sign in to comment.