Medallion
A JWT library for rust using serde, serde_json and openssl.
Documentation
- [Documentation] (https://commandline.github.io/medallion/)
Usage
The library provides a Token type that wraps headers and claims.
extern crate medallion;
use Default;
use ;
The Header struct contains all of the headers of the JWT. It requires that a supported algorithm (HS256, HS384, HS512, RS256, RS384, and RS512) be specified. It requires a type for additional header fields. That type must implement serde's Serialize and Deserialize as well as PartialEq. These traits can usually be derived, e.g. #[derive(PartialEq, Serialize, Deserialize).
extern crate medallion;
use Default;
use ;
use ;
The Payload struct contains all of the claims of the JWT. It provides the set of registered, public claims. Additional claims can be added by constructing the Payload with a generically typed value. That value's type must implement serde's Serialize and Deserialize as well as PartialEq. These traits can usually be derived, e.g. #[derive(PartialEq, Serialize, Deserialize). A convenience type, DefaultPayload, is provided that binds the generic parameter of Payload to an empty tuple type.
extern crate medallion;
use Default;
use ;
use ;
See the examples for more detailed usage.
This library was originally forked from @mikkyang's rust-jwt.