entropy-auth 2026.7.31

Authentication and authorization for Entropy Softworks server and API projects
//! JSON Web Token (JWT) parsing and verification.
//!
//! Implements JWT validation per RFC 7519. HMAC-based signing/verification
//! (HS256, HS512) is always available; asymmetric signing/verification
//! (`EdDSA` per RFC 8037, ES256 per RFC 7518) plus JWKS (RFC 7517) and key
//! rotation are added behind the `asym-jwt` feature (enabled transitively by
//! `oidc`).
//!
//! This module both **mints** tokens ([`JwtEncoder`]) and **verifies**
//! them ([`verify_jwt`]); the two are symmetrical, so a token produced by
//! [`JwtEncoder::sign`] round-trips through [`verify_jwt`]. The asymmetric
//! counterparts are [`JwtEncoder::sign_asymmetric`] and
//! [`verify_jwt_asymmetric`] / [`KeyRing::verify`] / [`JwkSet::verify`].
//!
//! # Security
//!
//! - The `"none"` algorithm is **always rejected** on verification, and is
//!   **unrepresentable** for signing: [`JwtEncoder::sign`] is parameterised
//!   by [`JwtSigningAlgorithm`], which has no `None` variant, so this crate
//!   cannot produce an unsigned token.
//! - Signature verification uses constant-time comparison via
//!   [`crate::crypto::constant_time::constant_time_eq`].
//! - Clock skew tolerance is configurable but must be explicitly opted
//!   into by the caller.

#[cfg(feature = "asym-jwt")]
mod asymmetric;
mod claims;
mod decode;
mod encode;
mod header;
#[cfg(feature = "asym-jwt")]
mod jwks;
mod signature;

pub use self::claims::{JwtClaims, JwtClaimsError};
pub use self::encode::{CustomClaimValueOpaque, IntoCustomClaim, JwtEncoder, JwtSigningAlgorithm};
pub use self::header::{JwtAlgorithm, JwtHeader, JwtHeaderError};
pub use self::signature::{JwtSignatureError, verify_jwt};

#[cfg(feature = "asym-jwt")]
pub use self::asymmetric::{
    AsymmetricAlgorithm, AsymmetricKeyError, AsymmetricSigningKey, AsymmetricVerifyingKey,
};
#[cfg(feature = "asym-jwt")]
pub use self::jwks::{Jwk, JwkError, JwkSet, KeyRing};
#[cfg(feature = "asym-jwt")]
pub use self::signature::verify_jwt_asymmetric;