diff --git a/src/securejoin.rs b/src/securejoin.rs index 39a14901b..dfdb74c06 100644 --- a/src/securejoin.rs +++ b/src/securejoin.rs @@ -515,12 +515,8 @@ pub(crate) async fn handle_securejoin_handshake( } "vg-member-added-received" | "vc-contact-confirm-received" => { - /*========================================================== - ==== Alice - the inviter side ==== - ==== Step 8 in "Out-of-band verified groups" protocol ==== - ==========================================================*/ - - Ok(HandshakeMessage::Done) // "Done" deletes the message + // Deprecated steps, delete them immediately. + Ok(HandshakeMessage::Done) } _ => { warn!(context, "invalid step: {}", step); @@ -541,10 +537,10 @@ pub(crate) async fn handle_securejoin_handshake( /// before sending vg-member-added/vc-contact-confirm - so, if we observe vg-member-added/vc-contact-confirm, /// we can mark the peer as verified as well. /// -/// - if we see the self-sent-message vg-member-added-received +/// - if we see the self-sent-message vg-request-with-auth/vc-request-with-auth /// we know that we're an joiner-observer. -/// the joining device has marked the peer as verified on vg-member-added/vc-contact-confirm -/// before sending vg-member-added-received - so, if we observe vg-member-added-received, +/// the joining device has marked the peer as verified +/// before sending vg-request-with-auth/vc-request-with-auth - so, if we observe vg-member-added-received, /// we can mark the peer as verified as well. pub(crate) async fn observe_securejoin_on_other_device( context: &Context, @@ -563,9 +559,7 @@ pub(crate) async fn observe_securejoin_on_other_device( "vg-request-with-auth" | "vc-request-with-auth" | "vg-member-added" - | "vc-contact-confirm" - | "vg-member-added-received" - | "vc-contact-confirm-received" => { + | "vc-contact-confirm" => { if !encrypted_and_signed( context, mime_message, @@ -941,27 +935,16 @@ mod tests { .unwrap(); assert_eq!(contact_bob.is_verified(&bob.ctx).await.unwrap(), false); - // Step 7: Bob receives vc-contact-confirm, sends vc-contact-confirm-received + // Step 7: Bob receives vc-contact-confirm bob.recv_msg(&sent).await; assert_eq!(contact_alice.is_verified(&bob.ctx).await.unwrap(), true); // Check Bob got the verified message in his 1:1 chat. - { - let chat = bob.create_chat(&alice).await; - let msg = get_chat_msg(&bob, chat.get_id(), 0, 1).await; - assert!(msg.is_info()); - let expected_text = chat_protection_enabled(&bob).await; - assert_eq!(msg.get_text(), expected_text); - } - - // Check Bob sent the final message - let sent = bob.pop_sent_msg().await; - let msg = alice.parse_msg(&sent).await; - assert!(msg.was_encrypted()); - assert_eq!( - msg.get_header(HeaderDef::SecureJoin).unwrap(), - "vc-contact-confirm-received" - ); + let chat = bob.create_chat(&alice).await; + let msg = get_chat_msg(&bob, chat.get_id(), 0, 1).await; + assert!(msg.is_info()); + let expected_text = chat_protection_enabled(&bob).await; + assert_eq!(msg.get_text(), expected_text); } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] @@ -1073,17 +1056,10 @@ mod tests { let contact_alice = Contact::get_by_id(&bob.ctx, contact_alice_id).await?; assert_eq!(contact_bob.is_verified(&bob.ctx).await?, false); - // Step 7: Bob receives vc-contact-confirm, sends vc-contact-confirm-received + // Step 7: Bob receives vc-contact-confirm bob.recv_msg(&sent).await; assert_eq!(contact_alice.is_verified(&bob.ctx).await?, true); - let sent = bob.pop_sent_msg().await; - let msg = alice.parse_msg(&sent).await; - assert!(msg.was_encrypted()); - assert_eq!( - msg.get_header(HeaderDef::SecureJoin).unwrap(), - "vc-contact-confirm-received" - ); Ok(()) } @@ -1248,7 +1224,7 @@ mod tests { let contact_alice = Contact::get_by_id(&bob.ctx, contact_alice_id).await?; assert_eq!(contact_bob.is_verified(&bob.ctx).await?, false); - // Step 7: Bob receives vg-member-added, sends vg-member-added-received + // Step 7: Bob receives vg-member-added bob.recv_msg(&sent).await; { // Bob has Alice verified, message shows up in the group chat. @@ -1268,14 +1244,6 @@ mod tests { } } - let sent = bob.pop_sent_msg().await; - let msg = alice.parse_msg(&sent).await; - assert!(msg.was_encrypted()); - assert_eq!( - msg.get_header(HeaderDef::SecureJoin).unwrap(), - "vg-member-added-received" - ); - let bob_chat = Chat::load_from_db(&bob.ctx, bob_chatid).await?; assert!(bob_chat.is_protected()); assert!(bob_chat.typ == Chattype::Group); diff --git a/src/securejoin/bobstate.rs b/src/securejoin/bobstate.rs index a32c4348b..227c75cf2 100644 --- a/src/securejoin/bobstate.rs +++ b/src/securejoin/bobstate.rs @@ -345,17 +345,6 @@ impl BobState { .await?; context.emit_event(EventType::ContactsChanged(None)); - self.send_handshake_message(context, BobHandshakeMsg::ContactConfirmReceived) - .await - .map_err(|_| { - warn!( - context, - "Failed to send vc-contact-confirm-received/vg-member-added-received" - ); - }) - // This is not an error affecting the protocol outcome. - .ok(); - self.update_next(&context.sql, SecureJoinStep::Completed) .await?; Ok(Some(BobHandshakeStage::Completed)) @@ -401,9 +390,6 @@ async fn send_handshake_message( msg.param.set(Param::Arg2, invite.authcode()); msg.param.set_int(Param::GuaranteeE2ee, 1); } - BobHandshakeMsg::ContactConfirmReceived => { - msg.param.set_int(Param::GuaranteeE2ee, 1); - } }; // Sends our own fingerprint in the Secure-Join-Fingerprint header. @@ -425,8 +411,6 @@ enum BobHandshakeMsg { Request, /// vc-request-with-auth or vg-request-with-auth RequestWithAuth, - /// vc-contact-confirm-received or vg-member-added-received - ContactConfirmReceived, } impl BobHandshakeMsg { @@ -454,10 +438,6 @@ impl BobHandshakeMsg { QrInvite::Contact { .. } => "vc-request-with-auth", QrInvite::Group { .. } => "vg-request-with-auth", }, - Self::ContactConfirmReceived => match invite { - QrInvite::Contact { .. } => "vc-contact-confirm-received", - QrInvite::Group { .. } => "vg-member-added-received", - }, } } }