From 14bc4eb7e0be8a5bae8739e1760500242bdfba30 Mon Sep 17 00:00:00 2001 From: Johannes Becker Date: Mon, 10 May 2021 09:11:15 +0200 Subject: [PATCH] appservice: Rename verify_hs_token to hs_token_matches --- matrix_sdk_appservice/src/actix.rs | 6 +++--- matrix_sdk_appservice/src/lib.rs | 2 +- matrix_sdk_appservice/tests/tests.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/matrix_sdk_appservice/src/actix.rs b/matrix_sdk_appservice/src/actix.rs index 3e899822..e260e822 100644 --- a/matrix_sdk_appservice/src/actix.rs +++ b/matrix_sdk_appservice/src/actix.rs @@ -65,7 +65,7 @@ async fn push_transactions( request: IncomingRequest, appservice: Data, ) -> Result { - if !appservice.verify_hs_token(request.access_token) { + if !appservice.hs_token_matches(request.access_token) { return Ok(HttpResponse::Unauthorized().finish()); } @@ -84,7 +84,7 @@ async fn query_user_id( request: IncomingRequest, appservice: Data, ) -> Result { - if !appservice.verify_hs_token(request.access_token) { + if !appservice.hs_token_matches(request.access_token) { return Ok(HttpResponse::Unauthorized().finish()); } @@ -97,7 +97,7 @@ async fn query_room_alias( request: IncomingRequest, appservice: Data, ) -> Result { - if !appservice.verify_hs_token(request.access_token) { + if !appservice.hs_token_matches(request.access_token) { return Ok(HttpResponse::Unauthorized().finish()); } diff --git a/matrix_sdk_appservice/src/lib.rs b/matrix_sdk_appservice/src/lib.rs index 8c27376f..3f40bacc 100644 --- a/matrix_sdk_appservice/src/lib.rs +++ b/matrix_sdk_appservice/src/lib.rs @@ -272,7 +272,7 @@ impl Appservice { /// Compare the given `hs_token` against `registration.hs_token` /// /// Returns `true` if the tokens match, `false` otherwise. - pub fn verify_hs_token(&self, hs_token: impl AsRef) -> bool { + pub fn hs_token_matches(&self, hs_token: impl AsRef) -> bool { self.registration.hs_token == hs_token.as_ref() } diff --git a/matrix_sdk_appservice/tests/tests.rs b/matrix_sdk_appservice/tests/tests.rs index 9b81b81c..19e8bc29 100644 --- a/matrix_sdk_appservice/tests/tests.rs +++ b/matrix_sdk_appservice/tests/tests.rs @@ -119,7 +119,7 @@ async fn test_verify_hs_token() -> Result<()> { let registration = appservice.registration(); - assert!(appservice.verify_hs_token(®istration.hs_token)); + assert!(appservice.hs_token_matches(®istration.hs_token)); Ok(()) }