pub enum TimeLockCadence {
None,
DayOfWeek(Weekday),
DayOfMonth(u8),
MonthOfYear(Month),
DayOfWeekInMonth(Weekday, Month),
DayOfMonthInMonth(u8, Month),
DayOfWeekAndDayOfMonth(Weekday, u8),
}Expand description
Calendar cadence for a scheduled time-lock — constrains key derivation to a recurring calendar pattern in addition to the time-of-day window.
Combine with a TimeLockTime on the encryption path to express policies
such as:
- “valid only on Tuesdays at 18:00” —
DayOfWeek(Weekday::Tuesday)+ 18 h - “valid only on the 1st of each month at 00:00” —
DayOfMonth(1)+ 0 h - “valid only on Tuesdays in February at 06:00” —
DayOfWeekInMonth(Weekday::Tuesday, Month::February)+ 6 h
On the decryption side, pass the cadence to pack (along with precision
and format) to obtain a TimeLockParams for storage in the ciphertext
header.
TimeLockCadence::None is equivalent to a call without any calendar
constraint — no calendar dimension is incorporated into the KDF input.
§Panics
Constructing DayOfMonthInMonth is
always valid, but key derivation panics if the stored day exceeds the
month’s maximum (for example, day 29 for February or day 31 for April).
Variants§
None
No calendar constraint — behaves like a plain time-lock.
Compact discriminant: 0.
DayOfWeek(Weekday)
Valid only on the specified weekday.
Compact discriminant: 1.
DayOfMonth(u8)
Valid only on the specified day of any month (1–31).
Days 29–31 simply never match in shorter months.
Compact discriminant: 2.
MonthOfYear(Month)
Valid only during the specified month of any year.
Compact discriminant: 3.
DayOfWeekInMonth(Weekday, Month)
Valid only on the specified weekday and during the specified month.
Compact discriminant: 4.
DayOfMonthInMonth(u8, Month)
Valid only on the specified day of the specified month.
Key derivation panics if the day exceeds the month’s maximum.
Compact discriminant: 5.
DayOfWeekAndDayOfMonth(Weekday, u8)
Valid only on the specified weekday and the specified day of month.
Days 29–31 do not match in shorter months.
Compact discriminant: 6.
Implementations§
Source§impl TimeLockCadence
impl TimeLockCadence
Sourcepub fn variant_id(self) -> u8
pub fn variant_id(self) -> u8
Returns the compact variant discriminant stored in
TimeLockParams::cadence_variant.
Trait Implementations§
Source§impl Clone for TimeLockCadence
impl Clone for TimeLockCadence
Source§fn clone(&self) -> TimeLockCadence
fn clone(&self) -> TimeLockCadence
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TimeLockCadence
impl Debug for TimeLockCadence
Source§impl Default for TimeLockCadence
Available on crate features enc-timelock-keygen-now or enc-timelock-keygen-input or enc-timelock-async-keygen-now or enc-timelock-async-keygen-input only.
impl Default for TimeLockCadence
enc-timelock-keygen-now or enc-timelock-keygen-input or enc-timelock-async-keygen-now or enc-timelock-async-keygen-input only.Source§impl PartialEq for TimeLockCadence
impl PartialEq for TimeLockCadence
impl Copy for TimeLockCadence
impl Eq for TimeLockCadence
impl StructuralPartialEq for TimeLockCadence
Auto Trait Implementations§
impl Freeze for TimeLockCadence
impl RefUnwindSafe for TimeLockCadence
impl Send for TimeLockCadence
impl Sync for TimeLockCadence
impl Unpin for TimeLockCadence
impl UnsafeUnpin for TimeLockCadence
impl UnwindSafe for TimeLockCadence
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.