Crates.io | token-handler |
lib.rs | token-handler |
version | 0.1.1 |
source | src |
created_at | 2025-04-24 06:31:40.898763+00 |
updated_at | 2025-04-24 06:41:17.331095+00 |
description | A library for handling tokens |
homepage | |
repository | https://github.com/bongkow/token-handler |
max_upload_size | |
id | 1646709 |
size | 16,201 |
A Rust library for handling JWT tokens with simple decoding functionality.
Add this to your Cargo.toml
:
[dependencies]
token-handler = "0.1.0"
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),
}
}
The decoder expects tokens with the following claims:
application
: The application identifieraddress
: User addressiat
: Issued at timestampexp
: Expiration timestampiss
: Issuer informationMIT