frank_jwt 2.1.0

Implementation of JSON JWT

Frank JWT Build Status

Implementation of JSON Web Tokens in Rust. It supports HS256, 384 and 512 signature algorithms.

Usage

Put this in your Cargo.toml:

[dependencies.jwt]
git = "https://github.com/GildedHonour/frank_jwt"

or

[dependencies]
frank_jwt = "*"

And this in your crate root:

extern crate jwt;

use jwt::Header;
use jwt::Payload;
use jwt::encode;
use jwt::decode;
use jwt::Algorithm;

Example

let mut payload = Payload::new();
payload.insert("key1".to_string(), "val1".to_string());
payload.insert("key2".to_string(), "val2".to_string());
payload.insert("key3".to_string(), "val3".to_string());

let secret = "secret123";
let header = Header::new(Algorithm::HS256);

let jwt = encode(header, secret.to_string(), payload.clone());

License

Apache 2.0

Tests

cargo test