pub struct DbOtpStore { /* private fields */ }Expand description
Database-backed OTP store for production use.
Stores OTP records in kipuka’s configured database (SQLite, PostgreSQL,
or MariaDB via sqlx). Hash-indexed for O(1) lookup during validation.
Token hashes are stored as hex-encoded strings in the token_hash TEXT
column. The id column is a database auto-increment integer; the
OtpRecord.id UUID is mapped bijectively via Uuid::from_u128.
Implementations§
Trait Implementations§
Source§impl OtpStore for DbOtpStore
Available on crate feature db only.
impl OtpStore for DbOtpStore
Available on crate feature
db only.Source§async fn find_by_hash(&self, hash: &[u8]) -> OtpResult<Option<OtpRecord>>
async fn find_by_hash(&self, hash: &[u8]) -> OtpResult<Option<OtpRecord>>
Find a record by its token hash.
Source§async fn increment_uses(&self, id: &Uuid, max_uses: u32) -> OtpResult<()>
async fn increment_uses(&self, id: &Uuid, max_uses: u32) -> OtpResult<()>
Atomically increment the usage counter for a record. Read more
Source§async fn cleanup_expired(&self) -> OtpResult<u64>
async fn cleanup_expired(&self) -> OtpResult<u64>
Remove all expired records (RHELBU-3536 R12).
Auto Trait Implementations§
impl Freeze for DbOtpStore
impl !RefUnwindSafe for DbOtpStore
impl Send for DbOtpStore
impl Sync for DbOtpStore
impl Unpin for DbOtpStore
impl UnsafeUnpin for DbOtpStore
impl !UnwindSafe for DbOtpStore
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more