# WebCryptoP256.createKeyPairECDH

Generates an ECDH P256 key pair for key agreement that includes:

* a `privateKey` of type [`CryptoKey`](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) - a `publicKey` of type [`PublicKey.PublicKey`](/api/PublicKey/types#publickey)

## Imports

:::code-group
```ts [Named]
import { WebCryptoP256 } from 'ox'
```

```ts [Entrypoint]
import * as WebCryptoP256 from 'ox/WebCryptoP256'
```
:::

## Examples

```ts twoslash
import { WebCryptoP256 } from 'ox'

const { publicKey, privateKey } =
  await WebCryptoP256.createKeyPairECDH()
// @log: {
// @log:   privateKey: CryptoKey {},
// @log:   publicKey: {
// @log:     x: '0x8318535b54105d4a7aae60c08fc45f9687181b4fdfc625bd1a753fa7397fed75',
// @log:     y: '0x3547f11ca8696646f2f3acb08e31016afac23e630c5d11f59f61fef57b0d2aa5',
// @log:     prefix: 4,
// @log:   },
// @log: }
```

## Definition

```ts
function createKeyPairECDH(
  options?: createKeyPairECDH.Options,
): Promise<createKeyPairECDH.ReturnType>
```

**Source:** [src/core/WebCryptoP256.ts](https://github.com/wevm/ox/blob/main/src/core/WebCryptoP256.ts#L389)

## Parameters

### options

* **Type:** `createKeyPairECDH.Options`
* **Optional**

Options for creating the key pair.

#### options.extractable

* **Type:** `boolean`
* **Optional**

A boolean value indicating whether it will be possible to export the private key using `globalThis.crypto.subtle.exportKey()`.

## Return Type

The key pair.

`Promise<createKeyPairECDH.ReturnType>`
