pub struct Client { /* private fields */ }Expand description
An app’s update verifier: the pinned root, the trusted root chain and anti-rollback state.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(pin: RootPin, initial_root: &Signed, now: Timestamp) -> Result<Self>
pub fn new(pin: RootPin, initial_root: &Signed, now: Timestamp) -> Result<Self>
Starts from the first root, checked against the pin compiled into the app.
Sourcepub fn from_state(
pin: RootPin,
state: ClientState,
now: Timestamp,
) -> Result<Self>
pub fn from_state( pin: RootPin, state: ClientState, now: Timestamp, ) -> Result<Self>
Restores saved state, re-verifying the whole root chain from the pin.
Sourcepub fn state(&self) -> &ClientState
pub fn state(&self) -> &ClientState
State to persist after each change.
Sourcepub fn update_root(&mut self, env: &Signed, now: Timestamp) -> Result<()>
pub fn update_root(&mut self, env: &Signed, now: Timestamp) -> Result<()>
Applies a root rotation. Versions at or below the trusted one are ignored if they are the same document, and refused otherwise.
Sourcepub fn verify(
&mut self,
app: &str,
channel: &str,
bundle: &UpdateBundle,
opts: &VerifyOptions,
) -> Result<VerifiedUpdate>
pub fn verify( &mut self, app: &str, channel: &str, bundle: &UpdateBundle, opts: &VerifyOptions, ) -> Result<VerifiedUpdate>
Runs the acceptance rule for app/channel and records the seq on success.
Sourcepub fn verify_announcement(
&self,
env: &Signed,
now: Timestamp,
) -> Result<Option<Announcement>>
pub fn verify_announcement( &self, env: &Signed, now: Timestamp, ) -> Result<Option<Announcement>>
Checks an announcement heard from a relay against the trusted root, and whether it is
news: Ok(None) if this client already saw that seq or a later one. On Some, fetch
the bundle (from the announcement’s sources or anywhere) and run Client::verify;
the announcement itself never makes an update acceptable.
Sourcepub fn mark_installed(&mut self, update: &VerifiedUpdate)
pub fn mark_installed(&mut self, update: &VerifiedUpdate)
Records that an update was installed and committed (after its boot check).