| Crates.io | jsonwebtoken-jwks-cache |
| lib.rs | jsonwebtoken-jwks-cache |
| version | 0.2.0 |
| created_at | 2025-10-20 12:37:59.482957+00 |
| updated_at | 2026-01-22 06:50:01.657301+00 |
| description | Resilient and blazingly fast async JWK Set cache |
| homepage | https://github.com/expl/rs-jsonwebtoken-jwks-cache |
| repository | https://github.com/expl/rs-jsonwebtoken-jwks-cache |
| max_upload_size | |
| id | 1891865 |
| size | 88,683 |
Resilient and blazingly fast async JWK Set cache
let cache = CachedJWKS::new(
// strictly follow caching semantics provided by the JWKS URL host
"https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com"
.parse()
.unwrap(),
// if requested 1hr before token cache gets expired, refresh the cache in the background
Duration::from_secs(60 * 60),
// simple timeout strategy
TimeoutSpec {
// if encountered network/http error or single try timeout, how many times more to retry
retries: 3,
// single try timeout period
retry_after: Duration::from_seconds(10),
// how long to wait between retries
backoff: Duration::from_seconds(1),
// total timeout deadline
deadline: Duration::from_seconds(30),
},
)
.unwrap();
let jwks = cache.get().await.unwrap();
// perform JWT validation here using `jsonwebtoken` crate