doc: improve ECDH example
PR-URL: https://github.com/nodejs/node/pull/22607 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
1f679107cc
commit
64cf96d684
@ -703,9 +703,9 @@ If the `inputEncoding` is not provided, `key` is expected to be a [`Buffer`][],
|
||||
Example (uncompressing a key):
|
||||
|
||||
```js
|
||||
const { ECDH } = require('crypto');
|
||||
const { createECDH, ECDH } = require('crypto');
|
||||
|
||||
const ecdh = ECDH('secp256k1');
|
||||
const ecdh = createECDH('secp256k1');
|
||||
ecdh.generateKeys();
|
||||
|
||||
const compressedKey = ecdh.getPublicKey('hex', 'compressed');
|
||||
|
Loading…
x
Reference in New Issue
Block a user