DEV Community

Farkas Zoli
Farkas Zoli

Posted on

How I built zero-knowledge secret sharing with Web Crypto and Cloudflare Durable Objects

Every team has had this moment: someone urgently needs an API token, database credential, or .env file, and the fastest path is pasting it into Slack, Teams, or Discord.

The problem? That chat channel keeps the plaintext forever: in search logs, backups, exports, and on every device synced to the account.

I built zeepass which is a free, open-source tool to share secrets via one-time self-destructing links.
But my goal was stricter than just "trusting the server not to look":

The server should physically never have what it needs to decrypt the secret.

Here is the exact architecture, the 150 lines of code powering it, and where the limits of browser cryptography lie.

How it works under the hood

  1. Client-side encryption: Your browser generates a fresh 256-bit AES-GCM key with the Web Crypto API. Only the ciphertext and a random 12-byte IV leave your machine.
  2. Zero-knowledge URL fragment: The key is appended to the URL fragment (pass.wzee.dev/s/<id>#key=...). Browsers never send fragments in HTTP requests, so the server only ever sees the ID, never the key.
  3. Mistyped-link protection: To prevent an accidentally truncated link from burning and losing the secret forever, the browser sends a SHA-256 verifier hash of the key. The server rejects wrong keys without deleting the secret.
  4. Ephemeral storage: Ciphertext lives in an isolated Cloudflare Durable Object (pinned to the EU). An automated alarm wipes it on expiration (1 hour to 7 days) or immediately upon reading.
  5. Preview-bot protection: Slack, Discord, and iMessage preview bots only issue GET requests. Opening the link reveals nothing; decrypting requires a button click that fires a POST request (Server Action), so crawlers never accidentally burn your links.

Realistic limits & threat model

  • Trusting the served JavaScript: Like every web crypto app, you trust that the host serves unaltered code. The code is MIT open source, but real-time build verification in a browser doesn't exist yet.
  • The link is the bearer token: Whoever holds the full URL before it is burned can decrypt it.
  • Edge metadata: Cloudflare terminates TLS at the edge and processes standard connection IP logs.

Try it / Inspect the Code

I'd love to hear your thoughts or any edge cases you spot!

Top comments (0)