From acda2e88e33091c429c82bca9dc00e5c794e18d3 Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Thu, 12 Mar 2026 17:09:40 +0000 Subject: [PATCH] Add HumanQrLoginError::UnsupportedQrCodeType and HumanQrGrantLoginError::UnsupportedQrCodeType --- bindings/matrix-sdk-ffi/CHANGELOG.md | 6 ++++++ bindings/matrix-sdk-ffi/src/qr_code.rs | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/bindings/matrix-sdk-ffi/CHANGELOG.md b/bindings/matrix-sdk-ffi/CHANGELOG.md index 01c384fcd..6e2a9322d 100644 --- a/bindings/matrix-sdk-ffi/CHANGELOG.md +++ b/bindings/matrix-sdk-ffi/CHANGELOG.md @@ -36,6 +36,12 @@ All notable changes to this project will be documented in this file. ### Features +- Add `HumanQrLoginError::UnsupportedQrCodeType` for when a QR is parseable but cannot be used to + complete a login. + ([#6141](https://github.com/matrix-org/matrix-rust-sdk/pull/6285) +- Add `HumanQrGrantLoginError::UnsupportedQrCodeType` for when a QR is parseable but cannot be used + to grant a login. + ([#6141](https://github.com/matrix-org/matrix-rust-sdk/pull/6285) - Add the `QrCodeData::base_url` and `QrCodeData::intent` methods. ([#6283](https://github.com/matrix-org/matrix-rust-sdk/pull/6283)) - Add `Encryption::recover_and_fix_backup` to automatically fix key storage backup if the diff --git a/bindings/matrix-sdk-ffi/src/qr_code.rs b/bindings/matrix-sdk-ffi/src/qr_code.rs index e661ccf79..58114375a 100644 --- a/bindings/matrix-sdk-ffi/src/qr_code.rs +++ b/bindings/matrix-sdk-ffi/src/qr_code.rs @@ -332,6 +332,8 @@ pub enum HumanQrLoginError { CheckCodeCannotBeSent, #[error("The rendezvous session was not found and might have expired")] NotFound, + #[error("The QR code specifies an unsupported protocol version")] + UnsupportedQrCodeType, } impl From for HumanQrLoginError { @@ -362,8 +364,10 @@ impl From for HumanQrLoginError { SecureChannelError::Utf8(_) | SecureChannelError::MessageDecode(_) | SecureChannelError::Json(_) - | SecureChannelError::RendezvousChannel(_) - | SecureChannelError::UnsupportedQrCodeType => HumanQrLoginError::Unknown, + | SecureChannelError::RendezvousChannel(_) => HumanQrLoginError::Unknown, + SecureChannelError::UnsupportedQrCodeType => { + HumanQrLoginError::UnsupportedQrCodeType + } SecureChannelError::SecureChannelMessage { .. } | SecureChannelError::Ecies(_) | SecureChannelError::InvalidCheckCode @@ -442,6 +446,10 @@ pub enum HumanQrGrantLoginError { /// devices. #[error("A secure connection could not have been established between the two devices.")] ConnectionInsecure, + + /// The QR code specifies an unsupported protocol version. + #[error("The QR code specifies an unsupported protocol version")] + UnsupportedQrCodeType, } impl From for HumanQrGrantLoginError { @@ -463,8 +471,8 @@ impl From for HumanQrGrantLoginError { SecureChannelError::Utf8(_) | SecureChannelError::MessageDecode(_) | SecureChannelError::Json(_) - | SecureChannelError::RendezvousChannel(_) - | SecureChannelError::UnsupportedQrCodeType => Self::Unknown(e.to_string()), + | SecureChannelError::RendezvousChannel(_) => Self::Unknown(e.to_string()), + SecureChannelError::UnsupportedQrCodeType => Self::UnsupportedQrCodeType, SecureChannelError::SecureChannelMessage { .. } | SecureChannelError::Ecies(_) | SecureChannelError::InvalidCheckCode