forked from GitHub-Mirror/riotX-android
Valere's review
This commit is contained in:
parent
e5958983d8
commit
6cbd6d3a33
@ -210,11 +210,7 @@ class CreateRoomParams {
|
|||||||
* @return the first invited user id
|
* @return the first invited user id
|
||||||
*/
|
*/
|
||||||
fun getFirstInvitedUserId(): String? {
|
fun getFirstInvitedUserId(): String? {
|
||||||
if (getInviteCount() > 0) {
|
return invitedUserIds?.firstOrNull() ?: invite3pids?.firstOrNull()?.address
|
||||||
return invitedUserIds?.firstOrNull()
|
|
||||||
}
|
|
||||||
|
|
||||||
return invite3pids?.firstOrNull()?.address
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,7 +176,7 @@ internal class MXOlmDecryption(
|
|||||||
sessionIds = ArrayList(sessionIdsSet)
|
sessionIds = ArrayList(sessionIdsSet)
|
||||||
}
|
}
|
||||||
|
|
||||||
val messageBody = message["body"] as String?
|
val messageBody = message["body"] as? String
|
||||||
var messageType: Int? = null
|
var messageType: Int? = null
|
||||||
|
|
||||||
val typeAsVoid = message["type"]
|
val typeAsVoid = message["type"]
|
||||||
|
@ -45,7 +45,6 @@ import im.vector.matrix.android.internal.crypto.keysbackup.tasks.*
|
|||||||
import im.vector.matrix.android.internal.crypto.keysbackup.util.computeRecoveryKey
|
import im.vector.matrix.android.internal.crypto.keysbackup.util.computeRecoveryKey
|
||||||
import im.vector.matrix.android.internal.crypto.keysbackup.util.extractCurveKeyFromRecoveryKey
|
import im.vector.matrix.android.internal.crypto.keysbackup.util.extractCurveKeyFromRecoveryKey
|
||||||
import im.vector.matrix.android.internal.crypto.model.ImportRoomKeysResult
|
import im.vector.matrix.android.internal.crypto.model.ImportRoomKeysResult
|
||||||
import im.vector.matrix.android.internal.crypto.model.MXDeviceInfo
|
|
||||||
import im.vector.matrix.android.internal.crypto.model.OlmInboundGroupSessionWrapper
|
import im.vector.matrix.android.internal.crypto.model.OlmInboundGroupSessionWrapper
|
||||||
import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore
|
import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore
|
||||||
import im.vector.matrix.android.internal.crypto.store.db.model.KeysBackupDataEntity
|
import im.vector.matrix.android.internal.crypto.store.db.model.KeysBackupDataEntity
|
||||||
@ -389,7 +388,7 @@ internal class KeysBackup @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val mySigs = authData.signatures?.get(myUserId)
|
val mySigs = authData.signatures?.get(myUserId)
|
||||||
if (mySigs == null || mySigs.isEmpty()) {
|
if (mySigs.isNullOrEmpty()) {
|
||||||
Timber.v("getKeysBackupTrust: Ignoring key backup because it lacks any signatures from this user")
|
Timber.v("getKeysBackupTrust: Ignoring key backup because it lacks any signatures from this user")
|
||||||
return keysBackupVersionTrust
|
return keysBackupVersionTrust
|
||||||
}
|
}
|
||||||
@ -403,18 +402,20 @@ internal class KeysBackup @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (deviceId != null) {
|
if (deviceId != null) {
|
||||||
var device = cryptoStore.getUserDevice(deviceId, myUserId)
|
val device = cryptoStore.getUserDevice(deviceId, myUserId)
|
||||||
|
|
||||||
var isSignatureValid = false
|
var isSignatureValid = false
|
||||||
|
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
Timber.v("getKeysBackupTrust: Signature from unknown device $deviceId")
|
Timber.v("getKeysBackupTrust: Signature from unknown device $deviceId")
|
||||||
} else {
|
} else {
|
||||||
try {
|
val fingerprint = device.fingerprint()
|
||||||
olmDevice.verifySignature(device.fingerprint()!!, authData.signalableJSONDictionary(), mySigs[keyId] as String)
|
if (fingerprint != null) {
|
||||||
isSignatureValid = true
|
try {
|
||||||
} catch (e: OlmException) {
|
olmDevice.verifySignature(fingerprint, authData.signalableJSONDictionary(), mySigs[keyId] as String)
|
||||||
Timber.v("getKeysBackupTrust: Bad signature from device " + device.deviceId + " " + e.localizedMessage)
|
isSignatureValid = true
|
||||||
|
} catch (e: OlmException) {
|
||||||
|
Timber.v("getKeysBackupTrust: Bad signature from device " + device.deviceId + " " + e.localizedMessage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSignatureValid && device.isVerified) {
|
if (isSignatureValid && device.isVerified) {
|
||||||
|
@ -124,7 +124,7 @@ data class MXDeviceInfo(
|
|||||||
* @return the display name
|
* @return the display name
|
||||||
*/
|
*/
|
||||||
fun displayName(): String? {
|
fun displayName(): String? {
|
||||||
return unsigned?.get("device_display_name") as String?
|
return unsigned?.get("device_display_name") as? String
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user