1
0
Fork
You've already forked auth
0
Rust auth token format similar to JWT.
  • Rust 100%
2026年03月25日 21:21:07 +02:00
src Remove unwraps in the library 2026年03月25日 21:21:07 +02:00
.gitignore Basic stuff 2025年11月06日 19:03:46 +02:00
Cargo.lock Basic stuff 2025年11月06日 19:03:46 +02:00
Cargo.toml Basic stuff 2025年11月06日 19:03:46 +02:00
LICENSE Initial commit 2025年11月06日 09:37:38 +01:00
README.md update readme 2025年11月06日 19:16:46 +02:00

auth

Rust auth token format similar to JWT.

Installation

Clone the repo and put this in your Cargo.toml file:

[dependencies]
auth_token = { path = "/path/to/cloned" }

Usage

To use it you need to define your own type and implement the ByteRepr trait.

example:

struct Token{}implByteReprforTest{fn to_bytes(&self)-> Vec<u8>{}fn from_bytes(bytes: Vec<u8>)-> Self{}}

after that call from_token or to_token and provide your secret key.

to_token returns a string with the following format: "<base64 encoded data>:<base64 encoded HMAC signature>".

from_token should decode it correctly. It'll return the decoded struct and TokenStatus that MUST be checked.