Struct medallion::Token [−][src]
pub struct Token<H = (), C = ()> { pub header: Header<H>, pub payload: Payload<C>, // some fields omitted }
Main struct representing a JSON Web Token, composed of a header and a set of claims.
Fields
header: Header<H>
payload: Payload<C>
Methods
impl<H, C> Token<H, C> where
H: Serialize + DeserializeOwned,
C: Serialize + DeserializeOwned,
[src]
impl<H, C> Token<H, C> where
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 new(header: Header<H>, payload: Payload<C>) -> Token<H, C>
pub fn parse(raw: &str) -> Result<Token<H, C>>
[src]
pub fn parse(raw: &str) -> Result<Token<H, C>>
Parse a token from a string.
pub fn verify(&self, key: &[u8]) -> Result<bool>
[src]
pub fn verify(&self, key: &[u8]) -> Result<bool>
Verify a token with a key and the token's specific algorithm.
pub fn sign(&self, key: &[u8]) -> Result<String>
[src]
pub fn sign(&self, key: &[u8]) -> Result<String>
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: Debug, C: Debug> Debug for Token<H, C>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<H: Default, C: Default> Default for Token<H, C>
[src]
impl<H: Default, C: Default> Default for Token<H, C>
impl<H, C> PartialEq for Token<H, C> where
H: PartialEq,
C: PartialEq,
[src]
impl<H, C> PartialEq for Token<H, C> where
H: PartialEq,
C: PartialEq,