diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt index b3cb03d657..1f9d712057 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt @@ -168,7 +168,7 @@ internal class OlmMachine( deviceObserver: DeviceUpdateObserver, private val requestSender: RequestSender, ) { - private val inner: InnerMachine = InnerMachine(user_id, device_id, path.toString()) + private val inner: InnerMachine = InnerMachine(user_id, device_id, path.toString(),null) private val deviceUpdateObserver = deviceObserver private val userIdentityUpdateObserver = UserIdentityUpdateObserver() private val privateKeysUpdateObserver = PrivateCrossSigningKeysUpdateObserver() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/QrCodeVerification.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/QrCodeVerification.kt index e61c5c8f8f..4dc64a3c54 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/QrCodeVerification.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/QrCodeVerification.kt @@ -179,7 +179,9 @@ internal class QrCodeVerification( } if (result != null) { - this.sender.sendVerificationRequest(result.request) + for (request in result.requests) { + this.sender.sendVerificationRequest(request) + } dispatchTxUpdated() val signatureRequest = result.signatureRequest diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/SasVerification.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/SasVerification.kt index 11a00c3b64..f210c2f2bc 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/SasVerification.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/SasVerification.kt @@ -209,7 +209,9 @@ internal class SasVerification( } if (result != null) { - this.sender.sendVerificationRequest(result.request) + for (request in result.requests) { + this.sender.sendVerificationRequest(request) + } dispatchTxUpdated() val signatureRequest = result.signatureRequest diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/ExtractMigrationDataUseCase.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/migration/ExtractMigrationDataUseCase.kt similarity index 98% rename from matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/ExtractMigrationDataUseCase.kt rename to matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/migration/ExtractMigrationDataUseCase.kt index 0b0b5a6346..305271ed5a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/ExtractMigrationDataUseCase.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/store/migration/ExtractMigrationDataUseCase.kt @@ -29,21 +29,22 @@ import uniffi.olm.PickledAccount import uniffi.olm.PickledInboundGroupSession import uniffi.olm.PickledSession import java.nio.charset.Charset +import javax.inject.Inject private val charset = Charset.forName("UTF-8") -internal class ExtractMigrationDataUseCase() { +internal class ExtractMigrationDataUseCase @Inject constructor() { operator fun invoke(realm: Realm): MigrationData? { - val pickleKey = OlmUtility.getRandomKey() + val metadataEntity = realm.where().findFirst() ?: return null + val pickleKey = OlmUtility.getRandomKey() val olmSessionEntities = realm.where().findAll() val pickledSessions = olmSessionEntities.map { it.toPickledSession(pickleKey) } val inboundGroupSessionEntities = realm.where().findAll() val pickledInboundGroupSessions = inboundGroupSessionEntities.map { it.toPickledInboundGroupSession(pickleKey) } - val metadataEntity = realm.where().findFirst() ?: return null val masterKey = metadataEntity.xSignMasterPrivateKey val userKey = metadataEntity.xSignUserPrivateKey val selfSignedKey = metadataEntity.xSignSelfSignedPrivateKey