PQ Python

PyJWT

HS256 is unaffected and ES384 or RSA-3072+ work as stopgaps, but there is no ML-DSA until PR #1256 merges; enforce RSA key size yourself.

PyPI
PyJWT
Version cited
2.15.128 Sep 2026
Downloads
763M/mo

Key exchange and encryption

Not affected

No JWE or key exchange

Signatures and identity

Stopgap only

Stopgap only; ML-DSA PR #1256 open

What to do

Keep HS256 for single-service tokens. Otherwise use ES384 or PS256/RS256 with RSA-3072+ (assert key size), pin algorithms= per issuer, test JWKS with a synthetic AKP key, and track PR #1256.

Since 1 Dec 2026 Community comments on ML-DSA PR #1256 on 3 Dec 2026 (AGY: PR updated 3 Dec); Apache Airflow #78000 (3 Dec) is blocked on it; no maintainer comment.

Details

PyJWT is the most-downloaded JWT library covered here, with 763,231,466 downloads in 30 days. It is the JWT engine of fastapi-users and django-allauth’s OIDC client, and FastAPI’s official tutorial uses it with HS256.

What it supports today#

  • No default algorithm; the caller chooses. It supports ES256, ES256K and EdDSA, plus ES384, ES512 and RS/PS256–512 (PyPI PyJWT 2.15.1).
  • The RSA floor only warns. _MIN_KEY_SIZE = 2048; below it PyJWT emits InsecureKeyLengthWarning unless enforce_minimum_key_length is set, and there is no 3072 floor. Assert key.key_size >= 3072 yourself (recipe).
  • cryptography is optional, via the crypto extra, declared as >=3.4.0, so environments can resolve to versions without ML-DSA. Pin cryptography>=48 yourself if you plan to use PR #1256.
  • No ML-DSA. PyJWT 2.15.1’s algorithms.py registers no RFC 9964 algorithm; in the ASTRA test environment with cryptography 51.0.0 its default registry contained none.
  • JWKS caching. PyJWKClient(..., cache_jwk_set=True) in PyJWT >= 2.15.0 caches parsed PyJWKSet objects (AGY report), which matters once ML-DSA JWKS documents grow to about 15–20 KB.

ML-DSA: PR #1256#

PR #1256, opened 20 Nov 2026, adds ML-DSA-44/65/87 and AKP JWKs and needs cryptography ≥48. It is open and unmerged. Community comments arrived on 3 Dec 2026, with no maintainer comment. Apache Airflow #78000, opened 3 Dec, asks for ML-DSA JWT signing and is blocked on it.

Sources disagree. The AGY report calls ML-DSA support “imminent” (PR updated 3 Dec 2026; “watch 2.16.0”). The OpenID Foundation’s October 2026 table lists PyJWT as “No Plans Yet”, and a DEV write-up lists it as not yet released. An Auth0 Community post claims PyJWT “has begun incorporating” ML-DSA; the Claude report treats this as false until a release.

Until it ships, options are jwcrypto, a pinned build of PR #1256, or a custom signer calling pyca/cryptography ≥48 mldsa directly.

Before switching, budget for size: an ML-DSA-65 token adds 4,326 B to every request ASTRA, and columns that store tokens or keys need widening (wire cost, storage).

Unknown kty in JWKS#

Sources disagree. The AGY report says PyJWKSet skips unknown kty values such as AKP, so mixed JWKS are safe. The Claude report did not verify whether PyJWT 2.15.1’s PyJWKClient/PyJWKSet skips or raises, and recommends testing with a synthetic AKP entry. A verifier that fails the whole JWKS breaks login when IdPs publish ML-DSA keys (AKP tolerance).

The zero-downtime verifier recipe for rotating IdPs is on the FastAPI page.

Sources cited on this page 7
  1. PyPI PyJWT 2.15.1 pypi.org
  2. PyJWT 2.15.1’s algorithms.py github.com
  3. PR #1256 github.com
  4. Apache Airflow #78000 github.com
  5. OpenID Foundation openid.net
  6. DEV write-up dev.to
  7. Auth0 Community post community.auth0.com

All sources across the guide