# Ed25519.toX25519PrivateKey

Converts an Ed25519 private key to an X25519 private key.

This is useful for performing X25519 Diffie-Hellman key exchange using an Ed25519 signing key pair.

## Imports

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

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

## Examples

```ts twoslash
import { Ed25519, X25519 } from 'ox'

const { privateKey, publicKey } = Ed25519.createKeyPair()

const x25519PrivateKey = Ed25519.toX25519PrivateKey({
  privateKey
})
```

## Definition

```ts
function toX25519PrivateKey<as>(
  options: toX25519PrivateKey.Options<as>,
): toX25519PrivateKey.ReturnType<as>
```

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

## Parameters

### options

* **Type:** `toX25519PrivateKey.Options<as>`

The options.

#### options.as

* **Type:** `"Bytes" | "Hex" | as`
* **Optional**

Format of the returned private key.

#### options.privateKey

* **Type:** `0x${string} | Uint8Array`

Ed25519 private key to convert.

## Return Type

The X25519 private key.

`toX25519PrivateKey.ReturnType<as>`
