mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Prepare to remove "vc-contact-confirm-received", "vg-member-added-received" messages from Securejoin
protocol
This commit is contained in:
@@ -5811,7 +5811,7 @@ void dc_event_unref(dc_event_t* event);
|
|||||||
* @param data2 (int) The progress as:
|
* @param data2 (int) The progress as:
|
||||||
* 300=vg-/vc-request received, typically shown as "bob@addr joins".
|
* 300=vg-/vc-request received, typically shown as "bob@addr joins".
|
||||||
* 600=vg-/vc-request-with-auth received, vg-member-added/vc-contact-confirm sent, typically shown as "bob@addr verified".
|
* 600=vg-/vc-request-with-auth received, vg-member-added/vc-contact-confirm sent, typically shown as "bob@addr verified".
|
||||||
* 800=vg-member-added-received received, shown as "bob@addr securely joined GROUP", only sent for the verified-group-protocol.
|
* 800=contact added to chat, shown as "bob@addr securely joined GROUP". Only for the verified-group-protocol.
|
||||||
* 1000=Protocol finished for this contact.
|
* 1000=Protocol finished for this contact.
|
||||||
*/
|
*/
|
||||||
#define DC_EVENT_SECUREJOIN_INVITER_PROGRESS 2060
|
#define DC_EVENT_SECUREJOIN_INVITER_PROGRESS 2060
|
||||||
|
|||||||
@@ -521,6 +521,9 @@ def test_see_new_verified_member_after_going_online(acfactory, tmpdir, lp):
|
|||||||
ac1._evtracker.wait_securejoin_inviter_progress(1000)
|
ac1._evtracker.wait_securejoin_inviter_progress(1000)
|
||||||
|
|
||||||
lp.sec("ac2: sending message")
|
lp.sec("ac2: sending message")
|
||||||
|
# Message can be sent only after a receipt of "vg-member-added" message. Just wait for
|
||||||
|
# "Member Me (<addr>) added by <addr>." message.
|
||||||
|
ac2._evtracker.wait_next_incoming_message()
|
||||||
msg_out = chat2.send_text("hello")
|
msg_out = chat2.send_text("hello")
|
||||||
|
|
||||||
lp.sec("ac1: receiving message")
|
lp.sec("ac1: receiving message")
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ pub enum EventType {
|
|||||||
/// @param data2 (int) Progress as:
|
/// @param data2 (int) Progress as:
|
||||||
/// 300=vg-/vc-request received, typically shown as "bob@addr joins".
|
/// 300=vg-/vc-request received, typically shown as "bob@addr joins".
|
||||||
/// 600=vg-/vc-request-with-auth received, vg-member-added/vc-contact-confirm sent, typically shown as "bob@addr verified".
|
/// 600=vg-/vc-request-with-auth received, vg-member-added/vc-contact-confirm sent, typically shown as "bob@addr verified".
|
||||||
/// 800=vg-member-added-received received, shown as "bob@addr securely joined GROUP", only sent for the verified-group-protocol.
|
/// 800=contact added to chat, shown as "bob@addr securely joined GROUP". Only for the verified-group-protocol.
|
||||||
/// 1000=Protocol finished for this contact.
|
/// 1000=Protocol finished for this contact.
|
||||||
SecurejoinInviterProgress {
|
SecurejoinInviterProgress {
|
||||||
contact_id: ContactId,
|
contact_id: ContactId,
|
||||||
|
|||||||
@@ -917,6 +917,17 @@ impl<'a> MimeFactory<'a> {
|
|||||||
"Secure-Join".to_string(),
|
"Secure-Join".to_string(),
|
||||||
"vg-member-added".to_string(),
|
"vg-member-added".to_string(),
|
||||||
));
|
));
|
||||||
|
// FIXME: Old clients require Secure-Join-Fingerprint header. Remove this
|
||||||
|
// eventually.
|
||||||
|
let fingerprint = Peerstate::from_addr(context, email_to_add)
|
||||||
|
.await?
|
||||||
|
.context("No peerstate found in db")?
|
||||||
|
.public_key_fingerprint
|
||||||
|
.context("No public key fingerprint in db for the member to add")?;
|
||||||
|
headers.protected.push(Header::new(
|
||||||
|
"Secure-Join-Fingerprint".into(),
|
||||||
|
fingerprint.hex(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SystemMessage::GroupNameChanged => {
|
SystemMessage::GroupNameChanged => {
|
||||||
|
|||||||
@@ -455,6 +455,8 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
}
|
}
|
||||||
None => bail!("Chat {} not found", &field_grpid),
|
None => bail!("Chat {} not found", &field_grpid),
|
||||||
}
|
}
|
||||||
|
inviter_progress!(context, contact_id, 800);
|
||||||
|
inviter_progress!(context, contact_id, 1000);
|
||||||
} else {
|
} else {
|
||||||
// Alice -> Bob
|
// Alice -> Bob
|
||||||
secure_connection_established(
|
secure_connection_established(
|
||||||
@@ -503,9 +505,6 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
return Ok(HandshakeMessage::Ignore);
|
return Ok(HandshakeMessage::Ignore);
|
||||||
}
|
}
|
||||||
if join_vg {
|
if join_vg {
|
||||||
// Responsible for showing "$Bob securely joined $group" message
|
|
||||||
inviter_progress!(context, contact_id, 800);
|
|
||||||
inviter_progress!(context, contact_id, 1000);
|
|
||||||
let field_grpid = mime_message
|
let field_grpid = mime_message
|
||||||
.get_header(HeaderDef::SecureJoinGroup)
|
.get_header(HeaderDef::SecureJoinGroup)
|
||||||
.map(|s| s.as_str())
|
.map(|s| s.as_str())
|
||||||
@@ -670,6 +669,12 @@ pub(crate) async fn observe_securejoin_on_other_device(
|
|||||||
.await?;
|
.await?;
|
||||||
return Ok(HandshakeMessage::Ignore);
|
return Ok(HandshakeMessage::Ignore);
|
||||||
}
|
}
|
||||||
|
if step.as_str() == "vg-member-added" {
|
||||||
|
inviter_progress!(context, contact_id, 800);
|
||||||
|
}
|
||||||
|
if step.as_str() == "vg-member-added" || step.as_str() == "vc-contact-confirm" {
|
||||||
|
inviter_progress!(context, contact_id, 1000);
|
||||||
|
}
|
||||||
Ok(if step.as_str() == "vg-member-added" {
|
Ok(if step.as_str() == "vg-member-added" {
|
||||||
HandshakeMessage::Propagate
|
HandshakeMessage::Propagate
|
||||||
} else {
|
} else {
|
||||||
@@ -768,6 +773,7 @@ mod tests {
|
|||||||
use crate::chatlist::Chatlist;
|
use crate::chatlist::Chatlist;
|
||||||
use crate::constants::{Chattype, DC_GCM_ADDDAYMARKER};
|
use crate::constants::{Chattype, DC_GCM_ADDDAYMARKER};
|
||||||
use crate::contact::ContactAddress;
|
use crate::contact::ContactAddress;
|
||||||
|
use crate::contact::VerifiedStatus;
|
||||||
use crate::peerstate::Peerstate;
|
use crate::peerstate::Peerstate;
|
||||||
use crate::receive_imf::receive_imf;
|
use crate::receive_imf::receive_imf;
|
||||||
use crate::test_utils::{TestContext, TestContextManager};
|
use crate::test_utils::{TestContext, TestContextManager};
|
||||||
|
|||||||
Reference in New Issue
Block a user