diff --git a/matrix_sdk_crypto/src/verification/qrcode.rs b/matrix_sdk_crypto/src/verification/qrcode.rs index 0b414b80..b1e7adfd 100644 --- a/matrix_sdk_crypto/src/verification/qrcode.rs +++ b/matrix_sdk_crypto/src/verification/qrcode.rs @@ -101,10 +101,15 @@ impl QrVerification { /// /// When the verification object is in this state it's required that the /// user confirms that the other side has scanned the QR code. - pub fn is_scanned(&self) -> bool { + pub fn has_been_scanned(&self) -> bool { matches!(&*self.state.lock().unwrap(), InnerState::Scanned(_)) } + /// Has the scanning of the QR code been confirmed by us. + pub fn has_been_confirmed(&self) -> bool { + matches!(&*self.state.lock().unwrap(), InnerState::Confirmed(_)) + } + /// Get our own user id. pub fn user_id(&self) -> &UserId { self.identities.user_id() diff --git a/matrix_sdk_crypto/src/verification/requests.rs b/matrix_sdk_crypto/src/verification/requests.rs index e858ceca..ac3cbf8e 100644 --- a/matrix_sdk_crypto/src/verification/requests.rs +++ b/matrix_sdk_crypto/src/verification/requests.rs @@ -551,7 +551,10 @@ impl InnerRequest { }) } - async fn generate_qr_code(&self, we_started: bool) -> Result, CryptoStoreError> { + async fn generate_qr_code( + &self, + we_started: bool, + ) -> Result, CryptoStoreError> { match self { InnerRequest::Created(_) => Ok(None), InnerRequest::Requested(_) => Ok(None),