pub struct Jwt { /* private fields */ }
Implementations§
Source§impl Jwt
impl Jwt
Sourcepub fn new(bytes: &[u8]) -> Self
pub fn new(bytes: &[u8]) -> Self
§Example
use dev_api::jwt::Jwt;
let jwt = Jwt::new(b"secret");
Sourcepub fn create_tokens_from_str(
&self,
extra_claims: HashMap<&str, &str>,
) -> Result<Tokens>
pub fn create_tokens_from_str( &self, extra_claims: HashMap<&str, &str>, ) -> Result<Tokens>
§Example
use std::collections::HashMap;
use dev_api::jwt::Jwt;
use std::str::FromStr;
let jwt = Jwt::new(b"secret");
let tokens = jwt.create_tokens_from_str(HashMap::from([("sub", "2ca44c87-f9a9-4cb8-bffc-7e5d2e6350cb")]));
pub fn create_tokens( &self, extra_claims: HashMap<String, Value>, ) -> Result<Tokens>
pub fn validate_jwt( &self, jwt: &str, type: TokenType, ) -> Result<HashMap<String, Value>>
Trait Implementations§
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
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<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request