pub struct DesSaltState { /* private fields */ }Expand description
Caller-owned durable sender state for DES and 3DES privacy.
One value (or its clones) must be shared by every live sender using the
same effective localized encryption-key/pre-IV domain. install requires
an atomic create-if-absent lease for a new domain, while restart requires
an atomic compare-and-set from the supplied previous epoch to the attempted
epoch. Those contracts reject a second live process starting from the same
durable state.
Implementations§
Source§impl DesSaltState
impl DesSaltState
Sourcepub fn install<E, F>(persist: F) -> Result<Self, DesSaltStateError>
pub fn install<E, F>(persist: F) -> Result<Self, DesSaltStateError>
Install a new DES key domain, persisting boots epoch 1 before use.
The callback must atomically create the durable record only if it does not already exist. A competing installer for the same effective key domain must return an error rather than lease epoch 1 twice.
Sourcepub fn restart<E, F>(
previous: PersistedDesSaltState,
persist: F,
) -> Result<Self, DesSaltStateError>
pub fn restart<E, F>( previous: PersistedDesSaltState, persist: F, ) -> Result<Self, DesSaltStateError>
Atomically advance persisted state and create a fresh boots epoch.
The callback must compare-and-set durable state from previous to the
supplied attempted state; a stale second live owner must return an error.
Sourcepub fn engine_boots(&self) -> u32
pub fn engine_boots(&self) -> u32
Return the local generating-engine boots epoch used in DES salts.
Sourcepub fn persisted_state(&self) -> PersistedDesSaltState
pub fn persisted_state(&self) -> PersistedDesSaltState
Return the durable record needed by a later process restart.
Sourcepub fn reserve(&self) -> PrivacyResult<DesSaltReservation>
pub fn reserve(&self) -> PrivacyResult<DesSaltReservation>
Irrevocably allocate the next salt in this boots epoch.
The reservation is burned even if later message encoding or encryption fails. It cannot be constructed or reused with a different epoch.
Trait Implementations§
Source§impl Clone for DesSaltState
impl Clone for DesSaltState
Source§fn clone(&self) -> DesSaltState
fn clone(&self) -> DesSaltState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more