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
Named
import { Ed25519 } from 'ox'Examples
import { Ed25519, X25519 } from 'ox'
const { privateKey, publicKey } = Ed25519.createKeyPair()
const x25519PrivateKey = Ed25519.toX25519PrivateKey({ privateKey })Definition
function toX25519PrivateKey<as>(
options: toX25519PrivateKey.Options<as>,
): toX25519PrivateKey.ReturnType<as>Source: src/core/Ed25519.ts
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>

