Skip to content

Commit

Permalink
Slight tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Keats committed Jun 30, 2020
1 parent 636c0dc commit 6262b47
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
21 changes: 2 additions & 19 deletions src/decoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 6262b47

Please sign in to comment.