P2P Sync
Sync your PrivStack data directly between devices without any server in the middle. Share specific documents with other PrivStack users using access controls.
How It Works
- Device Discovery: Your devices find each other automatically on your local network, or across the internet using your sync code
- Pairing: Pair devices with a simple 4-word code (e.g., “PEAR-MANGO-KIWI-GRAPE”)
- Verification: You manually approve each device before it can sync
- Sync: Only new changes are sent between devices — fast and efficient
- Automatic Merging: Edits from all devices merge automatically — no conflicts
- Device Discovery: Devices find each other via mDNS (local network) or Kademlia DHT (global, opt-in with sync code)
- Pairing: Pair devices with human-readable 4-word sync codes (e.g., “PEAR-MANGO-KIWI-GRAPE”)
- Authentication: Peers authenticate using the Noise protocol over QUIC transport
- Bidirectional Sync: Vector clocks determine missing events; only deltas are exchanged
- CRDT Merge: Changes merge automatically using conflict-free replicated data types
Setting Up P2P Sync
On Your First Device
- Go to Settings > Sync
- Click Enable P2P Sync
- A Sync Code is generated (4 easy-to-remember words)
On Additional Devices
- Install PrivStack and set up with the same master password
- Go to Settings > Sync
- Click Enable P2P Sync
- Enter the sync code from your first device
- Approve the connection on the first device — peers must be manually trusted
Local Network Sync
When devices are on the same network:
- Discovery is automatic (zero configuration)
- Sync is direct device-to-device
- No internet required
Technical: Uses mDNS for discovery and QUIC (UDP) for low-latency transport.
Internet Sync
When devices are on different networks:
- Your sync code lets devices find each other securely across the internet
- Devices connect directly when possible
- If a direct connection isn’t possible, an encrypted relay bridges the gap — but it can’t read your data
- The sync code is SHA-256 hashed to create a DHT namespace
- Peers discover each other via Kademlia DHT (only peers with the same code)
- Direct connection attempted first; encrypted relay used as fallback
- All traffic is end-to-end encrypted — relays see only encrypted packets
Sharing with Other Users
P2P sync isn’t just for your own devices. You can share specific entities with other PrivStack users:
- Open the item you want to share
- Select Share > Share with Peer
- The other user enters your sync code and you approve them
- Choose their access level: Viewer (read-only) or Editor (read/write)
- Only the shared entities sync to their device — nothing else
Access is enforced at every step. Revoking access stops future sync immediately.
Sync Status
View sync status in Settings > Sync:
- Connected and trusted peers
- Last sync time per peer
- Events sent and received
- Sync errors and diagnostics
Conflict Resolution
PrivStack automatically merges edits from all your devices:
- Edits to different parts of an item merge cleanly
- If two devices edit the same field, the most recent edit wins
- Ordered content (like note blocks) merges intelligently — no lost edits
- All devices always end up with the same result
PrivStack uses CRDTs (Conflict-free Replicated Data Types):
- Vector clocks track causal ordering across all peers
- LWW-per-field merge for most entities (last-writer-wins on individual fields, not whole documents)
- RGA (Replicated Growable Array) for ordered content like note blocks
- Edits from all devices are preserved — no data loss
- Mathematically guaranteed convergence (commutative, associative, idempotent)
Security
- End-to-end encrypted: All data encrypted before leaving your device
- Zero-knowledge relays: Relay servers cannot read, modify, or correlate your data
- Access control: Per-item permissions control who can see or edit your shared data
- No account required: Sync works without creating an account with us
- QUIC + Noise protocol: Peer authentication and transport encryption via libp2p
- Replay protection: Event IDs and vector clocks prevent duplicate application
- Per-entity ACLs enforced at handshake, sync request, event send, and event receive
Enterprise Features
For organizations using the Enterprise sync policy:
- Role-based access: Viewer, Editor, Admin, Owner hierarchy
- Team management: Group peers into teams for bulk access grants
- Device limits: Enforce per-peer device counts based on license tier
- Audit logging: Every access decision logged with peer, entity, action, and timestamp
- ACL propagation: Access control changes replicate as CRDT events across all peers