# Ed25519

Utilities for working with Ed25519 signatures and key pairs.

Ed25519 is a modern elliptic curve signature scheme that provides strong security
guarantees and high performance. It is widely used in various cryptographic applications.

## Examples

Below are some examples demonstrating common usages of the `Ed25519` module:

* [Creating Key Pairs](#creating-key-pairs)

* [Signing & Verifying](#signing-&-verifying)

### Creating Key Pairs

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

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

### Signing & Verifying

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

const { privateKey, publicKey } = Ed25519.createKeyPair()
const payload = '0xdeadbeef'

const signature = Ed25519.sign({ payload, privateKey })
const isValid = Ed25519.verify({
  payload,
  publicKey,
  signature
})
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`Ed25519.createKeyPair`](/api/Ed25519/createKeyPair) | Creates a new Ed25519 key pair consisting of a private key and its corresponding public key. |
| [`Ed25519.getPublicKey`](/api/Ed25519/getPublicKey) | Computes the Ed25519 public key from a provided private key. |
| [`Ed25519.randomPrivateKey`](/api/Ed25519/randomPrivateKey) | Generates a random Ed25519 private key. |
| [`Ed25519.sign`](/api/Ed25519/sign) | Signs the payload with the provided private key and returns an Ed25519 signature. |
| [`Ed25519.toX25519PrivateKey`](/api/Ed25519/toX25519PrivateKey) | Converts an Ed25519 private key to an X25519 private key. |
| [`Ed25519.toX25519PublicKey`](/api/Ed25519/toX25519PublicKey) | Converts an Ed25519 public key to an X25519 public key. |
| [`Ed25519.verify`](/api/Ed25519/verify) | Verifies a payload was signed by the provided public key. |
