Skip to content

Commit 259bdaf

Browse files
docs: add encryption info
1 parent eac3b57 commit 259bdaf

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

packages/e2ee-chat/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ If you ever need a fresh database during development, run `pnpm --filter @app/ch
7171
- `chatMirrors.ts` watches encrypted tables, decrypts with the user’s vault + room keys, and writes plaintext mirrors (`chat_rooms_plain`, `chat_messages_plain`) to the PowerSync client DB for querying.
7272
- No decrypted content leaves the device; uploads use Supabase RPC with ciphertext rows only.
7373

74+
## What is and isn’t protected
75+
76+
- **Summary**
77+
- Protected: Room titles, descriptions, and message contents are encrypted client-side before they leave the device, so Supabase and PowerSync cannot read them.
78+
- Not protected: Room membership, sender identifiers, and message timestamps stay in plaintext so the backend can authorize access and order events.
79+
- **Details**
80+
- Ciphertext columns (`chat_rooms.ciphertext`, `chat_messages.ciphertext`) and wrapped keys (`chat_room_keys`, `chat_identity_private_keys`, `chat_e2ee_keys`) keep all room metadata, message bodies, and vault material confidential.
81+
- Plaintext metadata (`chat_room_members`, bucket IDs and timestamps in `chat_messages` / `chat_rooms`, `chat_identity_public_keys`) remains visible to enforce RLS, drive sync, and let peers discover public keys.
82+
- Operational signals—such as when rooms change, which user triggered an update, and high-level traffic timing—are still observable even though the payloads are encrypted.
83+
7484
## How the vault works
7585

7686
- **Vault KEK** – Users unlock a per-device vault key (`ensureVaultKey`) with a passphrase or passkey. That key never leaves the device; everything below is wrapped with it.

0 commit comments

Comments
 (0)