Add method to mismatch SAS verifications
The method sets the proper CancelCode for the case when SAS doesn't match on both devices.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use matrix_sdk_base::crypto::{AcceptSettings, CancelInfo, ReadOnlyDevice, Sas as BaseSas};
|
||||
use ruma::UserId;
|
||||
use ruma::{events::key::verification::cancel::CancelCode, UserId};
|
||||
|
||||
use crate::{error::Result, Client};
|
||||
|
||||
@@ -89,6 +89,16 @@ impl SasVerification {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Cancel the interactive verification flow because the short auth strings didn't match on both sides.
|
||||
pub async fn mismatch(&self) -> Result<()> {
|
||||
// FIXME: Use variant once https://github.com/ruma/ruma/pull/804 is merged
|
||||
if let Some(request) = self.inner.cancel_with_code(CancelCode::from("m.mismatched_sas")) {
|
||||
self.client.send_verification_request(request).await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Cancel the interactive verification flow.
|
||||
pub async fn cancel(&self) -> Result<()> {
|
||||
if let Some(request) = self.inner.cancel() {
|
||||
|
||||
Reference in New Issue
Block a user