element-hq / hydrogen-web

Lightweight matrix client with legacy and mobile browser support
Apache License 2.0
646 stars 124 forks source link

Fetch all keys at once when enabling key backup #254

Open bwindels opened 3 years ago

bwindels commented 3 years ago

Right now, we try to get a single session from key backup when decryption fails. It's hard to know when is a good time to try to fetch from key backup though, especially when reading events that fail to decrypt but don't have their session in the backup either. You easily end up requesting sessions from backup when opening a room every time.

This is similar behaviour to what element web does.

bwindels commented 3 years ago

this will allow all decryption to happen in the sync loop:

So either way we can get rid of notifyRoomKey and most backup code in RoomEncryption. When we support key shares, those would also come in through sync.

bwindels commented 2 years ago

Not sure we actually want to do this, because if we fetch all, the key can be added after we fetched.