Expand description
Shared client-side primitives for Cinch CLI and desktop.
Wire DTOs (proto::cinch::v1::*) are generated from the canonical
proto/cinch/v1/*.proto files at build time via prost-build; see
build.rs for the serde attribute injection that keeps wire bytes
byte-equal to the Go relay’s encoding/json omitempty output.
The optional specta feature wires up specta::Type derives on wire
DTOs that desktop exposes to the frontend. CLI builds without it.
Modules§
- auth
- Credential storage —
~/.cinch/config.json(0600 permissions). - auth_
session - Single atomic entry point for installing a fresh sign-in onto disk.
- config
- On-disk client config:
~/.cinch/config.json. - credstore
- Credential store abstraction — plaintext config.json as canonical store.
- crypto
- AES-256-GCM encryption and X25519 ECDH key exchange. Wire format: base64url(nonce[12B] || ciphertext || GCM_tag[16B]).
- http
- REST client for the relay’s legacy HTTP+JSON endpoints.
- key_
exchange - Shared key-exchange responder logic. Both desktop (
ws.rs) and CLI (pull --watch,pair) implement key-bearer behavior by invokingrespondwhen the relay broadcastskey_exchange_requestedfor a peer device that has registered a public key but lacks an encrypted bundle. - machine
- Stable per-machine identifier used to deduplicate device rows on the relay.
- proto
- Generated Rust message types from
proto/cinch/v1/*.proto. - protocol
- Wire protocol types shared across CLI, desktop, and the relay’s WS frame.
- rest
- REST DTOs for the relay’s legacy HTTP+JSON endpoints.
- ser
- Helpers used by generated
#[serde(skip_serializing_if = "...")]attributes to mirror Go’sencoding/jsonomitemptysemantics on scalar fields. - store
- Local SQLite store for clips, devices, prefs. Shared by CLI and desktop.
- sync
- Sync layer — writer (long-lived WS) and reader (short-lived REST backfill). Lockfile coordinates at most one writer per machine.
- ws
- Slim WebSocket subscriber for the relay’s
/wsendpoint.