pub trait OtpStore: Send + Sync {
// Required methods
fn insert(
&self,
record: OtpRecord,
) -> impl Future<Output = OtpResult<()>> + Send;
fn find_by_hash(
&self,
hash: &[u8],
) -> impl Future<Output = OtpResult<Option<OtpRecord>>> + Send;
fn increment_uses(
&self,
id: &Uuid,
new_count: u32,
) -> impl Future<Output = OtpResult<()>> + Send;
fn revoke(&self, id: &Uuid) -> impl Future<Output = OtpResult<()>> + Send;
fn cleanup_expired(&self) -> impl Future<Output = OtpResult<u64>> + Send;
}Expand description
Trait for pluggable OTP storage backends.
Implementors must be Send + Sync for use in async contexts.
Required Methods§
Sourcefn insert(
&self,
record: OtpRecord,
) -> impl Future<Output = OtpResult<()>> + Send
fn insert( &self, record: OtpRecord, ) -> impl Future<Output = OtpResult<()>> + Send
Insert a new OTP record.
Sourcefn find_by_hash(
&self,
hash: &[u8],
) -> impl Future<Output = OtpResult<Option<OtpRecord>>> + Send
fn find_by_hash( &self, hash: &[u8], ) -> impl Future<Output = OtpResult<Option<OtpRecord>>> + Send
Find a record by its token hash.
Sourcefn increment_uses(
&self,
id: &Uuid,
new_count: u32,
) -> impl Future<Output = OtpResult<()>> + Send
fn increment_uses( &self, id: &Uuid, new_count: u32, ) -> impl Future<Output = OtpResult<()>> + Send
Increment the usage counter for a record.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.