Update error-chain and make typ public

This commit is contained in:
Vincent Prouillet 2017-09-07 16:46:40 +09:00
parent 7e36d3f7bb
commit 3985915da6
4 changed files with 7 additions and 8 deletions

View File

@ -3,15 +3,13 @@
## 3.0.0 (unreleased)
### Breaking change
- Remove `validate_signature` from `Validation`
- Remove `validate_signature` from `Validation`, use `decode_header` instead if you don't know the alg used
- Make `typ` optional in header, some providers apparently don't use it
### Others
- Update ring
- Update ring & error-chain
- Fix documentation about `leeway` being in seconds and not milliseconds
### Other
- Add `decode_header` to only decode the header: replaces the use case of `validate_signature`
## 2.0.3 (2017-07-18)

View File

@ -1,7 +1,7 @@
[package]
name = "jsonwebtoken"
version = "2.0.3"
authors = ["Vincent Prouillet <vincent@wearewizards.io>"]
version = "3.0.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
license = "MIT"
readme = "README.md"
description = "Create and parse JWT in a strongly typed way."
@ -10,7 +10,7 @@ repository = "https://github.com/Keats/rust-jwt"
keywords = ["jwt", "web", "api", "token", "json"]
[dependencies]
error-chain = { version = "0.10", default-features = false }
error-chain = { version = "0.11", default-features = false }
serde_json = "1.0"
serde_derive = "1.0"
serde = "1.0"

View File

@ -9,7 +9,7 @@ pub struct Header {
///
/// Defined in [RFC7515#4.1.9](https://tools.ietf.org/html/rfc7515#section-4.1.9).
#[serde(skip_serializing_if = "Option::is_none")]
typ: Option<String>,
pub typ: Option<String>,
/// The algorithm used
///
/// Defined in [RFC7515#4.1.1](https://tools.ietf.org/html/rfc7515#section-4.1.1).

View File

@ -101,5 +101,6 @@ fn decode_header_only() {
let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjb21wYW55IjoiMTIzNDU2Nzg5MCIsInN1YiI6IkpvaG4gRG9lIn0.S";
let header = decode_header(token).unwrap();
assert_eq!(header.alg, Algorithm::HS256);
assert_eq!(header.typ, Some("JWT".to_string()));
}