Skip to content

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

import { Ed25519 } from 'ox'
 
const { privateKey, publicKey } = Ed25519.createKeyPair()

Signing & Verifying

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

NameDescription
Ed25519.createKeyPairCreates a new Ed25519 key pair consisting of a private key and its corresponding public key.
Ed25519.getPublicKeyComputes the Ed25519 public key from a provided private key.
Ed25519.randomPrivateKeyGenerates a random Ed25519 private key.
Ed25519.signSigns the payload with the provided private key and returns an Ed25519 signature.
Ed25519.verifyVerifies a payload was signed by the provided public key.