Skip to main content

Crate teter_client

Crate teter_client 

Source
Expand description

A client’s connection to the teter relay, over ws:// or wss://, and the protocol messages sent and received on it. Shared by the backend and the frontend.

Modules§

account
The client side of accounts: the crypto (teter_core::account, re-exported here) and the requests to the relay’s account service (teter_common::account), with a machine’s authentication.
command
The device’s side of commands to a machine (#88): see teter_common::command. Split in steps so a caller (or a test) can hold a challenge, a sealed command and the channel apart.
e2e
End-to-end encryption between backend and frontend: the relay forwards terminal data it cannot read. See docs/architecture.md, “End-to-end encryption”, for the design.
history
A session’s history kept on disk across restarts (#93), as a frontend gets it: the machine seals each chunk of what its terminal printed to the account’s public keys (crate::account::seal_to with CHUNK_INFO), so it can write them but not read them back; after a restart, the session process sends the chunks it kept before, unopened, with the time it started and its screen, in one replay of kind crate::e2e::Kind::History; the device opens the chunks with the account’s private key.
sessions
The account’s machines and sessions as the relay lists them (#87, #133), checked and opened with the account’s keys: what a device may trust of a Sessions answer, never the relay’s word.

Structs§

Identity
A client certificate and its private key, as PEM files: what a relay that asks for client certificates (--client-ca, #159) takes.

Constants§

CLIENT_CERT_VAR
The environment variable naming the client certificate.
CLIENT_KEY_VAR
The environment variable naming the client certificate’s key.

Traits§

Io
A byte stream: plain TCP, or TLS over TCP.

Functions§

connect
Connect to url (ws://host:port/path or wss://...). For wss://, the relay’s certificate must chain to the system’s roots, or to ca_cert (a PEM file) when given; the client certificate Identity::from_env names, if any, goes to a relay that asks for one.
connect_as
connect, presenting identity (a client certificate) over wss:// rather than the one the environment names.
recv
The next protocol message on stream (a Relay, or its receiving half), or None once the relay closed the connection.
send
Send one protocol message on sink (a Relay, or its sending half).

Type Aliases§

Relay
A WebSocket connection to the relay.