2 releases
Uses new Rust 2024
new 0.1.1 | Apr 24, 2025 |
---|---|
0.1.0 | Apr 24, 2025 |
#701 in Encoding
6KB
Token Handler
A Rust library for handling JWT tokens with simple decoding functionality.
Features
- JWT token decoding with validation
- Support for standard JWT claims
Installation
Add this to your Cargo.toml
:
[dependencies]
token-handler = "0.1.0"
Usage
use token_handler::decode_token;
fn main() {
let token = "your.jwt.token";
let secret_key = "your-secret-key";
match decode_token(token, secret_key) {
Ok(claims) => println!("Token decoded successfully: {:?}", claims),
Err(err) => println!("Failed to decode token: {}", err),
}
}
Token Structure
The decoder expects tokens with the following claims:
application
: The application identifieraddress
: User addressiat
: Issued at timestampexp
: Expiration timestampiss
: Issuer information
License
MIT
Dependencies
~1–9.5MB
~108K SLoC