Skip to main content

Crate client_core

Crate client_core 

Source
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. The desktop’s sync writer and cinch pull --watch both invoke handle_event when the relay broadcasts key_exchange_requested for 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’s encoding/json omitempty semantics 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 /ws endpoint.