pub struct PasetoAuth { /* private fields */ }Expand description
A securely typed PASETO Auth Engine
Implementations§
Source§impl PasetoAuth
impl PasetoAuth
pub fn new(secret: Secret<String>) -> Result<Self, AppError>
Sourcepub fn generate_token(
&self,
payload: &AuthPayload,
duration: Duration,
) -> Result<String, AppError>
pub fn generate_token( &self, payload: &AuthPayload, duration: Duration, ) -> Result<String, AppError>
Generates a local (symmetric) PASETO v4 token
Sourcepub fn validate_token(&self, token: &str) -> Result<AuthPayload, AppError>
pub fn validate_token(&self, token: &str) -> Result<AuthPayload, AppError>
Validates a PASETO v4 token and returns the payload if successful
Auto Trait Implementations§
impl Freeze for PasetoAuth
impl RefUnwindSafe for PasetoAuth
impl Send for PasetoAuth
impl Sync for PasetoAuth
impl Unpin for PasetoAuth
impl UnsafeUnpin for PasetoAuth
impl UnwindSafe for PasetoAuth
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