Registry / auth / jwt-simple

jwt-simple

JSON →
library0.12.14rscratesunverified

Easy to use, secure, non opinionated JWT (JSON Web Tokens) implementation for Rust.

# Cargo.toml [dependencies] jwt-simple = "0.12.14"
INSTALL
IMPORT
SIG · JWT-SIMPLE
J
jwt-simple
authrustv0.12.14
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HS256Key
use jwt_simple::prelude::*;

Generates a JWT token using HS256.

use jwt_simple::prelude::*; fn main() { let key = HS256Key::generate(); let claims = Claims::create(Duration::from_hours(1)); let token = key.authenticate(claims).unwrap(); println!("Token: {}", token); }
Debug
Known issues
gotchaDefault algorithm is HS256; must explicitly choose asymmetric algorithms if needed.
fix
Use `RS256Key` or `ES256Key` for asymmetric signing.
affects: >=0.12.0
Upgrade
Version history
0.12.14latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
jwt-simple — cargo add jwt-simple · libregistry