Skip to main content

OtpStore

Trait OtpStore 

Source
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§

Source

fn insert( &self, record: OtpRecord, ) -> impl Future<Output = OtpResult<()>> + Send

Insert a new OTP record.

Source

fn find_by_hash( &self, hash: &[u8], ) -> impl Future<Output = OtpResult<Option<OtpRecord>>> + Send

Find a record by its token hash.

Source

fn increment_uses( &self, id: &Uuid, new_count: u32, ) -> impl Future<Output = OtpResult<()>> + Send

Increment the usage counter for a record.

Source

fn revoke(&self, id: &Uuid) -> impl Future<Output = OtpResult<()>> + Send

Mark a record as revoked.

Source

fn cleanup_expired(&self) -> impl Future<Output = OtpResult<u64>> + Send

Remove all expired records (RHELBU-3536 R12).

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.

Implementors§