Code review cleaning

This commit is contained in:
Valere 2022-03-04 19:19:18 +01:00
parent 99a07af9de
commit db84c679b4
4 changed files with 7 additions and 15 deletions

View file

@ -280,7 +280,6 @@ internal class MXOlmDevice @Inject constructor(
olmSessionWrapper.onMessageReceived()
olmSessionStore.storeSession(olmSessionWrapper, theirIdentityKey)
// store.storeSession(olmSessionWrapper, theirIdentityKey)
val sessionIdentifier = olmSession.sessionIdentifier()
@ -866,7 +865,6 @@ internal class MXOlmDevice @Inject constructor(
// sanity check
return if (theirDeviceIdentityKey.isEmpty() || sessionId.isEmpty()) null else {
olmSessionStore.getDeviceSession(sessionId, theirDeviceIdentityKey)
// store.getDeviceSession(sessionId, theirDeviceIdentityKey)
}
}

View file

@ -51,18 +51,13 @@ internal class OlmSessionStore @Inject constructor(private val store: IMXCryptoS
}
/**
* Get all the Olm Sessions we are sharing with the given user
* device.
* Get all the Olm Sessions we are sharing with the given device.
*
* @param deviceKey the public key of the other device.
* @return A set of sessionId, or empty if device is not known
*/
@Synchronized
fun getDeviceSessionIds(deviceKey: String): List<String> {
return internalGetAllSessions(deviceKey)
}
private fun internalGetAllSessions(deviceKey: String): MutableList<String> {
// we need to get the persisted ids first
val persistedKnownSessions = store.getDeviceSessionIds(deviceKey)
.orEmpty()
@ -79,12 +74,12 @@ internal class OlmSessionStore @Inject constructor(private val store: IMXCryptoS
}
/**
* Retrieve an end-to-end session between the logged-in user and another
* Retrieve an end-to-end session between our own device and another
* device.
*
* @param sessionId the session Id.
* @param deviceKey the public key of the other device.
* @return The Base64 end-to-end session, or null if not found
* @return the session wrapper if found
*/
@Synchronized
fun getDeviceSession(sessionId: String, deviceKey: String): OlmSessionWrapper? {

View file

@ -471,9 +471,8 @@ internal class MXMegolmEncryption(
}
val olmSessionResult = usersDeviceMap?.getObject(userId, deviceId)
if (olmSessionResult?.sessionId == null) {
return false.also {
Timber.tag(loggerTag.value).w("reshareKey: no session with this device, probably because there were no one-time keys")
}
return false
}
Timber.tag(loggerTag.value).i(" reshareKey: $groupSessionId:$chainIndex with device $userId:$deviceId using session ${olmSessionResult.sessionId}")

View file

@ -261,7 +261,7 @@ internal interface IMXCryptoStore {
fun storeSession(olmSessionWrapper: OlmSessionWrapper, deviceKey: String)
/**
* Retrieve the end-to-end session ids between the logged-in user and another
* Retrieve all end-to-end session ids between our own device and another
* device.
*
* @param deviceKey the public key of the other device.
@ -270,7 +270,7 @@ internal interface IMXCryptoStore {
fun getDeviceSessionIds(deviceKey: String): List<String>?
/**
* Retrieve an end-to-end session between the logged-in user and another
* Retrieve an end-to-end session between our own device and another
* device.
*
* @param sessionId the session Id.