Skip to main content

Trust

Struct Trust 

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

What an enforcer trusts: the settings setup wrote, the install id it derived itself, and the signer chain that grows from the fingerprint.

Implementations§

Source§

impl Trust

Source

pub fn new( settings: SigningSettings, install: InstallId, chain: &[SignedStatement], ledger: &Ledger, ) -> Result<Self>

Trust chain, which must start at the settings’ fingerprint and reach at least the signer list version ledger holds.

Source

pub fn settings(&self) -> &SigningSettings

The settings.

Source

pub fn install(&self) -> &InstallId

This install.

Source

pub fn project(&self) -> &str

The project, as signer list version 1 names it.

Source

pub fn chain(&self) -> &SignerChain

The signer chain.

Source

pub fn extend_chain(&mut self, statements: &[SignedStatement]) -> Result<bool>

Accept newer signer list versions. Returns whether the chain grew.

Source

pub fn record(&self, ledger: &mut Ledger) -> Result<()>

Record this trust in ledger: the trust root and the chain’s version.

Source

pub fn verify<B: DeserializeOwned>( &self, statement: &SignedStatement, kind: Kind, now: DateTime<Utc>, ) -> Result<Verified<B>>

Run the checks for a statement of kind and parse its body: project and install, the statement’s own expiry, the deny-list and signatures by keys that hold the kind’s role.

Signatures are checked against the current signer list. A statement signed by a key that has left the list is accepted only when the current list’s keep names its digest, kind and sequence: the admins signed that entry with the list, so the ledger and the install’s history play no part, and a new machine or Operator instance accepts it the same way. The deny-list refuses a statement first. Every enforcer applies this one rule.

Source

pub fn verify_release( &self, statement: &SignedStatement, now: DateTime<Utc>, ) -> Result<Verified<ReleaseBody>>

Verify a release for this install’s channel and check its rules.

Source

pub fn verify_config( &self, statement: &SignedStatement, release: &ReleaseBody, now: DateTime<Utc>, ) -> Result<Verified<ConfigBody>>

Verify a config statement for this install against the release it configures.

Trait Implementations§

Source§

impl Clone for Trust

Source§

fn clone(&self) -> Self

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 Trust

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Trust

§

impl Freeze for Trust

§

impl Move for Trust

§

impl RefUnwindSafe for Trust

§

impl Send for Trust

§

impl Sync for Trust

§

impl Unpin for Trust

§

impl UnsafeUnpin for Trust

§

impl UnwindSafe for Trust

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

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.