diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RustEncryptionService.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RustEncryptionService.kt index 74aeda9694..f380bbe532 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RustEncryptionService.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/encryption/RustEncryptionService.kt @@ -44,6 +44,7 @@ import org.matrix.rustcomponents.sdk.Encryption import org.matrix.rustcomponents.sdk.UserIdentity import org.matrix.rustcomponents.sdk.BackupUploadState as RustBackupUploadState import org.matrix.rustcomponents.sdk.EnableRecoveryProgress as RustEnableRecoveryProgress +import org.matrix.rustcomponents.sdk.RecoveryException as RustRecoveryException import org.matrix.rustcomponents.sdk.SteadyStateException as RustSteadyStateException class RustEncryptionService( @@ -205,8 +206,13 @@ class RustEncryptionService( override suspend fun recover(recoveryKey: String): Result = withContext(dispatchers.io) { runCatchingExceptions { service.recover(recoveryKey) - }.mapFailure { - it.mapRecoveryException() + }.recoverCatching { + if (it is RustRecoveryException.Import) { + // We ignore import errors because the user will be notified about them via the "Key storage out of sync" detection. + Unit + } else { + throw it.mapRecoveryException() + } } }