Merge pull request #5314 from uhoreg/separate_import_error
Fix error when attempting to verify with recovery key with missing backup key
This commit is contained in:
commit
a62ed35a62
1 changed files with 8 additions and 2 deletions
|
|
@ -44,6 +44,7 @@ import org.matrix.rustcomponents.sdk.Encryption
|
||||||
import org.matrix.rustcomponents.sdk.UserIdentity
|
import org.matrix.rustcomponents.sdk.UserIdentity
|
||||||
import org.matrix.rustcomponents.sdk.BackupUploadState as RustBackupUploadState
|
import org.matrix.rustcomponents.sdk.BackupUploadState as RustBackupUploadState
|
||||||
import org.matrix.rustcomponents.sdk.EnableRecoveryProgress as RustEnableRecoveryProgress
|
import org.matrix.rustcomponents.sdk.EnableRecoveryProgress as RustEnableRecoveryProgress
|
||||||
|
import org.matrix.rustcomponents.sdk.RecoveryException as RustRecoveryException
|
||||||
import org.matrix.rustcomponents.sdk.SteadyStateException as RustSteadyStateException
|
import org.matrix.rustcomponents.sdk.SteadyStateException as RustSteadyStateException
|
||||||
|
|
||||||
class RustEncryptionService(
|
class RustEncryptionService(
|
||||||
|
|
@ -205,8 +206,13 @@ class RustEncryptionService(
|
||||||
override suspend fun recover(recoveryKey: String): Result<Unit> = withContext(dispatchers.io) {
|
override suspend fun recover(recoveryKey: String): Result<Unit> = withContext(dispatchers.io) {
|
||||||
runCatchingExceptions {
|
runCatchingExceptions {
|
||||||
service.recover(recoveryKey)
|
service.recover(recoveryKey)
|
||||||
}.mapFailure {
|
}.recoverCatching {
|
||||||
it.mapRecoveryException()
|
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue