Skip to content

Meta: Encrypted state #5397

@andybalaam

Description

@andybalaam

@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_key as the key of the map. This causes 2 problems:
    1. Encrypted events have a fixed type of m.room.encrypted so events of different types will clash
    2. We potentially want the true state_key to be inaccessible to people without decryption keys

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_event and 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_key so the server can hold two events of different type with the same state_key even 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions