1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! # jwt-lab
//!
//! A production-grade JWT (JSON Web Token) crate for Rust with comprehensive
//! support for decoding, verifying, signing, and mutating JWTs.
//!
//! ## Features
//!
//! - **Multiple Algorithms**: HS256/384/512, RS256/384/512, ES256/384/512, EdDSA
//! - **JWK/JWKS Support**: Verify tokens using JSON Web Key Sets
//! - **Algorithm Validation**: Prevent algorithm confusion attacks
//! - **Time Validation**: Configurable leeway for `exp` and `nbf` claims
//! - **Claims Mutation**: Modify JWT claims using JSON pointer paths
//! - **Feature Flags**: Fine-grained control over included algorithms
//! - **Strong Error Types**: Comprehensive error handling with clear messages
//!
//! ## Quick Start
//!
//! ```rust
//! use jwt_lab::{Algorithm, Header, Claims, Key};
//! use jwt_lab::sign::sign;
//! use serde_json::json;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create and sign a JWT
//! let header = Header {
//! alg: Algorithm::HS256,
//! typ: Some("JWT".into()),
//! kid: None,
//! extra: Default::default()
//! };
//! let claims = Claims(serde_json::from_value(json!({
//! "sub": "user123",
//! "iat": 1516239022
//! }))?);
//! let token = sign(&header, &claims, &Key::hs("secret"))?;
//! println!("Generated token: {}", token);
//! # Ok(()) }
//! ```
//!
//! ## Security Considerations
//!
//! - Always validate the algorithm to prevent algorithm confusion attacks
//! - Set appropriate expiration times and use minimal leeway
//! - Validate issuer and audience claims when possible
//! - Never accept tokens with `alg: "none"`
/// JWT signing functionality
pub use ;
pub use ;
pub use VerifyOptions;
pub use ;
pub use Explanation;