pub struct ArkSide<R: Read, W: Write, A: Attester> { /* private fields */ }Expand description
Ark side of the wire, an encrypted transport for serving protobuf requests from a connected host. It waits for session resets (empty frames), responds to handshake and afterward decrypts inbound and encrypts outbound messages.
The device attestation is not interpreted by the wire, it is provided by an
Attester and forwarded to the host verbatim.
Implementations§
Source§impl<R: Read, W: Write, A: Attester> ArkSide<R, W, A>
impl<R: Read, W: Write, A: Attester> ArkSide<R, W, A>
Sourcepub fn new(reader: R, writer: W, signer: SecretKey, attester: A) -> Self
pub fn new(reader: R, writer: W, signer: SecretKey, attester: A) -> Self
Creates a new Ark side around a low level reader and writer. The signer is the Ark’s identity key, which signs the handshake; the host verifies that signature against the key it extracts from the attestation, so the two must match. Reads block per the transport’s semantics, so any timeout must be configured on the reader passed in.
Sourcepub fn next_message(&mut self) -> Result<HostToArk, Error>
pub fn next_message(&mut self) -> Result<HostToArk, Error>
Serves the next host-to-ark message, decrypting and protobuf decoding it. Empty frames are session resets and run the handshake inline; junk outside a session, undecryptable packets and failed handshakes are logged and skipped, so only transport failures and malformed messages surface as errors.