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

Usage in Deno

```typescript import { ECDH } from "node:node__crypto.d.ts"; ```
ECDH.prototype.setPrivateKey(privateKey: ArrayBufferView): void
Sets the EC Diffie-Hellman private key. If `encoding` is provided, `privateKey` is expected to be a string; otherwise `privateKey` is expected to be a `Buffer`, `TypedArray`, or `DataView`. If `privateKey` is not valid for the curve specified when the `ECDH` object was created, an error is thrown. Upon setting the private key, the associated public point (key) is also generated and set in the `ECDH` object.

Parameters

privateKey: ArrayBufferView

Return Type

void
ECDH.prototype.setPrivateKey(
privateKey: string,
): void

Parameters

privateKey: string

Return Type

void