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
impl DeviceComponentTestOnly
Sourcepub fn new(
seed: &[u8],
capacity: usize,
clock: Arc<dyn V2AuthoritativeClock>,
) -> V2Result<Self>
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.
Sourcepub fn public_key(&self) -> Vec<u8> ⓘ
pub fn public_key(&self) -> Vec<u8> ⓘ
The component key the primary pins.
Sourcepub fn set_power_loss(&self, fault: DevicePowerLoss)
pub fn set_power_loss(&self, fault: DevicePowerLoss)
Arm a power loss for the next submission only.
Sourcepub fn head(&self) -> (i64, Option<Vec<u8>>, bool)
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.
Sourcepub fn provision_state(&self, digest: &[u8]) -> V2Result<()>
pub fn provision_state(&self, digest: &[u8]) -> V2Result<()>
Anchor the primary’s initial complete-state digest. Accepted once, before any other anchor or acknowledgement.
Sourcepub fn anchor_state(
&self,
previous: &[u8],
next: &[u8],
) -> Result<(), DeviceErrorTestOnly>
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.
Sourcepub fn commit(
&self,
ctx: &V2Context,
log_id: &str,
sequence: i64,
previous_entry_hash: &[u8],
entry_hash: &[u8],
state: &[u8],
) -> Result<DeviceAcknowledgementTestOnly, DeviceErrorTestOnly>
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.
Sourcepub fn get(
&self,
log_id: &str,
sequence: i64,
) -> Result<DeviceAcknowledgementTestOnly, V2StoreError>
pub fn get( &self, log_id: &str, sequence: i64, ) -> Result<DeviceAcknowledgementTestOnly, V2StoreError>
The record for sequence, or AcknowledgementNotFound.