twizzler_security/
revocation.rs

1/// Specifies when a Capability is invalid.
2/// Currenty is a time in ns from unix epoch but
3/// plan to change later.
4#[derive(Clone, Copy, PartialEq, Eq, Debug)]
5pub struct Revoc {
6    inner: u128,
7}
8
9//TODO: impl all the revoc stuff (comparison, creating, allat)
10
11impl Revoc {
12    pub fn new(time: u128) -> Self {
13        Revoc { inner: time }
14    }
15
16    /// Represents a revocation as an owned array of bytes
17    pub fn to_bytes(&self) -> [u8; 16] {
18        self.inner.to_le_bytes()
19    }
20}
21
22impl Default for Revoc {
23    fn default() -> Self {
24        //TODO: come up with a sensible default
25        Self { inner: 0 }
26    }
27}