Inform users, that Keys not shared for messages before invitation
If there is a room with visibility for "all messages", there seems to be no key sharing for messages that are older then the invitation for the current user.
Steps to reproduce:
- Open a chat room (group room) with visibility "All Messages"
- send some messages into the room
- invite new user
- send a new message to the room
- accent the invitation with the new user
- check the chat room with the new user
Current result:
New user is not able to decrypt messages that are older then his invitation
This warning occurs frequently when the room is opened:
Logs
07:41:45.855 [DefaultDispatcher-worker-16] WARN n.f.t.c.o.OlmEncryptionService - decrypt megolm failed
net.folivo.trixnity.crypto.olm.OlmEncryptionService$DecryptMegolmError$MegolmKeyUnknownMessageIndex: megolm key with unknown message index while decrypting with megolm
at net.folivo.trixnity.crypto.olm.OlmEncryptionService$DecryptMegolmError$MegolmKeyUnknownMessageIndex.<clinit>(OlmEncryptionService.kt)
at net.folivo.trixnity.crypto.olm.OlmEncryptionServiceImpl.decryptMegolm-gIAlu-s(OlmEncryptionService.kt:606)
at net.folivo.trixnity.client.room.MegolmRoomEventEncryptionService.decrypt-YNEx5aM(MegolmRoomEventEncryptionService.kt:73)
at net.folivo.trixnity.client.room.RoomEventEncryptionServiceKt.decrypt(RoomEventEncryptionService.kt:43)
at net.folivo.trixnity.client.room.RoomServiceImpl$getTimelineEvent$1$2$1$1$decryptedEventContent$1.invokeSuspend(RoomService.kt:289)
at net.folivo.trixnity.client.room.RoomServiceImpl$getTimelineEvent$1$2$1$1$decryptedEventContent$1.invoke(RoomService.kt)
at net.folivo.trixnity.client.room.RoomServiceImpl$getTimelineEvent$1$2$1$1$decryptedEventContent$1.invoke(RoomService.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturnIgnoreTimeout(Undispatched.kt:72)
at kotlinx.coroutines.TimeoutKt.setupTimeout(Timeout.kt:148)
at kotlinx.coroutines.TimeoutKt.withTimeoutOrNull(Timeout.kt:104)
at kotlinx.coroutines.TimeoutKt.withTimeoutOrNull-KLykuaI(Timeout.kt:136)
at net.folivo.trixnity.client.room.RoomServiceImpl$getTimelineEvent$1$2$1$1.invokeSuspend(RoomService.kt:287)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:102)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)
07:41:45.856 [DefaultDispatcher-worker-16] DEBUG n.f.t.c.r.MegolmRoomEventEncryptionService - unknwon message index, so we request key backup and start to wait for inbound megolm session to decrypt $vk1YMZ1cSyiVNtrcaXxPnTbmtT5XvpOJKKYNe18yUEY in !JpWMlQrugxTYQBFEPi:demo.timmy-messenger.de again
07:41:45.856 [DefaultDispatcher-worker-16] DEBUG n.f.t.c.k.KeyBackupService - try to find key backup for roomId=!JpWMlQrugxTYQBFEPi:demo.timmy-messenger.de, sessionId=nLPNj8kpWfH6SN0h+YytOWUYtDTyG+r1NuuVN4BuBbg, version=1
Expected result:
New user is able to decrypt all messages that he should see. If this is not possible (there is a current matrix issue):
- for the invitee: show a message like "You can't see earlier messages - Enycrpted messages before this point are unavailable" for instead of the of the undecryptable messages
- for the inviter: show a message, that explains "It'll be not possible for the invitee to decrypt messages of the room before the invitation"
Environment: Tested on main (commit id: # connect2x/timmy-client@193618ff5f935da0a5d6a98fc7ec95e2b75b6bb6) on emulated Android device & Windows client
Edited by Martin U.