dendrite icon indicating copy to clipboard operation
dendrite copied to clipboard

Adding support for MSC3202 for E2E appservice support

Open danpe opened this issue 2 years ago • 1 comments

Looking at https://github.com/matrix-org/matrix-spec-proposals/pull/3202 seems like a pretty straight forward implementation. I think I can contribute that part, but would love for direction on which files it should be implemented on.

danpe avatar Dec 06 '23 20:12 danpe

Ignoring MSC2409, we need device_lists, device_one_time_keys_count and device_unused_fallback_key_types (the latter isn't implemented yet, iirc) device_lists and device_one_time_keys_count currently have some internal functions in the SyncAPI:

https://github.com/matrix-org/dendrite/blob/d65449c7822e89b506bf2caa7a098e38970f6f27/syncapi/internal/keychange.go#L36 https://github.com/matrix-org/dendrite/blob/d65449c7822e89b506bf2caa7a098e38970f6f27/syncapi/internal/keychange.go#L52-L55

Those are used for /sync responses and most likely will need to be "public" so the appservice API can use them. So IMO, we need to modify https://github.com/matrix-org/dendrite/blob/main/appservice/consumers/roomserver.go to:

  • Add OTKs for all users the appservice is interested in when the consumer receives a m.room.encrypted event
  • Have appserviceState keep track of the StreamPosition (from, in this case) to be able to calculate device_lists
  • Make the mentioned internal functions public

S7evinK avatar Dec 13 '23 08:12 S7evinK