Zero-Knowledge Clipboard Syncing: A Technical Deep Dive
Exploring browser-based cryptographic keys, local network device handshakes, and Web Crypto APIs to sync data between devices without centralized storage keys.
Introduction
Clipboard contents are highly sensitive. Developers frequently copy raw tokens, configuration parameters, snippets, or passwords. Synchronizing this text between devices usually involves query registers on remote servers, introducing security vulnerabilities. CoShareX implements zero-knowledge clipboard channels that run locally.
The Risk of Centralized Clipboards
Standard operating systems and cloud services sync clipboards by uploading everything you copy to an online database. If a database is breached or intercepted, your passwords and keys are compromised. Local-first syncing removes this server vulnerability.
Never copy plain text credentials when utilizing cloud-synced clipboards. Always use zero-knowledge local systems instead.
The Web Crypto API Framework
CoShareX generates AES-GCM symmetric keys directly inside the client sandbox using the browser's crypto module. The key is stored in volatile memory and never shared with signalling proxy servers.
// Generate 256-bit AES-GCM symmetric key
async function generateSymmetricKey() {
return await window.crypto.subtle.generateKey(
{
name: "AES-GCM",
length: 256
},
true, // extractable
["encrypt", "decrypt"]
);
}AES-GCM Encryption Sequence
To sync copied text, the sender encrypts the string using the local symmetric key and a random 96-bit initialization vector (IV) to prevent cryptographic duplication patterns. Below is the workflow comparison:
| Step | Sender Browser Activity | Proxy Signaling Server | Receiver Browser Activity |
|---|---|---|---|
| 1 | Generates AES key + IV | Idle | Idle |
| 2 | Encrypts plain text ➔ Ciphertext | Brokers handshake metadata | Idle |
| 3 | Streams encrypted payload | Routes encrypted bytes | Receives binary ciphertext |
| 4 | Idle | Idle | Decrypts payload using shared key |
Best Practices for Crypto Keys
- Avoid reusing initialization vectors (IVs). Use window.crypto.getRandomValues to guarantee a unique IV for each payload.
- Use AES-GCM over older algorithms like AES-CBC to secure authenticated integrity checks.
- Store active keys in session scopes to clear credentials once browser tabs are closed.
Fast Sandbox Text Paste Share
Format markdown tables, secure code files, or clean snippet handoffs using local browser encryption instantly.
Frequently Asked Questions
Can CoShareX view my clipboard history?
No. Since the symmetric keys are generated inside your browser tab and never shared with signaling proxies, CoShareX servers can only see encrypted binary strings.
Does it work when I am offline?
Yes, if both devices are connected to the same local network, client coordinates handshake directly without external routing.
Conclusion
Zero-knowledge encryption gives developers full custody over their clipboard items. By using standard Web Crypto APIs and symmetric AES-GCM keys, CoShareX ensures text pastes remain private.
Related Articles
How WebRTC Powers Peer-to-Peer Browser File Sharing
An in-depth look at using RTCDataChannel to establish direct socket-like connections between browser clients, completely bypassing cloud storage limits and uploads.
Browser APIsRunning Sandboxed Web Apps with WebAssembly & Web Workers
A technical guide on utilizing Web Workers and WASM binaries to execute CPU-intensive tasks like image processing and PDF adjustments entirely inside the client tab.