refactor: rename fingerprint_equals_sender to verify_sender_by_fingerprint

This commit is contained in:
link2xt
2024-01-07 21:38:21 +00:00
parent 1fd42f2c53
commit 9415a71f9d
2 changed files with 11 additions and 6 deletions

View File

@@ -203,7 +203,7 @@ async fn info_chat_id(context: &Context, contact_id: ContactId) -> Result<ChatId
/// Checks fingerprint and marks the contact as forward verified
/// if fingerprint matches.
async fn fingerprint_equals_sender(
async fn verify_sender_by_fingerprint(
context: &Context,
fingerprint: &Fingerprint,
contact_id: ContactId,
@@ -374,7 +374,7 @@ pub(crate) async fn handle_securejoin_handshake(
.await?;
return Ok(HandshakeMessage::Ignore);
}
if !fingerprint_equals_sender(context, &fingerprint, contact_id).await? {
if !verify_sender_by_fingerprint(context, &fingerprint, contact_id).await? {
could_not_establish_secure_connection(
context,
contact_id,

View File

@@ -11,7 +11,7 @@ use anyhow::Result;
use rusqlite::Connection;
use super::qrinvite::QrInvite;
use super::{encrypted_and_signed, fingerprint_equals_sender};
use super::{encrypted_and_signed, verify_sender_by_fingerprint};
use crate::chat::{self, ChatId};
use crate::config::Config;
use crate::contact::{Contact, Origin};
@@ -90,7 +90,8 @@ impl BobState {
chat_id: ChatId,
) -> Result<(Self, BobHandshakeStage, Vec<Self>)> {
let (stage, next) =
if fingerprint_equals_sender(context, invite.fingerprint(), invite.contact_id()).await?
if verify_sender_by_fingerprint(context, invite.fingerprint(), invite.contact_id())
.await?
{
// The scanned fingerprint matches Alice's key, we can proceed to step 4b.
info!(context, "Taking securejoin protocol shortcut");
@@ -268,8 +269,12 @@ impl BobState {
.await?;
return Ok(Some(BobHandshakeStage::Terminated(reason)));
}
if !fingerprint_equals_sender(context, self.invite.fingerprint(), self.invite.contact_id())
.await?
if !verify_sender_by_fingerprint(
context,
self.invite.fingerprint(),
self.invite.contact_id(),
)
.await?
{
self.update_next(&context.sql, SecureJoinStep::Terminated)
.await?;