ADR 004
End-to-end encrypted sync for a home inventory app
Context
EverydayOS is a local-first home organiser. Users record where they keep things, what they own, what's valuable and when they travel. Users wanted multi-device sync. To a burglar, that dataset is a shopping list with dates attached. Under India's DPDP Act, anyone who holds that data on a server becomes its data fiduciary, with breach-notification duties.
Options considered
| Option | For | Against |
|---|---|---|
| A: server-readable sync (normal API and database) | Fastest to build; server-side search and sharing; easy password reset | A breach exposes every user's valuables and travel dates; I hold sensitive personal data and its legal duties |
| No sync (status quo, export and import a file) | Zero risk | The top user request goes unmet |
| B: end-to-end encrypted sync | The server stores only ciphertext, so a breach exposes nothing readable; much smaller compliance surface | Hard key management: device pairing, a recovery key, and no server-side search; losing the recovery key loses the data |
Decision
- The app stays local-first and needs no account by default. Sync is opt-in.
- Turning sync on uses Google sign-in, but only to identify the user. The data key is generated on the device with Web Crypto and never leaves it unencrypted.
- New devices are added by scanning a QR code from an existing device. An auto-generated recovery key is shown once, for the user to save in a password manager or print.
- Records sync per item with last-write-wins and an offline queue. Photos are encrypted too.
- The server is a small API plus Postgres, estimated at 60–70 MB RAM and no extra cost.
- Users get a privacy notice and a "delete my synced data" button.
Consequences
- Good: the threat model stays simple. The server is untrusted for content.
- Cost: account recovery can't restore data without the recovery key. That needs clear, repeated UX warnings.
- Cost: last-write-wins can lose a concurrent edit to the same item. That's acceptable for inventory records, and wouldn't be for documents.
- Scoped out: the sister app, Family Handover, stays server-readable because it needs sharing and notifications. Different data, different answer.
Revisit when
- Shared households are needed. That means per-member keys and envelope encryption.
- Passkey support for WebAuthn PRF is widespread enough to replace the recovery key.
At bank scale
The same reasoning applies as data classification. Data minimisation and encryption, with keys the operator can't read, reduce the blast radius and the regulatory scope. In a bank you'd use customer-managed keys in an HSM, field-level encryption for the most sensitive attributes, and tokenisation for card and account numbers.