code review
This commit is contained in:
parent
031c4e5746
commit
4041e2e8ca
|
@ -840,7 +840,7 @@ internal class CryptoManager @Inject constructor(
|
||||||
val roomKeys = MXMegolmExportEncryption.decryptMegolmKeyFile(roomKeysAsArray, password)
|
val roomKeys = MXMegolmExportEncryption.decryptMegolmKeyFile(roomKeysAsArray, password)
|
||||||
val t1 = System.currentTimeMillis()
|
val t1 = System.currentTimeMillis()
|
||||||
|
|
||||||
Timber.v("""## importRoomKeys : decryptMegolmKeyFile done in ${t1 - t0} ms""")
|
Timber.v("## importRoomKeys : decryptMegolmKeyFile done in ${t1 - t0} ms")
|
||||||
|
|
||||||
val importedSessions = MoshiProvider.providesMoshi()
|
val importedSessions = MoshiProvider.providesMoshi()
|
||||||
.adapter<List<MegolmSessionData>>(Types.newParameterizedType(List::class.java, MegolmSessionData::class.java))
|
.adapter<List<MegolmSessionData>>(Types.newParameterizedType(List::class.java, MegolmSessionData::class.java))
|
||||||
|
@ -848,7 +848,7 @@ internal class CryptoManager @Inject constructor(
|
||||||
|
|
||||||
val t2 = System.currentTimeMillis()
|
val t2 = System.currentTimeMillis()
|
||||||
|
|
||||||
Timber.v("""## importRoomKeys : JSON parsing ${t2 - t1} ms""")
|
Timber.v("## importRoomKeys : JSON parsing ${t2 - t1} ms")
|
||||||
|
|
||||||
if (importedSessions == null) {
|
if (importedSessions == null) {
|
||||||
throw Exception("Error")
|
throw Exception("Error")
|
||||||
|
@ -1000,9 +1000,9 @@ internal class CryptoManager @Inject constructor(
|
||||||
val requestBody = RoomKeyRequestBody()
|
val requestBody = RoomKeyRequestBody()
|
||||||
|
|
||||||
requestBody.roomId = event.roomId
|
requestBody.roomId = event.roomId
|
||||||
requestBody.algorithm = wireContent["algorithm"].toString()
|
requestBody.algorithm = wireContent["algorithm"]?.toString()
|
||||||
requestBody.senderKey = wireContent["sender_key"].toString()
|
requestBody.senderKey = wireContent["sender_key"]?.toString()
|
||||||
requestBody.sessionId = wireContent["session_id"].toString()
|
requestBody.sessionId = wireContent["session_id"]?.toString()
|
||||||
|
|
||||||
outgoingRoomKeyRequestManager.resendRoomKeyRequest(requestBody)
|
outgoingRoomKeyRequestManager.resendRoomKeyRequest(requestBody)
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ internal class MXOlmDevice @Inject constructor(
|
||||||
try {
|
try {
|
||||||
deviceCurve25519Key = olmAccount!!.identityKeys()[OlmAccount.JSON_KEY_IDENTITY_KEY]
|
deviceCurve25519Key = olmAccount!!.identityKeys()[OlmAccount.JSON_KEY_IDENTITY_KEY]
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Timber.e(e, """## MXOlmDevice : cannot find ${OlmAccount.JSON_KEY_IDENTITY_KEY} with error""")
|
Timber.e(e, "## MXOlmDevice : cannot find ${OlmAccount.JSON_KEY_IDENTITY_KEY} with error")
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -77,7 +77,6 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
|
||||||
MXCryptoError.UNABLE_TO_DECRYPT, MXCryptoError.MISSING_FIELDS_REASON))
|
MXCryptoError.UNABLE_TO_DECRYPT, MXCryptoError.MISSING_FIELDS_REASON))
|
||||||
}
|
}
|
||||||
|
|
||||||
val eventDecryptionResult: MXEventDecryptionResult?
|
|
||||||
var cryptoError: MXCryptoError? = null
|
var cryptoError: MXCryptoError? = null
|
||||||
var decryptGroupMessageResult: MXDecryptionResult? = null
|
var decryptGroupMessageResult: MXDecryptionResult? = null
|
||||||
|
|
||||||
|
@ -88,7 +87,7 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
|
||||||
}
|
}
|
||||||
// the decryption succeeds
|
// the decryption succeeds
|
||||||
if (decryptGroupMessageResult?.payload != null) {
|
if (decryptGroupMessageResult?.payload != null) {
|
||||||
eventDecryptionResult = MXEventDecryptionResult()
|
val eventDecryptionResult = MXEventDecryptionResult()
|
||||||
|
|
||||||
eventDecryptionResult.clearEvent = decryptGroupMessageResult.payload
|
eventDecryptionResult.clearEvent = decryptGroupMessageResult.payload
|
||||||
eventDecryptionResult.senderCurve25519Key = decryptGroupMessageResult.senderKey
|
eventDecryptionResult.senderCurve25519Key = decryptGroupMessageResult.senderKey
|
||||||
|
@ -215,11 +214,6 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
|
||||||
forwardedRoomKeyContent.forwardingCurve25519KeyChain?.let {
|
forwardedRoomKeyContent.forwardingCurve25519KeyChain?.let {
|
||||||
forwardingCurve25519KeyChain.addAll(it)
|
forwardingCurve25519KeyChain.addAll(it)
|
||||||
}
|
}
|
||||||
// forwardingCurve25519KeyChain = if (forwardedRoomKeyContent.forwardingCurve25519KeyChain == null) {
|
|
||||||
// ArrayList()
|
|
||||||
// } else {
|
|
||||||
// ArrayList(forwardedRoomKeyContent.forwardingCurve25519KeyChain)
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (senderKey == null) {
|
if (senderKey == null) {
|
||||||
Timber.e("## onRoomKeyEvent() : event is missing sender_key field")
|
Timber.e("## onRoomKeyEvent() : event is missing sender_key field")
|
||||||
|
|
Loading…
Reference in New Issue