[fractal/fractal-next] verification: Use correct CancelCode for SAS mismatch
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/fractal-next] verification: Use correct CancelCode for SAS mismatch
- Date: Mon, 21 Mar 2022 11:24:34 +0000 (UTC)
commit 22ec222870b375b60e9fe30f05e7cc1135de161a
Author: Julian Sparber <julian sparber net>
Date: Mon Mar 21 10:58:58 2022 +0100
verification: Use correct CancelCode for SAS mismatch
src/session/verification/identity_verification.rs | 24 +++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/session/verification/identity_verification.rs
b/src/session/verification/identity_verification.rs
index 6a398c31b..f6a31f3a3 100644
--- a/src/session/verification/identity_verification.rs
+++ b/src/session/verification/identity_verification.rs
@@ -795,8 +795,11 @@ macro_rules! wait {
}
return Ok(State::Cancelled);
},
- Message::UserAction(UserAction::Cancel) | Message::UserAction(UserAction::NotMatch) => {
+ Message::UserAction(UserAction::Cancel) => {
return $this.cancel_request().await;
+ },
+ Message::UserAction(UserAction::NotMatch) => {
+ return $this.sas_mismatch().await;
},
Message::UserAction(UserAction::Accept) => {
if true $(&& $allow_action)? {
@@ -857,7 +860,7 @@ macro_rules! wait_without_scanning_sas {
return $this.cancel_request().await;
}
Message::UserAction(UserAction::NotMatch) => {
- return $this.cancel_request().await;
+ return $this.sas_mismatch().await;
},
Message::UserAction(UserAction::Accept) => {
break;
@@ -1080,4 +1083,21 @@ impl Context {
Ok(State::Cancelled)
}
+
+ async fn sas_mismatch(self) -> Result<State, RequestVerificationError> {
+ if let Some(Verification::SasV1(sas_verification)) = self
+ .client
+ .encryption()
+ .get_verification(self.request.other_user_id(), self.request.flow_id())
+ .await
+ {
+ sas_verification.mismatch().await?;
+
+ if let Some(info) = sas_verification.cancel_info() {
+ self.send_cancel_info(info);
+ }
+ }
+
+ Ok(State::Cancelled)
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]