pub struct NonceStore { /* private fields */ }Expand description
A store for confirmation nonces with TTL-based expiration.
Nonces are 8-character hex strings that gate dangerous operations.
They remain valid until their TTL expires — not consumed on validation —
making operations idempotent: a retried rm --confirm=abc123 bigdir/
works if the nonce hasn’t expired.
Implementations§
Source§impl NonceStore
impl NonceStore
Sourcepub fn lookup(&self, nonce: &str) -> Result<NonceScope, String>
pub fn lookup(&self, nonce: &str) -> Result<NonceScope, String>
Look up a nonce’s scope without validating against a command/path.
Returns the scope if the nonce exists and hasn’t expired, or an error. Useful for embedders building custom confirmation UIs.
Sourcepub fn issue(&self, command: &str, paths: &[&str]) -> String
pub fn issue(&self, command: &str, paths: &[&str]) -> String
Issue a new nonce for the given command and paths.
Returns an 8-character hex string. Opportunistically GCs expired nonces.
Sourcepub fn validate(
&self,
nonce: &str,
command: &str,
paths: &[&str],
) -> Result<(), String>
pub fn validate( &self, nonce: &str, command: &str, paths: &[&str], ) -> Result<(), String>
Validate a nonce against a command and paths.
Checks that the nonce exists, hasn’t expired, the command matches, and the confirmed paths are a subset of the authorized paths.
Does NOT consume the nonce — it stays valid until TTL expires.
Trait Implementations§
Source§impl Clone for NonceStore
impl Clone for NonceStore
Source§fn clone(&self) -> NonceStore
fn clone(&self) -> NonceStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NonceStore
impl Debug for NonceStore
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.