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
//! JWT (JSON Web Token) utilities for yimi-rutool
//!
//! This module provides functionality for creating, validating, and managing JWT tokens.
//! It supports various signing algorithms including HMAC, RSA, and ECDSA.
//!
//! # Features
//!
//! - JWT token creation and validation
//! - Multiple signing algorithms (HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512)
//! - Claims management with standard and custom claims
//! - Token expiration and validation
//! - Base64 encoding/decoding utilities
//!
//! # Quick Start
//!
//! ```rust
//! use yimi_rutool::jwt::{JwtUtil, Claims};
//! use std::collections::HashMap;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create a simple JWT token
//! let mut claims = Claims::new();
//! claims.subject = Some("user123".to_string());
//! claims.expires_at = Some(chrono::Utc::now().timestamp() + 3600); // 1 hour
//!
//! let secret = "your-secret-key";
//! let token = JwtUtil::create_token(&claims, secret)?;
//!
//! // Validate the token
//! let decoded_claims = JwtUtil::validate_token(&token, secret)?;
//! println!("Subject: {:?}", decoded_claims.subject);
//! # Ok(())
//! # }
//! ```
// Re-export main types for convenience
pub use JwtUtil;
pub use ;
pub use ;
pub use ;