Design a Vault Recovery System
Design how a user who lost their master password or every device gets back into an encrypted vault, without the service or an attacker being able to open it.
Problem statement
Design a vault recovery system.
For this exercise, assume the vault is part of an app where people store passwords, card numbers and private notes. The app encrypts each vault on the user's own devices before upload, so the servers store only ciphertext (data that is unreadable without the key).
A vault is opened with a vault key, and only the user's master password can unlock that key. The server never sees the master password or the vault key in readable form. This is often called a zero-knowledge design.
The problem. Sometimes a user forgets the master password, or loses every device that was signed in. Without help, their vault is gone for good. Recovery must let the real owner back in with the same vault contents. It must not let anyone else in.
Who must not get in. Attackers may control the user's email inbox or phone number, replay old requests, and send floods of recovery attempts. No single party may open a vault alone: not the service, not one employee, and not someone who controls the user's email. The service must not be able to read vault contents at any point, including during recovery.
What the owner sees. The real owner hears about every recovery attempt on the devices and contact methods already on the account, and can stop an attempt before it finishes.
Out of scope: sharing vaults between users, admin recovery for company-managed accounts, syncing vault items between devices, and normal sign-in for a user who still knows the master password.
What to build
- Before anything goes wrong, a user can set up recovery for their vault, and later see or change how it is set up.
- A user who forgot the master password or lost every device can start a recovery, prove who they are and, once the recovery is approved, set a new master password and open the same vault contents.
- Every recovery attempt alerts the devices and contact methods already on the account. The owner can cancel an attempt before it completes and can see a history of every attempt.
At scale
- For this exercise, assume 20 million users. On a normal day about 10,000 of them start a recovery; during an attack wave, recovery attempts can reach 50 times that, mostly from attackers.
- An approved recovery waits 48 hours before it can finish, so the real owner has time to cancel it. Each recovery API call should still answer within 1 second.
- Recovery must never open a vault for someone who lacks the required proofs, even if that means a user who has lost every recovery method cannot get the vault back.
- Recovery records and their history are kept for 7 years and cannot be edited or deleted, including by employees.