Skip to main content
ECDH.prototype.generateKeys - node__crypto.d.ts - Node documentation
method ECDH.prototype.generateKeys

Usage in Deno

```typescript import { ECDH } from "node:node__crypto.d.ts"; ```
ECDH.prototype.generateKeys(): Buffer
Generates private and public EC Diffie-Hellman key values, and returns the public key in the specified `format` and `encoding`. This key should be transferred to the other party. The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified, the point will be returned in`'uncompressed'` format. If `encoding` is provided a string is returned; otherwise a `Buffer` is returned.

Return Type

Buffer
ECDH.prototype.generateKeys(): string

Parameters

optional
format: ECDHKeyFormat

Return Type

string