token-handler

Crates.iotoken-handler
lib.rstoken-handler
version0.1.1
sourcesrc
created_at2025-04-24 06:31:40.898763+00
updated_at2025-04-24 06:41:17.331095+00
descriptionA library for handling tokens
homepage
repositoryhttps://github.com/bongkow/token-handler
max_upload_size
id1646709
size16,201
(bongkow)

documentation

README

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 identifier
  • address: User address
  • iat: Issued at timestamp
  • exp: Expiration timestamp
  • iss: Issuer information

License

MIT

Commit count: 0

cargo fmt