diff --git a/dependencies_groups.gradle b/dependencies_groups.gradle index 55b1db6392..3744aa04f3 100644 --- a/dependencies_groups.gradle +++ b/dependencies_groups.gradle @@ -135,7 +135,7 @@ ext.groups = [ 'com.sun.xml.bind.mvn', 'com.sun.xml.fastinfoset', 'com.thoughtworks.qdox', - // 'com.vanniktech', + 'com.vanniktech', 'commons-cli', 'commons-codec', 'commons-io', diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle index 0273277305..341624bc5c 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -218,7 +218,7 @@ dependencies { // rustCryptoImplementation 'org.matrix.rustcomponents:crypto-android:0.2.1-SNAPSHOT' // rustCryptoImplementation files('libs/matrix-rust-sdk-crypto.aar') - rustCryptoImplementation("org.matrix.rustcomponents:crypto-android:0.1.3") + rustCryptoImplementation("org.matrix.rustcomponents:crypto-android:0.3.1") // rustCryptoApi project(":library:rustCrypto") testImplementation libs.tests.junit diff --git a/matrix-sdk-android/src/rustCrypto/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt b/matrix-sdk-android/src/rustCrypto/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt index a264eabed3..a983aac114 100644 --- a/matrix-sdk-android/src/rustCrypto/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt +++ b/matrix-sdk-android/src/rustCrypto/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt @@ -472,15 +472,19 @@ internal class OlmMachine @Inject constructor( } catch (throwable: Throwable) { val reThrow = when (throwable) { is DecryptionException.MissingRoomKey -> { - if (throwable.withheldCode != null) { - MXCryptoError.Base(MXCryptoError.ErrorType.KEYS_WITHHELD, throwable.withheldCode!!) - } else { - MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID, throwable.error) - } + // Revert when witheld PR merged +// if (throwable.withheldCode != null) { +// MXCryptoError.Base(MXCryptoError.ErrorType.KEYS_WITHHELD, throwable.withheldCode!!) +// } else { +// MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID, throwable.error) +// } + + MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID, throwable.message.orEmpty()) } is DecryptionException.Megolm -> { // TODO check if it's the correct binding? - MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_MESSAGE_INDEX, throwable.error) +// MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_MESSAGE_INDEX, throwable.error) + MXCryptoError.Base(MXCryptoError.ErrorType.UNKNOWN_MESSAGE_INDEX, throwable.message.orEmpty()) } is DecryptionException.Identifier -> { MXCryptoError.Base(MXCryptoError.ErrorType.BAD_EVENT_FORMAT, MXCryptoError.BAD_EVENT_FORMAT_TEXT_REASON) @@ -504,7 +508,7 @@ internal class OlmMachine @Inject constructor( private fun ShieldState.toVerificationState(): MessageVerificationState? { return when (this.color) { - ShieldColor.GREEN -> MessageVerificationState.VERIFIED + ShieldColor.NONE -> MessageVerificationState.VERIFIED ShieldColor.RED -> { when (this.message) { "Encrypted by an unverified device." -> MessageVerificationState.UN_SIGNED_DEVICE @@ -513,10 +517,9 @@ internal class OlmMachine @Inject constructor( else -> MessageVerificationState.UN_SIGNED_DEVICE } } - ShieldColor.GRAY -> { + ShieldColor.GREY -> { MessageVerificationState.UNSAFE_SOURCE } - ShieldColor.NONE -> null } } diff --git a/matrix-sdk-android/src/rustCrypto/java/org/matrix/android/sdk/internal/crypto/store/db/migration/rust/ExtractMigrationDataUseCase.kt b/matrix-sdk-android/src/rustCrypto/java/org/matrix/android/sdk/internal/crypto/store/db/migration/rust/ExtractMigrationDataUseCase.kt index 96f3fda2f4..216316c5ed 100644 --- a/matrix-sdk-android/src/rustCrypto/java/org/matrix/android/sdk/internal/crypto/store/db/migration/rust/ExtractMigrationDataUseCase.kt +++ b/matrix-sdk-android/src/rustCrypto/java/org/matrix/android/sdk/internal/crypto/store/db/migration/rust/ExtractMigrationDataUseCase.kt @@ -102,6 +102,8 @@ internal class ExtractMigrationDataUseCase { trackedUsers = emptyList(), inboundGroupSessions = emptyList(), backupVersion = backupVersion, + // TODO import room settings from legacy DB + roomSettings = emptyMap() ) // import the account asap importPartial(baseExtract)