Back to Projects
mehro-paste
Period2025 - 2026
TeamSolo developer
Contribution100%
RoleFull-stack developer: architected zero-knowledge encryption protocols, built client-side cryptography worker, and deployed serverless Redis infrastructure.
mehro-paste is a high-speed, zero-knowledge, end-to-end encrypted paste sharing platform. Plaintext content is encrypted locally in the browser using WebAssembly-powered Libsodium (XChaCha20-Poly1305, Argon2id). The master decryption key is embedded solely in the URL fragment (#key), which is never transmitted over HTTP, ensuring the server stores only opaque ciphertext. Features include atomic burn-on-read, crawler defense shields, and customizable TTL expiration.
Live at paste.mehro.me
Next.js (App Router)React 19TypeScriptRedis (ioredis)Libsodium WebAssemblyComlinkMaterial UIjose (JWT)
Key Features
1
Zero-Knowledge Cryptographic Architecture
- Client-side encryption using Libsodium compiled to WebAssembly via libsodium-wrappers-sumo running inside a dedicated Web Worker via Comlink.
- Symmetric encryption via crypto_secretstream_xchacha20poly1305 and crypto_secretbox_easy for authenticated, tamper-proof ciphertext.
- Key isolation: the master decryption key is stored strictly within the URL fragment (#key). Standard HTTP specifications dictate that browsers never transmit fragment identifiers to the server, preventing server-side key exposure.
2
Atomic Burn-on-Read & Native Redis Expiration
- One-time pastes are atomically destroyed upon first read using Redis DEL inside the consume endpoint, rendering subsequent reads impossible.
- Configurable auto-expiration from 5 minutes to 7 days backed by native Redis key Time-To-Live (TTL).
- Strict zero-persistence guarantee: destroyed or expired pastes leave no lingering data in memory or disk.
3
Anti-Bot & Link Preview Crawler Shield
- Prevents chat applications (Discord, Slack, WhatsApp, Telegram, iMessage) from prematurely burning one-time pastes when generating link previews.
- Two-stage verification handshake: inspection of crawler headers (purpose, sec-purpose, preview User-Agents) returns static Open Graph metadata without touching ciphertext.
- Human consumption requires an x-paste-consume: 1 header and an HttpOnly JWT cookie (paste_guard) bound to the SHA-256 hash of the client User-Agent.
4
Argon2id Passphrase Key Derivation
- Optional secondary password protection utilizing memory-hard Argon2id (crypto_pwhash_ALG_ARGON2ID13).
- Resistant to GPU/ASIC-accelerated brute-force attacks by requiring substantial memory and CPU operations during key derivation.
- Dynamic QR code generation with styled download capabilities for mobile sharing.
Troubleshooting
Preventing Chat Crawlers from Prematurely Destroying Burn-on-Read Pastes
Problem Discovery
- When a user shared a burn-on-read link in Discord, Slack, or WhatsApp, the platform's link unfurler bot made an automated GET request to fetch Open Graph metadata. This triggered the read action and destroyed the paste before the intended recipient ever opened it.
Solution Process
- Analyzed incoming crawler headers, identifying Purpose: prefetch, Sec-Purpose: preview, and platform-specific User-Agent signatures.
- Separated link metadata serving from paste consumption: metadata endpoints serve generic preview cards without accessing the stored ciphertext.
- Created an anti-bot guard handshake requiring human browser execution: the browser requests a short-lived signed JWT cookie (paste_guard), then submits a POST request with confirmation headers to atomically consume the paste.
Result
- Zero premature paste burns when sharing links across all major messaging platforms.
💡Lessons Learned
- Zero-knowledge and one-time systems must account for modern web ecosystem behaviors like automatic pre-fetching and metadata scraping.




