8 releases
Uses old Rust 2015
0.1.7 | Sep 4, 2018 |
---|---|
0.1.6 | Dec 2, 2017 |
0.1.5 | Sep 20, 2017 |
0.1.2 | Jun 29, 2017 |
0.1.0 | May 29, 2017 |
#1576 in Encoding
9KB
193 lines
token
extern crate serde;
extern crate serde_json;
#[macro_use]
extern crate serde_derive;
impl Message for Messages {}
#[derive(Serialize, Deserialize, Debug)]
struct Messages {
user_id: i64,
date: i64,
}
fn main() {
let key = "123ABC";
let message = Messages {
user_id: 10000,
date: 123456789,
};
let token = encode(key, message, Algorithm::SHA256).unwrap();
println!("{:?}", token);
let result = decode::<Messages>(key, token);
println!("{:?}", result);
}
Dependencies
~7.5MB
~235K SLoC