pub struct DbVerificationStore<'a> { /* private fields */ }Implementations§
Source§impl<'a> DbVerificationStore<'a>
impl<'a> DbVerificationStore<'a>
pub fn new(adapter: &'a dyn DbAdapter) -> Self
pub fn from_context(context: &'a AuthContext) -> Result<Self, RustAuthError>
pub fn with_options( adapter: &'a dyn DbAdapter, schema: DbSchema, options: VerificationOptions, ) -> Self
pub fn with_default_schema( adapter: &'a dyn DbAdapter, options: VerificationOptions, ) -> Self
pub async fn create_verification( &self, input: CreateVerificationInput, ) -> Result<Verification, RustAuthError>
pub async fn find_verification( &self, identifier: &str, ) -> Result<Option<Verification>, RustAuthError>
pub async fn find_verification_including_expired( &self, identifier: &str, ) -> Result<Option<Verification>, RustAuthError>
Sourcepub async fn consume_verification_including_expired(
&self,
identifier: &str,
) -> Result<Option<Verification>, RustAuthError>
pub async fn consume_verification_including_expired( &self, identifier: &str, ) -> Result<Option<Verification>, RustAuthError>
Atomically consumes a verification record if present.
Parallel callers racing on the same identifier only observe a successful
consume once: the delete is keyed by both identifier and row id so later
attempts delete zero rows and return None.
Sourcepub async fn compare_and_update_verification_value(
&self,
identifier: &str,
verification_id: &str,
expected_value: &str,
new_value: String,
) -> Result<Option<Verification>, RustAuthError>
pub async fn compare_and_update_verification_value( &self, identifier: &str, verification_id: &str, expected_value: &str, new_value: String, ) -> Result<Option<Verification>, RustAuthError>
Atomically updates a verification row only when its stored value is unchanged.
Parallel callers racing on the same identifier can use this as a compare-and-swap boundary when incrementing attempt counters or other value-encoded state.
pub async fn update_verification( &self, identifier: &str, input: UpdateVerificationInput, ) -> Result<Option<Verification>, RustAuthError>
pub async fn delete_verification( &self, identifier: &str, ) -> Result<(), RustAuthError>
Sourcepub async fn take_verification(
&self,
identifier: &str,
) -> Result<Option<Verification>, RustAuthError>
pub async fn take_verification( &self, identifier: &str, ) -> Result<Option<Verification>, RustAuthError>
Remove and return an active verification, if one exists.
This enforces single-use semantics for challenge-like tokens: concurrent callers only observe the stored value once.
pub async fn take_verification_including_expired( &self, identifier: &str, ) -> Result<Option<Verification>, RustAuthError>
pub async fn delete_expired_verifications(&self) -> Result<u64, RustAuthError>
Trait Implementations§
Source§impl<'a> Clone for DbVerificationStore<'a>
impl<'a> Clone for DbVerificationStore<'a>
Source§fn clone(&self) -> DbVerificationStore<'a>
fn clone(&self) -> DbVerificationStore<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> !RefUnwindSafe for DbVerificationStore<'a>
impl<'a> !UnwindSafe for DbVerificationStore<'a>
impl<'a> Freeze for DbVerificationStore<'a>
impl<'a> Send for DbVerificationStore<'a>
impl<'a> Sync for DbVerificationStore<'a>
impl<'a> Unpin for DbVerificationStore<'a>
impl<'a> UnsafeUnpin for DbVerificationStore<'a>
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