Skip to main content

Module trust

Module trust 

Source
Expand description

Per-device trust for nearby sharing: every device seen on the network or in a request has one record, and the owner sets it to Allow, Ask or Deny.

  • Allow: a request is accepted without a card, files and text alike, but only from a sender that proves a key (receive::prepare_upload): by the client certificate it presents (proof = "certificate", identity), or, for senders that present none, by answering a connect-back handshake at the address it calls from (proof = "callback"). A callback is relayable by anyone on the network while the real device is online, so it is a convenience tier only: it skips the card, but the sender stays unproven (files kept apart, no clipboard, size caps). Without proof the request is asked about.
  • Ask: every request raises a card, text included.
  • Deny: a request is answered 403 at once and counted in refused.

The records live in the trust store file the host names (Config::trust_path). The legacy known-devices.json next to it is read once, when that file is absent. Fingerprints (always lowercase, see normalize) are the policy key; the alias, model and kind are only what the device claimed, and the owner’s own name for it is label.

Structs§

TrustEntry
What the owner decided about one device, and what it last claimed to be.

Enums§

TrustState

Constants§

MAX_UNDECIDED
Unlabelled records the owner never decided on, kept at most; past this the oldest makes room. Allow, Deny and labelled records are never dropped.
PROOF_CALLBACK
PROOF_CERTIFICATE

Functions§

normalize
The one spelling of a fingerprint used as a key everywhere.