pub struct JWT {
inner: String,
}Expand description
Fields§
§inner: StringImplementations§
Source§impl JWT
impl JWT
Sourcepub fn create<C: Serialize, SK: SigningKey>(
claims: &C,
key: &SK,
) -> Result<JWT, Error>
pub fn create<C: Serialize, SK: SigningKey>( claims: &C, key: &SK, ) -> Result<JWT, Error>
Creates JWT from claims and SigningKey key.
You can also use Claims::sign
Sourcepub fn open<VK: VerifyingKey>(&self, key: &VK) -> Result<Claims, Error>
pub fn open<VK: VerifyingKey>(&self, key: &VK) -> Result<Claims, Error>
Checks the validity of this jwt against the given VerifyingKey key, and the JSON syntax
of the claims. Does not check the validity of the claims itself.
If only the signature is invalid, the claims can be extracted from
Error::InvalidSignature::claims.
pub fn as_str(&self) -> &str
pub fn sha256(&self) -> Sha256
pub fn id(&self) -> Id
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
impl StructuralPartialEq for JWT
Auto Trait Implementations§
impl Freeze for JWT
impl RefUnwindSafe for JWT
impl Send for JWT
impl Sync for JWT
impl Unpin for JWT
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<I> IntoResettable<String> for I
impl<I> IntoResettable<String> for I
Source§fn into_resettable(self) -> Resettable<String>
fn into_resettable(self) -> Resettable<String>
Convert to the intended resettable type
Source§impl<T> PayloadTrait for T
impl<T> PayloadTrait for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.