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