From fc09210aea45c7da190bfbaa71c1b78fee584550 Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 9 Nov 2023 01:02:33 +0000 Subject: [PATCH] api: emit JoinerProgress(1000) event when Bob verifies Alice --- deltachat-ffi/deltachat.h | 1 + src/events/payload.rs | 1 + src/securejoin.rs | 1 + src/securejoin/bob.rs | 7 ++++--- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 1b0ddc39f..e05b97a26 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -6260,6 +6260,7 @@ void dc_event_unref(dc_event_t* event); * @param data2 (int) The progress as: * 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself." * (Bob has verified alice and waits until Alice does the same for him) + * 1000=vg-member-added/vc-contact-confirm received */ #define DC_EVENT_SECUREJOIN_JOINER_PROGRESS 2061 diff --git a/src/events/payload.rs b/src/events/payload.rs index 531447f2c..ea9e43698 100644 --- a/src/events/payload.rs +++ b/src/events/payload.rs @@ -250,6 +250,7 @@ pub enum EventType { /// Progress as: /// 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself." /// (Bob has verified alice and waits until Alice does the same for him) + /// 1000=vg-member-added/vc-contact-confirm received progress: usize, }, diff --git a/src/securejoin.rs b/src/securejoin.rs index 30e58009b..88da932f4 100644 --- a/src/securejoin.rs +++ b/src/securejoin.rs @@ -767,6 +767,7 @@ mod tests { use crate::chat; use crate::chat::ProtectionStatus; use crate::chatlist::Chatlist; + use crate::constants::Chattype; use crate::contact::ContactAddress; use crate::contact::VerifiedStatus; use crate::peerstate::Peerstate; diff --git a/src/securejoin/bob.rs b/src/securejoin/bob.rs index e6862f575..c36fd10e9 100644 --- a/src/securejoin/bob.rs +++ b/src/securejoin/bob.rs @@ -132,6 +132,7 @@ pub(super) async fn handle_contact_confirm( // verify both contacts (this could be a bug/security issue, see // e.g. https://github.com/deltachat/deltachat-core-rust/issues/1177). bobstate.notify_peer_verified(context).await?; + bobstate.emit_progress(context, JoinerProgress::Succeeded); Ok(retval) } Some(_) => { @@ -255,8 +256,8 @@ enum JoinerProgress { /// /// Typically shows as "alice@addr verified, introducing myself." RequestWithAuthSent, - // /// Completed securejoin. - // Succeeded, + /// Completed securejoin. + Succeeded, } impl From for usize { @@ -264,7 +265,7 @@ impl From for usize { match progress { JoinerProgress::Error => 0, JoinerProgress::RequestWithAuthSent => 400, - // JoinerProgress::Succeeded => 1000, + JoinerProgress::Succeeded => 1000, } } }