Skip to main content

DeviceComponentTestOnly

Struct DeviceComponentTestOnly 

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

The independent monotonic authenticated component (Go DeviceComponentTestOnly). Its clock is the device’s configured security-clock source.

Implementations§

Source§

impl DeviceComponentTestOnly

Source

pub fn new( seed: &[u8], capacity: usize, clock: Arc<dyn V2AuthoritativeClock>, ) -> V2Result<Self>

Go NewDeviceComponentTestOnly: a component with its own signing key (from a 32-byte test seed) and room for capacity acknowledgements.

Source

pub fn public_key(&self) -> Vec<u8> ⓘ

The component key the primary pins.

Source

pub fn set_power_loss(&self, fault: DevicePowerLoss)

Arm a power loss for the next submission only.

Source

pub fn head(&self) -> (i64, Option<Vec<u8>>, bool)

The acknowledged sequence (0 before the first acknowledgement), the anchored complete-state digest (None before provisioning), and whether the component is frozen.

Source

pub fn provision_state(&self, digest: &[u8]) -> V2Result<()>

Anchor the primary’s initial complete-state digest. Accepted once, before any other anchor or acknowledgement.

Source

pub fn anchor_state( &self, previous: &[u8], next: &[u8], ) -> Result<(), DeviceErrorTestOnly>

Advance the anchored complete-state digest from previous to next. previous must equal the anchored digest: a primary whose state was rolled back, restored, or altered cannot extend it. The register only moves forward through this call; nothing lowers or restores it.

Source

pub fn commit( &self, ctx: &V2Context, log_id: &str, sequence: i64, previous_entry_hash: &[u8], entry_hash: &[u8], state: &[u8], ) -> Result<DeviceAcknowledgementTestOnly, DeviceErrorTestOnly>

Go Commit: record the next receipt-log entry. It accepts only sequence head+1 whose previous entry hash equals the head’s and whose state digest equals the anchored complete-state digest. An identical retry (same log ID and entry hash) of an acknowledged sequence returns the original record, and a different entry at an acknowledged sequence freezes the component.

Source

pub fn get( &self, log_id: &str, sequence: i64, ) -> Result<DeviceAcknowledgementTestOnly, V2StoreError>

The record for sequence, or AcknowledgementNotFound.

Trait Implementations§

Source§

impl Debug for DeviceComponentTestOnly

Source§

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

Formats the value using the given formatter. Read more

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

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.