matrix-rust-sdk icon indicating copy to clipboard operation
matrix-rust-sdk copied to clipboard

Allow inbound megolm sessions to be merged when two copies are received from different sources

Open poljar opened this issue 8 months ago • 0 comments

We may receive a room key with an incomplete ratchet (first known message index of 1) but ideal SenderData, only to later find another room key with a complete ratchet (first known message index of 0) but less optimal SenderData.

PR #4040 addressed a special case of this issue, where the ratchets are identical (i.e., the first known message index is the same) but the SenderData differs.

However, we should also be able to merge two room keys with different ratchet states and SenderData, ensuring that the resulting key retains the best properties from both.

The InboundGroupSession::merge() method can be used to determine if two InboundGroupSession instances share the same ratchet.

This issue supersedes #3703, which had become cluttered with some loosely related discussions.

Causes app layer issue: https://github.com/element-hq/element-x-ios/issues/3352

poljar avatar Feb 20 '25 10:02 poljar