-
Notifications
You must be signed in to change notification settings - Fork 345
Open
Description
@kaylendog will be working on encrypted state - we will track our plans and progress here.
Goal
Investigate the feasibility of MSC3414 and prototype it in rust-sdk.
Context
Currently, all state events in a room are unencrypted: only non-state events can be encrypted.
To enhance privacy, we should encrypt state events where possible.
Problems
- The server holds the current state of a room, and it uses
type+state_keyas the key of the map. This causes 2 problems:- Encrypted events have a fixed
typeofm.room.encryptedso events of different types will clash - We potentially want the true
state_keyto be inaccessible to people without decryption keys
- Encrypted events have a fixed
We will start by not considering this problem, then progressively enhance our solution.
Plan
- Set-up, logins, passwords etc.
- Build matrix-rust-sdk including multiverse
- Run a local synapse and connect to it from multiverse
- Encrypt a test event. Write the minimum possible code to get a state event to send and receive whose contents are encrypted. Look at OlmMachine::encrypt_room_event. You will probably need to write a similar method called
encrypt_state_eventand figure out how to call it from multiverse. You will probably need to add code to decrypt state events if they arrive encrypted. - Consider stuffing the event type into
state_keyso the server can hold two events of differenttypewith the samestate_keyeven if they are encrypted. E.g. change the state_key to be "{type}:${state_key}" (note: careful choice of separator will eventually be needed, but no need to worry too much now). Confirm that the server correctly returns the right state in this circumstance. Figure out how to get the client to "unstuff" it and understand the right type and state_key. - Investigate how well this works. E.g. can I do live location sharing using encrypted state events?
- Implement runtime feature flag for encrypted state
- Merge into upstream SDK
- Investigate implementing encrypted state into existing clients - feature/labs flag.
- Implement encrypted state in Element Web as a labs flag.
Later Steps
- Evaluate using a new encryption algorithm vs the proposed
encrypt_state_eventsfield onm.room.encryptionvs differentiating encrypted and cleartext event payloads in Ruma; - Determine exactly which event types need encryption;
- Decide on state key handling - plaintext, string packing, HMAC obfuscated;
- How should invites be handled - key sharing even if history invisible? Session rotation;
- Spaces - implement a new
m.space.child_infoencrypted event, contains room name and topic; - Room directory - exclude rooms with encrypted state?
- Explore partial encryption for critical events.
bnjbvr
Metadata
Metadata
Assignees
Labels
No labels