Ed448 signatures and X448 key agreement for browsers, Bun, Deno and Node.js, compiled to WebAssembly from the RustCrypto ed448-goldilocks and x448 crates.
Curve448 gives about 224 bits of classical security, compared with about 128 for Curve25519. WebCrypto has no Ed448 or X448 in most browsers, so this package fills the gap. It is used for OpenPGP keys (RFC 9580) and the post-quantum hybrids of RFC 9980 (ML-DSA-87 + Ed448 and ML-KEM-1024 + X448).
Like every elliptic curve, Curve448 is not safe against quantum computers. For long-term security, pair it with ML-DSA or ML-KEM.
npm i @rabbit-company/curve448import { Ed448, X448 } from "@rabbit-company/curve448";
const signer = await Ed448.generateKeyPair();
const signature = await Ed448.sign("4d7f2a9c1e8b", signer.secretKey);
const valid = await Ed448.verify(signature, "4d7f2a9c1e8b", signer.publicKey);
const alice = await X448.generateKeyPair();
const bob = await X448.generateKeyPair();
const fromAlice = await X448.sharedSecret(alice.secretKey, bob.publicKey);
const fromBob = await X448.sharedSecret(bob.secretKey, alice.publicKey); // the same secret| Algorithm | Secret key | Public key | Output |
|---|---|---|---|
Ed448 |
57 bytes | 57 bytes | 114 byte signature |
X448 |
56 bytes | 56 bytes | 56 byte shared secret |
- Signing is deterministic, as RFC 8032 defines it: the same message, key and context always give the same signature.
signandverifytake an optional RFC 8032 context string of up to 255 bytes ({ context: "my-app invoice v1" }). A signature only verifies with the context it was made with. OpenPGP uses the empty context, which is the default.- Verification is strict. Every public key and signature has exactly one valid encoding: non-canonical points,
Svalues ofLor more, unused bits that are set and public keys of small order are refused.
- Public keys of low order, and any other key that would give the all-zero secret, are refused with
public key is invalid. Such a key would make the secret the same whatever your secret key is. - The shared secret is not uniformly random. Derive keys from it with a key derivation function such as HKDF instead of using it as a key.
- Secret keys are wiped from WebAssembly memory after every call. The WebAssembly module is embedded and loads on first use.
- Tested against the RFC 8032 and RFC 7748 test vectors and all Wycheproof Ed448 and X448 test vectors.
- The RustCrypto Curve448 crates are still pre-releases (0.14). They are pinned to exact versions.
bun run build-rust # test the Rust code, compile it to WebAssembly and embed it
bun run build # bundle the module
bun testbuild-rust needs the wasm32-unknown-unknown Rust target.