System Design Interview: Designing a Password Manager With End-to-End Encryption
3 views
"Design a password manager like 1Password or Bitwarden" is a system design interview question where security, not scale, drives most decisions. The interviewer wants to hear that the server should never be able to read user secrets, and how sync, sharing and recovery still work under that constraint.
1. Requirements
Functional: users store credentials and notes in a vault, sync across devices, autofill in browsers and phones, share items with family or teammates, and recover access if a device is lost. Non-functional: zero-knowledge (the server cannot decrypt vaults), high availability for reads, offline access, and strong protection against breaches.
2. Key derivation
The user's master password never leaves the device. The client derives a key with a slow, memory-hard function such as Argon2id (or PBKDF2 with a high iteration count) plus a per-user salt. That key decrypts a randomly generated vault key, and the vault key encrypts items with AES-256-GCM. Separating the two means changing the master password only re-encrypts one small key, not every item.
3. Authentication without revealing the password
Send the server a value derived separately from the master password (or use a protocol like SRP), so the login secret is different from the encryption key. Add device registration and optional two-factor authentication.
4. Storage and sync
- The server stores encrypted item blobs with metadata: item id, version, last-modified time, and which vault they belong to.
- Clients keep a local encrypted copy for offline use and sync with a version-based protocol: fetch changes since the last known revision, upload local changes, resolve conflicts with last-writer-wins per item or by keeping both versions.
- Item-level encryption keeps sync efficient because only changed items travel.
5. Sharing
Each user has a public/private key pair; the private key is encrypted with their vault key. To share a vault, the owner encrypts that vault's key with the recipient's public key. Revoking access means rotating the shared vault key and re-encrypting for the remaining members.
6. Account recovery
True zero-knowledge makes recovery hard by design. Options: a printed recovery key, recovery through an organization admin who holds an escrowed key (for business accounts), or trusted devices that can authorize a new one. Explain the trade-off between security and convenience.
7. Browser extension and autofill
Match items to the exact origin to prevent phishing pages from receiving credentials, require user action before filling on sensitive pages, and lock the vault after inactivity.
8. Threats to discuss
Server breach (attackers get encrypted blobs; slow key derivation makes brute force expensive), compromised client or malicious extension update (code signing, review), weak master passwords (strength meter, minimum length), and metadata leakage (encrypt item names and URLs too).
9. Scale
Read-heavy and modest in size per user; a replicated relational or document store with a cache handles it. Security reviews and audits matter more than sharding here.
Structure your answer: requirements, the key hierarchy, sync, sharing, recovery and threats. If you want support while the interviewer digs into the cryptography, Linkjob AI (https://linkjob.ai) offers real-time help during job interviews and technical interviews, including system design rounds.