mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 04:20:00 +03:00
Fix: ignore key request form self devices
This commit is contained in:
parent
885f836adb
commit
058d2e6b72
1 changed files with 1343 additions and 1334 deletions
|
@ -716,8 +716,10 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
}.foldToCallback(callback)
|
||||
} else {
|
||||
val algorithm = getEncryptionAlgorithm(roomId)
|
||||
val reason = String.format(MXCryptoError.UNABLE_TO_ENCRYPT_REASON,
|
||||
algorithm ?: MXCryptoError.NO_MORE_ALGORITHM_REASON)
|
||||
val reason = String.format(
|
||||
MXCryptoError.UNABLE_TO_ENCRYPT_REASON,
|
||||
algorithm ?: MXCryptoError.NO_MORE_ALGORITHM_REASON
|
||||
)
|
||||
Timber.tag(loggerTag.value).e("encryptEventContent() : failed $reason")
|
||||
callback.onFailure(Failure.CryptoError(MXCryptoError.Base(MXCryptoError.ErrorType.UNABLE_TO_ENCRYPT, reason)))
|
||||
}
|
||||
|
@ -797,9 +799,16 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
}
|
||||
EventType.ROOM_KEY_REQUEST -> {
|
||||
event.getClearContent().toModel<RoomKeyShareRequest>()?.let { req ->
|
||||
// We'll always get these because we send room key requests to
|
||||
// '*' (ie. 'all devices') which includes the sending device,
|
||||
// so ignore requests from ourself because apart from it being
|
||||
// very silly, it won't work because an Olm session cannot send
|
||||
// messages to itself.
|
||||
if (req.requestingDeviceId != deviceId) { // ignore self requests
|
||||
event.senderId?.let { incomingKeyRequestManager.addNewIncomingRequest(it, req) }
|
||||
}
|
||||
}
|
||||
}
|
||||
EventType.SEND_SECRET -> {
|
||||
onSecretSendReceived(event)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue