mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-28 03:48:37 +03:00
Cleaning
This commit is contained in:
parent
9e055d9793
commit
c01998ddd3
12 changed files with 20 additions and 27 deletions
|
@ -41,7 +41,6 @@ import org.matrix.android.sdk.api.listeners.ProgressListener
|
|||
import org.matrix.android.sdk.api.session.crypto.CryptoService
|
||||
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
||||
import org.matrix.android.sdk.api.session.crypto.crosssigning.CrossSigningService
|
||||
import org.matrix.android.sdk.api.session.crypto.keysbackup.KeysBackupService
|
||||
import org.matrix.android.sdk.api.session.crypto.keyshare.GossipingRequestListener
|
||||
import org.matrix.android.sdk.api.session.events.model.Content
|
||||
import org.matrix.android.sdk.api.session.events.model.Event
|
||||
|
@ -310,7 +309,7 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
setRustLogger()
|
||||
Timber.v(
|
||||
"## CRYPTO | Successfully started up an Olm machine for " +
|
||||
"${userId}, ${deviceId}, identity keys: ${this.olmMachine.identityKeys()}")
|
||||
"$userId, $deviceId, identity keys: ${this.olmMachine.identityKeys()}")
|
||||
} catch (throwable: Throwable) {
|
||||
Timber.v("Failed create an Olm machine: $throwable")
|
||||
}
|
||||
|
@ -626,9 +625,9 @@ internal class DefaultCryptoService @Inject constructor(
|
|||
cryptoCoroutineScope.launch {
|
||||
olmMachine.updateTrackedUsers(listOf(userId))
|
||||
}
|
||||
} else if (membership == Membership.INVITE
|
||||
&& shouldEncryptForInvitedMembers(roomId)
|
||||
&& isEncryptionEnabledForInvitedUser()) {
|
||||
} else if (membership == Membership.INVITE &&
|
||||
shouldEncryptForInvitedMembers(roomId) &&
|
||||
isEncryptionEnabledForInvitedUser()) {
|
||||
// track the deviceList for this invited user.
|
||||
// Caution: there's a big edge case here in that federated servers do not
|
||||
// know what other servers are in the room at the time they've been invited.
|
||||
|
|
|
@ -25,10 +25,10 @@ import org.matrix.android.sdk.internal.crypto.model.CryptoDeviceInfo
|
|||
import org.matrix.android.sdk.internal.crypto.model.rest.UnsignedDeviceInfo
|
||||
import org.matrix.android.sdk.internal.crypto.verification.prepareMethods
|
||||
import uniffi.olm.CryptoStoreException
|
||||
import uniffi.olm.Device as InnerDevice
|
||||
import uniffi.olm.OlmMachine
|
||||
import uniffi.olm.SignatureException
|
||||
import uniffi.olm.VerificationRequest
|
||||
import uniffi.olm.Device as InnerDevice
|
||||
|
||||
/** Class representing a device that supports E2EE in the Matrix world
|
||||
*
|
||||
|
|
|
@ -22,7 +22,6 @@ import kotlinx.coroutines.Dispatchers
|
|||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.matrix.android.sdk.api.auth.UserInteractiveAuthInterceptor
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
import org.matrix.android.sdk.api.listeners.ProgressListener
|
||||
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
||||
import org.matrix.android.sdk.api.session.crypto.crosssigning.MXCrossSigningInfo
|
||||
|
@ -771,7 +770,6 @@ internal class OlmMachine(
|
|||
suspend fun exportCrossSigningKeys(): PrivateKeysInfo? {
|
||||
val export = withContext(Dispatchers.IO) {
|
||||
inner.exportCrossSigningKeys()
|
||||
|
||||
} ?: return null
|
||||
|
||||
return PrivateKeysInfo(export.masterKey, export.selfSigningKey, export.userSigningKey)
|
||||
|
|
|
@ -174,8 +174,7 @@ internal class QrCodeVerification(
|
|||
*/
|
||||
@Throws(CryptoStoreException::class)
|
||||
private suspend fun confirm() {
|
||||
val result = withContext(Dispatchers.IO)
|
||||
{
|
||||
val result = withContext(Dispatchers.IO) {
|
||||
machine.confirmVerification(request.otherUser(), request.flowId())
|
||||
}
|
||||
|
||||
|
|
|
@ -168,8 +168,8 @@ internal class RequestSender @Inject constructor(
|
|||
try {
|
||||
uploadSigningKeysTask.execute(uploadSigningKeysParams)
|
||||
} catch (failure: Throwable) {
|
||||
if (interactiveAuthInterceptor == null
|
||||
|| !handleUIA(
|
||||
if (interactiveAuthInterceptor == null ||
|
||||
!handleUIA(
|
||||
failure = failure,
|
||||
interceptor = interactiveAuthInterceptor,
|
||||
retryBlock = { authUpdate ->
|
||||
|
@ -218,8 +218,8 @@ internal class RequestSender @Inject constructor(
|
|||
getKeysBackupLastVersionTask.execute(Unit)
|
||||
}
|
||||
} catch (failure: Throwable) {
|
||||
if (failure is Failure.ServerError
|
||||
&& failure.error.code == MatrixError.M_NOT_FOUND) {
|
||||
if (failure is Failure.ServerError &&
|
||||
failure.error.code == MatrixError.M_NOT_FOUND) {
|
||||
null
|
||||
} else {
|
||||
throw failure
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.matrix.android.sdk.api.session.crypto.keysbackup.KeysBackupState
|
|||
import org.matrix.android.sdk.api.session.crypto.keysbackup.KeysBackupStateListener
|
||||
import org.matrix.android.sdk.internal.crypto.MXCRYPTO_ALGORITHM_MEGOLM_BACKUP
|
||||
import org.matrix.android.sdk.internal.crypto.MegolmSessionData
|
||||
import org.matrix.android.sdk.internal.crypto.OlmMachine
|
||||
import org.matrix.android.sdk.internal.crypto.OlmMachineProvider
|
||||
import org.matrix.android.sdk.internal.crypto.RequestSender
|
||||
import org.matrix.android.sdk.internal.crypto.keysbackup.model.KeysBackupVersionTrust
|
||||
|
|
|
@ -73,8 +73,8 @@ internal interface VerificationInfoStart : VerificationInfo<ValidVerificationInf
|
|||
val validHashes = hashes?.takeIf { it.contains("sha256") } ?: return null
|
||||
val validMessageAuthenticationCodes = messageAuthenticationCodes
|
||||
?.takeIf {
|
||||
it.contains(SAS_MAC_SHA256)
|
||||
|| it.contains(SAS_MAC_SHA256_LONGKDF)
|
||||
it.contains(SAS_MAC_SHA256) ||
|
||||
it.contains(SAS_MAC_SHA256_LONGKDF)
|
||||
}
|
||||
?: return null
|
||||
val validShortAuthenticationStrings = shortAuthenticationStrings?.takeIf { it.contains(SasMode.DECIMAL) } ?: return null
|
||||
|
|
|
@ -174,13 +174,13 @@ internal class CreateRoomBodyBuilder @Inject constructor(
|
|||
}
|
||||
|
||||
private suspend fun canEnableEncryption(params: CreateRoomParams): Boolean {
|
||||
return params.enableEncryptionIfInvitedUsersSupportIt
|
||||
return params.enableEncryptionIfInvitedUsersSupportIt &&
|
||||
// Parity with web, enable if users have encryption ready devices
|
||||
// for now remove checks on cross signing and 3pid invites
|
||||
// && crossSigningService.isCrossSigningVerified()
|
||||
&& params.invite3pids.isEmpty()
|
||||
&& params.invitedUserIds.isNotEmpty()
|
||||
&& params.invitedUserIds.let { userIds ->
|
||||
params.invite3pids.isEmpty() &&
|
||||
params.invitedUserIds.isNotEmpty() &&
|
||||
params.invitedUserIds.let { userIds ->
|
||||
val keys = olmMachineProvider.olmMachine.getUserDevicesMap(userIds)
|
||||
// deviceListManager.downloadKeys(userIds, forceDownload = false)
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ import org.matrix.android.sdk.internal.session.room.accountdata.RoomAccountDataD
|
|||
import org.matrix.android.sdk.internal.session.room.membership.RoomDisplayNameResolver
|
||||
import org.matrix.android.sdk.internal.session.room.membership.RoomMemberHelper
|
||||
import org.matrix.android.sdk.internal.session.room.relationship.RoomChildRelationInfo
|
||||
import org.matrix.android.sdk.internal.util.Normalizer
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
|
|
@ -88,7 +88,6 @@ import im.vector.app.features.widgets.WidgetActivity
|
|||
import im.vector.app.features.widgets.WidgetArgsBuilder
|
||||
import im.vector.app.space
|
||||
import org.matrix.android.sdk.api.session.crypto.verification.SasVerificationTransaction
|
||||
import org.matrix.android.sdk.api.session.crypto.verification.IncomingSasVerificationTransaction
|
||||
import org.matrix.android.sdk.api.session.permalinks.PermalinkData
|
||||
import org.matrix.android.sdk.api.session.room.model.roomdirectory.PublicRoom
|
||||
import org.matrix.android.sdk.api.session.terms.TermsService
|
||||
|
|
Loading…
Reference in a new issue