Skip to main content

Module command

Module command 

Source
Expand description

Commands from a device of the account to one of its machines (#88): to start or end a session, and later others.

They travel as input and output on a command channel of the machine’s relay session, so the relay carries them like any other bytes. The machine answers a ToMachine::Hello with a fresh FromMachine::Challenge: a nonce and a one-time X25519 key, signed by the machine’s key. The device signs the command, bound to the machine and the nonce, with the account’s key, and seals it to the one-time key. The machine opens it, checks the signature against the account key it pinned at registration, uses the nonce once, runs the command and seals the outcome to the account. The relay learns that a command went and its size.

Structs§

SessionInfo
One of the machine’s sessions, as Command::List gives it.
Signed
A command and the account’s signature of command_bytes.

Enums§

Command
What the device asks.
FromMachine
From the machine, as the data of an output.
Outcome
How a command went.
ToMachine
From the device, as the data of an input.

Constants§

CHANNEL_PREFIX
What a command channel’s name starts with. Session channels are hex, so the m keeps the two apart.
MAX_FRAME
The most a command frame may take: room for a list of a few hundred sessions (bytes go as JSON numbers).

Functions§

challenge_bytes
What the machine signs in a challenge.
command_bytes
What the account signs: the command, bound to the machine and the challenge’s nonce.
command_info
What a sealed command is bound to.
is_command_channel
Whether channel is a command channel.
reply_bytes
What the machine signs in a reply: the sealed outcome, bound to the machine and the challenge’s nonce.
reply_info
What a sealed outcome is bound to.