SecureVault
A browser-encrypted vault for logins, secure notes, and API keys. Uses Web Crypto for PBKDF2-derived AES-GCM item encryption, with a configurable password generator, vault search and filtering, masked entries, and encrypted backup workflows.
Problem and audience
The vault is designed for people organizing passwords, API keys and private notes who want vault items encrypted before upload.
Architecture and tradeoffs
Follow the app’s actual key and item paths. The server receives an encrypted item payload and its IV; encryption and decryption happen in the browser.
- Web Crypto
- The source derives a non-extractable AES-GCM key with PBKDF2-SHA-256 (100,000 iterations). Each item gets a random 12-byte IV and is encrypted before the request is sent.
- Next.js API routes
- POST /api/vault checks userId, item type, ciphertext, and IV. GET returns the stored item records. Auth routes register and return the salt plus encrypted key verifier for client-side verification.
- Storage
- The vault_items row stores item type, encrypted_data, IV, user ID, and timestamps. The user record stores a salt and encrypted verifier challenge; the master key is not stored there.
- Unlock check
- Login returns the salt and encrypted verifier. The browser derives a candidate key and attempts to decrypt the verifier challenge before accepting the unlocked session.
Deriving the key in the browser keeps the item encryption key out of the server’s storage model. Unlocking instead depends on browser-side key derivation and checking the encrypted verifier. The server still handles item metadata and storage.
Scope and limitations
The web app selects Supabase when configured, or an in-memory mock database without credentials. The auth store also contains demo-specific session behavior; the encryption map describes the item-data path rather than a production security certification.
The reviewed change records work on vault notifications, demo user state and application icons.
Reviewed repository snapshot (02dad3d) ↗