# Ed25519.toX25519PublicKey

Converts an Ed25519 public key to an X25519 public 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 x25519PublicKey = Ed25519.toX25519PublicKey({
  publicKey
})
```

## Definition

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

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

## Parameters

### options

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

The options.

#### options.as

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

Format of the returned public key.

#### options.publicKey

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

Ed25519 public key to convert.

## Return Type

The X25519 public key.

`toX25519PublicKey.ReturnType<as>`
