mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
refactor: send Secure-Join-Fingerprint only in *-request-with-auth
This commit is contained in:
@@ -1003,17 +1003,6 @@ 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 => {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ pub enum Param {
|
|||||||
/// For Messages
|
/// For Messages
|
||||||
Arg2 = b'F',
|
Arg2 = b'F',
|
||||||
|
|
||||||
/// For Messages
|
/// `Secure-Join-Fingerprint` header for `{vc,vg}-request-with-auth` messages.
|
||||||
Arg3 = b'G',
|
Arg3 = b'G',
|
||||||
|
|
||||||
/// For Messages
|
/// For Messages
|
||||||
|
|||||||
@@ -174,7 +174,6 @@ async fn send_alice_handshake_msg(
|
|||||||
context: &Context,
|
context: &Context,
|
||||||
contact_id: ContactId,
|
contact_id: ContactId,
|
||||||
step: &str,
|
step: &str,
|
||||||
fingerprint: Option<Fingerprint>,
|
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut msg = Message {
|
let mut msg = Message {
|
||||||
viewtype: Viewtype::Text,
|
viewtype: Viewtype::Text,
|
||||||
@@ -184,9 +183,6 @@ async fn send_alice_handshake_msg(
|
|||||||
};
|
};
|
||||||
msg.param.set_cmd(SystemMessage::SecurejoinMessage);
|
msg.param.set_cmd(SystemMessage::SecurejoinMessage);
|
||||||
msg.param.set(Param::Arg, step);
|
msg.param.set(Param::Arg, step);
|
||||||
if let Some(fp) = fingerprint {
|
|
||||||
msg.param.set(Param::Arg3, fp.hex());
|
|
||||||
}
|
|
||||||
msg.param.set_int(Param::GuaranteeE2ee, 1);
|
msg.param.set_int(Param::GuaranteeE2ee, 1);
|
||||||
chat::send_msg(
|
chat::send_msg(
|
||||||
context,
|
context,
|
||||||
@@ -334,7 +330,6 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
context,
|
context,
|
||||||
contact_id,
|
contact_id,
|
||||||
&format!("{}-auth-required", &step[..2]),
|
&format!("{}-auth-required", &step[..2]),
|
||||||
None,
|
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.context("failed sending auth-required handshake message")?;
|
.context("failed sending auth-required handshake message")?;
|
||||||
@@ -480,14 +475,9 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
mime_message.timestamp_sent,
|
mime_message.timestamp_sent,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
send_alice_handshake_msg(
|
send_alice_handshake_msg(context, contact_id, "vc-contact-confirm")
|
||||||
context,
|
.await
|
||||||
contact_id,
|
.context("failed sending vc-contact-confirm message")?;
|
||||||
"vc-contact-confirm",
|
|
||||||
Some(fingerprint),
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
.context("failed sending vc-contact-confirm message")?;
|
|
||||||
|
|
||||||
inviter_progress(context, contact_id, 1000);
|
inviter_progress(context, contact_id, 1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -358,13 +358,13 @@ async fn send_handshake_message(
|
|||||||
// Sends the Secure-Join-Auth header in mimefactory.rs.
|
// Sends the Secure-Join-Auth header in mimefactory.rs.
|
||||||
msg.param.set(Param::Arg2, invite.authcode());
|
msg.param.set(Param::Arg2, invite.authcode());
|
||||||
msg.param.set_int(Param::GuaranteeE2ee, 1);
|
msg.param.set_int(Param::GuaranteeE2ee, 1);
|
||||||
|
|
||||||
|
// Sends our own fingerprint in the Secure-Join-Fingerprint header.
|
||||||
|
let bob_fp = load_self_public_key(context).await?.fingerprint();
|
||||||
|
msg.param.set(Param::Arg3, bob_fp.hex());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Sends our own fingerprint in the Secure-Join-Fingerprint header.
|
|
||||||
let bob_fp = load_self_public_key(context).await?.fingerprint();
|
|
||||||
msg.param.set(Param::Arg3, bob_fp.hex());
|
|
||||||
|
|
||||||
// Sends the grpid in the Secure-Join-Group header.
|
// Sends the grpid in the Secure-Join-Group header.
|
||||||
if let QrInvite::Group { ref grpid, .. } = invite {
|
if let QrInvite::Group { ref grpid, .. } = invite {
|
||||||
msg.param.set(Param::Arg4, grpid);
|
msg.param.set(Param::Arg4, grpid);
|
||||||
|
|||||||
Reference in New Issue
Block a user