opyebEd25519Lab

WebCrypto coverage and checking an implementation with RFC vectors

Verification · 6 min read

In one line: How far browser WebCrypto supports Ed25519 and X25519, how a pure-JS fallback matches it, and how to use the official test vectors.

In a browser you usually reach for crypto.subtle. Ed25519 and X25519 arrived comparatively late, so support differs by browser and version. Here is how to tell what is actually happening when a browser refuses.

1. Generating a key with WebCrypto

const kp = await crypto.subtle.generateKey(
  { name: "Ed25519" }, true, ["sign", "verify"]);
const jwk = await crypto.subtle.exportKey("jwk", kp.privateKey);

Where supported, this returns a JWK immediately. The hard case is a browser that throws — or one that appears to work but computes something different.

2. Detect, do not assume

try {
  await crypto.subtle.generateKey({ name: "X25519" }, false, ["deriveBits"]);
  supported = true;
} catch (e) { supported = false; }

Detect the feature and fall back rather than telling the user their browser is unsupported. A tool that only works in one browser has lost its purpose.

3. What a pure-JS engine does

RFC 8032 and RFC 7748 specify the algorithms in pseudocode. Implement the curve arithmetic with BigInt and you get the same result everywhere. Ed25519Lab uses that as its primary engine and compares against WebCrypto when it is available.

PartRole
Pure JS engineAlways-available reference
WebCryptoCross-check when present
DisagreementWarning on screen

4. What test vectors are

A test vector fixes an input and the exact output the specification requires. RFC 8032 lists Ed25519 signing vectors; RFC 7748 lists X25519 exchange vectors. Running them is the fastest way to know whether an implementation matches.

seed    9d61b19d…7f60
message (empty)
pub     d75a9801…511a
sig     e5564300…100b

5. Reading vectors carefully

  • They are public — published values, not real secrets. Never use them operationally.
  • Encoding matters — hex or Base64, little-endian or big-endian.
  • All of them must pass — one failure points at a boundary bug even if others succeed.
  • Negative vectors exist — a tampered signature that verifies means verification is too loose.

6. Panel ⑤

Run four RFC 8032 signing vectors and the RFC 7748 exchange vectors at once. Pass and fail appear in a table, each vector can be loaded into panels ①–④ for hands-on inspection, and the summary is carried into the report in panel ⑥.

Making a key yourself shows the format differences immediately.

Open Ed25519Lab

Frequently asked questions

WebCrypto and this tool disagree. Which is wrong?

One of them does not match the specification. Run the RFC vectors to see which side agrees with them; the matching side is correct.

Is the pure-JS engine slow?

It is fast enough for single-key operations. For bulk signing, use a server or native library; treat this tool as a format and verification inspector.

References

Read next

0 bytes of your input sent to a server (advertising and affiliate widgets excluded)