Slight tweaks

This commit is contained in:
Vincent Prouillet 2020-06-30 19:58:11 +02:00
parent 636c0dc203
commit 6262b4700b
2 changed files with 2 additions and 22 deletions

View File

@ -206,26 +206,9 @@ pub fn dangerous_insecure_decode<T: DeserializeOwned>(token: &str) -> Result<Tok
Ok(TokenData { header, claims: decoded_claims })
}
/// Decode a JWT without any signature verification/validations.
///
/// NOTE: Do not use this unless you know what you are doing! If the token's signature is invalid, it will *not* return an error.
///
/// ```rust
/// use serde::{Deserialize, Serialize};
/// use jsonwebtoken::{dangerous_unsafe_decode, Validation, Algorithm};
///
/// #[derive(Debug, Serialize, Deserialize)]
/// struct Claims {
/// sub: String,
/// company: String
/// }
///
/// let token = "a.jwt.token".to_string();
/// // Claims is a struct that implements Deserialize
/// let token_message = dangerous_unsafe_decode::<Claims>(&token);
/// ```
/// Decode a JWT without any signature verification/validations. DEPRECATED.
#[deprecated(
note = "This function has been renamed to `dangerous_unsafe_decode` and will be removed in a later version."
note = "This function has been renamed to `dangerous_insecure_decode` and will be removed in a later version."
)]
pub fn dangerous_unsafe_decode<T: DeserializeOwned>(token: &str) -> Result<TokenData<T>> {
dangerous_insecure_decode(token)

View File

@ -2,9 +2,6 @@ use std::error::Error as StdError;
use std::fmt;
use std::result;
use base64;
use serde_json;
/// A crate private constructor for `Error`.
pub(crate) fn new_error(kind: ErrorKind) -> Error {
Error(Box::new(kind))