Robustness
This commit is contained in:
parent
9df928e709
commit
466a39d239
|
@ -209,7 +209,13 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
|
|||
} else {
|
||||
ArrayList(forwardedRoomKeyContent.forwardingCurve25519KeyChain)
|
||||
}
|
||||
forwardingCurve25519KeyChain.add(senderKey!!)
|
||||
|
||||
if (senderKey == null) {
|
||||
Timber.e("## onRoomKeyEvent() : event is missing sender_key field")
|
||||
return
|
||||
}
|
||||
|
||||
forwardingCurve25519KeyChain.add(senderKey)
|
||||
|
||||
exportFormat = true
|
||||
senderKey = forwardedRoomKeyContent.senderKey
|
||||
|
@ -223,7 +229,7 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
|
|||
return
|
||||
}
|
||||
|
||||
keysClaimed["ed25519"] = forwardedRoomKeyContent.senderClaimedEd25519Key!!
|
||||
keysClaimed["ed25519"] = forwardedRoomKeyContent.senderClaimedEd25519Key
|
||||
} else {
|
||||
Timber.v("## onRoomKeyEvent(), Adding key : roomId " + roomKeyContent.roomId + " sessionId " + roomKeyContent.sessionId
|
||||
+ " sessionKey " + roomKeyContent.sessionKey) // from " + event);
|
||||
|
@ -236,7 +242,15 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
|
|||
// inherit the claimed ed25519 key from the setup message
|
||||
keysClaimed = event.getKeysClaimed().toMutableMap()
|
||||
}
|
||||
val added = olmDevice.addInboundGroupSession(roomKeyContent.sessionId!!, roomKeyContent.sessionKey!!, roomKeyContent.roomId!!, senderKey, forwardingCurve25519KeyChain, keysClaimed, exportFormat)
|
||||
|
||||
if (roomKeyContent.sessionId == null
|
||||
|| roomKeyContent.sessionKey == null
|
||||
|| roomKeyContent.roomId == null) {
|
||||
Timber.e("## invalid roomKeyContent")
|
||||
return
|
||||
}
|
||||
|
||||
val added = olmDevice.addInboundGroupSession(roomKeyContent.sessionId, roomKeyContent.sessionKey, roomKeyContent.roomId, senderKey, forwardingCurve25519KeyChain, keysClaimed, exportFormat)
|
||||
|
||||
if (added) {
|
||||
keysBackup.maybeBackupKeys()
|
||||
|
@ -250,7 +264,7 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
|
|||
|
||||
outgoingRoomKeyRequestManager.cancelRoomKeyRequest(content)
|
||||
|
||||
onNewSession(senderKey, roomKeyContent.sessionId!!)
|
||||
onNewSession(senderKey, roomKeyContent.sessionId)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue