mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
feat: Rename vb-request-v2 -> vb-request-with-auth
Turns out that Alice reacts to a request-v2 message in exactly the same way as to a request-with-auth message. So, no need to distinguish here.
This commit is contained in:
@@ -2948,7 +2948,7 @@ async fn prepare_send_msg(
|
|||||||
.get_bool(Param::ForcePlaintext)
|
.get_bool(Param::ForcePlaintext)
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
// V2 securejoin messages are symmetrically encrypted, no need for the public key:
|
// V2 securejoin messages are symmetrically encrypted, no need for the public key:
|
||||||
|| msg.securejoin_step() == Some("vb-request-v2")
|
|| msg.securejoin_step() == Some("vb-request-with-auth")
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -579,7 +579,7 @@ impl MimeFactory {
|
|||||||
// messages are auto-sent unlike usual unencrypted messages.
|
// messages are auto-sent unlike usual unencrypted messages.
|
||||||
step == "vg-request-with-auth"
|
step == "vg-request-with-auth"
|
||||||
|| step == "vc-request-with-auth"
|
|| step == "vc-request-with-auth"
|
||||||
|| step == "vb-request-v2"
|
|| step == "vb-request-with-auth"
|
||||||
|| step == "vg-member-added"
|
|| step == "vg-member-added"
|
||||||
|| step == "vb-member-added"
|
|| step == "vb-member-added"
|
||||||
|| step == "vc-contact-confirm"
|
|| step == "vc-contact-confirm"
|
||||||
@@ -826,7 +826,7 @@ impl MimeFactory {
|
|||||||
} else if let Loaded::Message { msg, .. } = &self.loaded {
|
} else if let Loaded::Message { msg, .. } = &self.loaded {
|
||||||
if msg.param.get_cmd() == SystemMessage::SecurejoinMessage {
|
if msg.param.get_cmd() == SystemMessage::SecurejoinMessage {
|
||||||
let step = msg.param.get(Param::Arg).unwrap_or_default();
|
let step = msg.param.get(Param::Arg).unwrap_or_default();
|
||||||
if step != "vg-request" && step != "vc-request" && step != "vb-request-v2" {
|
if step != "vg-request" && step != "vc-request" && step != "vb-request-with-auth" {
|
||||||
headers.push((
|
headers.push((
|
||||||
"Auto-Submitted",
|
"Auto-Submitted",
|
||||||
mail_builder::headers::raw::Raw::new("auto-replied".to_string()).into(),
|
mail_builder::headers::raw::Raw::new("auto-replied".to_string()).into(),
|
||||||
@@ -1563,7 +1563,7 @@ impl MimeFactory {
|
|||||||
headers.push((
|
headers.push((
|
||||||
if step == "vg-request-with-auth"
|
if step == "vg-request-with-auth"
|
||||||
|| step == "vc-request-with-auth"
|
|| step == "vc-request-with-auth"
|
||||||
|| step == "vb-request-v2"
|
|| step == "vb-request-with-auth"
|
||||||
{
|
{
|
||||||
"Secure-Join-Auth"
|
"Secure-Join-Auth"
|
||||||
} else {
|
} else {
|
||||||
@@ -1916,7 +1916,7 @@ fn hidden_recipients() -> Address<'static> {
|
|||||||
|
|
||||||
fn should_encrypt_with_auth_token(msg: &Message) -> bool {
|
fn should_encrypt_with_auth_token(msg: &Message) -> bool {
|
||||||
msg.param.get_cmd() == SystemMessage::SecurejoinMessage
|
msg.param.get_cmd() == SystemMessage::SecurejoinMessage
|
||||||
&& msg.param.get(Param::Arg).unwrap_or_default() == "vb-request-v2"
|
&& msg.param.get(Param::Arg).unwrap_or_default() == "vb-request-with-auth"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn should_encrypt_with_broadcast_secret(msg: &Message, chat: &Chat) -> bool {
|
fn should_encrypt_with_broadcast_secret(msg: &Message, chat: &Chat) -> bool {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ pub enum Param {
|
|||||||
///
|
///
|
||||||
/// For `BobHandshakeMsg::RequestWithAuth`, this is the `Secure-Join-Auth` header.
|
/// For `BobHandshakeMsg::RequestWithAuth`, this is the `Secure-Join-Auth` header.
|
||||||
///
|
///
|
||||||
/// For version two of the securejoin protocol (`vb-request-v2`),
|
/// For version two of the securejoin protocol (`vb-request-with-auth`),
|
||||||
/// this is the Auth token used to encrypt the message.
|
/// this is the Auth token used to encrypt the message.
|
||||||
///
|
///
|
||||||
/// For [`SystemMessage::MultiDeviceSync`], this contains the ids that are synced.
|
/// For [`SystemMessage::MultiDeviceSync`], this contains the ids that are synced.
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
// -> or just ignore the problem for now - we will need to solve it for all messages anyways: https://github.com/chatmail/core/issues/7057
|
// -> or just ignore the problem for now - we will need to solve it for all messages anyways: https://github.com/chatmail/core/issues/7057
|
||||||
if !matches!(
|
if !matches!(
|
||||||
step,
|
step,
|
||||||
"vg-request" | "vc-request" | "vb-request-v2" | "vb-member-added"
|
"vg-request" | "vc-request" | "vb-request-with-auth" | "vb-member-added"
|
||||||
) {
|
) {
|
||||||
let mut self_found = false;
|
let mut self_found = false;
|
||||||
let self_fingerprint = load_self_public_key(context).await?.dc_fingerprint();
|
let self_fingerprint = load_self_public_key(context).await?.dc_fingerprint();
|
||||||
@@ -360,7 +360,7 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
========================================================*/
|
========================================================*/
|
||||||
bob::handle_auth_required(context, mime_message).await
|
bob::handle_auth_required(context, mime_message).await
|
||||||
}
|
}
|
||||||
"vg-request-with-auth" | "vc-request-with-auth" | "vb-request-v2" => {
|
"vg-request-with-auth" | "vc-request-with-auth" | "vb-request-with-auth" => {
|
||||||
/*==========================================================
|
/*==========================================================
|
||||||
==== Alice - the inviter side ====
|
==== Alice - the inviter side ====
|
||||||
==== Steps 5+6 in "Setup verified contact" protocol ====
|
==== Steps 5+6 in "Setup verified contact" protocol ====
|
||||||
@@ -441,7 +441,7 @@ pub(crate) async fn handle_securejoin_handshake(
|
|||||||
.await?;
|
.await?;
|
||||||
inviter_progress(context, contact_id, 800);
|
inviter_progress(context, contact_id, 800);
|
||||||
inviter_progress(context, contact_id, 1000);
|
inviter_progress(context, contact_id, 1000);
|
||||||
if step == "vb-request-v2" {
|
if step == "vb-request-with-auth" {
|
||||||
// For broadcasts, we don't want to delete the message,
|
// For broadcasts, we don't want to delete the message,
|
||||||
// because the other device should also internally add the member
|
// because the other device should also internally add the member
|
||||||
// and see the key (because it won't see the member via autocrypt-gossip).
|
// and see the key (because it won't see the member via autocrypt-gossip).
|
||||||
@@ -595,7 +595,7 @@ pub(crate) async fn observe_securejoin_on_other_device(
|
|||||||
inviter_progress(context, contact_id, 1000);
|
inviter_progress(context, contact_id, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO not sure if I should add vb-request-v2 here
|
// TODO not sure if I should add vb-request-with-auth here
|
||||||
// Actually, I'm not even sure why vg-request-with-auth is here - why do we create a 1:1 chat??
|
// Actually, I'm not even sure why vg-request-with-auth is here - why do we create a 1:1 chat??
|
||||||
if step == "vg-request-with-auth" || step == "vc-request-with-auth" {
|
if step == "vg-request-with-auth" || step == "vc-request-with-auth" {
|
||||||
// This actually reflects what happens on the first device (which does the secure
|
// This actually reflects what happens on the first device (which does the secure
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul
|
|||||||
let mut msg = Message {
|
let mut msg = Message {
|
||||||
viewtype: Viewtype::Text,
|
viewtype: Viewtype::Text,
|
||||||
// TODO I may want to make this generic also for group/contacts
|
// TODO I may want to make this generic also for group/contacts
|
||||||
text: "Secure-Join: vb-request-v2".to_string(),
|
text: "Secure-Join: vb-request-with-auth".to_string(),
|
||||||
hidden: true,
|
hidden: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
msg.param.set_cmd(SystemMessage::SecurejoinMessage);
|
msg.param.set_cmd(SystemMessage::SecurejoinMessage);
|
||||||
|
|
||||||
msg.param.set(Param::Arg, "vb-request-v2");
|
msg.param.set(Param::Arg, "vb-request-with-auth");
|
||||||
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);
|
||||||
let bob_fp = self_fingerprint(context).await?;
|
let bob_fp = self_fingerprint(context).await?;
|
||||||
@@ -357,7 +357,7 @@ pub(crate) async fn send_handshake_message(
|
|||||||
pub(crate) enum BobHandshakeMsg {
|
pub(crate) enum BobHandshakeMsg {
|
||||||
/// vc-request or vg-request
|
/// vc-request or vg-request
|
||||||
Request,
|
Request,
|
||||||
/// vc-request-with-auth, vg-request-with-auth, or vb-request-v2
|
/// vc-request-with-auth, vg-request-with-auth, or vb-request-with-auth
|
||||||
RequestWithAuth,
|
RequestWithAuth,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user