Honest JWT Library
Implementation of JSON Web Tokens in Rust. Honest about its feature set and actively maintained. Support for all claim checks and JWEs is a goal. Fork of frank_jwt.
Algorithms and features supported
- HS256
- HS384
- HS512
- RS256
- RS384
- RS512
- ES256
- ES384
- ES512
- Sign
- Verify
- iss check (issuer)
- sub check (subject)
- aud check (audience)
- exp check (expiration time)
- nbf check (not before time)
- iat check (issued at)
- jti check (JWT id)
Usage
Put this into your Cargo.toml
:
[]
= "0.1"
And this in your crate root:
extern crate honest_jwt;
extern crate serde_json;
use ;
Example
//HS256
let mut payload = json!;
let mut header = json!;
let secret = "secret123";
let jwt = encode;
//RS256
use env;
let mut payload = json!;
let mut header = json!;
let mut keypath = current_dir.unwrap;
keypath.push;
keypath.push;
let jwt = encode;
let = decode;
License
Original project code (frank_jwt) was licensed under the Apache 2.0 license. New code is being written under the LGPL 3.0. Eventually all original code will be re-rewitten and entire project will be LGPL'd.