How I encrypt my AI agent's HTML before it ever reaches a server
Most share links protect a file with a login screen on someone else's server. The server holds the readable file and decides who gets it. When I built Hushdrop, a tool my agents use to turn the HTML they write into share
Most share links protect a file with a login screen on someone else's server. The server holds the readable file and decides who gets it. When I built Hushdrop, a tool my agents use to turn the HTML they write into share links, I wanted locked pages to work the other way around: encrypted on my laptop, stored as ciphertext, decrypted only in the reader's browser.
Here's every step between npx hushdrop report.html and someone reading the page, with the real parameters.
1. You publish
npx hushdrop report.html # generates a password for you
npx hushdrop report.html -p 'correct horse battery'
The CLI adds branding first (title, social preview tags, a small corner badge). Then it hands the page to StatiCrypt, an open-source encryption tool, before anything touches the network.
2. The password becomes a key
The password is never used directly. It goes through PBKDF2 with SHA-256 for 600,000 iterations, together with a salt, to produce a 256-bit key. The iteration count is the point: every guess an attacker makes costs them the same 600,000 rounds.
3. The page is encrypted
The whole HTML document is encrypted with AES-256 in CBC mode, and an HMAC over the ciphertext lets the browser detect tampering. The result is wrapped in a small unlock page: a logo, a password field and the decryption script. That unlock page plus the ciphertext is all that gets uploaded.
4. The server stores ciphertext
Whether you self-host on your own Vercel Blob store or publish to hushdrop.dev, the stored file is the encrypted blob. The password isn't sent anywhere and isn't in the URL. Every drop is also served with X-Robots-Tag: noindex and a strict Content-Security-Policy, so a leaked link doesn't end up in search results.
5. The reader decrypts in their browser
The recipient opens the link and types the password. Their browser derives the same key with the Web Crypto API, checks the HMAC and decrypts the page in memory. The readable page never crosses the network.
What this protects, and what it doesn't
It keeps the content away from the host, from anyone who scrapes or intercepts the link, and from search engines.
It does not save you from a weak password. The ciphertext can be downloaded, so someone with time can guess offline. That's why the generated passwords are long, and why the password should travel through a different channel than the link.
Two modes work differently, and I'd rather say so up front:
- A whole static site locked with
hush site/ -p secret(self-hosted) uses a password check at the edge (PBKDF2, 100,000 iterations) instead of encrypting every file. - The hosted MCP server at
hushdrop.dev/mcp, which lets Claude, ChatGPT or Cursor publish with no install, receives the HTML from the agent, so the host can read those pages. If the host must never see the content, use the CLI.
Check it yourself
The CLI, the unlock template and the server are MIT licensed and in the public repo. Publish a page, download the stored file with curl, and you'll see the unlock page and ciphertext, nothing else.
If you want your agent to do this for you, the hosted MCP server is at https://hushdrop.dev/mcp, and the local one is npx -y hushdrop-mcp.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.