Rust implementation of JSON Web Tokens
Usable, but not production ready. Hasn't been audited for security and the API will change.
Add this to your Cargo.toml:
[dependencies.jwt]
git = "https://github.com/stygstra/rust-jwt"Example:
extern crate jwt;
use jwt::Claims;
use jwt::jws::hs256::{encode, decode};
fn main() {
let mut claims = Claims::new();
claims.insert_unsafe("com.example.my-claim", "value".to_string());
let token = encode(&claims, b"secret");
let decoded = decode(&*token, b"secret").unwrap();
assert_eq!(claims, decoded);
println!("ok");
}- More algorithms (at least RS256 and ES256)
- Validate
critheader - Validate registered claims
- JWE
- Improve API