dig-capsule 0.5.0

The DIG Network .dig capsule data plane — one crate over the DIGS format, capsule read-crypto, compiler, staging, and the guest/host serve triad.
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Temporal keys (§16). A request may carry a validity window; the guest checks
//! it against host_get_current_time. Outside the window -> the content path
//! returns a decoy (indistinguishable from a real miss).

use crate::imp::guest::request::ValidityWindow;

/// True iff `now` is within `[not_before, not_after]`, or no window is set.
pub fn within_window(window: &Option<ValidityWindow>, now: u64) -> bool {
    match window {
        None => true,
        Some(w) => now >= w.not_before && now <= w.not_after,
    }
}