pub struct Clauses<T> { /* private fields */ }Expand description
A verified mandate’s clauses. Constructible only by the verifier terminals, so its existence is proof the mandate authenticated and decoded as canonical CBOR (the mandate-must-be-authenticated rule of the Security Considerations, §16.2; the Reserved fields section, §8).
use obsigil::{Issuer, MandateKey, NoApp, Verifier};
let token = Issuer::new(MandateKey::from_bytes([42u8; 64])?)
.clauses(&NoApp::default())
.exp(4_000_000_000)
.subject("user-1")
.mint()?;
let key = MandateKey::from_bytes([42u8; 64])?;
let clauses = Verifier::new().key(&key).now(1_000_000_000)
.clauses::<NoApp>(&token)?;
assert_eq!(clauses.exp(), 4_000_000_000);
assert_eq!(clauses.subject(), Some("user-1"));
assert_eq!(clauses.tid().get_version_num(), 7); // UUIDv7 (the `tid` field, §8.2)Implementations§
Source§impl<T> Clauses<T>
impl<T> Clauses<T>
Sourcepub fn exp(&self) -> NumericDate
pub fn exp(&self) -> NumericDate
Authoritative expiry (the exp field, §8.3).
Sourcepub fn issued_at(&self) -> NumericDate
pub fn issued_at(&self) -> NumericDate
Issue time, derived from tid (the tid field, §8.2).
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Clauses<T>where
T: Freeze,
impl<T> RefUnwindSafe for Clauses<T>where
T: RefUnwindSafe,
impl<T> Send for Clauses<T>where
T: Send,
impl<T> Sync for Clauses<T>where
T: Sync,
impl<T> Unpin for Clauses<T>where
T: Unpin,
impl<T> UnsafeUnpin for Clauses<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Clauses<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more