Skip to content

Technical Specification

This specification is split across the following pages:

  1. Overview, Architecture & Protocol Stack — this page
  2. Security Model — key hierarchy, threat model, trust assumptions
  3. Wire Protocol — message specification and envelope format
  4. Client Library — public API, configuration, events, encryption flow
  5. Relay Server — responsibilities, storage schema, behavior, rate limits
  6. Pairing & Devices — pairing flow, device revocation
  7. Integration — framework integration (Tauri) and mobile lifecycle
  8. Configuration — tier config, error handling, config reference, best practices
  9. Content Transfer — push notifications and large content transfer protocol
  10. Multi-Language Bindings — sync-bridge, napi-rs, PyO3, Tauri plugin
  11. Vault Mode — cloud backup, object storage, restore flow, crate dependencies

0k-Sync provides secure, zero-knowledge synchronization between multiple instances of any local-first application across devices (desktop, mobile, web).

PrincipleMeaning
Zero KnowledgeRelay cannot decrypt user data
Local-FirstApps work offline; sync is opportunistic
Pass-Through OnlyRelay routes messages, does not store data long-term
Client ConstantSame client library for all relay tiers
Open Standards100% open source dependencies
  • Real-time collaborative editing (CRDTs are app responsibility)
  • File sync (use Syncthing; this is for app state)
  • User accounts (zero-knowledge, QR pairing only)
  • Background sync on mobile (OS limitations)
  • Data storage (relay is ephemeral)

Component architecture: Application → Framework Integration → sync-client → Relay

ComponentResponsibility
ApplicationBusiness logic, CRDT merge, conflict resolution, UI
Framework IntegrationPlatform bindings (optional), state management, events
sync-clientE2E encryption, connection, cursor tracking, pairing
sync-typesWire format, message definitions, shared types
sync-corePure logic (state machine, buffer), no I/O
sync-relayConnection management, message routing, temp buffer

Data flow: Push (encrypt then send) and Pull (receive then decrypt)


Detailed protocol stack: Layer 0 (iroh Transport) through Layer 4 (Application Sync Logic)

Amendment (2026-02-02): Layer structure updated per iroh-deep-dive-report.md recommendations. Added Layer 3 (Content Transfer) for large file handling via iroh-blobs. Layer 0 now explicitly includes mDNS local discovery and ALPN routing.

Format: MessagePack (rmp-serde)

Rationale:

  • Binary format (smaller than JSON)
  • Schema-less (flexible evolution)
  • Well-supported in Rust
  • Cross-platform compatibility