crypto: Don't allow QR code generation if we or the other can't handle it

master
Damir Jelić 2021-06-14 17:51:13 +02:00
parent b7986a5153
commit 58d3b42a60
1 changed files with 9 additions and 0 deletions

View File

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