pub struct NonceStore { /* private fields */ }Expand description
Per-address pending nonce (issued at /siwe/nonce, consumed at /siwe/verify). Single-use, 5-min TTL.
Implementations§
Source§impl NonceStore
impl NonceStore
pub fn new() -> Self
Sourcepub fn issue(&self, address: &str) -> String
pub fn issue(&self, address: &str) -> String
Mint + stash a nonce for address. Overwrites any existing
nonce for that address (reissue is fine — only one in-flight
challenge per address).
Sourcepub fn take(&self, address: &str) -> Option<String>
pub fn take(&self, address: &str) -> Option<String>
Consume the stored nonce for address (single-use). Returns
None for unknown OR expired entries — but DOESN’T remove an
expired entry early (an attacker repeatedly posting expired
nonces would otherwise burn the slot and DoS legitimate
retries).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for NonceStore
impl RefUnwindSafe for NonceStore
impl Send for NonceStore
impl Sync for NonceStore
impl Unpin for NonceStore
impl UnsafeUnpin for NonceStore
impl UnwindSafe for NonceStore
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