pub struct AuthService { /* private fields */ }Implementations§
Source§impl AuthService
impl AuthService
pub fn new(secret_key: String, encryption_key: String) -> Self
pub fn hash(input: &str) -> Result<String, Box<dyn Error>>
pub fn hash_password(input: &str) -> Result<String, BcryptError>
pub fn verify_password(password: &str, hash: &str) -> Result<bool, BcryptError>
pub fn generate_token<T: Serialize>( &self, email: String, data: T, minutes: i64, ) -> String
pub fn verify_token<T>(&self, token: &str) -> boolwhere
T: for<'de> Deserialize<'de> + Clone,
pub fn is_token_expired<T>(&self, token: &str) -> boolwhere
T: for<'de> Deserialize<'de> + Clone,
pub fn encrypt(&self, input: &str) -> Result<String, Box<dyn Error>>
pub fn decrypt(&self, input: &str) -> Result<String, Box<dyn Error>>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AuthService
impl<'de> Deserialize<'de> for AuthService
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 AuthService
impl RefUnwindSafe for AuthService
impl Send for AuthService
impl Sync for AuthService
impl Unpin for AuthService
impl UnsafeUnpin for AuthService
impl UnwindSafe for AuthService
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