Post-quantum readiness
DaloyJS has no encryption or key exchange of its own, so the urgent part of a post-quantum migration is your runtime's TLS. The part the framework owns is token signatures, andjwk()andcreateJwtVerifier()verify ML-DSA tokens when you list the algorithm.
What quantum attacks affect
A large quantum computer breaks today's public-key algorithms: RSA, ECDSA, EdDSA and Diffie-Hellman key exchange. Symmetric cryptography and hash functions are not affected in the same way. That splits the framework into three layers.
| Area | What DaloyJS uses | Affected | What to do |
|---|---|---|---|
| TLS | Whatever the runtime negotiates | Yes, and it is urgent | Keep the runtime current and check the key exchange |
jwk(), createJwtVerifier() | RS, PS, ES, EdDSA, and ML-DSA when listed | Yes, later | List an ML-DSA algorithm once your issuer publishes such keys |
http-signatures | Ed25519, ECDSA, RSA, HMAC | Yes, later | Nothing yet. That module has no post-quantum algorithm |
session(), cursors, webhooks | HMAC-SHA-256 | No | Nothing |
passwordHash() | scrypt | No | Nothing |
clientCertAuth() | The certificate your CA issued | Decided by your CA | Follow your CA's migration |
TLS is the urgent part
DaloyJS does not configure TLS groups. The Node adapter, fetchGuard() and plain fetch() all use the runtime's defaults, so the fix for recorded-traffic attacks is a runtime that offers the hybrid group X25519MLKEM768 and a peer that accepts it.
Check what your deployment negotiates instead of trusting a version number:
If the name is X25519 or a P-256 curve, one side does not offer the hybrid group. Update the runtime first: DaloyJS supports every Node 24 release, but an older 24 patch release may not offer the hybrid group by default. Then check the proxy or load balancer in front of the app, because it terminates TLS for your clients.
ML-DSA tokens
ML-DSA is the NIST post-quantum signature standard (FIPS 204). RFC 9964 registers it for JWTs as ML-DSA-44, ML-DSA-65 and ML-DSA-87, with keys published as kty: "AKP" JSON Web Keys.
Nothing accepts these algorithms by default. A verifier takes them only when its allowlist names them, the same rule as every other algorithm:
Listing both lets the issuer move at its own pace: classical tokens keep verifying, and ML-DSA tokens verify as soon as the JWKS carries an ML-DSA key. Remove the classical algorithm once the issuer has stopped signing with it.
With a key you hold yourself, pass the public JWK or a CryptoKey:
Runtime support
ML-DSA runs through WebCrypto, so @daloyjs/core still has no runtime dependency. The runtime must implement it. Check before you list the algorithm:
On a runtime without ML-DSA the verifier rejects the token with unsupported_alg, and jwk() answers 401. It never falls back to another algorithm.
What the verifier checks
- The token's
algmust be in the allowlist.ML-DSA-65in the list does not acceptML-DSA-44orML-DSA-87. - The JWK must be
kty: "AKP"and itsalgmust equal the token's algorithm. RFC 9964 makesalgmandatory on these keys, and theAKPkey type is shared with other algorithms, so this is what ties a key to ML-DSA and to one parameter set. pubmust have the exact length for the parameter set, so a key relabelled as a different set is refused before it is used.- A verification key must not carry
priv. A JWKS that publishes a private seed is rejected instead of quietly used. HS*next to a JWK source is still refused at construction, andalg: "none"is still refused everywhere.
| Code | Meaning |
|---|---|
alg_not_allowed | The token's algorithm is not in the allowlist |
key_algorithm_mismatch | The key's alg is missing or names a different algorithm |
invalid_key | Not an AKP key, wrong pub length, a priv on a verification key, or the runtime refused it |
unsupported_alg | The runtime's WebCrypto has no ML-DSA |
invalid_signature | The signature does not verify |
Token size
ML-DSA signatures are large. Plan for it before you switch.
| Algorithm | Public key | Signature | Signature in a token |
|---|---|---|---|
ES256 | 65 bytes | 64 bytes | 86 characters |
ML-DSA-44 | 1,312 bytes | 2,420 bytes | 3,227 characters |
ML-DSA-65 | 1,952 bytes | 3,309 bytes | 4,412 characters |
ML-DSA-87 | 2,592 bytes | 4,627 bytes | 6,170 characters |
- Cookies: browsers cap a cookie near 4 KB, so an ML-DSA token does not fit in one. Send it in the
Authorizationheader, or keep a session cookie and hold the token server-side. - Header limits: the Node adapter accepts 16 KiB of headers by default (
maxHeaderBytes), which fits every parameter set. Many proxies cap a single header line at 8 KB; anML-DSA-87token with large claims gets close to that. - JWKS size:
jwk()caps a fetched key set at 1 MiB, which is room for hundreds of ML-DSA keys.
Signing
createJwtSigner() accepts the same three algorithms, with a CryptoKey or an AkpJsonWebKey whose priv is the 32-byte seed. Minting tokens is authorization-server work, so the boundary described in the security API reference applies here too.
A migration order that works
Fix TLS first
Update the runtime, run the check above against production, and confirm the proxy in front of the app offers the hybrid group.
List where you verify public-key signatures
Search for
jwk(andcreateJwtVerifier(and note each issuer.Add the ML-DSA algorithm next to the classical one
Do this when an issuer announces post-quantum keys, after checking that the runtime supports ML-DSA.
Check sizes on the path the token takes
Cookies, proxy header limits, and any gateway that logs or stores tokens.
Remove the classical algorithm
Take it out of the allowlist once the issuer has stopped signing with it.
Related
- JWT and authentication safeguards for
jwk()in full. - Security API reference for
JwtAlgorithm,AkpJsonWebKeyand the signer boundary. - FIPS 204, the ML-DSA standard, and RFC 9964, its JOSE registration.