pub struct IdempotencyKey(/* private fields */);Expand description
Domain-separated deduplication key for a non-idempotent effect.
Derived with BLAKE3 in derive_key mode from (execution_id, step_id, op_fingerprint). The
derivation is injective (length-delimited input) so an attacker-controlled op_fingerprint
cannot be crafted to collide with a different (execution_id, step_id) pair. The key is a
deduplication discriminator only — never the sole trust basis for skipping a guarded effect.
§Examples
use zeph_durable::{ExecutionId, IdempotencyKey, StepId};
let exec = ExecutionId::new();
let a = IdempotencyKey::derive(exec, StepId::new(0), b"transfer:acct-7");
let b = IdempotencyKey::derive(exec, StepId::new(0), b"transfer:acct-7");
let c = IdempotencyKey::derive(exec, StepId::new(1), b"transfer:acct-7");
assert_eq!(a, b, "same inputs derive the same key");
assert_ne!(a, c, "a different step derives a different key");Implementations§
Source§impl IdempotencyKey
impl IdempotencyKey
Sourcepub fn derive(
execution_id: ExecutionId,
step_id: StepId,
op_fingerprint: &[u8],
) -> Self
pub fn derive( execution_id: ExecutionId, step_id: StepId, op_fingerprint: &[u8], ) -> Self
Derive an idempotency key from the execution identity, step position, and an opaque operation fingerprint.
The fingerprint MUST be derived from non-secret descriptors only (e.g. a tool name and its non-secret arguments); resolved secret material MUST NOT be passed here (INV-6).
The input is length-delimited — len(execution_id) || execution_id || len(step_id) || step_id || op_fingerprint — so the field boundaries are unambiguous and the derivation is
injective. The fixed BLAKE3 derive_key context string keeps these keys disjoint from any
other BLAKE3 use in the workspace.
Trait Implementations§
Source§impl Clone for IdempotencyKey
impl Clone for IdempotencyKey
Source§fn clone(&self) -> IdempotencyKey
fn clone(&self) -> IdempotencyKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for IdempotencyKey
Source§impl Debug for IdempotencyKey
impl Debug for IdempotencyKey
Source§impl<'de> Deserialize<'de> for IdempotencyKey
impl<'de> Deserialize<'de> for IdempotencyKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for IdempotencyKey
Source§impl Hash for IdempotencyKey
impl Hash for IdempotencyKey
Source§impl PartialEq for IdempotencyKey
impl PartialEq for IdempotencyKey
Source§impl Serialize for IdempotencyKey
impl Serialize for IdempotencyKey
impl StructuralPartialEq for IdempotencyKey
Auto Trait Implementations§
impl Freeze for IdempotencyKey
impl RefUnwindSafe for IdempotencyKey
impl Send for IdempotencyKey
impl Sync for IdempotencyKey
impl Unpin for IdempotencyKey
impl UnsafeUnpin for IdempotencyKey
impl UnwindSafe for IdempotencyKey
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
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> ⓘ
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> ⓘ
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