Releases: lmammino/jwtinfo
Releases · lmammino/jwtinfo
v0.4.4
What's Changed
- fixes typo in tests by @WhiskeyTuesday in #36
- make it a nix module by @adminy in #39
New Contributors
- @WhiskeyTuesday made their first contribution in #36
- @adminy made their first contribution in #39
Full Changelog: v0.4.3...v0.4.4
v0.4.3
v0.4.2
v0.4.1
v0.4.0
v0.3.0
v0.2.3
v0.2.2
v0.2.1
v0.2.0
- Allows displaying the header using the
--header
flag. The internal representation of thejwt::Token
was changed to exposeheader
andbody
asserde_json::Value
types (rather thanjwt::Header
andstr
types). This offers more flexibility in handling arbitrary properties in both header and body (#24, #26).
CLI example
jwtinfo --header eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
will print:
{"alg":"HS256","typ":"JWT"}
Library example
use jwtinfo::{jwt};
let token_str = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
let token = jwt::parse(token_str).unwrap();
assert_eq!(token.header.to_string(), "{\"alg\":\"HS256\",\"typ\":\"JWT\"}");
assert_eq!(token.body.to_string(), "{\"iat\":1516239022,\"name\":\"John Doe\",\"sub\":\"1234567890\"}");