pub struct JWT {
pub header: Header,
pub payload: Payload,
pub signature: Option<Signature>,
}Fields§
§header: Header§payload: Payload§signature: Option<Signature>Implementations§
Source§impl JWT
impl JWT
pub fn to_token(&self) -> Result<String, Error>
pub fn sign(&mut self, private_key: impl SignFromKey) -> Result<(), Error>
pub fn from_token(token: &str) -> Result<Self, Error>
pub fn validate(&self, public_key: impl VerifyFromKey) -> Result<bool, Error>
pub fn validate_token( token_str: &str, public_key: impl VerifyFromKey, ) -> Result<(Self, bool), Error>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JWT
impl<'de> Deserialize<'de> for JWT
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for JWT
impl RefUnwindSafe for JWT
impl Send for JWT
impl Sync for JWT
impl Unpin for JWT
impl UnwindSafe for JWT
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more