[][src]Struct jwt::Token

pub struct Token<H, C> where
    H: Component,
    C: Component
{ pub header: H, pub claims: C, // some fields omitted }

Fields

header: Hclaims: C

Methods

impl<H, C> Token<H, C> where
    H: Component,
    C: Component
[src]

pub fn new(header: H, claims: C) -> Token<H, C>[src]

pub fn parse(raw: &str) -> Result<Token<H, C>, Error>[src]

Parse a token from a string.

pub fn verify<D>(&self, key: &[u8], digest: D) -> bool where
    D: Input + BlockInput + FixedOutput + Reset + Default + Clone,
    D::BlockSize: ArrayLength<u8>,
    D::OutputSize: ArrayLength<u8>, 
[src]

Verify a from_base64d token with a key and a given hashing algorithm. Make sure to check the token's algorithm before applying.

pub fn signed<D>(&self, key: &[u8], digest: D) -> Result<String, Error> where
    D: Input + BlockInput + FixedOutput + Reset + Default + Clone,
    D::BlockSize: ArrayLength<u8>,
    D::OutputSize: ArrayLength<u8>, 
[src]

Generate the signed token from a key and a given hashing algorithm.

Trait Implementations

impl<H: Debug, C: Debug> Debug for Token<H, C> where
    H: Component,
    C: Component
[src]

impl<H: Default, C: Default> Default for Token<H, C> where
    H: Component,
    C: Component
[src]

impl<H, C> PartialEq<Token<H, C>> for Token<H, C> where
    H: Component + PartialEq,
    C: Component + PartialEq
[src]

Auto Trait Implementations

impl<H, C> RefUnwindSafe for Token<H, C> where
    C: RefUnwindSafe,
    H: RefUnwindSafe

impl<H, C> Send for Token<H, C> where
    C: Send,
    H: Send

impl<H, C> Sync for Token<H, C> where
    C: Sync,
    H: Sync

impl<H, C> Unpin for Token<H, C> where
    C: Unpin,
    H: Unpin

impl<H, C> UnwindSafe for Token<H, C> where
    C: UnwindSafe,
    H: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.