Skip to main content

Client

Struct Client 

Source
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

Source

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.

Source

pub fn from_state( pin: RootPin, state: ClientState, now: Timestamp, ) -> Result<Self>

Restores saved state, re-verifying the whole root chain from the pin.

Source

pub fn pin(&self) -> RootPin

The pin.

Source

pub fn root(&self) -> &Root

The trusted root.

Source

pub fn state(&self) -> &ClientState

State to persist after each change.

Source

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.

Source

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.

Source

pub fn mark_installed(&mut self, update: &VerifiedUpdate)

Records that an update was installed and committed (after its boot check).

Source

pub fn mark_bad(&mut self, update_id: &str)

Records that an update failed its boot check; it is refused from now on.

Trait Implementations§

Source§

impl Debug for Client

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Client

§

impl Freeze for Client

§

impl Move for Client

§

impl RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl UnsafeUnpin for Client

§

impl UnwindSafe for Client

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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.