diff --git a/bindings/matrix-sdk-ffi/src/encryption.rs b/bindings/matrix-sdk-ffi/src/encryption.rs
index f9fec9d9965..85468b2cf93 100644
--- a/bindings/matrix-sdk-ffi/src/encryption.rs
+++ b/bindings/matrix-sdk-ffi/src/encryption.rs
@@ -462,15 +462,12 @@ impl From<&matrix_sdk::encryption::CrossSigningResetAuthType> for CrossSigningRe
#[derive(uniffi::Record)]
pub struct OidcCrossSigningResetInfo {
- /// The error message we received from the homeserver after we attempted to
- /// reset the cross-signing keys.
- pub error: String,
/// The URL where the user can approve the reset of the cross-signing keys.
pub approval_url: String,
}
impl From<&matrix_sdk::encryption::OidcCrossSigningResetInfo> for OidcCrossSigningResetInfo {
fn from(value: &matrix_sdk::encryption::OidcCrossSigningResetInfo) -> Self {
- Self { error: value.error.to_owned(), approval_url: value.approval_url.to_string() }
+ Self { approval_url: value.approval_url.to_string() }
}
}
diff --git a/crates/matrix-sdk/src/encryption/mod.rs b/crates/matrix-sdk/src/encryption/mod.rs
index 712c90bff67..1438db50fcd 100644
--- a/crates/matrix-sdk/src/encryption/mod.rs
+++ b/crates/matrix-sdk/src/encryption/mod.rs
@@ -36,7 +36,6 @@ use matrix_sdk_base::crypto::{
use matrix_sdk_common::executor::spawn;
use ruma::{
api::client::{
- error::{ErrorBody, ErrorKind},
keys::{
get_keys, upload_keys, upload_signatures::v3::Request as UploadSignaturesRequest,
upload_signing_keys::v3::Request as UploadSigningKeysRequest,
@@ -57,6 +56,7 @@ use ruma::{
},
DeviceId, OwnedDeviceId, OwnedUserId, TransactionId, UserId,
};
+use serde::Deserialize;
use tokio::sync::{Mutex, RwLockReadGuard};
use tracing::{debug, error, instrument, trace, warn};
use url::Url;
@@ -279,13 +279,12 @@ impl CrossSigningResetHandle {
let mut upload_request = self.upload_request.clone();
upload_request.auth = auth;
- // TODO: Do we want to put a limit on this infinite loop? 🤷
while let Err(e) = self.client.send(upload_request.clone(), None).await {
if *self.is_cancelled.lock().await {
return Ok(());
}
- if e.client_api_error_kind() != Some(&ErrorKind::Unrecognized) {
+ if e.as_uiaa_response().is_none() {
return Err(e.into());
}
}
@@ -313,15 +312,22 @@ pub enum CrossSigningResetAuthType {
}
impl CrossSigningResetAuthType {
- async fn new(client: &Client, error: &HttpError) -> Result