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

