Trait TimeProvider

Source
pub trait TimeProvider {
    // Required method
    fn now(&mut self) -> (u64, Option<u64>);

    // Provided method
    fn past_trusted(&mut self, timestamp: u64) { ... }
}
Expand description

A clock by which time stamps on authorization credentials are compared.

It is yet unspecified whether timestamps are given in Unix time (UTC) or TAI.

§Evolution

Currently this is set up to provide interval and ray time. It may need more interfaces later in order to also accommodate usages where a cnonce is generated (which may then be used to either just validate a token’s time constraints, or may be used together with an iat in the subsequent token to enhance the device’s understanding of time).

Given that the 2038 problem can be mitigated also by using a different offset, we might consider switching to an internal u32 based type that expresses Unix time / TAI with an offset – while the 130 years expressible with it are coming to an end, I’m relatively sure that we can get away with limiting the usable range to 130 years starting from when a concrete firmware is built.

Required Methods§

Source

fn now(&mut self) -> (u64, Option<u64>)

Confidence interval of the clock as lower and upper bound.

Provided Methods§

Source

fn past_trusted(&mut self, timestamp: u64)

Informs the clock that a credential has been ingested from a trusted AS that claims this time to be in the past.

Implementations on Foreign Types§

Source§

impl<T: TimeProvider> TimeProvider for &mut T

Source§

fn now(&mut self) -> (u64, Option<u64>)

Source§

fn past_trusted(&mut self, timestamp: u64)

Implementors§