pub struct InMemoryExecutionNonceStore { /* private fields */ }Expand description
In-memory LRU-backed execution nonce store.
Mirrors the shape of dpop::DpopNonceStore but keys on the nonce_id
alone because the full binding lives inside the signed body and is
checked separately by verify_execution_nonce.
Implementations§
Source§impl InMemoryExecutionNonceStore
impl InMemoryExecutionNonceStore
Sourcepub fn new(capacity: usize, ttl: Duration) -> Self
pub fn new(capacity: usize, ttl: Duration) -> Self
Create a new in-memory store.
capacity is the maximum number of recently consumed nonces to
remember. ttl is how long a nonce entry is retained. After ttl
elapses the slot can be recycled (which matters only for long-lived
kernels – the signed body’s expires_at still prevents actual
replay because verify will have already rejected on expiry).
Sourcepub fn from_config(config: &ExecutionNonceConfig) -> Self
pub fn from_config(config: &ExecutionNonceConfig) -> Self
Build a store with the TTL and capacity from config.
Trait Implementations§
Source§impl ExecutionNonceStore for InMemoryExecutionNonceStore
impl ExecutionNonceStore for InMemoryExecutionNonceStore
Source§fn reserve(&self, nonce_id: &str) -> Result<bool, KernelError>
fn reserve(&self, nonce_id: &str) -> Result<bool, KernelError>
Attempt to reserve (consume) the given nonce identifier. Read more
Source§fn reserve_until(
&self,
nonce_id: &str,
_nonce_expires_at: i64,
) -> Result<bool, KernelError>
fn reserve_until( &self, nonce_id: &str, _nonce_expires_at: i64, ) -> Result<bool, KernelError>
Reserve a nonce while telling the store when the nonce stops
being cryptographically valid. Durable implementations (SQLite,
remote KV stores) MUST retain the consumed marker until at least
nonce_expires_at so replay protection covers the nonce’s full
validity window. Read moreAuto Trait Implementations§
impl !Freeze for InMemoryExecutionNonceStore
impl RefUnwindSafe for InMemoryExecutionNonceStore
impl Send for InMemoryExecutionNonceStore
impl Sync for InMemoryExecutionNonceStore
impl Unpin for InMemoryExecutionNonceStore
impl UnsafeUnpin for InMemoryExecutionNonceStore
impl UnwindSafe for InMemoryExecutionNonceStore
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