Add HumanQrLoginError::UnsupportedQrCodeType and HumanQrGrantLoginError::UnsupportedQrCodeType

This commit is contained in:
Hugh Nimmo-Smith
2026-03-12 17:09:40 +00:00
committed by Damir Jelić
parent b6c4bca5a0
commit acda2e88e3
2 changed files with 18 additions and 4 deletions

View File

@@ -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

View File

@@ -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<qrcode::QRCodeLoginError> for HumanQrLoginError {
@@ -362,8 +364,10 @@ impl From<qrcode::QRCodeLoginError> 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<qrcode::QRCodeGrantLoginError> for HumanQrGrantLoginError {
@@ -463,8 +471,8 @@ impl From<qrcode::QRCodeGrantLoginError> 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