Skip to main content
X25519 implements RFC 7748 Elliptic Curve Diffie-Hellman key agreement on Montgomery Curve25519 backed by @noble/curves/ed25519.js. All keys and shared secrets are fixed 32-byte Uint8Array values.

Key Exchange Protocol

Quick Start

API Reference

All functions are exported on X25519 and as named exports from @tevm/voltaire/X25519.

Constants

Security Notes

Never use the raw scalarmult output directly as an encryption key, and reject all-zero shared secrets (produced by low-order contributor points). Always derive symmetric keys by passing the shared secret and public keys through a KDF (such as HKDF-SHA256 or BLAKE2b).
  • Constant-time Montgomery ladder: Scalar clamping and ladder operations execute in constant time without secret-dependent branches.
  • Errors: Invalid key lengths throw InvalidSecretKeyError or InvalidPublicKeyError (X25519Error on computation failures).
  • WASM backend: For Zig-compiled WASM execution, import X25519Wasm from @tevm/voltaire/wasm.