Skip to main content

CapabilityAmendment

Struct CapabilityAmendment 

Source
pub struct CapabilityAmendment { /* private fields */ }
Expand description

A pending amendment to an existing capability.

Two kinds of change accumulate here:

Implementations§

Source§

impl CapabilityAmendment

Source

pub fn designation( self, label: impl Into<String>, value: impl Into<String>, ) -> Self

Require a designation: adds check if designation(label, value).

Source

pub fn designation_trusting( self, pk: PublicKey, label: impl Into<String>, value: impl Into<String>, ) -> Self

Require a designation that must be attested by pk: adds check if designation(label, value) trusting {pk}.

Source

pub fn valid_for(self, duration: Duration) -> Self

Tighten the capability’s lifetime to duration from now. Checks only accumulate, so this can shorten the window, never extend it.

Source

pub fn activate(self) -> Self

Attest that this (latent) capability is active as of now: supplies an activation fact, satisfying a latent capability’s activation check. Only meaningful under Self::attest (the signer vouches for it).

Source

pub fn with_designation( self, label: impl Into<String>, value: impl Into<String>, ) -> Self

Attest a designation fact: supplies designation(label, value), satisfying a matching designation_trusting constraint. Mirrors crate::CapabilityVerifier::with_designation. Only meaningful under Self::attest.

Source

pub fn with_time(self, time_config: TokenTimeConfig) -> Self

Supply a TokenTimeConfig to control time. Only start_time is used here: when set it overrides “now” for the activation fact and the tightened-window deadline (the seam for deterministic tests). duration is ignored – amend’s time check is opt-in via Self::valid_for.

Source

pub fn attenuate(self) -> Result<String, TokenError>

Finalize as a keyless attenuation: appends a first-party block carrying only the require-side constraints. Errors if any attestation (a provide-side fact) was added – those require a signature via Self::attest.

Source

pub fn attest(self, keypair: &KeyPair) -> Result<String, TokenError>

Finalize as an attestation: a third-party block signed by keypair carrying the attested facts plus any constraints. The signer vouches for the facts; constraints (trusting {keypair.public()}) reference this signer so the matching facts are honored only from blocks it signed.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more