frank_jwt 2.0.0

Implementation of JSON JWT

rust-jwt Build Status

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

Usage

Put this in your Cargo.toml:

[dependencies.jwt]
git = "https://github.com/GildedHonour/rust-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