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: StringThe provider id (host routing/consent key) this receipt authorizes.
scope: EgressScopeThe 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: StringThe provider’s declared name at grant time — pinned so the audit trail survives the provider being renamed or swapped.
provider_version: StringThe provider’s declared version at grant time.
grantor: GrantorWho granted consent (a human or a policy).
granted_at: StringWhen 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
impl ConsentReceipt
Sourcepub fn new(
provider_id: impl Into<String>,
info: &ProviderInfo,
scope: EgressScope,
grantor: Grantor,
granted_at: impl Into<String>,
) -> Self
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.
Sourcepub fn with_expiry(self, expires_at: impl Into<String>) -> Self
pub fn with_expiry(self, expires_at: impl Into<String>) -> Self
Set the receipt’s expiry (RFC 3339).
Sourcepub fn is_live(&self, now: &str) -> bool
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
impl Clone for ConsentReceipt
Source§fn clone(&self) -> ConsentReceipt
fn clone(&self) -> ConsentReceipt
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more