Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: alphabetize crypto.* methods #37353

Merged
merged 1 commit into from
Feb 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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