Decode a JWT without any signature verification/validations and return its [Header](struct.Header.html). If the token has an invalid format (ie 3 parts separated by a `.`), it will return an error. ```rust use jsonwebtoken::decode_header; let token = "a.jwt.token".to_string(); let header = decode_header(&token); ```
(token: impl AsRef<[u8]>)
| 341 | /// let header = decode_header(&token); |
| 342 | /// ``` |
| 343 | pub fn decode_header(token: impl AsRef<[u8]>) -> Result<Header> { |
| 344 | let token = token.as_ref(); |
| 345 | let (_, message) = expect_two!(token.rsplitn(2, |b| *b == b'.')); |
| 346 | let (_, header) = expect_two!(message.rsplitn(2, |b| *b == b'.')); |
| 347 | Header::from_encoded_unchecked(header) |
| 348 | } |
| 349 | |
| 350 | pub(crate) fn verify_signature_body( |
| 351 | message: &[u8], |
no outgoing calls
no test coverage detected