Basic Rust library to manipulate JWTs https://crates.io/crates/basic-jwt
Go to file
Pierre HUBERT 9f56be95de
All checks were successful
continuous-integration/drone/push Build is passing
Add Renovate configuration
2024-04-20 13:24:36 +02:00
src Add README 2024-04-20 13:17:44 +02:00
.drone.yml Add Drone configuration 2024-04-20 13:21:05 +02:00
.gitignore Initial commit 2024-04-20 13:04:45 +02:00
Cargo.lock Add core code 2024-04-20 13:13:20 +02:00
Cargo.toml Update crate metadata 2024-04-20 13:19:52 +02:00
README.md Add README 2024-04-20 13:17:44 +02:00
renovate.json Add Renovate configuration 2024-04-20 13:24:36 +02:00

Basic JWT

This crate provide basic functions to:

  • Sign JWT
  • Parse and validate JWT

Basic usage:

let claims = ...; // note : claims must be serializable

// Generate a key pair. Public and private key are both serializable
let (pub_key, priv_key) = generate_ec384_keypair().unwrap();

// Create a JWT for the given claims (note: standard claims: sub, iss, ...) are not
// automatically added if they are missing
let jwt = sign_jwt(&priv_key, &claims).expect("Failed to sign JWT!");

// Validate signed JWT
let claims_out = validate_jwt::<Claims>(&pub_key, &jwt).expect("Failed to validate JWT!");