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
impl Trust
Sourcepub fn new(
settings: SigningSettings,
install: InstallId,
chain: &[SignedStatement],
ledger: &Ledger,
) -> Result<Self>
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.
Sourcepub fn settings(&self) -> &SigningSettings
pub fn settings(&self) -> &SigningSettings
The settings.
Sourcepub fn chain(&self) -> &SignerChain
pub fn chain(&self) -> &SignerChain
The signer chain.
Sourcepub fn extend_chain(&mut self, statements: &[SignedStatement]) -> Result<bool>
pub fn extend_chain(&mut self, statements: &[SignedStatement]) -> Result<bool>
Accept newer signer list versions. Returns whether the chain grew.
Sourcepub fn record(&self, ledger: &mut Ledger) -> Result<()>
pub fn record(&self, ledger: &mut Ledger) -> Result<()>
Record this trust in ledger: the trust root and the chain’s version.
Sourcepub fn verify<B: DeserializeOwned>(
&self,
statement: &SignedStatement,
kind: Kind,
now: DateTime<Utc>,
) -> Result<Verified<B>>
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.
Sourcepub fn verify_release(
&self,
statement: &SignedStatement,
now: DateTime<Utc>,
) -> Result<Verified<ReleaseBody>>
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.
Sourcepub fn verify_config(
&self,
statement: &SignedStatement,
release: &ReleaseBody,
now: DateTime<Utc>,
) -> Result<Verified<ConfigBody>>
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.