Technologies
The Problem
Traditional cloud-storage systems commonly rely on RSA or elliptic-curve cryptography for key exchange, which is vulnerable to future quantum attacks. The project addresses the 'Harvest Now, Decrypt Later' risk by protecting long-lived sensitive files with post-quantum cryptography while maintaining a practical browser-based storage experience.
The Approach
Built a strict zero-knowledge encryption workflow in which files are encrypted and decrypted locally in the browser. Each file is encrypted with a random AES-256-GCM key, while ML-KEM-768 encapsulation and HKDF-derived wrapping keys protect the file encryption key before encrypted data is sent to storage.
Architecture
The Next.js client handles password-based key derivation, ML-KEM key-pair generation, AES encryption and decryption using the Web Crypto API and cryptographic packages. A Node.js and Express backend manages JWT sessions, quotas, metadata, audit events and signed storage access. MongoDB stores encrypted key packages and metadata, while Cloudflare R2 stores only encrypted file blobs under isolated UUID-based object keys.
Key Features
- —Browser-side end-to-end file encryption and decryption
- —Zero-knowledge architecture with no plaintext files or keys sent to the server
- —Post-quantum ML-KEM-768 key encapsulation based on NIST FIPS 203
- —AES-256-GCM authenticated encryption for file confidentiality and tamper detection
- —Argon2id memory-hard password-based master-key derivation
- —Cloudflare R2 storage for encrypted file payloads
- —JWT session management using HttpOnly cookies
- —Per-user storage quotas, file-count bounds and download limits
- —Self-destruct rules based on expiry time or download thresholds
- —Immutable audit logging for upload, download and deletion events
Technical Challenges
The main challenge was designing a secure browser-only trust boundary while combining post-quantum key encapsulation, password-derived protection for private keys, envelope encryption and cloud object storage. Another important consideration was reducing XSS exposure because active client-side cryptographic material can be vulnerable during a live browser session.
Result
Delivered a full-stack prototype where the backend and storage provider handle ciphertext, encrypted key packages and metadata only. The design ensures that compromise of MongoDB, Cloudflare R2 or the backend alone does not reveal users' plaintext files, AES file keys, master passwords or plaintext private keys.
Learnings
Developed practical experience implementing post-quantum cryptography in a web application, using ML-KEM hybrid encryption, Argon2id key derivation, AES-GCM authenticated encryption, secure object storage workflows and zero-knowledge architecture design.
Next Project