12 releases (7 breaking)
0.8.0 | Oct 17, 2023 |
---|---|
0.7.1 | May 22, 2022 |
0.7.0 | Apr 21, 2022 |
0.6.1 | Feb 24, 2021 |
0.1.1 | Dec 25, 2016 |
#19 in #representation
221,975 downloads per month
Used in 96 crates
(12 directly)
9KB
165 lines
rust-jwt [docs]
Very simple JWT generation lib, provides a Jwt struct which can be finalised to produce an encoded and signed String representation.
Generic over serde::ser::Serialize trait.
Usage
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate smpl_jwt;
use serde::Serialize;
use smpl_jwt::{Jwt, RSAKey};
fn main() {
#[derive(Serialize)]
struct ExampleStruct {
field: String
}
let rsa_key = match RSAKey::from_pem("random_rsa_for_testing") {
Ok(x) => x,
Err(e) => panic!("{}", e)
};
let jwt = Jwt::new(ExampleStruct{field: String::from("test")},
rsa_key,
None);
println!("{}", jwt);
}
Dependencies
~3–5MB
~107K SLoC