[−][src]Struct medallion::Token
Main struct representing a JSON Web Token, composed of a header and a set of claims.
Fields
header: Header<H>
payload: Payload<C>
Implementations
impl<H, C> Token<H, C> where
H: Serialize + DeserializeOwned,
C: Serialize + DeserializeOwned,
[src]
H: Serialize + DeserializeOwned,
C: Serialize + DeserializeOwned,
Provide the ability to parse a token, verify it and sign/serialize it.
pub fn new(header: Header<H>, payload: Payload<C>) -> Token<H, C>
[src]
pub fn parse(raw: &str) -> Result<Token<H, C>>
[src]
Parse a token from a string.
pub fn verify(&self, key: &[u8]) -> Result<bool>
[src]
Verify a token with a key and the token's specific algorithm.
pub fn sign(&self, key: &[u8]) -> Result<String>
[src]
Generate the signed token from a key with the specific algorithm as a url-safe, base64 string.
Trait Implementations
impl<H: Debug, C: Debug> Debug for Token<H, C>
[src]
impl<H: Default, C: Default> Default for Token<H, C>
[src]
impl<H, C> PartialEq<Token<H, C>> for Token<H, C> where
H: PartialEq,
C: PartialEq,
[src]
H: PartialEq,
C: PartialEq,
Auto Trait Implementations
impl<H, C> RefUnwindSafe for Token<H, C> where
C: RefUnwindSafe,
H: RefUnwindSafe,
C: RefUnwindSafe,
H: RefUnwindSafe,
impl<H, C> Send for Token<H, C> where
C: Send,
H: Send,
C: Send,
H: Send,
impl<H, C> Sync for Token<H, C> where
C: Sync,
H: Sync,
C: Sync,
H: Sync,
impl<H, C> Unpin for Token<H, C> where
C: Unpin,
H: Unpin,
C: Unpin,
H: Unpin,
impl<H, C> UnwindSafe for Token<H, C> where
C: UnwindSafe,
H: UnwindSafe,
C: UnwindSafe,
H: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,