Skip to main content

ConsentReceipt

Struct ConsentReceipt 

Source
pub struct ConsentReceipt {
    pub provider_id: String,
    pub scope: EgressScope,
    pub provider_name: String,
    pub provider_version: String,
    pub grantor: Grantor,
    pub granted_at: String,
    pub expires_at: Option<String>,
}
Expand description

An audit-grade record that consent was granted for one provider to send content under one egress scope (docs/context-reuse.md §3).

It pins the provider’s identity at grant time (so a later rename can’t retroactively rewrite what was agreed), names the Grantor, and carries an optional expiry.

Fields§

§provider_id: String

The provider id (host routing/consent key) this receipt authorizes.

§scope: EgressScope

The egress scope consented to. Content leaving this provider under this scope is authorized; any other off-machine scope it declares is not, until its own receipt exists.

§provider_name: String

The provider’s declared name at grant time — pinned so the audit trail survives the provider being renamed or swapped.

§provider_version: String

The provider’s declared version at grant time.

§grantor: Grantor

Who granted consent (a human or a policy).

§granted_at: String

When consent was granted (RFC 3339), supplied by the host’s clock.

§expires_at: Option<String>

When consent expires (RFC 3339), if it does. None ⇒ open-ended.

Implementations§

Source§

impl ConsentReceipt

Source

pub fn new( provider_id: impl Into<String>, info: &ProviderInfo, scope: EgressScope, grantor: Grantor, granted_at: impl Into<String>, ) -> Self

Record consent for provider to egress under scope, granted by grantor at granted_at (an RFC 3339 instant from the host’s clock). The provider’s identity is copied out of info and pinned into the receipt. Open-ended by default; add an expiry with with_expiry.

Source

pub fn with_expiry(self, expires_at: impl Into<String>) -> Self

Set the receipt’s expiry (RFC 3339).

Source

pub fn is_live(&self, now: &str) -> bool

Whether this receipt is still live at now (an RFC 3339 instant). A receipt with no expiry is always live; otherwise it is live while now < expires_at.

The comparison is lexicographic on the RFC 3339 strings, which is correct for fixed-width UTC (Z) timestamps — the form a host stamps — so liveness needs no calendar parsing and the type stays dependency-free. The runtime consent gate is presence-based (it does not carry a clock); a host that enforces expiry consults this against its own now.

Trait Implementations§

Source§

impl Clone for ConsentReceipt

Source§

fn clone(&self) -> ConsentReceipt

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConsentReceipt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ConsentReceipt

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ConsentReceipt

Source§

impl PartialEq for ConsentReceipt

Source§

fn eq(&self, other: &ConsentReceipt) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ConsentReceipt

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ConsentReceipt

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.