jwt-tools 0.1.0
Sign, verify and decode HS256 JSON Web Tokens (RFC 7519), with exp and nbf checks
Install
cargo add jwt-tools --registry rupm
In Ruststudio: Packages, search for jwt-tools, Install.
Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-22.
Versions
- 0.1.0 2026-11-22
README
# jwt-tools
Sign, verify and decode HS256 JSON Web Tokens (RFC 7519), with exp and nbf checks
Add it with `rupm add jwt-tools` (or `cargo add jwt-tools --registry rupm`).
Matches the RFC 7515 and jwt.io HS256 examples. Only HS256 is accepted (tokens claiming none or any other algorithm are rejected). The HMAC-SHA-256 is unaudited and not constant-time, so this crate is not meant for security-critical use; use an audited JWT library for a production authentication system.
```rust
use serde_json::json;
let token = jwt_tools::sign(&json!({"sub": "42", "exp": 4102444800u64}), b"secret").unwrap();
let claims = jwt_tools::verify(&token, b"secret").unwrap();
assert_eq!(claims["sub"], "42");
assert!(jwt_tools::verify(&token, b"wrong").is_err());
```