From 479a5632fb4ee1f954ec0e0afcdb2ce2749024a8 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Mon, 11 Aug 2025 16:00:31 +0200 Subject: [PATCH] feat: Make reacting to v2 invites generic over the type of the invite (contact/group/broadcast) --- src/securejoin/bob.rs | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/securejoin/bob.rs b/src/securejoin/bob.rs index 1b8306e3d..293dc4a6f 100644 --- a/src/securejoin/bob.rs +++ b/src/securejoin/bob.rs @@ -69,22 +69,13 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul } info!(context, "Using fast securejoin with symmetric encryption"); - let mut msg = Message { - viewtype: Viewtype::Text, - // TODO I may want to make this generic also for group/contacts - text: "Secure-Join: vb-request-with-auth".to_string(), - hidden: true, - ..Default::default() - }; - msg.param.set_cmd(SystemMessage::SecurejoinMessage); - - msg.param.set(Param::Arg, "vb-request-with-auth"); - msg.param.set(Param::Arg2, invite.authcode()); - msg.param.set_int(Param::GuaranteeE2ee, 1); - let bob_fp = self_fingerprint(context).await?; - msg.param.set(Param::Arg3, bob_fp); - - chat::send_msg(context, private_chat_id, &mut msg).await?; + send_handshake_message( + context, + &invite, + private_chat_id, + BobHandshakeMsg::RequestWithAuth, + ) + .await?; context.emit_event(EventType::SecurejoinJoinerProgress { contact_id: invite.contact_id(), @@ -388,9 +379,7 @@ impl BobHandshakeMsg { Self::RequestWithAuth => match invite { QrInvite::Contact { .. } => "vc-request-with-auth", QrInvite::Group { .. } => "vg-request-with-auth", - QrInvite::Broadcast { .. } => { - panic!("There is no request-with-auth for broadcasts") - } // TODO remove panic + QrInvite::Broadcast { .. } => "vb-request-with-auth", }, } }