mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-13 02:25:51 -04:00
crypto: Don't allow QR code generation if we or the other can't handle it
This commit is contained in:
@@ -726,6 +726,15 @@ impl RequestState<Ready> {
|
||||
|
||||
async fn generate_qr_code(&self) -> Result<Option<QrVerification>, CryptoStoreError> {
|
||||
// TODO return an error explaining why we can't generate a QR code?
|
||||
|
||||
// If we didn't state that we support showing QR codes or if the other
|
||||
// side doesn't support scanning QR codes bail early.
|
||||
if !self.state.our_methods.contains(&VerificationMethod::MQrCodeShowV1)
|
||||
|| !self.state.their_methods.contains(&VerificationMethod::MQrScanShowV1)
|
||||
{
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let device = if let Some(device) =
|
||||
self.store.get_device(&self.other_user_id, &self.state.other_device_id).await?
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user