diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index beb1f4a32c..6496d7b35b 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -1696,15 +1696,12 @@ dc_chat_t* dc_get_chat (dc_context_t* context, uint32_t ch * * @memberof dc_context_t * @param context The context object. - * @param protect If set to 1 the function creates group with protection initially enabled. - * Only verified members are allowed in these groups - * and end-to-end-encryption is always enabled. * @param name The name of the group chat to create. * The name may be changed later using dc_set_chat_name(). * To find out the name of a group later, see dc_chat_get_name() * @return The chat ID of the new group chat, 0 on errors. */ -uint32_t dc_create_group_chat (dc_context_t* context, int protect, const char* name); +uint32_t dc_create_group_chat (dc_context_t* context, const char* name); /** @@ -3827,23 +3824,6 @@ int dc_chat_is_device_talk (const dc_chat_t* chat); int dc_chat_can_send (const dc_chat_t* chat); -/** - * Check if a chat is protected. - * - * Only verified contacts - * as determined by dc_contact_is_verified() - * can be added to protected chats. - * - * Protected chats are created using dc_create_group_chat() - * by setting the 'protect' parameter to 1. - * - * @memberof dc_chat_t - * @param chat The chat object. - * @return 1=chat protected, 0=chat is not protected. - */ -int dc_chat_is_protected (const dc_chat_t* chat); - - /** * Check if the chat is encrypted. * @@ -3859,28 +3839,6 @@ int dc_chat_is_protected (const dc_chat_t* chat); int dc_chat_is_encrypted (const dc_chat_t *chat); -/** - * Checks if the chat was protected, and then an incoming message broke this protection. - * - * This function is only useful if the UI enabled the `verified_one_on_one_chats` feature flag, - * otherwise it will return false for all chats. - * - * 1:1 chats are automatically set as protected when a contact is verified. - * When a message comes in that is not encrypted / signed correctly, - * the chat is automatically set as unprotected again. - * dc_chat_is_protection_broken() will return true until dc_accept_chat() is called. - * - * The UI should let the user confirm that this is OK with a message like - * `Bob sent a message from another device. Tap to learn more` and then call dc_accept_chat(). - * - * @deprecated 2025-07 chats protection cannot break any longer - * @memberof dc_chat_t - * @param chat The chat object. - * @return 1=chat protection broken, 0=otherwise. - */ -int dc_chat_is_protection_broken (const dc_chat_t* chat); - - /** * Check if locations are sent to the chat * at the time the object was created using dc_get_chat(). @@ -5278,8 +5236,7 @@ int dc_contact_is_blocked (const dc_contact_t* contact); * * @memberof dc_contact_t * @param contact The contact object. - * @return 0: contact is not verified. - * 2: SELF and contact have verified their fingerprints in both directions. + * @return 1=contact is verified, 0=contact is not verified. */ int dc_contact_is_verified (dc_contact_t* contact); @@ -7056,6 +7013,8 @@ void dc_event_unref(dc_event_t* event); /// "Unknown sender for this chat. See 'info' for more details." /// /// Use as message text if assigning the message to a chat is not totally correct. +/// +/// @deprecated 2025-08-18 #define DC_STR_UNKNOWN_SENDER_FOR_CHAT 72 /// "Message from %1$s" diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 601cbdebcf..e747309887 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -22,7 +22,7 @@ use std::sync::{Arc, LazyLock}; use std::time::{Duration, SystemTime}; use anyhow::Context as _; -use deltachat::chat::{ChatId, ChatVisibility, MessageListOptions, MuteDuration, ProtectionStatus}; +use deltachat::chat::{ChatId, ChatVisibility, MessageListOptions, MuteDuration}; use deltachat::constants::DC_MSG_ID_LAST_SPECIAL; use deltachat::contact::{Contact, ContactId, Origin}; use deltachat::context::{Context, ContextBuilder}; @@ -1659,7 +1659,6 @@ pub unsafe extern "C" fn dc_get_chat(context: *mut dc_context_t, chat_id: u32) - #[no_mangle] pub unsafe extern "C" fn dc_create_group_chat( context: *mut dc_context_t, - protect: libc::c_int, name: *const libc::c_char, ) -> u32 { if context.is_null() || name.is_null() { @@ -1667,22 +1666,12 @@ pub unsafe extern "C" fn dc_create_group_chat( return 0; } let ctx = &*context; - let Some(protect) = ProtectionStatus::from_i32(protect) - .context("Bad protect-value for dc_create_group_chat()") - .log_err(ctx) - .ok() - else { - return 0; - }; - block_on(async move { - chat::create_group_chat(ctx, protect, &to_string_lossy(name)) - .await - .context("Failed to create group chat") - .log_err(ctx) - .map(|id| id.to_u32()) - .unwrap_or(0) - }) + block_on(chat::create_group_chat(ctx, &to_string_lossy(name))) + .context("Failed to create group chat") + .log_err(ctx) + .map(|id| id.to_u32()) + .unwrap_or(0) } #[no_mangle] @@ -3143,16 +3132,6 @@ pub unsafe extern "C" fn dc_chat_can_send(chat: *mut dc_chat_t) -> libc::c_int { .unwrap_or_default() as libc::c_int } -#[no_mangle] -pub unsafe extern "C" fn dc_chat_is_protected(chat: *mut dc_chat_t) -> libc::c_int { - if chat.is_null() { - eprintln!("ignoring careless call to dc_chat_is_protected()"); - return 0; - } - let ffi_chat = &*chat; - ffi_chat.chat.is_protected() as libc::c_int -} - #[no_mangle] pub unsafe extern "C" fn dc_chat_is_encrypted(chat: *mut dc_chat_t) -> libc::c_int { if chat.is_null() { @@ -3165,16 +3144,6 @@ pub unsafe extern "C" fn dc_chat_is_encrypted(chat: *mut dc_chat_t) -> libc::c_i .unwrap_or_log_default(&ffi_chat.context, "Failed dc_chat_is_encrypted") as libc::c_int } -#[no_mangle] -pub unsafe extern "C" fn dc_chat_is_protection_broken(chat: *mut dc_chat_t) -> libc::c_int { - if chat.is_null() { - eprintln!("ignoring careless call to dc_chat_is_protection_broken()"); - return 0; - } - let ffi_chat = &*chat; - ffi_chat.chat.is_protection_broken() as libc::c_int -} - #[no_mangle] pub unsafe extern "C" fn dc_chat_is_sending_locations(chat: *mut dc_chat_t) -> libc::c_int { if chat.is_null() { @@ -4281,17 +4250,10 @@ pub unsafe extern "C" fn dc_contact_is_verified(contact: *mut dc_contact_t) -> l let ffi_contact = &*contact; let ctx = &*ffi_contact.context; - if block_on(ffi_contact.contact.is_verified(ctx)) + block_on(ffi_contact.contact.is_verified(ctx)) .context("is_verified failed") .log_err(ctx) - .unwrap_or_default() - { - // Return value is essentially a boolean, - // but we return 2 for true for backwards compatibility. - 2 - } else { - 0 - } + .unwrap_or_default() as libc::c_int } #[no_mangle] diff --git a/deltachat-jsonrpc/src/api.rs b/deltachat-jsonrpc/src/api.rs index fe6d2e7444..4119c96adf 100644 --- a/deltachat-jsonrpc/src/api.rs +++ b/deltachat-jsonrpc/src/api.rs @@ -11,7 +11,6 @@ use deltachat::blob::BlobObject; use deltachat::chat::{ self, add_contact_to_chat, forward_msgs, get_chat_media, get_chat_msgs, get_chat_msgs_ex, marknoticed_chat, remove_contact_from_chat, Chat, ChatId, ChatItem, MessageListOptions, - ProtectionStatus, }; use deltachat::chatlist::Chatlist; use deltachat::config::Config; @@ -968,16 +967,9 @@ impl CommandApi { /// /// To check, if a chat is still unpromoted, you can look at the `is_unpromoted` property of `BasicChat` or `FullChat`. /// This may be useful if you want to show some help for just created groups. - /// - /// @param protect If set to 1 the function creates group with protection initially enabled. - /// Only verified members are allowed in these groups - async fn create_group_chat(&self, account_id: u32, name: String, protect: bool) -> Result { + async fn create_group_chat(&self, account_id: u32, name: String) -> Result { let ctx = self.get_context(account_id).await?; - let protect = match protect { - true => ProtectionStatus::Protected, - false => ProtectionStatus::Unprotected, - }; - chat::create_group_ex(&ctx, Some(protect), &name) + chat::create_group_chat(&ctx, &name) .await .map(|id| id.to_u32()) } @@ -988,7 +980,7 @@ impl CommandApi { /// address-contacts. async fn create_group_chat_unencrypted(&self, account_id: u32, name: String) -> Result { let ctx = self.get_context(account_id).await?; - chat::create_group_ex(&ctx, None, &name) + chat::create_group_chat_unencrypted(&ctx, &name) .await .map(|id| id.to_u32()) } diff --git a/deltachat-jsonrpc/src/api/types/chat.rs b/deltachat-jsonrpc/src/api/types/chat.rs index 96388c27be..6b5e693043 100644 --- a/deltachat-jsonrpc/src/api/types/chat.rs +++ b/deltachat-jsonrpc/src/api/types/chat.rs @@ -19,18 +19,6 @@ pub struct FullChat { id: u32, name: String, - /// True if the chat is protected. - /// - /// Only verified contacts - /// as determined by [`ContactObject::is_verified`] / `Contact.isVerified` - /// can be added to protected chats. - /// - /// Protected chats are created using [`create_group_chat`] / `createGroupChat()` - /// by setting the 'protect' parameter to true. - /// - /// [`create_group_chat`]: crate::api::CommandApi::create_group_chat - is_protected: bool, - /// True if the chat is encrypted. /// This means that all messages in the chat are encrypted, /// and all contacts in the chat are "key-contacts", @@ -71,8 +59,6 @@ pub struct FullChat { fresh_message_counter: usize, // is_group - please check over chat.type in frontend instead is_contact_request: bool, - /// Deprecated 2025-07. Chats protection cannot break any longer. - is_protection_broken: bool, is_device_chat: bool, self_in_group: bool, @@ -133,7 +119,6 @@ impl FullChat { Ok(FullChat { id: chat_id, name: chat.name.clone(), - is_protected: chat.is_protected(), is_encrypted: chat.is_encrypted(context).await?, profile_image, //BLOBS ? archived: chat.get_visibility() == chat::ChatVisibility::Archived, @@ -147,7 +132,6 @@ impl FullChat { color, fresh_message_counter, is_contact_request: chat.is_contact_request(), - is_protection_broken: chat.is_protection_broken(), is_device_chat: chat.is_device_talk(), self_in_group: contact_ids.contains(&ContactId::SELF), is_muted: chat.is_muted(), @@ -175,18 +159,6 @@ pub struct BasicChat { id: u32, name: String, - /// True if the chat is protected. - /// - /// UI should display a green checkmark - /// in the chat title, - /// in the chat profile title and - /// in the chatlist item - /// if chat protection is enabled. - /// UI should also display a green checkmark - /// in the contact profile - /// if 1:1 chat with this contact exists and is protected. - is_protected: bool, - /// True if the chat is encrypted. /// This means that all messages in the chat are encrypted, /// and all contacts in the chat are "key-contacts", @@ -218,8 +190,6 @@ pub struct BasicChat { is_self_talk: bool, color: String, is_contact_request: bool, - /// Deprecated 2025-07. Chats protection cannot break any longer. - is_protection_broken: bool, is_device_chat: bool, is_muted: bool, @@ -239,7 +209,6 @@ impl BasicChat { Ok(BasicChat { id: chat_id, name: chat.name.clone(), - is_protected: chat.is_protected(), is_encrypted: chat.is_encrypted(context).await?, profile_image, //BLOBS ? archived: chat.get_visibility() == chat::ChatVisibility::Archived, @@ -249,7 +218,6 @@ impl BasicChat { is_self_talk: chat.is_self_talk(), color, is_contact_request: chat.is_contact_request(), - is_protection_broken: chat.is_protection_broken(), is_device_chat: chat.is_device_talk(), is_muted: chat.is_muted(), }) diff --git a/deltachat-jsonrpc/src/api/types/chat_list.rs b/deltachat-jsonrpc/src/api/types/chat_list.rs index b5d31a7913..47e72524c0 100644 --- a/deltachat-jsonrpc/src/api/types/chat_list.rs +++ b/deltachat-jsonrpc/src/api/types/chat_list.rs @@ -30,7 +30,6 @@ pub enum ChatListItemFetchResult { summary_status: u32, /// showing preview if last chat message is image summary_preview_image: Option, - is_protected: bool, /// True if the chat is encrypted. /// This means that all messages in the chat are encrypted, @@ -161,7 +160,6 @@ pub(crate) async fn get_chat_list_item_by_id( summary_text2, summary_status: summary.state.to_u32().expect("impossible"), // idea and a function to transform the constant to strings? or return string enum summary_preview_image, - is_protected: chat.is_protected(), is_encrypted: chat.is_encrypted(ctx).await?, is_group: chat.get_type() == Chattype::Group, fresh_message_counter, diff --git a/deltachat-jsonrpc/src/api/types/contact.rs b/deltachat-jsonrpc/src/api/types/contact.rs index c4fb5663e7..9a98a75f98 100644 --- a/deltachat-jsonrpc/src/api/types/contact.rs +++ b/deltachat-jsonrpc/src/api/types/contact.rs @@ -38,12 +38,6 @@ pub struct ContactObject { /// See [`Self::verifier_id`]/`Contact.verifierId` for a guidance how to display these information. is_verified: bool, - /// True if the contact profile title should have a green checkmark. - /// - /// This indicates whether 1:1 chat has a green checkmark - /// or will have a green checkmark if created. - is_profile_verified: bool, - /// The contact ID that verified a contact. /// /// As verifier may be unknown, @@ -87,7 +81,6 @@ impl ContactObject { None => None, }; let is_verified = contact.is_verified(context).await?; - let is_profile_verified = contact.is_profile_verified(context).await?; let verifier_id = contact .get_verifier_id(context) @@ -109,7 +102,6 @@ impl ContactObject { is_key_contact: contact.is_key_contact(), e2ee_avail: contact.e2ee_avail(context).await?, is_verified, - is_profile_verified, verifier_id, last_seen: contact.last_seen(), was_seen_recently: contact.was_seen_recently(), diff --git a/deltachat-jsonrpc/src/api/types/message.rs b/deltachat-jsonrpc/src/api/types/message.rs index af3c45d31f..56175e278f 100644 --- a/deltachat-jsonrpc/src/api/types/message.rs +++ b/deltachat-jsonrpc/src/api/types/message.rs @@ -539,7 +539,6 @@ pub struct MessageSearchResult { chat_color: String, chat_name: String, chat_type: u32, - is_chat_protected: bool, is_chat_contact_request: bool, is_chat_archived: bool, message: String, @@ -579,7 +578,6 @@ impl MessageSearchResult { chat_color, chat_type: chat.get_type().to_u32().context("unknown chat type id")?, chat_profile_image, - is_chat_protected: chat.is_protected(), is_chat_contact_request: chat.is_contact_request(), is_chat_archived: chat.get_visibility() == ChatVisibility::Archived, message: message.get_text(), diff --git a/deltachat-repl/src/cmdline.rs b/deltachat-repl/src/cmdline.rs index 29f11c20fb..c94b706152 100644 --- a/deltachat-repl/src/cmdline.rs +++ b/deltachat-repl/src/cmdline.rs @@ -6,9 +6,7 @@ use std::str::FromStr; use std::time::Duration; use anyhow::{bail, ensure, Result}; -use deltachat::chat::{ - self, Chat, ChatId, ChatItem, ChatVisibility, MuteDuration, ProtectionStatus, -}; +use deltachat::chat::{self, Chat, ChatId, ChatItem, ChatVisibility, MuteDuration}; use deltachat::chatlist::*; use deltachat::constants::*; use deltachat::contact::*; @@ -353,7 +351,6 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu createchat \n\ creategroup \n\ createbroadcast \n\ - createprotected \n\ addmember \n\ removemember \n\ groupname \n\ @@ -569,7 +566,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu for i in (0..cnt).rev() { let chat = Chat::load_from_db(&context, chatlist.get_chat_id(i)?).await?; println!( - "{}#{}: {} [{} fresh] {}{}{}{}", + "{}#{}: {} [{} fresh] {}{}{}", chat_prefix(&chat), chat.get_id(), chat.get_name(), @@ -580,7 +577,6 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu ChatVisibility::Archived => "πŸ“¦", ChatVisibility::Pinned => "πŸ“Œ", }, - if chat.is_protected() { "πŸ›‘οΈ" } else { "" }, if chat.is_contact_request() { "πŸ†•" } else { @@ -695,7 +691,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu format!("{} member(s)", members.len()) }; println!( - "{}#{}: {} [{}]{}{}{} {}", + "{}#{}: {} [{}]{}{}{}", chat_prefix(sel_chat), sel_chat.get_id(), sel_chat.get_name(), @@ -713,11 +709,6 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu }, _ => "".to_string(), }, - if sel_chat.is_protected() { - "πŸ›‘οΈ" - } else { - "" - }, ); log_msglist(&context, &msglist).await?; if let Some(draft) = sel_chat.get_id().get_draft(&context).await? { @@ -746,8 +737,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu } "creategroup" => { ensure!(!arg1.is_empty(), "Argument missing."); - let chat_id = - chat::create_group_chat(&context, ProtectionStatus::Unprotected, arg1).await?; + let chat_id = chat::create_group_chat(&context, arg1).await?; println!("Group#{chat_id} created successfully."); } @@ -757,13 +747,6 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu println!("Broadcast#{chat_id} created successfully."); } - "createprotected" => { - ensure!(!arg1.is_empty(), "Argument missing."); - let chat_id = - chat::create_group_chat(&context, ProtectionStatus::Protected, arg1).await?; - - println!("Group#{chat_id} created and protected successfully."); - } "addmember" => { ensure!(sel_chat.is_some(), "No chat selected"); ensure!(!arg1.is_empty(), "Argument missing."); diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/account.py b/deltachat-rpc-client/src/deltachat_rpc_client/account.py index 6f919f71e7..0085fb4d47 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/account.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/account.py @@ -299,7 +299,7 @@ def get_chatlist( chats.append(AttrDict(item)) return chats - def create_group(self, name: str, protect: bool = False) -> Chat: + def create_group(self, name: str) -> Chat: """Create a new group chat. After creation, @@ -316,12 +316,8 @@ def create_group(self, name: str, protect: bool = False) -> Chat: To check, if a chat is still unpromoted, you can look at the `is_unpromoted` property of a chat (see `get_full_snapshot()` / `get_basic_snapshot()`). This may be useful if you want to show some help for just created groups. - - :param protect: If set to 1 the function creates group with protection initially enabled. - Only verified members are allowed in these groups - and end-to-end-encryption is always enabled. """ - return Chat(self, self._rpc.create_group_chat(self.id, name, protect)) + return Chat(self, self._rpc.create_group_chat(self.id, name)) def create_broadcast(self, name: str) -> Chat: """Create a new **broadcast channel** diff --git a/deltachat-rpc-client/tests/test_securejoin.py b/deltachat-rpc-client/tests/test_securejoin.py index 31f4835207..fba719f1c7 100644 --- a/deltachat-rpc-client/tests/test_securejoin.py +++ b/deltachat-rpc-client/tests/test_securejoin.py @@ -58,8 +58,7 @@ def test_qr_setup_contact_svg(acfactory) -> None: assert "Alice" in svg -@pytest.mark.parametrize("protect", [True, False]) -def test_qr_securejoin(acfactory, protect): +def test_qr_securejoin(acfactory): alice, bob, fiona = acfactory.get_online_accounts(3) # Setup second device for Alice @@ -67,8 +66,7 @@ def test_qr_securejoin(acfactory, protect): alice2 = alice.clone() logging.info("Alice creates a group") - alice_chat = alice.create_group("Group", protect=protect) - assert alice_chat.get_basic_snapshot().is_protected == protect + alice_chat = alice.create_group("Group") logging.info("Bob joins the group") qr_code = alice_chat.get_qr_code() @@ -89,7 +87,6 @@ def test_qr_securejoin(acfactory, protect): snapshot = bob.get_message_by_id(bob.wait_for_incoming_msg_event().msg_id).get_snapshot() assert snapshot.text == "Member Me added by {}.".format(alice.get_config("addr")) - assert snapshot.chat.get_basic_snapshot().is_protected == protect # Test that Bob verified Alice's profile. bob_contact_alice = bob.create_contact(alice) @@ -125,8 +122,8 @@ def test_qr_securejoin_contact_request(acfactory) -> None: bob_chat_alice = snapshot.chat assert bob_chat_alice.get_basic_snapshot().is_contact_request - alice_chat = alice.create_group("Verified group", protect=True) - logging.info("Bob joins verified group") + alice_chat = alice.create_group("Group") + logging.info("Bob joins the group") qr_code = alice_chat.get_qr_code() bob.secure_join(qr_code) while True: @@ -150,8 +147,8 @@ def test_qr_readreceipt(acfactory) -> None: for joiner in [bob, charlie]: joiner.wait_for_securejoin_joiner_success() - logging.info("Alice creates a verified group") - group = alice.create_group("Group", protect=True) + logging.info("Alice creates a group") + group = alice.create_group("Group") alice_contact_bob = alice.create_contact(bob, "Bob") alice_contact_charlie = alice.create_contact(charlie, "Charlie") @@ -216,11 +213,10 @@ def test_verified_group_member_added_recovery(acfactory) -> None: """Tests verified group recovery by reverifying then removing and adding a member back.""" ac1, ac2, ac3 = acfactory.get_online_accounts(3) - logging.info("ac1 creates verified group") - chat = ac1.create_group("Verified group", protect=True) - assert chat.get_basic_snapshot().is_protected + logging.info("ac1 creates a group") + chat = ac1.create_group("Group") - logging.info("ac2 joins verified group") + logging.info("ac2 joins the group") qr_code = chat.get_qr_code() ac2.secure_join(qr_code) ac2.wait_for_securejoin_joiner_success() @@ -302,8 +298,8 @@ def test_qr_join_chat_with_pending_bobstate_issue4894(acfactory): # we first create a fully joined verified group, and then start # joining a second time but interrupt it, to create pending bob state - logging.info("ac1: create verified group that ac2 fully joins") - ch1 = ac1.create_group("Group", protect=True) + logging.info("ac1: create a group that ac2 fully joins") + ch1 = ac1.create_group("Group") qr_code = ch1.get_qr_code() ac2.secure_join(qr_code) ac1.wait_for_securejoin_inviter_success() @@ -313,7 +309,6 @@ def test_qr_join_chat_with_pending_bobstate_issue4894(acfactory): while 1: snapshot = ac2.get_message_by_id(ac2.wait_for_incoming_msg_event().msg_id).get_snapshot() if snapshot.text == "ac1 says hello": - assert snapshot.chat.get_basic_snapshot().is_protected break logging.info("ac1: let ac2 join again but shutoff ac1 in the middle of securejoin") @@ -327,7 +322,7 @@ def test_qr_join_chat_with_pending_bobstate_issue4894(acfactory): assert ac2.create_contact(ac3).get_snapshot().is_verified logging.info("ac3: create a verified group VG with ac2") - vg = ac3.create_group("ac3-created", protect=True) + vg = ac3.create_group("ac3-created") vg.add_contact(ac3.create_contact(ac2)) # ensure ac2 receives message in VG @@ -335,7 +330,6 @@ def test_qr_join_chat_with_pending_bobstate_issue4894(acfactory): while 1: msg = ac2.get_message_by_id(ac2.wait_for_incoming_msg_event().msg_id).get_snapshot() if msg.text == "hello": - assert msg.chat.get_basic_snapshot().is_protected break logging.info("ac3: create a join-code for group VG and let ac4 join, check that ac2 got it") @@ -359,7 +353,7 @@ def test_qr_new_group_unblocked(acfactory): """ ac1, ac2 = acfactory.get_online_accounts(2) - ac1_chat = ac1.create_group("Group for joining", protect=True) + ac1_chat = ac1.create_group("Group for joining") qr_code = ac1_chat.get_qr_code() ac2.secure_join(qr_code) @@ -384,8 +378,7 @@ def test_aeap_flow_verified(acfactory): addr, password = acfactory.get_credentials() logging.info("ac1: create verified-group QR, ac2 scans and joins") - chat = ac1.create_group("hello", protect=True) - assert chat.get_basic_snapshot().is_protected + chat = ac1.create_group("hello") qr_code = chat.get_qr_code() logging.info("ac2: start QR-code based join-group protocol") ac2.secure_join(qr_code) @@ -439,7 +432,6 @@ def test_gossip_verification(acfactory) -> None: logging.info("Bob creates an Autocrypt group") bob_group_chat = bob.create_group("Autocrypt Group") - assert not bob_group_chat.get_basic_snapshot().is_protected bob_group_chat.add_contact(bob_contact_alice) bob_group_chat.add_contact(bob_contact_carol) bob_group_chat.send_message(text="Hello Autocrypt group") @@ -448,13 +440,12 @@ def test_gossip_verification(acfactory) -> None: assert snapshot.text == "Hello Autocrypt group" assert snapshot.show_padlock - # Autocrypt group does not propagate verification. + # Autocrypt group propagates verification using Autocrypt-Gossip header. carol_contact_alice_snapshot = carol_contact_alice.get_snapshot() - assert not carol_contact_alice_snapshot.is_verified + assert carol_contact_alice_snapshot.is_verified logging.info("Bob creates a Securejoin group") - bob_group_chat = bob.create_group("Securejoin Group", protect=True) - assert bob_group_chat.get_basic_snapshot().is_protected + bob_group_chat = bob.create_group("Securejoin Group") bob_group_chat.add_contact(bob_contact_alice) bob_group_chat.add_contact(bob_contact_carol) bob_group_chat.send_message(text="Hello Securejoin group") @@ -477,7 +468,7 @@ def test_securejoin_after_contact_resetup(acfactory) -> None: ac1, ac2, ac3 = acfactory.get_online_accounts(3) # ac3 creates protected group with ac1. - ac3_chat = ac3.create_group("Verified group", protect=True) + ac3_chat = ac3.create_group("Group") # ac1 joins ac3 group. ac3_qr_code = ac3_chat.get_qr_code() @@ -525,7 +516,6 @@ def test_securejoin_after_contact_resetup(acfactory) -> None: snapshot = ac2.get_message_by_id(ac2.wait_for_incoming_msg_event().msg_id).get_snapshot() assert snapshot.is_info ac2_chat = snapshot.chat - assert ac2_chat.get_basic_snapshot().is_protected assert len(ac2_chat.get_contacts()) == 3 # ac1 is still "not verified" for ac2 due to inconsistent state. @@ -535,9 +525,8 @@ def test_securejoin_after_contact_resetup(acfactory) -> None: def test_withdraw_securejoin_qr(acfactory): alice, bob = acfactory.get_online_accounts(2) - logging.info("Alice creates a verified group") - alice_chat = alice.create_group("Verified group", protect=True) - assert alice_chat.get_basic_snapshot().is_protected + logging.info("Alice creates a group") + alice_chat = alice.create_group("Group") logging.info("Bob joins verified group") qr_code = alice_chat.get_qr_code() @@ -548,7 +537,6 @@ def test_withdraw_securejoin_qr(acfactory): snapshot = bob.get_message_by_id(bob.wait_for_incoming_msg_event().msg_id).get_snapshot() assert snapshot.text == "Member Me added by {}.".format(alice.get_config("addr")) - assert snapshot.chat.get_basic_snapshot().is_protected bob_chat.leave() snapshot = alice.get_message_by_id(alice.wait_for_msgs_changed_event().msg_id).get_snapshot() diff --git a/python/src/deltachat/account.py b/python/src/deltachat/account.py index 647226fe2a..3b89bce815 100644 --- a/python/src/deltachat/account.py +++ b/python/src/deltachat/account.py @@ -404,18 +404,16 @@ def create_group_chat( self, name: str, contacts: Optional[List[Contact]] = None, - verified: bool = False, ) -> Chat: """create a new group chat object. Chats are unpromoted until the first message is sent. :param contacts: list of contacts to add - :param verified: if true only verified contacts can be added. :returns: a :class:`deltachat.chat.Chat` object. """ bytes_name = name.encode("utf8") - chat_id = lib.dc_create_group_chat(self._dc_context, int(verified), bytes_name) + chat_id = lib.dc_create_group_chat(self._dc_context, bytes_name) chat = Chat(self, chat_id) if contacts is not None: for contact in contacts: diff --git a/python/src/deltachat/chat.py b/python/src/deltachat/chat.py index edc2d5ba7d..a11bc8074d 100644 --- a/python/src/deltachat/chat.py +++ b/python/src/deltachat/chat.py @@ -142,13 +142,6 @@ def can_send(self) -> bool: """ return bool(lib.dc_chat_can_send(self._dc_chat)) - def is_protected(self) -> bool: - """return True if this chat is a protected chat. - - :returns: True if chat is protected, False otherwise. - """ - return bool(lib.dc_chat_is_protected(self._dc_chat)) - def get_name(self) -> Optional[str]: """return name of this chat. diff --git a/python/src/deltachat/contact.py b/python/src/deltachat/contact.py index fc5713d61a..33d770a51b 100644 --- a/python/src/deltachat/contact.py +++ b/python/src/deltachat/contact.py @@ -73,7 +73,7 @@ def unblock(self): def is_verified(self) -> bool: """Return True if the contact is verified.""" - return lib.dc_contact_is_verified(self._dc_contact) == 2 + return bool(lib.dc_contact_is_verified(self._dc_contact)) def get_verifier(self, contact) -> Optional["Contact"]: """Return the address of the contact that verified the contact.""" diff --git a/python/src/deltachat/testplugin.py b/python/src/deltachat/testplugin.py index 15bdb6035b..77a2195f0f 100644 --- a/python/src/deltachat/testplugin.py +++ b/python/src/deltachat/testplugin.py @@ -604,20 +604,6 @@ def get_accepted_chat(self, ac1: Account, ac2: Account): ac2.create_chat(ac1) return ac1.create_chat(ac2) - def get_protected_chat(self, ac1: Account, ac2: Account): - chat = ac1.create_group_chat("Protected Group", verified=True) - qr = chat.get_join_qr() - ac2.qr_join_chat(qr) - ac2._evtracker.wait_securejoin_joiner_progress(1000) - ev = ac2._evtracker.get_matching("DC_EVENT_MSGS_CHANGED") - msg = ac2.get_message_by_id(ev.data2) - assert msg is not None - assert msg.text == "Messages are end-to-end encrypted." - msg = ac2._evtracker.wait_next_incoming_message() - assert msg is not None - assert "Member Me " in msg.text and " added by " in msg.text - return chat - def introduce_each_other(self, accounts, sending=True): to_wait = [] for i, acc in enumerate(accounts): diff --git a/python/tests/test_0_complex_or_slow.py b/python/tests/test_0_complex_or_slow.py index d92dbcacca..3915e3653d 100644 --- a/python/tests/test_0_complex_or_slow.py +++ b/python/tests/test_0_complex_or_slow.py @@ -118,8 +118,7 @@ def test_qr_verified_group_and_chatting(acfactory, lp): ac1, ac2, ac3 = acfactory.get_online_accounts(3) ac1_addr = ac1.get_self_contact().addr lp.sec("ac1: create verified-group QR, ac2 scans and joins") - chat1 = ac1.create_group_chat("hello", verified=True) - assert chat1.is_protected() + chat1 = ac1.create_group_chat("hello") qr = chat1.get_join_qr() lp.sec("ac2: start QR-code based join-group protocol") chat2 = ac2.qr_join_chat(qr) @@ -142,7 +141,6 @@ def test_qr_verified_group_and_chatting(acfactory, lp): lp.sec("ac2: read message and check that it's a verified chat") msg = ac2._evtracker.wait_next_incoming_message() assert msg.text == "hello" - assert msg.chat.is_protected() assert msg.is_encrypted() lp.sec("ac2: Check that ac2 verified ac1") @@ -173,8 +171,10 @@ def test_qr_verified_group_and_chatting(acfactory, lp): lp.sec("ac2: Check that ac1 verified ac3 for ac2") ac2_ac1_contact = ac2.get_contacts()[0] assert ac2.get_self_contact().get_verifier(ac2_ac1_contact).id == dc.const.DC_CONTACT_ID_SELF - ac2_ac3_contact = ac2.get_contacts()[1] - assert ac2.get_self_contact().get_verifier(ac2_ac3_contact).addr == ac1_addr + for ac2_contact in chat2.get_contacts(): + if ac2_contact == ac2_ac1_contact or ac2_contact.id == dc.const.DC_CONTACT_ID_SELF: + continue + assert ac2.get_self_contact().get_verifier(ac2_contact).addr == ac1_addr lp.sec("ac2: send message and let ac3 read it") chat2.send_text("hi") @@ -266,8 +266,7 @@ def test_see_new_verified_member_after_going_online(acfactory, tmp_path, lp): ac1_offl.stop_io() lp.sec("ac1: create verified-group QR, ac2 scans and joins") - chat = ac1.create_group_chat("hello", verified=True) - assert chat.is_protected() + chat = ac1.create_group_chat("hello") qr = chat.get_join_qr() lp.sec("ac2: start QR-code based join-group protocol") chat2 = ac2.qr_join_chat(qr) @@ -321,8 +320,7 @@ def test_use_new_verified_group_after_going_online(acfactory, data, tmp_path, lp ac1.set_avatar(avatar_path) lp.sec("ac1: create verified-group QR, ac2 scans and joins") - chat = ac1.create_group_chat("hello", verified=True) - assert chat.is_protected() + chat = ac1.create_group_chat("hello") qr = chat.get_join_qr() lp.sec("ac2: start QR-code based join-group protocol") ac2.qr_join_chat(qr) @@ -336,7 +334,6 @@ def test_use_new_verified_group_after_going_online(acfactory, data, tmp_path, lp assert msg_in.is_system_message() assert contact.addr == ac1.get_config("addr") chat2 = msg_in.chat - assert chat2.is_protected() assert chat2.get_messages()[0].text == "Messages are end-to-end encrypted." assert open(contact.get_profile_image(), "rb").read() == open(avatar_path, "rb").read() @@ -376,8 +373,7 @@ def test_verified_group_vs_delete_server_after(acfactory, tmp_path, lp): ac2_offl.stop_io() lp.sec("ac1: create verified-group QR, ac2 scans and joins") - chat1 = ac1.create_group_chat("hello", verified=True) - assert chat1.is_protected() + chat1 = ac1.create_group_chat("hello") qr = chat1.get_join_qr() lp.sec("ac2: start QR-code based join-group protocol") chat2 = ac2.qr_join_chat(qr) @@ -402,28 +398,17 @@ def test_verified_group_vs_delete_server_after(acfactory, tmp_path, lp): assert ac2_offl_ac1_contact.addr == ac1.get_config("addr") assert not ac2_offl_ac1_contact.is_verified() chat2_offl = msg_in.chat - assert not chat2_offl.is_protected() lp.sec("ac2: sending message re-gossiping Autocrypt keys") chat2.send_text("hi2") lp.sec("ac2_offl: receiving message") - ev = ac2_offl._evtracker.get_matching("DC_EVENT_INCOMING_MSG|DC_EVENT_MSGS_CHANGED") - msg_in = ac2_offl.get_message_by_id(ev.data2) - assert msg_in.is_system_message() - assert msg_in.text == "Messages are end-to-end encrypted." - - # We need to consume one event that has data2=0 - ev = ac2_offl._evtracker.get_matching("DC_EVENT_INCOMING_MSG|DC_EVENT_MSGS_CHANGED") - assert ev.data2 == 0 - ev = ac2_offl._evtracker.get_matching("DC_EVENT_INCOMING_MSG|DC_EVENT_MSGS_CHANGED") msg_in = ac2_offl.get_message_by_id(ev.data2) assert not msg_in.is_system_message() assert msg_in.text == "hi2" assert msg_in.chat == chat2_offl assert msg_in.get_sender_contact().addr == ac2.get_config("addr") - assert msg_in.chat.is_protected() assert ac2_offl_ac1_contact.is_verified() diff --git a/python/tests/test_1_online.py b/python/tests/test_1_online.py index 9ae861eb9a..ec5b0bb334 100644 --- a/python/tests/test_1_online.py +++ b/python/tests/test_1_online.py @@ -432,7 +432,7 @@ def test_forward_messages(acfactory, lp): lp.sec("ac2: check new chat has a forwarded message") assert chat3.is_promoted() messages = chat3.get_messages() - assert len(messages) == 2 + assert len(messages) == 3 msg = messages[-1] assert msg.is_forwarded() ac2.delete_messages(messages) @@ -1242,7 +1242,7 @@ def test_qr_email_capitalization(acfactory, lp): ac1.create_contact(ac2_addr_uppercase) lp.sec("ac3 creates a verified group with a QR code") - chat = ac3.create_group_chat("hello", verified=True) + chat = ac3.create_group_chat("hello") qr = chat.get_join_qr() lp.sec("ac1 joins a verified group via a QR code") diff --git a/python/tests/test_3_offline.py b/python/tests/test_3_offline.py index 850baba71f..8701143210 100644 --- a/python/tests/test_3_offline.py +++ b/python/tests/test_3_offline.py @@ -271,10 +271,9 @@ def test_group_chat_creation_with_translation(self, ac1): chat.set_name("Homework") assert chat.get_messages()[-1].text == "abc homework xyz Homework" - @pytest.mark.parametrize("verified", [True, False]) - def test_group_chat_qr(self, acfactory, ac1, verified): + def test_group_chat_qr(self, acfactory, ac1): ac2 = acfactory.get_pseudo_configured_account() - chat = ac1.create_group_chat(name="title1", verified=verified) + chat = ac1.create_group_chat(name="title1") assert chat.is_group() qr = chat.get_join_qr() assert ac2.check_qr(qr).is_ask_verifygroup @@ -663,4 +662,4 @@ def test_audit_log_view_without_daymarker(self, acfactory, lp): lp.sec("check message count of only system messages (without daymarkers)") sysmessages = [x for x in chat.get_messages() if x.is_system_message()] - assert len(sysmessages) == 3 + assert len(sysmessages) == 4 diff --git a/rustc-ice-2025-08-19T18_52_16-154475.txt b/rustc-ice-2025-08-19T18_52_16-154475.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/aheader.rs b/src/aheader.rs index c0e26a3ecc..bef5d722f6 100644 --- a/src/aheader.rs +++ b/src/aheader.rs @@ -48,6 +48,13 @@ pub struct Aheader { pub addr: String, pub public_key: SignedPublicKey, pub prefer_encrypt: EncryptPreference, + + // Whether `_verified` attribute is present. + // + // `_verified` attribute is an extension to `Autocrypt-Gossip` + // header that is used to tell that the sender + // marked this key as verified. + pub is_verified: bool, } impl Aheader { @@ -56,11 +63,13 @@ impl Aheader { addr: String, public_key: SignedPublicKey, prefer_encrypt: EncryptPreference, + is_verified: bool, ) -> Self { Aheader { addr, public_key, prefer_encrypt, + is_verified, } } } @@ -71,6 +80,9 @@ impl fmt::Display for Aheader { if self.prefer_encrypt == EncryptPreference::Mutual { write!(fmt, " prefer-encrypt=mutual;")?; } + if self.is_verified { + write!(fmt, " _verified=1;")?; + } // adds a whitespace every 78 characters, this allows // email crate to wrap the lines according to RFC 5322 @@ -125,6 +137,8 @@ impl FromStr for Aheader { .and_then(|raw| raw.parse().ok()) .unwrap_or_default(); + let is_verified = attributes.remove("_verified").is_some(); + // Autocrypt-Level0: unknown attributes starting with an underscore can be safely ignored // Autocrypt-Level0: unknown attribute, treat the header as invalid if attributes.keys().any(|k| !k.starts_with('_')) { @@ -135,6 +149,7 @@ impl FromStr for Aheader { addr, public_key, prefer_encrypt, + is_verified, }) } } @@ -152,6 +167,7 @@ mod tests { assert_eq!(h.addr, "me@mail.com"); assert_eq!(h.prefer_encrypt, EncryptPreference::Mutual); + assert_eq!(h.is_verified, false); Ok(()) } @@ -248,7 +264,8 @@ mod tests { Aheader::new( "test@example.com".to_string(), SignedPublicKey::from_base64(RAWKEY).unwrap(), - EncryptPreference::Mutual + EncryptPreference::Mutual, + false ) ) .contains("prefer-encrypt=mutual;") @@ -263,7 +280,8 @@ mod tests { Aheader::new( "test@example.com".to_string(), SignedPublicKey::from_base64(RAWKEY).unwrap(), - EncryptPreference::NoPreference + EncryptPreference::NoPreference, + false ) ) .contains("prefer-encrypt") @@ -276,10 +294,24 @@ mod tests { Aheader::new( "TeSt@eXaMpLe.cOm".to_string(), SignedPublicKey::from_base64(RAWKEY).unwrap(), - EncryptPreference::Mutual + EncryptPreference::Mutual, + false ) ) .contains("test@example.com") ); + + assert!( + format!( + "{}", + Aheader::new( + "test@example.com".to_string(), + SignedPublicKey::from_base64(RAWKEY).unwrap(), + EncryptPreference::NoPreference, + true + ) + ) + .contains("_verified") + ); } } diff --git a/src/chat.rs b/src/chat.rs index e9d63e6090..e4ff033925 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -12,7 +12,6 @@ use std::time::Duration; use anyhow::{Context as _, Result, anyhow, bail, ensure}; use chrono::TimeZone; use deltachat_contact_tools::{ContactAddress, sanitize_bidi_characters, sanitize_single_line}; -use deltachat_derive::{FromSql, ToSql}; use mail_builder::mime::MimePart; use serde::{Deserialize, Serialize}; use strum_macros::EnumIter; @@ -67,41 +66,6 @@ pub enum ChatItem { }, } -/// Chat protection status. -#[derive( - Debug, - Default, - Display, - Clone, - Copy, - PartialEq, - Eq, - FromPrimitive, - ToPrimitive, - FromSql, - ToSql, - IntoStaticStr, - Serialize, - Deserialize, -)] -#[repr(u32)] -pub enum ProtectionStatus { - /// Chat is not protected. - #[default] - Unprotected = 0, - - /// Chat is protected. - /// - /// All members of the chat must be verified. - Protected = 1, - // `2` was never used as a value. - - // Chats don't break in Core v2 anymore. Chats with broken protection existing before the - // key-contacts migration are treated as `Unprotected`. - // - // ProtectionBroken = 3, -} - /// The reason why messages cannot be sent to the chat. /// /// The reason is mainly for logging and displaying in debug REPL, thus not translated. @@ -306,14 +270,12 @@ impl ChatId { /// Create a group or mailinglist raw database record with the given parameters. /// The function does not add SELF nor checks if the record already exists. - #[expect(clippy::too_many_arguments)] pub(crate) async fn create_multiuser_record( context: &Context, chattype: Chattype, grpid: &str, grpname: &str, create_blocked: Blocked, - create_protected: ProtectionStatus, param: Option, timestamp: i64, ) -> Result { @@ -321,31 +283,27 @@ impl ChatId { let timestamp = cmp::min(timestamp, smeared_time(context)); let row_id = context.sql.insert( - "INSERT INTO chats (type, name, grpid, blocked, created_timestamp, protected, param) VALUES(?, ?, ?, ?, ?, ?, ?);", + "INSERT INTO chats (type, name, grpid, blocked, created_timestamp, protected, param) VALUES(?, ?, ?, ?, ?, 0, ?);", ( chattype, &grpname, grpid, create_blocked, timestamp, - create_protected, param.unwrap_or_default(), ), ).await?; let chat_id = ChatId::new(u32::try_from(row_id)?); + let chat = Chat::load_from_db(context, chat_id).await?; - if create_protected == ProtectionStatus::Protected { - chat_id - .add_protection_msg(context, ProtectionStatus::Protected, None, timestamp) - .await?; - } else { - chat_id.maybe_add_encrypted_msg(context, timestamp).await?; + if chat.is_encrypted(context).await? { + chat_id.add_encrypted_msg(context, timestamp).await?; } info!( context, - "Created group/mailinglist '{}' grpid={} as {}, blocked={}, protected={create_protected}.", + "Created group/mailinglist '{}' grpid={} as {}, blocked={}.", &grpname, grpid, chat_id, @@ -500,111 +458,8 @@ impl ChatId { Ok(()) } - /// Sets protection without sending a message. - /// - /// Returns whether the protection status was actually modified. - pub(crate) async fn inner_set_protection( - self, - context: &Context, - protect: ProtectionStatus, - ) -> Result { - ensure!(!self.is_special(), "Invalid chat-id {self}."); - - let chat = Chat::load_from_db(context, self).await?; - - if protect == chat.protected { - info!(context, "Protection status unchanged for {}.", self); - return Ok(false); - } - - match protect { - ProtectionStatus::Protected => match chat.typ { - Chattype::Single - | Chattype::Group - | Chattype::OutBroadcast - | Chattype::InBroadcast => {} - Chattype::Mailinglist => bail!("Cannot protect mailing lists"), - }, - ProtectionStatus::Unprotected => {} - }; - - context - .sql - .execute("UPDATE chats SET protected=? WHERE id=?;", (protect, self)) - .await?; - - context.emit_event(EventType::ChatModified(self)); - chatlist_events::emit_chatlist_item_changed(context, self); - - // make sure, the receivers will get all keys - self.reset_gossiped_timestamp(context).await?; - - Ok(true) - } - - /// Adds an info message to the chat, telling the user that the protection status changed. - /// - /// Params: - /// - /// * `contact_id`: In a 1:1 chat, pass the chat partner's contact id. - /// * `timestamp_sort` is used as the timestamp of the added message - /// and should be the timestamp of the change happening. - pub(crate) async fn add_protection_msg( - self, - context: &Context, - protect: ProtectionStatus, - contact_id: Option, - timestamp_sort: i64, - ) -> Result<()> { - if contact_id == Some(ContactId::SELF) { - // Do not add protection messages to Saved Messages chat. - // This chat never gets protected and unprotected, - // we do not want the first message - // to be a protection message with an arbitrary timestamp. - return Ok(()); - } - - let text = context.stock_protection_msg(protect, contact_id).await; - let cmd = match protect { - ProtectionStatus::Protected => SystemMessage::ChatProtectionEnabled, - ProtectionStatus::Unprotected => SystemMessage::ChatProtectionDisabled, - }; - add_info_msg_with_cmd( - context, - self, - &text, - cmd, - timestamp_sort, - None, - None, - None, - None, - ) - .await?; - - Ok(()) - } - - /// Adds message "Messages are end-to-end encrypted" if appropriate. - /// - /// This function is rather slow because it does a lot of database queries, - /// but this is fine because it is only called on chat creation. - async fn maybe_add_encrypted_msg(self, context: &Context, timestamp_sort: i64) -> Result<()> { - let chat = Chat::load_from_db(context, self).await?; - - // as secure-join adds its own message on success (after some other messasges), - // we do not want to add "Messages are end-to-end encrypted" on chat creation. - // we detect secure join by `can_send` (for Bob, scanner side) and by `blocked` (for Alice, inviter side) below. - if !chat.is_encrypted(context).await? - || self <= DC_CHAT_ID_LAST_SPECIAL - || chat.is_device_talk() - || chat.is_self_talk() - || (!chat.can_send(context).await? && !chat.is_contact_request()) - || chat.blocked == Blocked::Yes - { - return Ok(()); - } - + /// Adds message "Messages are end-to-end encrypted". + async fn add_encrypted_msg(self, context: &Context, timestamp_sort: i64) -> Result<()> { let text = stock_str::messages_e2e_encrypted(context).await; add_info_msg_with_cmd( context, @@ -621,74 +476,6 @@ impl ChatId { Ok(()) } - /// Sets protection and adds a message. - /// - /// `timestamp_sort` is used as the timestamp of the added message - /// and should be the timestamp of the change happening. - async fn set_protection_for_timestamp_sort( - self, - context: &Context, - protect: ProtectionStatus, - timestamp_sort: i64, - contact_id: Option, - ) -> Result<()> { - let protection_status_modified = self - .inner_set_protection(context, protect) - .await - .with_context(|| format!("Cannot set protection for {self}"))?; - if protection_status_modified { - self.add_protection_msg(context, protect, contact_id, timestamp_sort) - .await?; - chatlist_events::emit_chatlist_item_changed(context, self); - } - Ok(()) - } - - /// Sets protection and sends or adds a message. - /// - /// `timestamp_sent` is the "sent" timestamp of a message caused the protection state change. - pub(crate) async fn set_protection( - self, - context: &Context, - protect: ProtectionStatus, - timestamp_sent: i64, - contact_id: Option, - ) -> Result<()> { - let sort_to_bottom = true; - let (received, incoming) = (false, false); - let ts = self - .calc_sort_timestamp(context, timestamp_sent, sort_to_bottom, received, incoming) - .await? - // Always sort protection messages below `SystemMessage::SecurejoinWait{,Timeout}` ones - // in case of race conditions. - .saturating_add(1); - self.set_protection_for_timestamp_sort(context, protect, ts, contact_id) - .await - } - - /// Sets the 1:1 chat with the given address to ProtectionStatus::Protected, - /// and posts a `SystemMessage::ChatProtectionEnabled` into it. - /// - /// If necessary, creates a hidden chat for this. - pub(crate) async fn set_protection_for_contact( - context: &Context, - contact_id: ContactId, - timestamp: i64, - ) -> Result<()> { - let chat_id = ChatId::create_for_contact_with_blocked(context, contact_id, Blocked::Yes) - .await - .with_context(|| format!("can't create chat for {contact_id}"))?; - chat_id - .set_protection( - context, - ProtectionStatus::Protected, - timestamp, - Some(contact_id), - ) - .await?; - Ok(()) - } - /// Archives or unarchives a chat. pub async fn set_visibility(self, context: &Context, visibility: ChatVisibility) -> Result<()> { self.set_visibility_ex(context, Sync, visibility).await @@ -1398,16 +1185,6 @@ impl ChatId { Ok(()) } - /// Returns true if the chat is protected. - pub async fn is_protected(self, context: &Context) -> Result { - let protection_status = context - .sql - .query_get_value("SELECT protected FROM chats WHERE id=?", (self,)) - .await? - .unwrap_or_default(); - Ok(protection_status) - } - /// Returns the sort timestamp for a new message in the chat. /// /// `message_timestamp` should be either the message "sent" timestamp or a timestamp of the @@ -1562,9 +1339,6 @@ pub struct Chat { /// Duration of the chat being muted. pub mute_duration: MuteDuration, - - /// If the chat is protected (verified). - pub(crate) protected: ProtectionStatus, } impl Chat { @@ -1574,7 +1348,7 @@ impl Chat { .sql .query_row( "SELECT c.type, c.name, c.grpid, c.param, c.archived, - c.blocked, c.locations_send_until, c.muted_until, c.protected + c.blocked, c.locations_send_until, c.muted_until FROM chats c WHERE c.id=?;", (chat_id,), @@ -1589,7 +1363,6 @@ impl Chat { blocked: row.get::<_, Option<_>>(5)?.unwrap_or_default(), is_sending_locations: row.get(6)?, mute_duration: row.get(7)?, - protected: row.get(8)?, }; Ok(c) }, @@ -1870,61 +1643,41 @@ impl Chat { !self.is_unpromoted() } - /// Returns true if chat protection is enabled. - /// - /// UI should display a green checkmark - /// in the chat title, - /// in the chat profile title and - /// in the chatlist item - /// if chat protection is enabled. - /// UI should also display a green checkmark - /// in the contact profile - /// if 1:1 chat with this contact exists and is protected. - pub fn is_protected(&self) -> bool { - self.protected == ProtectionStatus::Protected - } - /// Returns true if the chat is encrypted. pub async fn is_encrypted(&self, context: &Context) -> Result { - let is_encrypted = self.is_protected() - || match self.typ { - Chattype::Single => { - match context - .sql - .query_row_optional( - "SELECT cc.contact_id, c.fingerprint<>'' + let is_encrypted = match self.typ { + Chattype::Single => { + match context + .sql + .query_row_optional( + "SELECT cc.contact_id, c.fingerprint<>'' FROM chats_contacts cc LEFT JOIN contacts c ON c.id=cc.contact_id WHERE cc.chat_id=? ", - (self.id,), - |row| { - let id: ContactId = row.get(0)?; - let is_key: bool = row.get(1)?; - Ok((id, is_key)) - }, - ) - .await? - { - Some((id, is_key)) => is_key || id == ContactId::DEVICE, - None => true, - } - } - Chattype::Group => { - // Do not encrypt ad-hoc groups. - !self.grpid.is_empty() + (self.id,), + |row| { + let id: ContactId = row.get(0)?; + let is_key: bool = row.get(1)?; + Ok((id, is_key)) + }, + ) + .await? + { + Some((id, is_key)) => is_key || id == ContactId::DEVICE, + None => true, } - Chattype::Mailinglist => false, - Chattype::OutBroadcast | Chattype::InBroadcast => true, - }; + } + Chattype::Group => { + // Do not encrypt ad-hoc groups. + !self.grpid.is_empty() + } + Chattype::Mailinglist => false, + Chattype::OutBroadcast | Chattype::InBroadcast => true, + }; Ok(is_encrypted) } - /// Deprecated 2025-07. Returns false. - pub fn is_protection_broken(&self) -> bool { - false - } - /// Returns true if location streaming is enabled in the chat. pub fn is_sending_locations(&self) -> bool { self.is_sending_locations @@ -2632,7 +2385,6 @@ impl ChatIdBlocked { _ => (), } - let protected = contact_id == ContactId::SELF || contact.is_verified(context).await?; let smeared_time = create_smeared_timestamp(context); let chat_id = context @@ -2640,19 +2392,14 @@ impl ChatIdBlocked { .transaction(move |transaction| { transaction.execute( "INSERT INTO chats - (type, name, param, blocked, created_timestamp, protected) - VALUES(?, ?, ?, ?, ?, ?)", + (type, name, param, blocked, created_timestamp) + VALUES(?, ?, ?, ?, ?)", ( Chattype::Single, chat_name, params.to_string(), create_blocked as u8, smeared_time, - if protected { - ProtectionStatus::Protected - } else { - ProtectionStatus::Unprotected - }, ), )?; let chat_id = ChatId::new( @@ -2673,19 +2420,12 @@ impl ChatIdBlocked { }) .await?; - if protected { - chat_id - .add_protection_msg( - context, - ProtectionStatus::Protected, - Some(contact_id), - smeared_time, - ) - .await?; - } else { - chat_id - .maybe_add_encrypted_msg(context, smeared_time) - .await?; + let chat = Chat::load_from_db(context, chat_id).await?; + if chat.is_encrypted(context).await? + && !chat.param.exists(Param::Devicetalk) + && !chat.param.exists(Param::Selftalk) + { + chat_id.add_encrypted_msg(context, smeared_time).await?; } Ok(Self { @@ -3682,22 +3422,22 @@ pub async fn get_past_chat_contacts(context: &Context, chat_id: ChatId) -> Resul } /// Creates a group chat with a given `name`. -/// Deprecated on 2025-06-21, use `create_group_ex()`. -pub async fn create_group_chat( - context: &Context, - protect: ProtectionStatus, - name: &str, -) -> Result { - create_group_ex(context, Some(protect), name).await +pub async fn create_group_chat(context: &Context, name: &str) -> Result { + create_group_ex(context, true, name).await +} + +/// Creates a new unencrypted group chat. +pub async fn create_group_chat_unencrypted(context: &Context, name: &str) -> Result { + create_group_ex(context, false, name).await } /// Creates a group chat. /// -/// * `encryption` - If `Some`, the chat is encrypted (with key-contacts) and can be protected. +/// * `is_encrypted` - If true, the chat is encrypted (with key-contacts). /// * `name` - Chat name. -pub async fn create_group_ex( +pub(crate) async fn create_group_ex( context: &Context, - encryption: Option, + is_encrypted: bool, name: &str, ) -> Result { let mut chat_name = sanitize_single_line(name); @@ -3708,9 +3448,10 @@ pub async fn create_group_ex( chat_name = "…".to_string(); } - let grpid = match encryption { - Some(_) => create_id(), - None => String::new(), + let grpid = if is_encrypted { + create_id() + } else { + String::new() }; let timestamp = create_smeared_timestamp(context); @@ -3731,11 +3472,9 @@ pub async fn create_group_ex( chatlist_events::emit_chatlist_changed(context); chatlist_events::emit_chatlist_item_changed(context, chat_id); - if encryption == Some(ProtectionStatus::Protected) { - let protect = ProtectionStatus::Protected; - chat_id - .set_protection_for_timestamp_sort(context, protect, timestamp, None) - .await?; + if is_encrypted { + // Add "Messages are end-to-end encrypted." message. + chat_id.add_encrypted_msg(context, timestamp).await?; } if !context.get_config_bool(Config::Bot).await? @@ -3986,13 +3725,6 @@ pub(crate) async fn add_contact_to_chat_ex( } } else { // else continue and send status mail - if chat.is_protected() && !contact.is_verified(context).await? { - error!( - context, - "Cannot add non-bidirectionally verified contact {contact_id} to protected chat {chat_id}." - ); - return Ok(false); - } if is_contact_in_chat(context, chat_id, contact_id).await? { return Ok(false); } @@ -4643,24 +4375,21 @@ pub(crate) async fn get_chat_cnt(context: &Context) -> Result { } } -/// Returns a tuple of `(chatid, is_protected, blocked)`. +/// Returns a tuple of `(chatid, blocked)`. pub(crate) async fn get_chat_id_by_grpid( context: &Context, grpid: &str, -) -> Result> { +) -> Result> { context .sql .query_row_optional( - "SELECT id, blocked, protected FROM chats WHERE grpid=?;", + "SELECT id, blocked FROM chats WHERE grpid=?;", (grpid,), |row| { let chat_id = row.get::<_, ChatId>(0)?; let b = row.get::<_, Option>(1)?.unwrap_or_default(); - let p = row - .get::<_, Option>(2)? - .unwrap_or_default(); - Ok((chat_id, p == ProtectionStatus::Protected, b)) + Ok((chat_id, b)) }, ) .await diff --git a/src/chat/chat_tests.rs b/src/chat/chat_tests.rs index 64651f5834..0d473f35bf 100644 --- a/src/chat/chat_tests.rs +++ b/src/chat/chat_tests.rs @@ -11,7 +11,9 @@ use crate::test_utils::{ AVATAR_64x64_BYTES, AVATAR_64x64_DEDUPLICATED, E2EE_INFO_MSGS, TestContext, TestContextManager, TimeShiftFalsePositiveNote, sync, }; +use crate::tools::SystemTime; use pretty_assertions::assert_eq; +use std::time::Duration; use strum::IntoEnumIterator; use tokio::fs; @@ -94,7 +96,7 @@ async fn test_get_draft() { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_delete_draft() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "abc").await?; + let chat_id = create_group_chat(&t, "abc").await?; let mut msg = Message::new_text("hi!".to_string()); chat_id.set_draft(&t, Some(&mut msg)).await?; @@ -118,7 +120,7 @@ async fn test_forwarding_draft_failing() -> Result<()> { chat_id.set_draft(&t, Some(&mut msg)).await?; assert_eq!(msg.id, chat_id.get_draft(&t).await?.unwrap().id); - let chat_id2 = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id2 = create_group_chat(&t, "foo").await?; assert!(forward_msgs(&t, &[msg.id], chat_id2).await.is_err()); Ok(()) } @@ -167,7 +169,7 @@ async fn test_draft_stable_ids() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_only_one_draft_per_chat() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "abc").await?; + let chat_id = create_group_chat(&t, "abc").await?; let msgs: Vec = (1..=1000) .map(|i| Message::new_text(i.to_string())) @@ -194,7 +196,7 @@ async fn test_only_one_draft_per_chat() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_change_quotes_on_reused_message_object() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "chat").await?; + let chat_id = create_group_chat(&t, "chat").await?; let quote1 = Message::load_from_db(&t, send_text_msg(&t, chat_id, "quote1".to_string()).await?).await?; let quote2 = @@ -245,7 +247,7 @@ async fn test_quote_replies() -> Result<()> { let alice = TestContext::new_alice().await; let bob = TestContext::new_bob().await; - let grp_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "grp").await?; + let grp_chat_id = create_group_chat(&alice, "grp").await?; let grp_msg_id = send_text_msg(&alice, grp_chat_id, "bar".to_string()).await?; let grp_msg = Message::load_from_db(&alice, grp_msg_id).await?; @@ -293,9 +295,7 @@ async fn test_quote_replies() -> Result<()> { async fn test_add_contact_to_chat_ex_add_self() { // Adding self to a contact should succeed, even though it's pointless. let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo") - .await - .unwrap(); + let chat_id = create_group_chat(&t, "foo").await.unwrap(); let added = add_contact_to_chat_ex(&t, Nosync, chat_id, ContactId::SELF, false) .await .unwrap(); @@ -334,8 +334,7 @@ async fn test_member_add_remove() -> Result<()> { } tcm.section("Create and promote a group."); - let alice_chat_id = - create_group_chat(&alice, ProtectionStatus::Unprotected, "Group chat").await?; + let alice_chat_id = create_group_chat(&alice, "Group chat").await?; let alice_fiona_contact_id = alice.add_or_lookup_contact_id(&fiona).await; add_contact_to_chat(&alice, alice_chat_id, alice_fiona_contact_id).await?; let sent = alice @@ -397,8 +396,7 @@ async fn test_parallel_member_remove() -> Result<()> { let alice_charlie_contact_id = alice.add_or_lookup_contact_id(&charlie).await; tcm.section("Alice creates and promotes a group"); - let alice_chat_id = - create_group_chat(&alice, ProtectionStatus::Unprotected, "Group chat").await?; + let alice_chat_id = create_group_chat(&alice, "Group chat").await?; add_contact_to_chat(&alice, alice_chat_id, alice_bob_contact_id).await?; add_contact_to_chat(&alice, alice_chat_id, alice_fiona_contact_id).await?; let alice_sent_msg = alice @@ -455,8 +453,7 @@ async fn test_msg_with_implicit_member_removed() -> Result<()> { let alice_bob_contact_id = alice.add_or_lookup_contact_id(&bob).await; let alice_fiona_contact_id = alice.add_or_lookup_contact_id(&fiona).await; let bob_fiona_contact_id = bob.add_or_lookup_contact_id(&fiona).await; - let alice_chat_id = - create_group_chat(&alice, ProtectionStatus::Unprotected, "Group chat").await?; + let alice_chat_id = create_group_chat(&alice, "Group chat").await?; add_contact_to_chat(&alice, alice_chat_id, alice_bob_contact_id).await?; let sent_msg = alice.send_text(alice_chat_id, "I created a group").await; let bob_received_msg = bob.recv_msg(&sent_msg).await; @@ -502,7 +499,7 @@ async fn test_modify_chat_multi_device() -> Result<()> { a1.set_config_bool(Config::BccSelf, true).await?; // create group and sync it to the second device - let a1_chat_id = create_group_chat(&a1, ProtectionStatus::Unprotected, "foo").await?; + let a1_chat_id = create_group_chat(&a1, "foo").await?; let sent = a1.send_text(a1_chat_id, "ho!").await; let a1_msg = a1.get_last_msg().await; let a1_chat = Chat::load_from_db(&a1, a1_chat_id).await?; @@ -600,7 +597,7 @@ async fn test_modify_chat_disordered() -> Result<()> { let fiona = tcm.fiona().await; let fiona_id = alice.add_or_lookup_contact_id(&fiona).await; - let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "foo").await?; + let alice_chat_id = create_group_chat(&alice, "foo").await?; send_text_msg(&alice, alice_chat_id, "populate".to_string()).await?; add_contact_to_chat(&alice, alice_chat_id, bob_id).await?; @@ -647,9 +644,7 @@ async fn test_lost_member_added() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; let charlie = &tcm.charlie().await; - let alice_chat_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "Group", &[bob]) - .await; + let alice_chat_id = alice.create_group_with_members("Group", &[bob]).await; let alice_sent = alice.send_text(alice_chat_id, "Hi!").await; let bob_chat_id = bob.recv_msg(&alice_sent).await.chat_id; assert_eq!(get_chat_contacts(bob, bob_chat_id).await?.len(), 2); @@ -679,7 +674,7 @@ async fn test_modify_chat_lost() -> Result<()> { let fiona = tcm.fiona().await; let fiona_id = alice.add_or_lookup_contact_id(&fiona).await; - let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "foo").await?; + let alice_chat_id = create_group_chat(&alice, "foo").await?; add_contact_to_chat(&alice, alice_chat_id, bob_id).await?; add_contact_to_chat(&alice, alice_chat_id, charlie_id).await?; add_contact_to_chat(&alice, alice_chat_id, fiona_id).await?; @@ -720,7 +715,7 @@ async fn test_leave_group() -> Result<()> { let bob = tcm.bob().await; tcm.section("Alice creates group chat with Bob."); - let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "foo").await?; + let alice_chat_id = create_group_chat(&alice, "foo").await?; let bob_contact = alice.add_or_lookup_contact(&bob).await.id; add_contact_to_chat(&alice, alice_chat_id, bob_contact).await?; @@ -1379,9 +1374,7 @@ async fn test_pinned() { tokio::time::sleep(std::time::Duration::from_millis(1000)).await; let chat_id2 = t.get_self_chat().await.id; tokio::time::sleep(std::time::Duration::from_millis(1000)).await; - let chat_id3 = create_group_chat(&t, ProtectionStatus::Unprotected, "foo") - .await - .unwrap(); + let chat_id3 = create_group_chat(&t, "foo").await.unwrap(); let chatlist = get_chats_from_chat_list(&t, DC_GCL_NO_SPECIALS).await; assert_eq!(chatlist, vec![chat_id3, chat_id2, chat_id1]); @@ -1471,9 +1464,7 @@ async fn test_set_chat_name() { let mut tcm = TestContextManager::new(); let alice = &tcm.alice().await; - let chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "foo") - .await - .unwrap(); + let chat_id = create_group_chat(alice, "foo").await.unwrap(); assert_eq!( Chat::load_from_db(alice, chat_id).await.unwrap().get_name(), "foo" @@ -1545,7 +1536,7 @@ async fn test_shall_attach_selfavatar() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(alice, "foo").await?; assert!(!shall_attach_selfavatar(alice, chat_id).await?); let contact_id = alice.add_or_lookup_contact_id(bob).await; @@ -1567,7 +1558,7 @@ async fn test_profile_data_on_group_leave() -> Result<()> { let mut tcm = TestContextManager::new(); let t = &tcm.alice().await; let bob = &tcm.bob().await; - let chat_id = create_group_chat(t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(t, "foo").await?; let contact_id = t.add_or_lookup_contact_id(bob).await; add_contact_to_chat(t, chat_id, contact_id).await?; @@ -1592,9 +1583,7 @@ async fn test_profile_data_on_group_leave() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_set_mute_duration() { let t = TestContext::new().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo") - .await - .unwrap(); + let chat_id = create_group_chat(&t, "foo").await.unwrap(); // Initial assert_eq!( Chat::load_from_db(&t, chat_id).await.unwrap().is_muted(), @@ -1643,8 +1632,8 @@ async fn test_set_mute_duration() { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_add_info_msg() -> Result<()> { let t = TestContext::new().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; - add_info_msg(&t, chat_id, "foo info", 200000).await?; + let chat_id = create_group_chat(&t, "foo").await?; + add_info_msg(&t, chat_id, "foo info", time()).await?; let msg = t.get_last_msg_in(chat_id).await; assert_eq!(msg.get_chat_id(), chat_id); @@ -1660,13 +1649,13 @@ async fn test_add_info_msg() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_add_info_msg_with_cmd() -> Result<()> { let t = TestContext::new().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let msg_id = add_info_msg_with_cmd( &t, chat_id, "foo bar info", SystemMessage::EphemeralTimerChanged, - 10000, + time(), None, None, None, @@ -1929,14 +1918,14 @@ async fn test_classic_email_chat() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_chat_get_color() -> Result<()> { let t = TestContext::new().await; - let chat_id = create_group_ex(&t, None, "a chat").await?; + let chat_id = create_group_chat_unencrypted(&t, "a chat").await?; let color1 = Chat::load_from_db(&t, chat_id).await?.get_color(&t).await?; assert_eq!(color1, 0x613dd7); // upper-/lowercase makes a difference for the colors, these are different groups // (in contrast to email addresses, where upper-/lowercase is ignored in practise) let t = TestContext::new().await; - let chat_id = create_group_ex(&t, None, "A CHAT").await?; + let chat_id = create_group_chat_unencrypted(&t, "A CHAT").await?; let color2 = Chat::load_from_db(&t, chat_id).await?.get_color(&t).await?; assert_ne!(color2, color1); Ok(()) @@ -1946,7 +1935,7 @@ async fn test_chat_get_color() -> Result<()> { async fn test_chat_get_color_encrypted() -> Result<()> { let mut tcm = TestContextManager::new(); let t = &tcm.alice().await; - let chat_id = create_group_ex(t, Some(ProtectionStatus::Unprotected), "a chat").await?; + let chat_id = create_group_chat(t, "a chat").await?; let color1 = Chat::load_from_db(t, chat_id).await?.get_color(t).await?; set_chat_name(t, chat_id, "A CHAT").await?; let color2 = Chat::load_from_db(t, chat_id).await?.get_color(t).await?; @@ -2135,7 +2124,7 @@ async fn test_forward_info_msg() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let chat_id1 = create_group_chat(alice, ProtectionStatus::Unprotected, "a").await?; + let chat_id1 = create_group_chat(alice, "a").await?; send_text_msg(alice, chat_id1, "msg one".to_string()).await?; let bob_id = alice.add_or_lookup_contact_id(bob).await; add_contact_to_chat(alice, chat_id1, bob_id).await?; @@ -2202,8 +2191,7 @@ async fn test_forward_group() -> Result<()> { let bob_chat = bob.create_chat(&alice).await; // Alice creates a group with Bob. - let alice_group_chat_id = - create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?; + let alice_group_chat_id = create_group_chat(&alice, "Group").await?; let bob_id = alice.add_or_lookup_contact_id(&bob).await; let charlie_id = alice.add_or_lookup_contact_id(&charlie).await; add_contact_to_chat(&alice, alice_group_chat_id, bob_id).await?; @@ -2255,8 +2243,7 @@ async fn test_only_minimal_data_are_forwarded() -> Result<()> { .set_config(Config::Displayname, Some("secretname")) .await?; let bob_id = alice.add_or_lookup_contact_id(&bob).await; - let group_id = - create_group_chat(&alice, ProtectionStatus::Unprotected, "secretgrpname").await?; + let group_id = create_group_chat(&alice, "secretgrpname").await?; add_contact_to_chat(&alice, group_id, bob_id).await?; let mut msg = Message::new_text("bla foo".to_owned()); let sent_msg = alice.send_msg(group_id, &mut msg).await; @@ -2271,7 +2258,7 @@ async fn test_only_minimal_data_are_forwarded() -> Result<()> { let orig_msg = bob.recv_msg(&sent_msg).await; let charlie_id = bob.add_or_lookup_contact_id(&charlie).await; let single_id = ChatId::create_for_contact(&bob, charlie_id).await?; - let group_id = create_group_chat(&bob, ProtectionStatus::Unprotected, "group2").await?; + let group_id = create_group_chat(&bob, "group2").await?; add_contact_to_chat(&bob, group_id, charlie_id).await?; let broadcast_id = create_broadcast(&bob, "Channel".to_string()).await?; add_contact_to_chat(&bob, broadcast_id, charlie_id).await?; @@ -2369,7 +2356,7 @@ async fn test_save_msgs_order() -> Result<()> { for a in [alice, alice1] { a.set_config_bool(Config::SyncMsgs, true).await?; } - let chat_id = create_group_chat(alice, ProtectionStatus::Protected, "grp").await?; + let chat_id = create_group_chat(alice, "grp").await?; let sent = [ alice.send_text(chat_id, "0").await, alice.send_text(chat_id, "1").await, @@ -2490,7 +2477,7 @@ async fn test_resend_own_message() -> Result<()> { let alice = TestContext::new_alice().await; let bob = TestContext::new_bob().await; let fiona = TestContext::new_fiona().await; - let alice_grp = create_group_chat(&alice, ProtectionStatus::Unprotected, "grp").await?; + let alice_grp = create_group_chat(&alice, "grp").await?; add_contact_to_chat( &alice, alice_grp, @@ -2577,7 +2564,7 @@ async fn test_resend_foreign_message_fails() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let alice_grp = create_group_chat(alice, ProtectionStatus::Unprotected, "grp").await?; + let alice_grp = create_group_chat(alice, "grp").await?; add_contact_to_chat(alice, alice_grp, alice.add_or_lookup_contact_id(bob).await).await?; let sent1 = alice.send_text(alice_grp, "alice->bob").await; @@ -2594,7 +2581,7 @@ async fn test_resend_info_message_fails() -> Result<()> { let bob = &tcm.bob().await; let charlie = &tcm.charlie().await; - let alice_grp = create_group_chat(alice, ProtectionStatus::Unprotected, "grp").await?; + let alice_grp = create_group_chat(alice, "grp").await?; add_contact_to_chat(alice, alice_grp, alice.add_or_lookup_contact_id(bob).await).await?; alice.send_text(alice_grp, "alice->bob").await; @@ -2617,7 +2604,7 @@ async fn test_can_send_group() -> Result<()> { let chat_id = ChatId::create_for_contact(&alice, bob).await?; let chat = Chat::load_from_db(&alice, chat_id).await?; assert!(chat.can_send(&alice).await?); - let chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&alice, "foo").await?; assert_eq!( Chat::load_from_db(&alice, chat_id) .await? @@ -3116,7 +3103,7 @@ async fn test_chat_get_encryption_info() -> Result<()> { let contact_bob = alice.add_or_lookup_contact_id(bob).await; let contact_fiona = alice.add_or_lookup_contact_id(fiona).await; - let chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?; + let chat_id = create_group_chat(alice, "Group").await?; assert_eq!( chat_id.get_encryption_info(alice).await?, "End-to-end encryption available" @@ -3174,8 +3161,8 @@ async fn test_chat_get_encryption_info() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_get_chat_media() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id1 = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; - let chat_id2 = create_group_chat(&t, ProtectionStatus::Unprotected, "bar").await?; + let chat_id1 = create_group_chat(&t, "foo").await?; + let chat_id2 = create_group_chat(&t, "bar").await?; assert_eq!( get_chat_media( @@ -3399,7 +3386,7 @@ async fn test_get_chat_media_webxdc_order() -> Result<()> { async fn test_blob_renaming() -> Result<()> { let alice = TestContext::new_alice().await; let bob = TestContext::new_bob().await; - let chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?; + let chat_id = create_group_chat(&alice, "Group").await?; add_contact_to_chat(&alice, chat_id, alice.add_or_lookup_contact_id(&bob).await).await?; let file = alice.get_blobdir().join("harmless_file.\u{202e}txt.exe"); fs::write(&file, "aaa").await?; @@ -3461,9 +3448,7 @@ async fn test_sync_blocked() -> Result<()> { // - Group chats synchronisation. // - That blocking a group deletes it on other devices. let fiona = TestContext::new_fiona().await; - let fiona_grp_chat_id = fiona - .create_group_with_members(ProtectionStatus::Unprotected, "grp", &[alice0]) - .await; + let fiona_grp_chat_id = fiona.create_group_with_members("grp", &[alice0]).await; let sent_msg = fiona.send_text(fiona_grp_chat_id, "hi").await; let a0_grp_chat_id = alice0.recv_msg(&sent_msg).await.chat_id; let a1_grp_chat_id = alice1.recv_msg(&sent_msg).await.chat_id; @@ -3596,9 +3581,7 @@ async fn test_sync_delete_chat() -> Result<()> { .get_matching(|evt| matches!(evt, EventType::ChatDeleted { .. })) .await; - let bob_grp_chat_id = bob - .create_group_with_members(ProtectionStatus::Unprotected, "grp", &[alice0]) - .await; + let bob_grp_chat_id = bob.create_group_with_members("grp", &[alice0]).await; let sent_msg = bob.send_text(bob_grp_chat_id, "hi").await; let a0_grp_chat_id = alice0.recv_msg(&sent_msg).await.chat_id; let a1_grp_chat_id = alice1.recv_msg(&sent_msg).await.chat_id; @@ -3965,9 +3948,7 @@ async fn test_info_contact_id() -> Result<()> { } // Alice creates group, Bob receives group - let alice_chat_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "play", &[bob]) - .await; + let alice_chat_id = alice.create_group_with_members("play", &[bob]).await; let sent_msg1 = alice.send_text(alice_chat_id, "moin").await; let msg = bob.recv_msg(&sent_msg1).await; @@ -4062,8 +4043,7 @@ async fn test_add_member_bug() -> Result<()> { let alice_fiona_contact_id = alice.add_or_lookup_contact_id(fiona).await; // Create a group. - let alice_chat_id = - create_group_chat(alice, ProtectionStatus::Unprotected, "Group chat").await?; + let alice_chat_id = create_group_chat(alice, "Group chat").await?; add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?; add_contact_to_chat(alice, alice_chat_id, alice_fiona_contact_id).await?; @@ -4107,8 +4087,7 @@ async fn test_past_members() -> Result<()> { let alice_fiona_contact_id = alice.add_or_lookup_contact_id(fiona).await; tcm.section("Alice creates a chat."); - let alice_chat_id = - create_group_chat(alice, ProtectionStatus::Unprotected, "Group chat").await?; + let alice_chat_id = create_group_chat(alice, "Group chat").await?; add_contact_to_chat(alice, alice_chat_id, alice_fiona_contact_id).await?; alice .send_text(alice_chat_id, "Hi! I created a group.") @@ -4142,8 +4121,7 @@ async fn non_member_cannot_modify_member_list() -> Result<()> { let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await; - let alice_chat_id = - create_group_chat(alice, ProtectionStatus::Unprotected, "Group chat").await?; + let alice_chat_id = create_group_chat(alice, "Group chat").await?; add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?; let alice_sent_msg = alice .send_text(alice_chat_id, "Hi! I created a group.") @@ -4180,8 +4158,7 @@ async fn unpromoted_group_no_tombstones() -> Result<()> { let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await; let alice_fiona_contact_id = alice.add_or_lookup_contact_id(fiona).await; - let alice_chat_id = - create_group_chat(alice, ProtectionStatus::Unprotected, "Group chat").await?; + let alice_chat_id = create_group_chat(alice, "Group chat").await?; add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?; add_contact_to_chat(alice, alice_chat_id, alice_fiona_contact_id).await?; assert_eq!(get_chat_contacts(alice, alice_chat_id).await?.len(), 3); @@ -4212,8 +4189,7 @@ async fn test_expire_past_members_after_60_days() -> Result<()> { let fiona = &tcm.fiona().await; let alice_fiona_contact_id = alice.add_or_lookup_contact_id(fiona).await; - let alice_chat_id = - create_group_chat(alice, ProtectionStatus::Unprotected, "Group chat").await?; + let alice_chat_id = create_group_chat(alice, "Group chat").await?; add_contact_to_chat(alice, alice_chat_id, alice_fiona_contact_id).await?; alice .send_text(alice_chat_id, "Hi! I created a group.") @@ -4250,7 +4226,7 @@ async fn test_past_members_order() -> Result<()> { let fiona = tcm.fiona().await; let fiona_contact_id = t.add_or_lookup_contact_id(&fiona).await; - let chat_id = create_group_chat(t, ProtectionStatus::Unprotected, "Group chat").await?; + let chat_id = create_group_chat(t, "Group chat").await?; add_contact_to_chat(t, chat_id, bob_contact_id).await?; add_contact_to_chat(t, chat_id, charlie_contact_id).await?; add_contact_to_chat(t, chat_id, fiona_contact_id).await?; @@ -4312,8 +4288,7 @@ async fn test_restore_backup_after_60_days() -> Result<()> { let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await; let alice_charlie_contact_id = alice.add_or_lookup_contact_id(charlie).await; - let alice_chat_id = - create_group_chat(alice, ProtectionStatus::Unprotected, "Group chat").await?; + let alice_chat_id = create_group_chat(alice, "Group chat").await?; add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?; add_contact_to_chat(alice, alice_chat_id, alice_charlie_contact_id).await?; @@ -4501,9 +4476,7 @@ async fn test_cannot_send_edit_request() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let chat_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "My Group", &[bob]) - .await; + let chat_id = alice.create_group_with_members("My Group", &[bob]).await; // Alice can edit her message let sent1 = alice.send_text(chat_id, "foo").await; @@ -4685,7 +4658,7 @@ async fn test_no_address_contacts_in_group_chats() -> Result<()> { let bob = &tcm.bob().await; let charlie = &tcm.charlie().await; - let chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group chat").await?; + let chat_id = create_group_chat(alice, "Group chat").await?; let bob_key_contact_id = alice.add_or_lookup_contact_id(bob).await; let charlie_address_contact_id = alice.add_or_lookup_address_contact_id(charlie).await; @@ -4744,7 +4717,7 @@ async fn test_create_unencrypted_group_chat() -> Result<()> { let bob = &tcm.bob().await; let charlie = &tcm.charlie().await; - let chat_id = create_group_ex(alice, None, "Group chat").await?; + let chat_id = create_group_chat_unencrypted(alice, "Group chat").await?; let bob_key_contact_id = alice.add_or_lookup_contact_id(bob).await; let charlie_address_contact_id = alice.add_or_lookup_address_contact_id(charlie).await; @@ -4765,7 +4738,7 @@ async fn test_create_unencrypted_group_chat() -> Result<()> { async fn test_create_group_invalid_name() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = &tcm.alice().await; - let chat_id = create_group_ex(alice, None, " ").await?; + let chat_id = create_group_chat(alice, " ").await?; let chat = Chat::load_from_db(alice, chat_id).await?; assert_eq!(chat.get_name(), "…"); Ok(()) @@ -4811,7 +4784,7 @@ async fn test_long_group_name() -> Result<()> { let bob = &tcm.bob().await; let group_name = "δδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδ"; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, group_name).await?; + let alice_chat_id = create_group_chat(alice, group_name).await?; let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await; add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?; let sent = alice diff --git a/src/chatlist.rs b/src/chatlist.rs index 423a30ea96..1616ebe774 100644 --- a/src/chatlist.rs +++ b/src/chatlist.rs @@ -481,27 +481,23 @@ mod tests { use super::*; use crate::chat::save_msgs; use crate::chat::{ - ProtectionStatus, add_contact_to_chat, create_group_chat, get_chat_contacts, - remove_contact_from_chat, send_text_msg, + add_contact_to_chat, create_group_chat, get_chat_contacts, remove_contact_from_chat, + send_text_msg, }; use crate::receive_imf::receive_imf; use crate::stock_str::StockMessage; use crate::test_utils::TestContext; use crate::test_utils::TestContextManager; + use crate::tools::SystemTime; + use std::time::Duration; #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_try_load() { let mut tcm = TestContextManager::new(); let bob = &tcm.bob().await; - let chat_id1 = create_group_chat(bob, ProtectionStatus::Unprotected, "a chat") - .await - .unwrap(); - let chat_id2 = create_group_chat(bob, ProtectionStatus::Unprotected, "b chat") - .await - .unwrap(); - let chat_id3 = create_group_chat(bob, ProtectionStatus::Unprotected, "c chat") - .await - .unwrap(); + let chat_id1 = create_group_chat(bob, "a chat").await.unwrap(); + let chat_id2 = create_group_chat(bob, "b chat").await.unwrap(); + let chat_id3 = create_group_chat(bob, "c chat").await.unwrap(); // check that the chatlist starts with the most recent message let chats = Chatlist::try_load(bob, 0, None, None).await.unwrap(); @@ -510,6 +506,8 @@ mod tests { assert_eq!(chats.get_chat_id(1).unwrap(), chat_id2); assert_eq!(chats.get_chat_id(2).unwrap(), chat_id1); + SystemTime::shift(Duration::from_secs(5)); + // New drafts are sorted to the top // We have to set a draft on the other two messages, too, as // chat timestamps are only exact to the second and sorting by timestamp @@ -532,9 +530,7 @@ mod tests { // receive a message from alice let alice = &tcm.alice().await; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "alice chat") - .await - .unwrap(); + let alice_chat_id = create_group_chat(alice, "alice chat").await.unwrap(); add_contact_to_chat( alice, alice_chat_id, @@ -572,9 +568,7 @@ mod tests { async fn test_sort_self_talk_up_on_forward() { let t = TestContext::new_alice().await; t.update_device_chats().await.unwrap(); - create_group_chat(&t, ProtectionStatus::Unprotected, "a chat") - .await - .unwrap(); + create_group_chat(&t, "a chat").await.unwrap(); let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap(); assert_eq!(chats.len(), 3); @@ -761,9 +755,7 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_get_summary_unwrap() { let t = TestContext::new().await; - let chat_id1 = create_group_chat(&t, ProtectionStatus::Unprotected, "a chat") - .await - .unwrap(); + let chat_id1 = create_group_chat(&t, "a chat").await.unwrap(); let mut msg = Message::new_text("foo:\nbar \r\n test".to_string()); chat_id1.set_draft(&t, Some(&mut msg)).await.unwrap(); @@ -779,9 +771,7 @@ mod tests { async fn test_get_summary_deleted_draft() { let t = TestContext::new().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "a chat") - .await - .unwrap(); + let chat_id = create_group_chat(&t, "a chat").await.unwrap(); let mut msg = Message::new_text("Foobar".to_string()); chat_id.set_draft(&t, Some(&mut msg)).await.unwrap(); @@ -820,15 +810,9 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_load_broken() { let t = TestContext::new_bob().await; - let chat_id1 = create_group_chat(&t, ProtectionStatus::Unprotected, "a chat") - .await - .unwrap(); - create_group_chat(&t, ProtectionStatus::Unprotected, "b chat") - .await - .unwrap(); - create_group_chat(&t, ProtectionStatus::Unprotected, "c chat") - .await - .unwrap(); + let chat_id1 = create_group_chat(&t, "a chat").await.unwrap(); + create_group_chat(&t, "b chat").await.unwrap(); + create_group_chat(&t, "c chat").await.unwrap(); // check that the chatlist starts with the most recent message let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap(); diff --git a/src/config.rs b/src/config.rs index 7bfebd868e..b16382cd72 100644 --- a/src/config.rs +++ b/src/config.rs @@ -422,7 +422,7 @@ pub enum Config { /// Regardless of this setting, `chat.is_protected()` returns true while the key is verified, /// and when the key changes, an info message is posted into the chat. /// 0=Nothing else happens when the key changes. - /// 1=After the key changed, `can_send()` returns false and `is_protection_broken()` returns true + /// 1=After the key changed, `can_send()` returns false /// until `chat_id.accept()` is called. #[strum(props(default = "0"))] VerifiedOneOnOneChats, diff --git a/src/contact.rs b/src/contact.rs index 2eb8bda663..6f6024e452 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -21,7 +21,7 @@ use tokio::task; use tokio::time::{Duration, timeout}; use crate::blob::BlobObject; -use crate::chat::{ChatId, ChatIdBlocked, ProtectionStatus}; +use crate::chat::ChatId; use crate::color::str_to_color; use crate::config::Config; use crate::constants::{self, Blocked, Chattype}; @@ -1650,29 +1650,6 @@ impl Contact { } } - /// Returns if the contact profile title should display a green checkmark. - /// - /// This generally should be consistent with the 1:1 chat with the contact - /// so 1:1 chat with the contact and the contact profile - /// either both display the green checkmark or both don't display a green checkmark. - /// - /// UI often knows beforehand if a chat exists and can also call - /// `chat.is_protected()` (if there is a chat) - /// or `contact.is_verified()` (if there is no chat) directly. - /// This is often easier and also skips some database calls. - pub async fn is_profile_verified(&self, context: &Context) -> Result { - let contact_id = self.id; - - if let Some(ChatIdBlocked { id: chat_id, .. }) = - ChatIdBlocked::lookup_by_contact(context, contact_id).await? - { - Ok(chat_id.is_protected(context).await? == ProtectionStatus::Protected) - } else { - // 1:1 chat does not exist. - Ok(self.is_verified(context).await?) - } - } - /// Returns the number of real (i.e. non-special) contacts in the database. pub async fn get_real_cnt(context: &Context) -> Result { if !context.sql.is_open().await { @@ -1806,9 +1783,7 @@ WHERE type=? AND id IN ( // also unblock mailinglist // if the contact is a mailinglist address explicitly created to allow unblocking if !new_blocking && contact.origin == Origin::MailinglistAddress { - if let Some((chat_id, _, _)) = - chat::get_chat_id_by_grpid(context, &contact.addr).await? - { + if let Some((chat_id, ..)) = chat::get_chat_id_by_grpid(context, &contact.addr).await? { chat_id.unblock_ex(context, Nosync).await?; } } diff --git a/src/contact/contact_tests.rs b/src/contact/contact_tests.rs index 48f2f2af4b..c82d54ed15 100644 --- a/src/contact/contact_tests.rs +++ b/src/contact/contact_tests.rs @@ -1295,23 +1295,6 @@ async fn test_import_vcard_key_change() -> Result<()> { Ok(()) } -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn test_self_is_verified() -> Result<()> { - let mut tcm = TestContextManager::new(); - let alice = tcm.alice().await; - - let contact = Contact::get_by_id(&alice, ContactId::SELF).await?; - assert_eq!(contact.is_verified(&alice).await?, true); - assert!(contact.is_profile_verified(&alice).await?); - assert!(contact.get_verifier_id(&alice).await?.is_none()); - assert!(contact.is_key_contact()); - - let chat_id = ChatId::get_for_contact(&alice, ContactId::SELF).await?; - assert!(chat_id.is_protected(&alice).await.unwrap() == ProtectionStatus::Protected); - - Ok(()) -} - /// Tests that importing a vCard with a key creates a key-contact. #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_vcard_creates_key_contact() -> Result<()> { diff --git a/src/context.rs b/src/context.rs index 0272a74c06..a652c5b33d 100644 --- a/src/context.rs +++ b/src/context.rs @@ -14,7 +14,7 @@ use pgp::types::PublicKeyTrait; use ratelimit::Ratelimit; use tokio::sync::{Mutex, Notify, RwLock}; -use crate::chat::{ChatId, ProtectionStatus, get_chat_cnt}; +use crate::chat::{ChatId, get_chat_cnt}; use crate::chatlist_events; use crate::config::Config; use crate::constants::{ @@ -1091,7 +1091,6 @@ impl Context { async fn get_self_report(&self) -> Result { #[derive(Default)] struct ChatNumbers { - protected: u32, opportunistic_dc: u32, opportunistic_mua: u32, unencrypted_dc: u32, @@ -1126,7 +1125,6 @@ impl Context { res += &format!("key_created {key_created}\n"); // how many of the chats active in the last months are: - // - protected // - opportunistic-encrypted and the contact uses Delta Chat // - opportunistic-encrypted and the contact uses a classical MUA // - unencrypted and the contact uses Delta Chat @@ -1135,7 +1133,7 @@ impl Context { let chats = self .sql .query_map( - "SELECT c.protected, m.param, m.msgrmsg + "SELECT m.param, m.msgrmsg FROM chats c JOIN msgs m ON c.id=m.chat_id @@ -1153,23 +1151,20 @@ impl Context { GROUP BY c.id", (DownloadState::Done, ContactId::INFO, three_months_ago), |row| { - let protected: ProtectionStatus = row.get(0)?; let message_param: Params = row.get::<_, String>(1)?.parse().unwrap_or_default(); let is_dc_message: bool = row.get(2)?; - Ok((protected, message_param, is_dc_message)) + Ok((message_param, is_dc_message)) }, |rows| { let mut chats = ChatNumbers::default(); for row in rows { - let (protected, message_param, is_dc_message) = row?; + let (message_param, is_dc_message) = row?; let encrypted = message_param .get_bool(Param::GuaranteeE2ee) .unwrap_or(false); - if protected == ProtectionStatus::Protected { - chats.protected += 1; - } else if encrypted { + if encrypted { if is_dc_message { chats.opportunistic_dc += 1; } else { @@ -1185,7 +1180,6 @@ impl Context { }, ) .await?; - res += &format!("chats_protected {}\n", chats.protected); res += &format!("chats_opportunistic_dc {}\n", chats.opportunistic_dc); res += &format!("chats_opportunistic_mua {}\n", chats.opportunistic_mua); res += &format!("chats_unencrypted_dc {}\n", chats.unencrypted_dc); @@ -1218,9 +1212,6 @@ impl Context { mark_contact_id_as_verified(self, contact_id, ContactId::SELF).await?; let chat_id = ChatId::create_for_contact(self, contact_id).await?; - chat_id - .set_protection(self, ProtectionStatus::Protected, time(), Some(contact_id)) - .await?; let mut msg = Message::new_text(self.get_self_report().await?); diff --git a/src/context/context_tests.rs b/src/context/context_tests.rs index e80c17448f..03dcaf3bbe 100644 --- a/src/context/context_tests.rs +++ b/src/context/context_tests.rs @@ -604,15 +604,12 @@ async fn test_draft_self_report() -> Result<()> { let chat_id = alice.draft_self_report().await?; let msg = get_chat_msg(&alice, chat_id, 0, 1).await; - assert_eq!(msg.get_info_type(), SystemMessage::ChatProtectionEnabled); - - let chat = Chat::load_from_db(&alice, chat_id).await?; - assert!(chat.is_protected()); + assert_eq!(msg.get_info_type(), SystemMessage::ChatE2ee); let mut draft = chat_id.get_draft(&alice).await?.unwrap(); assert!(draft.text.starts_with("core_version")); - // Test that sending into the protected chat works: + // Test that sending into the chat works: let _sent = alice.send_msg(chat_id, &mut draft).await; Ok(()) diff --git a/src/e2ee.rs b/src/e2ee.rs index 9968c22457..80ddf4af1e 100644 --- a/src/e2ee.rs +++ b/src/e2ee.rs @@ -37,7 +37,8 @@ impl EncryptHelper { pub fn get_aheader(&self) -> Aheader { let pk = self.public_key.clone(); let addr = self.addr.to_string(); - Aheader::new(addr, pk, self.prefer_encrypt) + let verified = false; + Aheader::new(addr, pk, self.prefer_encrypt, verified) } /// Tries to encrypt the passed in `mail`. diff --git a/src/ephemeral/ephemeral_tests.rs b/src/ephemeral/ephemeral_tests.rs index 56d18de454..6c140b4f33 100644 --- a/src/ephemeral/ephemeral_tests.rs +++ b/src/ephemeral/ephemeral_tests.rs @@ -12,7 +12,7 @@ use crate::receive_imf::receive_imf; use crate::test_utils::{TestContext, TestContextManager}; use crate::timesmearing::MAX_SECONDS_TO_LEND_FROM_FUTURE; use crate::{ - chat::{self, Chat, ChatItem, ProtectionStatus, create_group_chat, send_text_msg}, + chat::{self, Chat, ChatItem, create_group_chat, send_text_msg}, tools::IsNoneOrEmpty, }; @@ -164,7 +164,7 @@ async fn test_ephemeral_enable_disable() -> Result<()> { async fn test_ephemeral_unpromoted() -> Result<()> { let alice = TestContext::new_alice().await; - let chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group name").await?; + let chat_id = create_group_chat(&alice, "Group name").await?; // Group is unpromoted, the timer can be changed without sending a message. assert!(chat_id.is_unpromoted(&alice).await?); @@ -799,8 +799,7 @@ async fn test_ephemeral_timer_non_member() -> Result<()> { let bob = &tcm.bob().await; let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await; - let alice_chat_id = - create_group_chat(alice, ProtectionStatus::Unprotected, "Group name").await?; + let alice_chat_id = create_group_chat(alice, "Group name").await?; add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?; send_text_msg(alice, alice_chat_id, "Hi!".to_string()).await?; diff --git a/src/events/chatlist_events.rs b/src/events/chatlist_events.rs index 87af729429..15c9f75af4 100644 --- a/src/events/chatlist_events.rs +++ b/src/events/chatlist_events.rs @@ -66,8 +66,8 @@ mod test_chatlist_events { use crate::{ EventType, chat::{ - self, ChatId, ChatVisibility, MuteDuration, ProtectionStatus, create_broadcast, - create_group_chat, set_muted, + self, ChatId, ChatVisibility, MuteDuration, create_broadcast, create_group_chat, + set_muted, }, config::Config, constants::*, @@ -138,12 +138,7 @@ mod test_chatlist_events { async fn test_change_chat_visibility() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; - let chat_id = create_group_chat( - &alice, - crate::chat::ProtectionStatus::Unprotected, - "my_group", - ) - .await?; + let chat_id = create_group_chat(&alice, "my_group").await?; chat_id .set_visibility(&alice, ChatVisibility::Pinned) @@ -289,7 +284,7 @@ mod test_chatlist_events { async fn test_delete_chat() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; - let chat = create_group_chat(&alice, ProtectionStatus::Protected, "My Group").await?; + let chat = create_group_chat(&alice, "My Group").await?; alice.evtracker.clear_events(); chat.delete(&alice).await?; @@ -303,7 +298,7 @@ mod test_chatlist_events { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; alice.evtracker.clear_events(); - let chat = create_group_chat(&alice, ProtectionStatus::Protected, "My Group").await?; + let chat = create_group_chat(&alice, "My Group").await?; wait_for_chatlist_and_specific_item(&alice, chat).await; Ok(()) } @@ -324,7 +319,7 @@ mod test_chatlist_events { async fn test_mute_chat() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; - let chat = create_group_chat(&alice, ProtectionStatus::Protected, "My Group").await?; + let chat = create_group_chat(&alice, "My Group").await?; alice.evtracker.clear_events(); chat::set_muted(&alice, chat, MuteDuration::Forever).await?; @@ -343,7 +338,7 @@ mod test_chatlist_events { async fn test_mute_chat_expired() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; - let chat = create_group_chat(&alice, ProtectionStatus::Protected, "My Group").await?; + let chat = create_group_chat(&alice, "My Group").await?; let mute_duration = MuteDuration::Until( std::time::SystemTime::now() @@ -363,7 +358,7 @@ mod test_chatlist_events { async fn test_change_chat_name() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; - let chat = create_group_chat(&alice, ProtectionStatus::Protected, "My Group").await?; + let chat = create_group_chat(&alice, "My Group").await?; alice.evtracker.clear_events(); chat::set_chat_name(&alice, chat, "New Name").await?; @@ -377,7 +372,7 @@ mod test_chatlist_events { async fn test_change_chat_profile_image() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; - let chat = create_group_chat(&alice, ProtectionStatus::Protected, "My Group").await?; + let chat = create_group_chat(&alice, "My Group").await?; alice.evtracker.clear_events(); let file = alice.dir.path().join("avatar.png"); @@ -395,9 +390,7 @@ mod test_chatlist_events { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; let bob = tcm.bob().await; - let chat = alice - .create_group_with_members(ProtectionStatus::Unprotected, "My Group", &[&bob]) - .await; + let chat = alice.create_group_with_members("My Group", &[&bob]).await; let sent_msg = alice.send_text(chat, "Hello").await; let chat_id_for_bob = bob.recv_msg(&sent_msg).await.chat_id; @@ -419,9 +412,7 @@ mod test_chatlist_events { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; let bob = tcm.bob().await; - let chat = alice - .create_group_with_members(ProtectionStatus::Unprotected, "My Group", &[&bob]) - .await; + let chat = alice.create_group_with_members("My Group", &[&bob]).await; let sent_msg = alice.send_text(chat, "Hello").await; let chat_id_for_bob = bob.recv_msg(&sent_msg).await.chat_id; @@ -438,9 +429,7 @@ mod test_chatlist_events { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; let bob = tcm.bob().await; - let chat = alice - .create_group_with_members(ProtectionStatus::Unprotected, "My Group", &[&bob]) - .await; + let chat = alice.create_group_with_members("My Group", &[&bob]).await; let sent_msg = alice.send_text(chat, "Hello").await; let chat_id_for_bob = bob.recv_msg(&sent_msg).await.chat_id; @@ -456,7 +445,7 @@ mod test_chatlist_events { async fn test_delete_message() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; - let chat = create_group_chat(&alice, ProtectionStatus::Protected, "My Group").await?; + let chat = create_group_chat(&alice, "My Group").await?; let message = chat::send_text_msg(&alice, chat, "Hello World".to_owned()).await?; alice.evtracker.clear_events(); @@ -473,9 +462,7 @@ mod test_chatlist_events { let alice = tcm.alice().await; let bob = tcm.bob().await; - let chat = alice - .create_group_with_members(ProtectionStatus::Unprotected, "My Group", &[&bob]) - .await; + let chat = alice.create_group_with_members("My Group", &[&bob]).await; let sent_msg = alice.send_text(chat, "Hello").await; let chat_id_for_bob = bob.recv_msg(&sent_msg).await.chat_id; chat_id_for_bob.accept(&bob).await?; @@ -516,7 +503,7 @@ mod test_chatlist_events { async fn test_update_after_ephemeral_messages() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; - let chat = create_group_chat(&alice, ProtectionStatus::Protected, "My Group").await?; + let chat = create_group_chat(&alice, "My Group").await?; chat.set_ephemeral_timer(&alice, crate::ephemeral::Timer::Enabled { duration: 60 }) .await?; alice @@ -560,8 +547,7 @@ First thread."#; let alice = tcm.alice().await; let bob = tcm.bob().await; - let alice_chatid = - chat::create_group_chat(&alice.ctx, ProtectionStatus::Protected, "the chat").await?; + let alice_chatid = chat::create_group_chat(&alice.ctx, "the chat").await?; // Step 1: Generate QR-code, secure-join implied by chatid let qr = get_securejoin_qr(&alice.ctx, Some(alice_chatid)).await?; @@ -608,7 +594,7 @@ First thread."#; async fn test_resend_message() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; - let chat = create_group_chat(&alice, ProtectionStatus::Protected, "My Group").await?; + let chat = create_group_chat(&alice, "My Group").await?; let msg_id = chat::send_text_msg(&alice, chat, "Hello".to_owned()).await?; let _ = alice.pop_sent_msg().await; @@ -628,7 +614,7 @@ First thread."#; async fn test_reaction() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = tcm.alice().await; - let chat = create_group_chat(&alice, ProtectionStatus::Protected, "My Group").await?; + let chat = create_group_chat(&alice, "My Group").await?; let msg_id = chat::send_text_msg(&alice, chat, "Hello".to_owned()).await?; let _ = alice.pop_sent_msg().await; diff --git a/src/mimefactory.rs b/src/mimefactory.rs index 0d971bf243..73d4d47741 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -1088,6 +1088,17 @@ impl MimeFactory { .is_none_or(|ts| now >= ts + gossip_period || now < ts) }; + let verifier_id: Option = context + .sql + .query_get_value( + "SELECT verifier FROM contacts WHERE fingerprint=?", + (&fingerprint,), + ) + .await?; + + let is_verified = + verifier_id.is_some_and(|verifier_id| verifier_id != 0); + if !should_do_gossip { continue; } @@ -1098,6 +1109,7 @@ impl MimeFactory { // Autocrypt 1.1.0 specification says that // `prefer-encrypt` attribute SHOULD NOT be included. EncryptPreference::NoPreference, + is_verified, ) .to_string(); @@ -1322,20 +1334,6 @@ impl MimeFactory { let command = msg.param.get_cmd(); let mut placeholdertext = None; - let send_verified_headers = match chat.typ { - Chattype::Single => true, - Chattype::Group => true, - // Mailinglists and broadcast channels can actually never be verified: - Chattype::Mailinglist => false, - Chattype::OutBroadcast | Chattype::InBroadcast => false, - }; - if chat.is_protected() && send_verified_headers { - headers.push(( - "Chat-Verified", - mail_builder::headers::raw::Raw::new("1").into(), - )); - } - if chat.typ == Chattype::Group { // Send group ID unless it is an ad hoc group that has no ID. if !chat.grpid.is_empty() { diff --git a/src/mimefactory/mimefactory_tests.rs b/src/mimefactory/mimefactory_tests.rs index a856a243d3..a058c778f4 100644 --- a/src/mimefactory/mimefactory_tests.rs +++ b/src/mimefactory/mimefactory_tests.rs @@ -6,8 +6,7 @@ use std::time::Duration; use super::*; use crate::chat::{ - self, ChatId, ProtectionStatus, add_contact_to_chat, create_group_chat, - remove_contact_from_chat, send_text_msg, + self, ChatId, add_contact_to_chat, create_group_chat, remove_contact_from_chat, send_text_msg, }; use crate::chatlist::Chatlist; use crate::constants; @@ -352,9 +351,7 @@ async fn test_subject_in_group() -> Result<()> { let mut tcm = TestContextManager::new(); let t = tcm.alice().await; let bob = tcm.bob().await; - let group_id = chat::create_group_chat(&t, chat::ProtectionStatus::Unprotected, "groupname") - .await - .unwrap(); + let group_id = chat::create_group_chat(&t, "groupname").await.unwrap(); let bob_contact_id = t.add_or_lookup_contact_id(&bob).await; chat::add_contact_to_chat(&t, group_id, bob_contact_id).await?; @@ -756,7 +753,7 @@ async fn test_remove_member_bcc() -> Result<()> { let charlie_contact = Contact::get_by_id(alice, charlie_id).await?; let charlie_addr = charlie_contact.get_addr(); - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "foo").await?; + let alice_chat_id = create_group_chat(alice, "foo").await?; add_contact_to_chat(alice, alice_chat_id, bob_id).await?; add_contact_to_chat(alice, alice_chat_id, charlie_id).await?; send_text_msg(alice, alice_chat_id, "Creating a group".to_string()).await?; @@ -846,16 +843,12 @@ async fn test_dont_remove_self() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let first_group = alice - .create_group_with_members(ProtectionStatus::Unprotected, "First group", &[bob]) - .await; + let first_group = alice.create_group_with_members("First group", &[bob]).await; alice.send_text(first_group, "Hi! I created a group.").await; remove_contact_from_chat(alice, first_group, ContactId::SELF).await?; alice.pop_sent_msg().await; - let second_group = alice - .create_group_with_members(ProtectionStatus::Unprotected, "First group", &[bob]) - .await; + let second_group = alice.create_group_with_members("First group", &[bob]).await; let sent = alice .send_text(second_group, "Hi! I created another group.") .await; @@ -883,9 +876,7 @@ async fn test_new_member_is_first_recipient() -> Result<()> { let bob_id = alice.add_or_lookup_contact_id(bob).await; let charlie_id = alice.add_or_lookup_contact_id(charlie).await; - let group = alice - .create_group_with_members(ProtectionStatus::Unprotected, "Group", &[bob]) - .await; + let group = alice.create_group_with_members("Group", &[bob]).await; alice.send_text(group, "Hi! I created a group.").await; SystemTime::shift(Duration::from_secs(60)); diff --git a/src/mimeparser.rs b/src/mimeparser.rs index e015b95ca2..e99d53b8a5 100644 --- a/src/mimeparser.rs +++ b/src/mimeparser.rs @@ -1,7 +1,7 @@ //! # MIME message parsing module. use std::cmp::min; -use std::collections::{HashMap, HashSet}; +use std::collections::{BTreeMap, HashMap, HashSet}; use std::path::Path; use std::str; use std::str::FromStr; @@ -36,6 +36,17 @@ use crate::tools::{ }; use crate::{chatlist_events, location, stock_str, tools}; +/// Public key extracted from `Autocrypt-Gossip` +/// header with associated information. +#[derive(Debug)] +pub struct GossipedKey { + /// Public key extracted from `keydata` attribute. + pub public_key: SignedPublicKey, + + /// True if `Autocrypt-Gossip` has a `_verified` attribute. + pub is_verified: bool, +} + /// A parsed MIME message. /// /// This represents the relevant information of a parsed MIME message @@ -85,7 +96,7 @@ pub(crate) struct MimeMessage { /// The addresses for which there was a gossip header /// and their respective gossiped keys. - pub gossiped_keys: HashMap, + pub gossiped_keys: BTreeMap, /// Fingerprint of the key in the Autocrypt header. /// @@ -1548,15 +1559,6 @@ impl MimeMessage { } } - pub fn replace_msg_by_error(&mut self, error_msg: &str) { - self.is_system_message = SystemMessage::Unknown; - if let Some(part) = self.parts.first_mut() { - part.typ = Viewtype::Text; - part.msg = format!("[{error_msg}]"); - self.parts.truncate(1); - } - } - pub(crate) fn get_rfc724_mid(&self) -> Option { self.get_header(HeaderDef::MessageId) .and_then(|msgid| parse_message_id(msgid).ok()) @@ -1942,9 +1944,9 @@ async fn parse_gossip_headers( from: &str, recipients: &[SingleInfo], gossip_headers: Vec, -) -> Result> { +) -> Result> { // XXX split the parsing from the modification part - let mut gossiped_keys: HashMap = Default::default(); + let mut gossiped_keys: BTreeMap = Default::default(); for value in &gossip_headers { let header = match value.parse::() { @@ -1986,7 +1988,12 @@ async fn parse_gossip_headers( ) .await?; - gossiped_keys.insert(header.addr.to_lowercase(), header.public_key); + let gossiped_key = GossipedKey { + public_key: header.public_key, + + is_verified: header.is_verified, + }; + gossiped_keys.insert(header.addr.to_lowercase(), gossiped_key); } Ok(gossiped_keys) diff --git a/src/peer_channels.rs b/src/peer_channels.rs index 53d37927d1..ad78d99250 100644 --- a/src/peer_channels.rs +++ b/src/peer_channels.rs @@ -560,7 +560,7 @@ mod tests { use super::*; use crate::{ EventType, - chat::{self, ChatId, ProtectionStatus, add_contact_to_chat, resend_msgs, send_msg}, + chat::{self, ChatId, add_contact_to_chat, resend_msgs, send_msg}, message::{Message, Viewtype}, test_utils::{TestContext, TestContextManager}, }; @@ -948,9 +948,7 @@ mod tests { let mut tcm = TestContextManager::new(); let alice = &mut tcm.alice().await; let bob = &mut tcm.bob().await; - let group = chat::create_group_chat(alice, ProtectionStatus::Unprotected, "group chat") - .await - .unwrap(); + let group = chat::create_group_chat(alice, "group chat").await.unwrap(); // Alice sends webxdc to bob let mut instance = Message::new(Viewtype::File); diff --git a/src/qr/qr_tests.rs b/src/qr/qr_tests.rs index 01cb0edbec..b16a973a34 100644 --- a/src/qr/qr_tests.rs +++ b/src/qr/qr_tests.rs @@ -1,5 +1,5 @@ use super::*; -use crate::chat::{ProtectionStatus, create_group_chat}; +use crate::chat::create_group_chat; use crate::config::Config; use crate::securejoin::get_securejoin_qr; use crate::test_utils::{TestContext, TestContextManager}; @@ -479,7 +479,7 @@ async fn test_withdraw_verifycontact() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_withdraw_verifygroup() -> Result<()> { let alice = TestContext::new_alice().await; - let chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&alice, "foo").await?; let qr = get_securejoin_qr(&alice, Some(chat_id)).await?; // scanning own verify-group code offers withdrawing diff --git a/src/receive_imf.rs b/src/receive_imf.rs index addabc1560..84b8ef63d7 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -1,6 +1,6 @@ //! Internet Message Format reception pipeline. -use std::collections::{HashMap, HashSet}; +use std::collections::{BTreeMap, HashSet}; use std::iter; use std::sync::LazyLock; @@ -14,9 +14,7 @@ use mailparse::SingleInfo; use num_traits::FromPrimitive; use regex::Regex; -use crate::chat::{ - self, Chat, ChatId, ChatIdBlocked, ProtectionStatus, remove_from_chat_contacts_table, -}; +use crate::chat::{self, Chat, ChatId, ChatIdBlocked, remove_from_chat_contacts_table}; use crate::config::Config; use crate::constants::{self, Blocked, Chattype, DC_CHAT_ID_TRASH, EDITED_PREFIX, ShowEmails}; use crate::contact::{Contact, ContactId, Origin, mark_contact_id_as_verified}; @@ -28,14 +26,14 @@ use crate::events::EventType; use crate::headerdef::{HeaderDef, HeaderDefMap}; use crate::imap::{GENERATED_PREFIX, markseen_on_imap_table}; use crate::key::self_fingerprint_opt; -use crate::key::{DcKey, Fingerprint, SignedPublicKey}; +use crate::key::{DcKey, Fingerprint}; use crate::log::LogExt; use crate::log::{info, warn}; use crate::logged_debug_assert; use crate::message::{ self, Message, MessageState, MessengerMessage, MsgId, Viewtype, rfc724_mid_exists, }; -use crate::mimeparser::{AvatarAction, MimeMessage, SystemMessage, parse_message_ids}; +use crate::mimeparser::{AvatarAction, GossipedKey, MimeMessage, SystemMessage, parse_message_ids}; use crate::param::{Param, Params}; use crate::peer_channels::{add_gossip_peer_from_header, insert_topic_stub}; use crate::reaction::{Reaction, set_msg_reaction}; @@ -248,9 +246,7 @@ async fn get_to_and_past_contact_ids( let chat_id = match chat_assignment { ChatAssignment::Trash => None, ChatAssignment::GroupChat { grpid } => { - if let Some((chat_id, _protected, _blocked)) = - chat::get_chat_id_by_grpid(context, grpid).await? - { + if let Some((chat_id, _blocked)) = chat::get_chat_id_by_grpid(context, grpid).await? { Some(chat_id) } else { None @@ -743,7 +739,7 @@ pub(crate) async fn receive_imf_inner( let verified_encryption = has_verified_encryption(context, &mime_parser, from_id).await?; if verified_encryption == VerifiedEncryption::Verified { - mark_recipients_as_verified(context, from_id, &to_ids, &mime_parser).await?; + mark_recipients_as_verified(context, from_id, &mime_parser).await?; } let received_msg = if let Some(received_msg) = received_msg { @@ -795,7 +791,6 @@ pub(crate) async fn receive_imf_inner( allow_creation, &mut mime_parser, is_partial_download, - &verified_encryption, parent_message, ) .await?; @@ -813,7 +808,6 @@ pub(crate) async fn receive_imf_inner( is_partial_download, replace_msg_id, prevent_rename, - verified_encryption, chat_id, chat_id_blocked, is_dc_message, @@ -835,7 +829,7 @@ pub(crate) async fn receive_imf_inner( context .sql .transaction(move |transaction| { - let fingerprint = gossiped_key.dc_fingerprint().hex(); + let fingerprint = gossiped_key.public_key.dc_fingerprint().hex(); transaction.execute( "INSERT INTO gossip_timestamp (chat_id, fingerprint, timestamp) VALUES (?, ?, ?) @@ -1305,7 +1299,6 @@ async fn do_chat_assignment( allow_creation: bool, mime_parser: &mut MimeMessage, is_partial_download: Option, - verified_encryption: &VerifiedEncryption, parent_message: Option, ) -> Result<(ChatId, Blocked)> { let is_bot = context.get_config_bool(Config::Bot).await?; @@ -1348,9 +1341,7 @@ async fn do_chat_assignment( } ChatAssignment::GroupChat { grpid } => { // Try to assign to a chat based on Chat-Group-ID. - if let Some((id, _protected, blocked)) = - chat::get_chat_id_by_grpid(context, grpid).await? - { + if let Some((id, blocked)) = chat::get_chat_id_by_grpid(context, grpid).await? { chat_id = Some(id); chat_id_blocked = blocked; } else if allow_creation || test_normal_chat.is_some() { @@ -1362,7 +1353,6 @@ async fn do_chat_assignment( from_id, to_ids, past_ids, - verified_encryption, grpid, ) .await? @@ -1464,45 +1454,6 @@ async fn do_chat_assignment( ); } } - - // Check if the message was sent with verified encryption and set the protection of - // the 1:1 chat accordingly. - let chat = match is_partial_download.is_none() - && mime_parser.get_header(HeaderDef::SecureJoin).is_none() - { - true => Some(Chat::load_from_db(context, chat_id).await?) - .filter(|chat| chat.typ == Chattype::Single), - false => None, - }; - if let Some(chat) = chat { - ensure_and_debug_assert!( - chat.typ == Chattype::Single, - "Chat {chat_id} is not Single", - ); - let new_protection = match verified_encryption { - VerifiedEncryption::Verified => ProtectionStatus::Protected, - VerifiedEncryption::NotVerified(_) => ProtectionStatus::Unprotected, - }; - - ensure_and_debug_assert!( - chat.protected == ProtectionStatus::Unprotected - || new_protection == ProtectionStatus::Protected, - "Chat {chat_id} can't downgrade to Unprotected", - ); - if chat.protected != new_protection { - // The message itself will be sorted under the device message since the device - // message is `MessageState::InNoticed`, which means that all following - // messages are sorted under it. - chat_id - .set_protection( - context, - new_protection, - mime_parser.timestamp_sent, - Some(from_id), - ) - .await?; - } - } } } } else { @@ -1519,9 +1470,7 @@ async fn do_chat_assignment( chat_id = Some(DC_CHAT_ID_TRASH); } ChatAssignment::GroupChat { grpid } => { - if let Some((id, _protected, blocked)) = - chat::get_chat_id_by_grpid(context, grpid).await? - { + if let Some((id, blocked)) = chat::get_chat_id_by_grpid(context, grpid).await? { chat_id = Some(id); chat_id_blocked = blocked; } else if allow_creation { @@ -1533,7 +1482,6 @@ async fn do_chat_assignment( from_id, to_ids, past_ids, - verified_encryption, grpid, ) .await? @@ -1589,7 +1537,7 @@ async fn do_chat_assignment( if chat_id.is_none() && allow_creation { let to_contact = Contact::get_by_id(context, to_id).await?; if let Some(list_id) = to_contact.param.get(Param::ListId) { - if let Some((id, _, blocked)) = + if let Some((id, blocked)) = chat::get_chat_id_by_grpid(context, list_id).await? { chat_id = Some(id); @@ -1655,7 +1603,6 @@ async fn add_parts( is_partial_download: Option, mut replace_msg_id: Option, prevent_rename: bool, - verified_encryption: VerifiedEncryption, chat_id: ChatId, chat_id_blocked: Blocked, is_dc_message: MessengerMessage, @@ -1689,12 +1636,6 @@ async fn add_parts( let name: &str = from.display_name.as_ref().unwrap_or(&from.addr); for part in &mut mime_parser.parts { part.param.set(Param::OverrideSenderDisplayname, name); - - if chat.is_protected() { - // In protected chat, also mark the message with an error. - let s = stock_str::unknown_sender_for_chat(context).await; - part.error = Some(s); - } } } } @@ -1710,16 +1651,7 @@ async fn add_parts( apply_out_broadcast_changes(context, mime_parser, &mut chat, from_id).await? } Chattype::Group => { - apply_group_changes( - context, - mime_parser, - &mut chat, - from_id, - to_ids, - past_ids, - &verified_encryption, - ) - .await? + apply_group_changes(context, mime_parser, &mut chat, from_id, to_ids, past_ids).await? } Chattype::InBroadcast => { apply_in_broadcast_changes(context, mime_parser, &mut chat, from_id).await? @@ -1866,25 +1798,6 @@ async fn add_parts( None }; - let mut verification_failed = false; - if !chat_id.is_special() && is_partial_download.is_none() { - // For outgoing emails in the 1:1 chat we have an exception that - // they are allowed to be unencrypted: - // 1. They can't be an attack (they are outgoing, not incoming) - // 2. Probably the unencryptedness is just a temporary state, after all - // the user obviously still uses DC - // -> Showing info messages every time would be a lot of noise - // 3. The info messages that are shown to the user ("Your chat partner - // likely reinstalled DC" or similar) would be wrong. - if chat.is_protected() && (mime_parser.incoming || chat.typ != Chattype::Single) { - if let VerifiedEncryption::NotVerified(err) = verified_encryption { - verification_failed = true; - warn!(context, "Verification problem: {err:#}."); - let s = format!("{err}. Re-download the message or see 'Info' for more details"); - mime_parser.replace_msg_by_error(&s); - } - } - } drop(chat); // Avoid using stale `chat` object. let sort_timestamp = tweak_sort_timestamp( @@ -2142,10 +2055,6 @@ RETURNING id DownloadState::Available } else if mime_parser.decrypting_failed { DownloadState::Undecipherable - } else if verification_failed { - // Verification can fail because of message reordering. Re-downloading the - // message should help if so. - DownloadState::Available } else { DownloadState::Done }, @@ -2628,27 +2537,12 @@ async fn create_group( from_id: ContactId, to_ids: &[Option], past_ids: &[Option], - verified_encryption: &VerifiedEncryption, grpid: &str, ) -> Result> { let to_ids_flat: Vec = to_ids.iter().filter_map(|x| *x).collect(); let mut chat_id = None; let mut chat_id_blocked = Default::default(); - let create_protected = if mime_parser.get_header(HeaderDef::ChatVerified).is_some() { - if let VerifiedEncryption::NotVerified(err) = verified_encryption { - warn!( - context, - "Creating unprotected group because of the verification problem: {err:#}." - ); - ProtectionStatus::Unprotected - } else { - ProtectionStatus::Protected - } - } else { - ProtectionStatus::Unprotected - }; - async fn self_explicitly_added( context: &Context, mime_parser: &&mut MimeMessage, @@ -2684,7 +2578,6 @@ async fn create_group( grpid, grpname, create_blocked, - create_protected, None, mime_parser.timestamp_sent, ) @@ -2856,7 +2749,6 @@ async fn apply_group_changes( from_id: ContactId, to_ids: &[Option], past_ids: &[Option], - verified_encryption: &VerifiedEncryption, ) -> Result { let to_ids_flat: Vec = to_ids.iter().filter_map(|x| *x).collect(); ensure!(chat.typ == Chattype::Group); @@ -2880,24 +2772,6 @@ async fn apply_group_changes( let is_from_in_chat = !chat_contacts.contains(&ContactId::SELF) || chat_contacts.contains(&from_id); - if mime_parser.get_header(HeaderDef::ChatVerified).is_some() && !chat.is_protected() { - if let VerifiedEncryption::NotVerified(err) = verified_encryption { - warn!( - context, - "Not marking chat {} as protected due to verification problem: {err:#}.", chat.id, - ); - } else { - chat.id - .set_protection( - context, - ProtectionStatus::Protected, - mime_parser.timestamp_sent, - Some(from_id), - ) - .await?; - } - } - if let Some(removed_addr) = mime_parser.get_header(HeaderDef::ChatGroupMemberRemoved) { // TODO: if address "alice@example.org" is a member of the group twice, // with old and new key, @@ -2926,7 +2800,7 @@ async fn apply_group_changes( // highest `add_timestamp` to disambiguate. // The result of the error is that info message // may contain display name of the wrong contact. - let fingerprint = key.dc_fingerprint().hex(); + let fingerprint = key.public_key.dc_fingerprint().hex(); if let Some(contact_id) = lookup_key_contact_by_fingerprint(context, &fingerprint).await? { @@ -3269,7 +3143,7 @@ async fn create_or_lookup_mailinglist_or_broadcast( ) -> Result> { let listid = mailinglist_header_listid(list_id_header)?; - if let Some((chat_id, _, blocked)) = chat::get_chat_id_by_grpid(context, &listid).await? { + if let Some((chat_id, blocked)) = chat::get_chat_id_by_grpid(context, &listid).await? { return Ok(Some((chat_id, blocked))); } @@ -3307,7 +3181,6 @@ async fn create_or_lookup_mailinglist_or_broadcast( &listid, name, blocked, - ProtectionStatus::Unprotected, param, mime_parser.timestamp_sent, ) @@ -3589,7 +3462,6 @@ async fn create_adhoc_group( "", // Ad hoc groups have no ID. grpname, create_blocked, - ProtectionStatus::Unprotected, None, mime_parser.timestamp_sent, ) @@ -3665,19 +3537,35 @@ async fn has_verified_encryption( async fn mark_recipients_as_verified( context: &Context, from_id: ContactId, - to_ids: &[Option], mimeparser: &MimeMessage, ) -> Result<()> { - if mimeparser.get_header(HeaderDef::ChatVerified).is_none() { - return Ok(()); - } - for to_id in to_ids.iter().filter_map(|&x| x) { + for gossiped_key in mimeparser + .gossiped_keys + .values() + .filter(|gossiped_key| gossiped_key.is_verified) + { + let fingerprint = gossiped_key.public_key.dc_fingerprint().hex(); + let Some(to_id) = lookup_key_contact_by_fingerprint(context, &fingerprint).await? else { + continue; + }; + if to_id == ContactId::SELF || to_id == from_id { continue; } - mark_contact_id_as_verified(context, to_id, from_id).await?; - ChatId::set_protection_for_contact(context, to_id, mimeparser.timestamp_sent).await?; + if from_id == ContactId::SELF { + // Mark the contact as verified. + // We don't know however if the contact was directly verified + // as we did not observe SecureJoin, so mark as verified by unknown contact. + // `verifier` equal to contact ID itself means that the contact + // is verified, but it is not known by whom. + context + .sql + .execute("UPDATE contacts SET verifier=?1 WHERE id=?1", (to_id,)) + .await?; + } else { + mark_contact_id_as_verified(context, to_id, from_id).await?; + } } Ok(()) @@ -3763,7 +3651,7 @@ async fn add_or_lookup_contacts_by_address_list( async fn add_or_lookup_key_contacts( context: &Context, address_list: &[SingleInfo], - gossiped_keys: &HashMap, + gossiped_keys: &BTreeMap, fingerprints: &[Fingerprint], origin: Origin, ) -> Result>> { @@ -3779,7 +3667,7 @@ async fn add_or_lookup_key_contacts( // Iterator has not ran out of fingerprints yet. fp.hex() } else if let Some(key) = gossiped_keys.get(addr) { - key.dc_fingerprint().hex() + key.public_key.dc_fingerprint().hex() } else if context.is_self_addr(addr).await? { contact_ids.push(Some(ContactId::SELF)); continue; diff --git a/src/receive_imf/receive_imf_tests.rs b/src/receive_imf/receive_imf_tests.rs index 3feb8183f3..164767eb95 100644 --- a/src/receive_imf/receive_imf_tests.rs +++ b/src/receive_imf/receive_imf_tests.rs @@ -1000,7 +1000,7 @@ async fn test_other_device_writes_to_mailinglist() -> Result<()> { chat::get_chat_id_by_grpid(&t, "delta.codespeak.net") .await? .unwrap(), - (first_chat.id, false, Blocked::Request) + (first_chat.id, Blocked::Request) ); receive_imf( @@ -2944,7 +2944,7 @@ async fn test_outgoing_private_reply_multidevice() -> Result<()> { let charlie = tcm.charlie().await; // =============== Bob creates a group =============== - let group_id = chat::create_group_chat(&bob, ProtectionStatus::Unprotected, "Group").await?; + let group_id = chat::create_group_chat(&bob, "Group").await?; chat::add_to_chat_contacts_table( &bob, time(), @@ -3042,9 +3042,7 @@ async fn test_auto_accept_protected_group_for_bots() -> Result<()> { bob.set_config(Config::Bot, Some("1")).await.unwrap(); mark_as_verified(alice, bob).await; mark_as_verified(bob, alice).await; - let group_id = alice - .create_group_with_members(ProtectionStatus::Protected, "Group", &[bob]) - .await; + let group_id = alice.create_group_with_members("Group", &[bob]).await; let sent = alice.send_text(group_id, "Hello!").await; let msg = bob.recv_msg(&sent).await; let chat = chat::Chat::load_from_db(bob, msg.chat_id).await?; @@ -3092,13 +3090,11 @@ async fn test_bot_accepts_another_group_after_qr_scan() -> Result<()> { let bob = &tcm.bob().await; bob.set_config(Config::Bot, Some("1")).await?; - let group_id = chat::create_group_chat(alice, ProtectionStatus::Protected, "Group").await?; + let group_id = chat::create_group_chat(alice, "Group").await?; let qr = get_securejoin_qr(alice, Some(group_id)).await?; tcm.exec_securejoin_qr(bob, alice, &qr).await; - let group_id = alice - .create_group_with_members(ProtectionStatus::Protected, "Group", &[bob]) - .await; + let group_id = alice.create_group_with_members("Group", &[bob]).await; let sent = alice.send_text(group_id, "Hello!").await; let msg = bob.recv_msg(&sent).await; let chat = chat::Chat::load_from_db(bob, msg.chat_id).await?; @@ -3152,7 +3148,7 @@ async fn test_no_private_reply_to_blocked_account() -> Result<()> { let bob = tcm.bob().await; tcm.section("Bob creates a group"); - let group_id = chat::create_group_chat(&bob, ProtectionStatus::Unprotected, "Group").await?; + let group_id = chat::create_group_chat(&bob, "Group").await?; chat::add_to_chat_contacts_table( &bob, time(), @@ -3228,11 +3224,7 @@ async fn test_blocked_contact_creates_group() -> Result<()> { chat.id.block(&alice).await?; let group_id = bob - .create_group_with_members( - ProtectionStatus::Unprotected, - "group name", - &[&alice, &fiona], - ) + .create_group_with_members("group name", &[&alice, &fiona]) .await; let sent = bob.send_text(group_id, "Heyho, I'm a spammer!").await; @@ -3253,7 +3245,7 @@ async fn test_blocked_contact_creates_group() -> Result<()> { assert_eq!(rcvd.chat_blocked, Blocked::Request); // In order not to lose context, Bob's message should also be shown in the group let msgs = chat::get_chat_msgs(&alice, rcvd.chat_id).await?; - assert_eq!(msgs.len(), 2); + assert_eq!(msgs.len(), 3); Ok(()) } @@ -3728,7 +3720,7 @@ async fn test_unsigned_chat_group_hdr() -> Result<()> { let bob = &tcm.bob().await; let bob_addr = bob.get_config(Config::Addr).await?.unwrap(); let bob_id = alice.add_or_lookup_contact_id(bob).await; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "foos").await?; + let alice_chat_id = create_group_chat(alice, "foos").await?; add_contact_to_chat(alice, alice_chat_id, bob_id).await?; send_text_msg(alice, alice_chat_id, "populate".to_string()).await?; let sent_msg = alice.pop_sent_msg().await; @@ -3774,7 +3766,7 @@ async fn test_sync_member_list_on_rejoin() -> Result<()> { let bob_id = alice.add_or_lookup_contact_id(bob).await; let fiona_id = alice.add_or_lookup_contact_id(fiona).await; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "foos").await?; + let alice_chat_id = create_group_chat(alice, "foos").await?; add_contact_to_chat(alice, alice_chat_id, bob_id).await?; add_contact_to_chat(alice, alice_chat_id, fiona_id).await?; @@ -3812,7 +3804,7 @@ async fn test_ignore_outdated_membership_changes() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; let alice_bob_id = alice.add_or_lookup_contact_id(bob).await; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "grp").await?; + let alice_chat_id = create_group_chat(alice, "grp").await?; // Alice creates a group chat. Bob accepts it. add_contact_to_chat(alice, alice_chat_id, alice_bob_id).await?; @@ -3860,7 +3852,7 @@ async fn test_dont_recreate_contacts_on_add_remove() -> Result<()> { let fiona = &tcm.fiona().await; let charlie = &tcm.charlie().await; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?; + let alice_chat_id = create_group_chat(alice, "Group").await?; add_contact_to_chat( alice, @@ -3911,7 +3903,7 @@ async fn test_delayed_removal_is_ignored() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; let fiona = &tcm.fiona().await; - let chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?; + let chat_id = create_group_chat(alice, "Group").await?; let alice_bob = alice.add_or_lookup_contact_id(bob).await; let alice_fiona = alice.add_or_lookup_contact_id(fiona).await; // create chat with three members @@ -3964,7 +3956,7 @@ async fn test_dont_readd_with_normal_msg() -> Result<()> { let bob = &tcm.bob().await; let fiona = &tcm.fiona().await; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?; + let alice_chat_id = create_group_chat(alice, "Group").await?; add_contact_to_chat( alice, @@ -4202,7 +4194,7 @@ async fn test_member_left_does_not_create_chat() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?; + let alice_chat_id = create_group_chat(alice, "Group").await?; add_contact_to_chat( alice, alice_chat_id, @@ -4230,7 +4222,7 @@ async fn test_recreate_member_list_on_missing_add_of_self() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?; + let alice_chat_id = create_group_chat(alice, "Group").await?; add_contact_to_chat( alice, alice_chat_id, @@ -4274,7 +4266,7 @@ async fn test_recreate_member_list_on_missing_add_of_self() -> Result<()> { async fn test_keep_member_list_if_possibly_nomember() -> Result<()> { let alice = TestContext::new_alice().await; let bob = TestContext::new_bob().await; - let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?; + let alice_chat_id = create_group_chat(&alice, "Group").await?; add_contact_to_chat( &alice, alice_chat_id, @@ -4414,7 +4406,7 @@ async fn test_create_group_with_big_msg() -> Result<()> { let file_bytes = include_bytes!("../../test-data/image/screenshot.png"); - let bob_grp_id = create_group_chat(&bob, ProtectionStatus::Unprotected, "Group").await?; + let bob_grp_id = create_group_chat(&bob, "Group").await?; add_contact_to_chat(&bob, bob_grp_id, ba_contact).await?; let mut msg = Message::new(Viewtype::Image); msg.set_file_from_bytes(&bob, "a.jpg", file_bytes, None)?; @@ -4445,7 +4437,7 @@ async fn test_create_group_with_big_msg() -> Result<()> { // Now Bob can send encrypted messages to Alice. - let bob_grp_id = create_group_chat(&bob, ProtectionStatus::Unprotected, "Group1").await?; + let bob_grp_id = create_group_chat(&bob, "Group1").await?; add_contact_to_chat(&bob, bob_grp_id, ba_contact).await?; let mut msg = Message::new(Viewtype::Image); msg.set_file_from_bytes(&bob, "a.jpg", file_bytes, None)?; @@ -4486,7 +4478,7 @@ async fn test_partial_group_consistency() -> Result<()> { let bob = tcm.bob().await; let fiona = tcm.fiona().await; let bob_id = alice.add_or_lookup_contact_id(&bob).await; - let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "foos").await?; + let alice_chat_id = create_group_chat(&alice, "foos").await?; add_contact_to_chat(&alice, alice_chat_id, bob_id).await?; send_text_msg(&alice, alice_chat_id, "populate".to_string()).await?; @@ -4566,7 +4558,7 @@ async fn test_protected_group_add_remove_member_missing_key() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; mark_as_verified(alice, bob).await; - let group_id = create_group_chat(alice, ProtectionStatus::Protected, "Group").await?; + let group_id = create_group_chat(alice, "Group").await?; let alice_bob_id = alice.add_or_lookup_contact(bob).await.id; add_contact_to_chat(alice, group_id, alice_bob_id).await?; alice.send_text(group_id, "Hello!").await; @@ -4663,7 +4655,7 @@ async fn test_unarchive_on_member_removal() -> Result<()> { let fiona = &tcm.fiona().await; let bob_id = alice.add_or_lookup_contact_id(bob).await; let fiona_id = alice.add_or_lookup_contact_id(fiona).await; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "foos").await?; + let alice_chat_id = create_group_chat(alice, "foos").await?; add_contact_to_chat(alice, alice_chat_id, bob_id).await?; add_contact_to_chat(alice, alice_chat_id, fiona_id).await?; @@ -4696,9 +4688,7 @@ async fn test_no_op_member_added_is_trash() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; let fiona = &tcm.fiona().await; - let alice_chat_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "foos", &[bob]) - .await; + let alice_chat_id = alice.create_group_with_members("foos", &[bob]).await; send_text_msg(alice, alice_chat_id, "populate".to_string()).await?; let msg = alice.pop_sent_msg().await; bob.recv_msg(&msg).await; @@ -4765,7 +4755,7 @@ async fn test_references() -> Result<()> { let bob = &tcm.bob().await; alice.set_config_bool(Config::BccSelf, true).await?; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?; + let alice_chat_id = create_group_chat(alice, "Group").await?; alice .send_text(alice_chat_id, "Hi! I created a group.") .await; @@ -4809,7 +4799,7 @@ async fn test_prefer_references_to_downloaded_msgs() -> Result<()> { let fiona = &tcm.fiona().await; let alice_bob_id = tcm.send_recv(bob, alice, "hi").await.from_id; let alice_fiona_id = tcm.send_recv(fiona, alice, "hi").await.from_id; - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?; + let alice_chat_id = create_group_chat(alice, "Group").await?; add_contact_to_chat(alice, alice_chat_id, alice_bob_id).await?; // W/o fiona the test doesn't work -- the last message is assigned to the 1:1 chat due to // `is_probably_private_reply()`. @@ -5009,12 +4999,7 @@ async fn test_group_name_with_newline() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let chat_id = create_group_chat( - alice, - ProtectionStatus::Unprotected, - "Group\r\nwith\nnewlines", - ) - .await?; + let chat_id = create_group_chat(alice, "Group\r\nwith\nnewlines").await?; add_contact_to_chat(alice, chat_id, alice.add_or_lookup_contact_id(bob).await).await?; send_text_msg(alice, chat_id, "populate".to_string()).await?; let bob_chat_id = bob.recv_msg(&alice.pop_sent_msg().await).await.chat_id; @@ -5032,7 +5017,7 @@ async fn test_rename_chat_on_missing_message() -> Result<()> { let alice = tcm.alice().await; let bob = tcm.bob().await; let charlie = tcm.charlie().await; - let chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?; + let chat_id = create_group_chat(&alice, "Group").await?; add_to_chat_contacts_table( &alice, time(), @@ -5068,7 +5053,7 @@ async fn test_rename_chat_after_creating_invite() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; for populate_before_securejoin in [false, true] { - let alice_chat_id = create_group_chat(alice, ProtectionStatus::Protected, "Group").await?; + let alice_chat_id = create_group_chat(alice, "Group").await?; let qr = get_securejoin_qr(alice, Some(alice_chat_id)).await?; SystemTime::shift(Duration::from_secs(60)); @@ -5098,7 +5083,7 @@ async fn test_two_group_securejoins() -> Result<()> { let bob = &tcm.bob().await; let fiona = &tcm.fiona().await; - let group_id = chat::create_group_chat(alice, ProtectionStatus::Protected, "Group").await?; + let group_id = chat::create_group_chat(alice, "Group").await?; let qr = get_securejoin_qr(alice, Some(group_id)).await?; @@ -5123,8 +5108,7 @@ async fn test_unverified_member_msg() -> Result<()> { let bob = &tcm.bob().await; let fiona = &tcm.fiona().await; - let alice_chat_id = - chat::create_group_chat(alice, ProtectionStatus::Protected, "Group").await?; + let alice_chat_id = chat::create_group_chat(alice, "Group").await?; let qr = get_securejoin_qr(alice, Some(alice_chat_id)).await?; tcm.exec_securejoin_qr(bob, alice, &qr).await; @@ -5133,21 +5117,9 @@ async fn test_unverified_member_msg() -> Result<()> { let fiona_chat_id = fiona.get_last_msg().await.chat_id; let fiona_sent_msg = fiona.send_text(fiona_chat_id, "Hi").await; - // The message can't be verified, but the user can re-download it. - let bob_msg = bob.recv_msg(&fiona_sent_msg).await; - assert_eq!(bob_msg.download_state, DownloadState::Available); - assert!( - bob_msg - .text - .contains("Re-download the message or see 'Info' for more details") - ); - - let alice_sent_msg = alice - .send_text(alice_chat_id, "Hi all, it's Alice introducing Fiona") - .await; - bob.recv_msg(&alice_sent_msg).await; - - // Now Bob has Fiona's key and can verify the message. + // The message is by non-verified member, + // but the checks have been removed + // and the message should be downloaded as usual. let bob_msg = bob.recv_msg(&fiona_sent_msg).await; assert_eq!(bob_msg.download_state, DownloadState::Done); assert_eq!(bob_msg.text, "Hi"); @@ -5197,9 +5169,7 @@ async fn test_no_address_contact_added_into_group() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let alice_chat_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "Group", &[bob]) - .await; + let alice_chat_id = alice.create_group_with_members("Group", &[bob]).await; let bob_received_msg = bob .recv_msg(&alice.send_text(alice_chat_id, "Message").await) .await; @@ -5479,7 +5449,7 @@ async fn test_small_unencrypted_group() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let alice_chat_id = chat::create_group_ex(alice, None, "Unencrypted group").await?; + let alice_chat_id = chat::create_group_chat_unencrypted(alice, "Unencrypted group").await?; let alice_bob_id = alice.add_or_lookup_address_contact_id(bob).await; add_contact_to_chat(alice, alice_chat_id, alice_bob_id).await?; send_text_msg(alice, alice_chat_id, "Hello!".to_string()).await?; diff --git a/src/securejoin.rs b/src/securejoin.rs index 4fff0eca28..06a203ef2e 100644 --- a/src/securejoin.rs +++ b/src/securejoin.rs @@ -4,8 +4,7 @@ use anyhow::{Context as _, Error, Result, bail, ensure}; use deltachat_contact_tools::ContactAddress; use percent_encoding::{NON_ALPHANUMERIC, utf8_percent_encode}; -use crate::chat::{self, Chat, ChatId, ChatIdBlocked, ProtectionStatus, get_chat_id_by_grpid}; -use crate::chatlist_events; +use crate::chat::{self, Chat, ChatId, ChatIdBlocked, get_chat_id_by_grpid}; use crate::config::Config; use crate::constants::{Blocked, Chattype, NON_ALPHANUMERIC_WITHOUT_DOT}; use crate::contact::mark_contact_id_as_verified; @@ -194,12 +193,6 @@ async fn send_alice_handshake_msg( Ok(()) } -/// Get an unblocked chat that can be used for info messages. -async fn info_chat_id(context: &Context, contact_id: ContactId) -> Result { - let chat_id_blocked = ChatIdBlocked::get_for_contact(context, contact_id, Blocked::Not).await?; - Ok(chat_id_blocked.id) -} - /// Checks fingerprint and marks the contact as verified /// if fingerprint matches. async fn verify_sender_by_fingerprint( @@ -272,7 +265,9 @@ pub(crate) async fn handle_securejoin_handshake( let mut self_found = false; let self_fingerprint = load_self_public_key(context).await?.dc_fingerprint(); for (addr, key) in &mime_message.gossiped_keys { - if key.dc_fingerprint() == self_fingerprint && context.is_self_addr(addr).await? { + if key.public_key.dc_fingerprint() == self_fingerprint + && context.is_self_addr(addr).await? + { self_found = true; break; } @@ -406,13 +401,6 @@ pub(crate) async fn handle_securejoin_handshake( inviter_progress(context, contact_id, 600); if let Some(group_chat_id) = group_chat_id { // Join group. - secure_connection_established( - context, - contact_id, - group_chat_id, - mime_message.timestamp_sent, - ) - .await?; chat::add_contact_to_chat_ex(context, Nosync, group_chat_id, contact_id, true) .await?; inviter_progress(context, contact_id, 800); @@ -422,13 +410,6 @@ pub(crate) async fn handle_securejoin_handshake( Ok(HandshakeMessage::Done) } else { // Setup verified contact. - secure_connection_established( - context, - contact_id, - info_chat_id(context, contact_id).await?, - mime_message.timestamp_sent, - ) - .await?; send_alice_handshake_msg(context, contact_id, "vc-contact-confirm") .await .context("failed sending vc-contact-confirm message")?; @@ -542,7 +523,7 @@ pub(crate) async fn observe_securejoin_on_other_device( return Ok(HandshakeMessage::Ignore); }; - if key.dc_fingerprint() != contact_fingerprint { + if key.public_key.dc_fingerprint() != contact_fingerprint { // Fingerprint does not match, ignore. warn!(context, "Fingerprint does not match."); return Ok(HandshakeMessage::Ignore); @@ -550,8 +531,6 @@ pub(crate) async fn observe_securejoin_on_other_device( mark_contact_id_as_verified(context, contact_id, ContactId::SELF).await?; - ChatId::set_protection_for_contact(context, contact_id, mime_message.timestamp_sent).await?; - if step == "vg-member-added" { inviter_progress(context, contact_id, 800); } @@ -573,28 +552,6 @@ pub(crate) async fn observe_securejoin_on_other_device( } } -async fn secure_connection_established( - context: &Context, - contact_id: ContactId, - chat_id: ChatId, - timestamp: i64, -) -> Result<()> { - let private_chat_id = ChatIdBlocked::get_for_contact(context, contact_id, Blocked::Yes) - .await? - .id; - private_chat_id - .set_protection( - context, - ProtectionStatus::Protected, - timestamp, - Some(contact_id), - ) - .await?; - context.emit_event(EventType::ChatModified(chat_id)); - chatlist_events::emit_chatlist_item_changed(context, chat_id); - Ok(()) -} - /* ****************************************************************************** * Tools: Misc. ******************************************************************************/ diff --git a/src/securejoin/bob.rs b/src/securejoin/bob.rs index 5392f94692..2d7046f5d4 100644 --- a/src/securejoin/bob.rs +++ b/src/securejoin/bob.rs @@ -4,7 +4,7 @@ use anyhow::{Context as _, Result}; use super::HandshakeMessage; use super::qrinvite::QrInvite; -use crate::chat::{self, ChatId, ProtectionStatus, is_contact_in_chat}; +use crate::chat::{self, ChatId, is_contact_in_chat}; use crate::constants::{Blocked, Chattype}; use crate::contact::Origin; use crate::context::Context; @@ -74,16 +74,6 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul send_handshake_message(context, &invite, chat_id, BobHandshakeMsg::RequestWithAuth) .await?; - // Mark 1:1 chat as verified already. - chat_id - .set_protection( - context, - ProtectionStatus::Protected, - time(), - Some(invite.contact_id()), - ) - .await?; - context.emit_event(EventType::SecurejoinJoinerProgress { contact_id: invite.contact_id(), progress: JoinerProgress::RequestWithAuthSent.to_usize(), @@ -123,21 +113,19 @@ pub(super) async fn start_protocol(context: &Context, invite: QrInvite) -> Resul let ts_sort = chat_id .calc_sort_timestamp(context, 0, sort_to_bottom, received, incoming) .await?; - if chat_id.is_protected(context).await? == ProtectionStatus::Unprotected { - let ts_start = time(); - chat::add_info_msg_with_cmd( - context, - chat_id, - &stock_str::securejoin_wait(context).await, - SystemMessage::SecurejoinWait, - ts_sort, - Some(ts_start), - None, - None, - None, - ) - .await?; - } + let ts_start = time(); + chat::add_info_msg_with_cmd( + context, + chat_id, + &stock_str::securejoin_wait(context).await, + SystemMessage::SecurejoinWait, + ts_sort, + Some(ts_start), + None, + None, + None, + ) + .await?; Ok(chat_id) } } @@ -215,15 +203,6 @@ pub(super) async fn handle_auth_required( } } - chat_id - .set_protection( - context, - ProtectionStatus::Protected, - message.timestamp_sent, - Some(invite.contact_id()), - ) - .await?; - context.emit_event(EventType::SecurejoinJoinerProgress { contact_id: invite.contact_id(), progress: JoinerProgress::RequestWithAuthSent.to_usize(), @@ -348,7 +327,7 @@ async fn joining_chat_id( QrInvite::Contact { .. } => Ok(alice_chat_id), QrInvite::Group { grpid, name, .. } => { let group_chat_id = match chat::get_chat_id_by_grpid(context, grpid).await? { - Some((chat_id, _protected, _blocked)) => { + Some((chat_id, _blocked)) => { chat_id.unblock_ex(context, Nosync).await?; chat_id } @@ -359,7 +338,6 @@ async fn joining_chat_id( grpid, name, Blocked::Not, - ProtectionStatus::Unprotected, // protection is added later as needed None, create_smeared_timestamp(context), ) diff --git a/src/securejoin/securejoin_tests.rs b/src/securejoin/securejoin_tests.rs index b5f3fcd84a..05e7a36d89 100644 --- a/src/securejoin/securejoin_tests.rs +++ b/src/securejoin/securejoin_tests.rs @@ -5,18 +5,16 @@ use crate::chat::{CantSendReason, remove_contact_from_chat}; use crate::chatlist::Chatlist; use crate::constants::Chattype; use crate::key::self_fingerprint; +use crate::mimeparser::GossipedKey; use crate::receive_imf::receive_imf; use crate::stock_str::{self, messages_e2e_encrypted}; use crate::test_utils::{ TestContext, TestContextManager, TimeShiftFalsePositiveNote, get_chat_msg, }; -use crate::tools::SystemTime; -use std::time::Duration; #[derive(PartialEq)] enum SetupContactCase { Normal, - CheckProtectionTimestamp, WrongAliceGossip, AliceIsBot, AliceHasName, @@ -27,11 +25,6 @@ async fn test_setup_contact() { test_setup_contact_ex(SetupContactCase::Normal).await } -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn test_setup_contact_protection_timestamp() { - test_setup_contact_ex(SetupContactCase::CheckProtectionTimestamp).await -} - #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_setup_contact_wrong_alice_gossip() { test_setup_contact_ex(SetupContactCase::WrongAliceGossip).await @@ -168,10 +161,6 @@ async fn test_setup_contact_ex(case: SetupContactCase) { assert!(sent.payload.contains("Auto-Submitted: auto-replied")); assert!(!sent.payload.contains("Bob Examplenet")); let mut msg = alice.parse_msg(&sent).await; - let vc_request_with_auth_ts_sent = msg - .get_header(HeaderDef::Date) - .and_then(|value| mailparse::dateparse(value).ok()) - .unwrap(); assert!(msg.was_encrypted()); assert_eq!( msg.get_header(HeaderDef::SecureJoin).unwrap(), @@ -185,7 +174,10 @@ async fn test_setup_contact_ex(case: SetupContactCase) { ); if case == SetupContactCase::WrongAliceGossip { - let wrong_pubkey = load_self_public_key(&bob).await.unwrap(); + let wrong_pubkey = GossipedKey { + public_key: load_self_public_key(&bob).await.unwrap(), + is_verified: false, + }; let alice_pubkey = msg .gossiped_keys .insert(alice_addr.to_string(), wrong_pubkey) @@ -215,10 +207,6 @@ async fn test_setup_contact_ex(case: SetupContactCase) { assert_eq!(contact_bob.is_verified(&alice).await.unwrap(), false); assert_eq!(contact_bob.get_authname(), ""); - if case == SetupContactCase::CheckProtectionTimestamp { - SystemTime::shift(Duration::from_secs(3600)); - } - tcm.section("Step 5+6: Alice receives vc-request-with-auth, sends vc-contact-confirm"); alice.recv_msg_trash(&sent).await; assert_eq!(contact_bob.is_verified(&alice).await.unwrap(), true); @@ -248,9 +236,6 @@ async fn test_setup_contact_ex(case: SetupContactCase) { assert!(msg.is_info()); let expected_text = messages_e2e_encrypted(&alice).await; assert_eq!(msg.get_text(), expected_text); - if case == SetupContactCase::CheckProtectionTimestamp { - assert_eq!(msg.timestamp_sort, vc_request_with_auth_ts_sent + 1); - } } // Make sure Alice hasn't yet sent their name to Bob. @@ -293,10 +278,10 @@ async fn test_setup_contact_ex(case: SetupContactCase) { let mut i = 0..msg_cnt; let msg = get_chat_msg(&bob, bob_chat.get_id(), i.next().unwrap(), msg_cnt).await; assert!(msg.is_info()); - assert_eq!(msg.get_text(), stock_str::securejoin_wait(&bob).await); + assert_eq!(msg.get_text(), messages_e2e_encrypted(&bob).await); let msg = get_chat_msg(&bob, bob_chat.get_id(), i.next().unwrap(), msg_cnt).await; assert!(msg.is_info()); - assert_eq!(msg.get_text(), messages_e2e_encrypted(&bob).await); + assert_eq!(msg.get_text(), stock_str::securejoin_wait(&bob).await); } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] @@ -425,8 +410,7 @@ async fn test_secure_join() -> Result<()> { assert_eq!(Chatlist::try_load(&alice, 0, None, None).await?.len(), 0); assert_eq!(Chatlist::try_load(&bob, 0, None, None).await?.len(), 0); - let alice_chatid = - chat::create_group_chat(&alice, ProtectionStatus::Protected, "the chat").await?; + let alice_chatid = chat::create_group_chat(&alice, "the chat").await?; tcm.section("Step 1: Generate QR-code, secure-join implied by chatid"); let qr = get_securejoin_qr(&alice, Some(alice_chatid)).await.unwrap(); @@ -535,7 +519,7 @@ async fn test_secure_join() -> Result<()> { Blocked::Yes, "Alice's 1:1 chat with Bob is not hidden" ); - // There should be 3 messages in the chat: + // There should be 2 messages in the chat: // - The ChatProtectionEnabled message // - You added member bob@example.net let msg = get_chat_msg(&alice, alice_chatid, 0, 2).await; @@ -571,7 +555,6 @@ async fn test_secure_join() -> Result<()> { } let bob_chat = Chat::load_from_db(&bob.ctx, bob_chatid).await?; - assert!(bob_chat.is_protected()); assert!(bob_chat.typ == Chattype::Group); // On this "happy path", Alice and Bob get only a group-chat where all information are added to. @@ -619,7 +602,7 @@ async fn test_unknown_sender() -> Result<()> { tcm.execute_securejoin(&alice, &bob).await; let alice_chat_id = alice - .create_group_with_members(ProtectionStatus::Protected, "Group with Bob", &[&bob]) + .create_group_with_members("Group with Bob", &[&bob]) .await; let sent = alice.send_text(alice_chat_id, "Hi!").await; @@ -634,7 +617,7 @@ async fn test_unknown_sender() -> Result<()> { // The message from Bob is delivered late, Bob is already removed. let msg = alice.recv_msg(&sent).await; assert_eq!(msg.text, "Hi hi!"); - assert_eq!(msg.error.unwrap(), "Unknown sender for this chat."); + assert_eq!(msg.get_override_sender_name().unwrap(), "bob@example.net"); Ok(()) } @@ -690,10 +673,8 @@ async fn test_parallel_securejoin() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let alice_chat1_id = - chat::create_group_chat(alice, ProtectionStatus::Protected, "First chat").await?; - let alice_chat2_id = - chat::create_group_chat(alice, ProtectionStatus::Protected, "Second chat").await?; + let alice_chat1_id = chat::create_group_chat(alice, "First chat").await?; + let alice_chat2_id = chat::create_group_chat(alice, "Second chat").await?; let qr1 = get_securejoin_qr(alice, Some(alice_chat1_id)).await?; let qr2 = get_securejoin_qr(alice, Some(alice_chat2_id)).await?; diff --git a/src/stock_str.rs b/src/stock_str.rs index acc3099e0f..8edd4d221c 100644 --- a/src/stock_str.rs +++ b/src/stock_str.rs @@ -11,7 +11,7 @@ use tokio::sync::RwLock; use crate::accounts::Accounts; use crate::blob::BlobObject; -use crate::chat::{self, Chat, ChatId, ProtectionStatus}; +use crate::chat::{self, Chat, ChatId}; use crate::config::Config; use crate::contact::{Contact, ContactId, Origin}; use crate::context::Context; @@ -123,9 +123,6 @@ pub enum StockMessage { however, of course, if they like, you may point them to πŸ‘‰ https://get.delta.chat"))] WelcomeMessage = 71, - #[strum(props(fallback = "Unknown sender for this chat."))] - UnknownSenderForChat = 72, - #[strum(props(fallback = "Message from %1$s"))] SubjectForNewContact = 73, @@ -909,11 +906,6 @@ pub(crate) async fn welcome_message(context: &Context) -> String { translated(context, StockMessage::WelcomeMessage).await } -/// Stock string: `Unknown sender for this chat.`. -pub(crate) async fn unknown_sender_for_chat(context: &Context) -> String { - translated(context, StockMessage::UnknownSenderForChat).await -} - /// Stock string: `Message from %1$s`. // TODO: This can compute `self_name` itself instead of asking the caller to do this. pub(crate) async fn subject_for_new_contact(context: &Context, self_name: &str) -> String { @@ -1051,13 +1043,6 @@ pub(crate) async fn messages_e2e_encrypted(context: &Context) -> String { translated(context, StockMessage::ChatProtectionEnabled).await } -/// Stock string: `%1$s sent a message from another device.` -pub(crate) async fn chat_protection_disabled(context: &Context, contact_id: ContactId) -> String { - translated(context, StockMessage::ChatProtectionDisabled) - .await - .replace1(&contact_id.get_stock_name(context).await) -} - /// Stock string: `Reply`. pub(crate) async fn reply_noun(context: &Context) -> String { translated(context, StockMessage::ReplyNoun).await @@ -1302,26 +1287,6 @@ impl Context { Ok(()) } - /// Returns a stock message saying that protection status has changed. - pub(crate) async fn stock_protection_msg( - &self, - protect: ProtectionStatus, - contact_id: Option, - ) -> String { - match protect { - ProtectionStatus::Unprotected => { - if let Some(contact_id) = contact_id { - chat_protection_disabled(self, contact_id).await - } else { - // In a group chat, it's not possible to downgrade verification. - // In a 1:1 chat, the `contact_id` always has to be provided. - "[Error] No contact_id given".to_string() - } - } - ProtectionStatus::Protected => messages_e2e_encrypted(self).await, - } - } - pub(crate) async fn update_device_chats(&self) -> Result<()> { if self.get_config_bool(Config::Bot).await? { return Ok(()); diff --git a/src/sync.rs b/src/sync.rs index 90e302f06b..57fc0349fa 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -332,7 +332,7 @@ mod tests { use anyhow::bail; use super::*; - use crate::chat::{Chat, ProtectionStatus, remove_contact_from_chat}; + use crate::chat::{Chat, remove_contact_from_chat}; use crate::chatlist::Chatlist; use crate::contact::{Contact, Origin}; use crate::securejoin::get_securejoin_qr; @@ -707,8 +707,7 @@ mod tests { let mut tcm = TestContextManager::new(); let alice = &tcm.alice().await; alice.set_config_bool(Config::SyncMsgs, true).await?; - let alice_chatid = - chat::create_group_chat(alice, ProtectionStatus::Protected, "the chat").await?; + let alice_chatid = chat::create_group_chat(alice, "the chat").await?; let qr = get_securejoin_qr(alice, Some(alice_chatid)).await?; // alice2 syncs the QR code token. diff --git a/src/test_utils.rs b/src/test_utils.rs index 6900cc0d24..aab4a279be 100644 --- a/src/test_utils.rs +++ b/src/test_utils.rs @@ -21,8 +21,8 @@ use tokio::runtime::Handle; use tokio::{fs, task}; use crate::chat::{ - self, Chat, ChatId, ChatIdBlocked, MessageListOptions, ProtectionStatus, - add_to_chat_contacts_table, create_group_chat, + self, Chat, ChatId, ChatIdBlocked, MessageListOptions, add_to_chat_contacts_table, + create_group_chat, }; use crate::chatlist::Chatlist; use crate::config::Config; @@ -186,8 +186,8 @@ impl TestContextManager { msg, to.name() )); - let chat = from.create_chat(to).await; - let sent = from.send_text(chat.id, msg).await; + let chat_id = from.create_chat_id(to).await; + let sent = from.send_text(chat_id, msg).await; to.recv_msg(&sent).await } @@ -852,14 +852,23 @@ impl TestContext { Chat::load_from_db(&self.ctx, chat_id).await.unwrap() } + /// Creates or returns an existing 1:1 [`ChatId`] with another account. + /// + /// This first creates a contact by exporting a vCard from the `other` + /// and importing it into `self`, + /// then creates a 1:1 chat with this contact. + pub async fn create_chat_id(&self, other: &TestContext) -> ChatId { + let contact_id = self.add_or_lookup_contact_id(other).await; + ChatId::create_for_contact(self, contact_id).await.unwrap() + } + /// Creates or returns an existing 1:1 [`Chat`] with another account. /// /// This first creates a contact by exporting a vCard from the `other` /// and importing it into `self`, /// then creates a 1:1 chat with this contact. pub async fn create_chat(&self, other: &TestContext) -> Chat { - let contact_id = self.add_or_lookup_contact_id(other).await; - let chat_id = ChatId::create_for_contact(self, contact_id).await.unwrap(); + let chat_id = self.create_chat_id(other).await; Chat::load_from_db(self, chat_id).await.unwrap() } @@ -997,7 +1006,7 @@ impl TestContext { }; writeln!( res, - "{}#{}: {} [{}]{}{}{} {}", + "{}#{}: {} [{}]{}{}{}", sel_chat.typ, sel_chat.get_id(), sel_chat.get_name(), @@ -1015,11 +1024,6 @@ impl TestContext { }, _ => "".to_string(), }, - if sel_chat.is_protected() { - "πŸ›‘οΈ" - } else { - "" - }, ) .unwrap(); @@ -1050,11 +1054,10 @@ impl TestContext { pub async fn create_group_with_members( &self, - protect: ProtectionStatus, chat_name: &str, members: &[&TestContext], ) -> ChatId { - let chat_id = create_group_chat(self, protect, chat_name).await.unwrap(); + let chat_id = create_group_chat(self, chat_name).await.unwrap(); let mut to_add = vec![]; for member in members { let contact_id = self.add_or_lookup_contact_id(member).await; diff --git a/src/tests/aeap.rs b/src/tests/aeap.rs index 55c5342f9b..51316efc50 100644 --- a/src/tests/aeap.rs +++ b/src/tests/aeap.rs @@ -9,7 +9,7 @@ use anyhow::Result; -use crate::chat::{self, Chat, ChatId, ProtectionStatus}; +use crate::chat::{self, Chat, ChatId}; use crate::contact::{Contact, ContactId}; use crate::message::Message; use crate::receive_imf::receive_imf; @@ -90,24 +90,12 @@ async fn check_aeap_transition(chat_for_transition: ChatForTransition, verified: } let mut groups = vec![ - chat::create_group_chat(bob, chat::ProtectionStatus::Unprotected, "Group 0") - .await - .unwrap(), - chat::create_group_chat(bob, chat::ProtectionStatus::Unprotected, "Group 1") - .await - .unwrap(), + chat::create_group_chat(bob, "Group 0").await.unwrap(), + chat::create_group_chat(bob, "Group 1").await.unwrap(), ]; if verified { - groups.push( - chat::create_group_chat(bob, chat::ProtectionStatus::Protected, "Group 2") - .await - .unwrap(), - ); - groups.push( - chat::create_group_chat(bob, chat::ProtectionStatus::Protected, "Group 3") - .await - .unwrap(), - ); + groups.push(chat::create_group_chat(bob, "Group 2").await.unwrap()); + groups.push(chat::create_group_chat(bob, "Group 3").await.unwrap()); } let alice_contact = bob.add_or_lookup_contact_id(alice).await; @@ -201,8 +189,7 @@ async fn test_aeap_replay_attack() -> Result<()> { tcm.send_recv_accept(&alice, &bob, "Hi").await; tcm.send_recv(&bob, &alice, "Hi back").await; - let group = - chat::create_group_chat(&bob, chat::ProtectionStatus::Unprotected, "Group 0").await?; + let group = chat::create_group_chat(&bob, "Group 0").await?; let bob_alice_contact = bob.add_or_lookup_contact_id(&alice).await; let bob_fiona_contact = bob.add_or_lookup_contact_id(&fiona).await; @@ -243,16 +230,13 @@ async fn test_write_to_alice_after_aeap() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; - let alice_grp_id = chat::create_group_chat(alice, ProtectionStatus::Protected, "Group").await?; + let alice_grp_id = chat::create_group_chat(alice, "Group").await?; let qr = get_securejoin_qr(alice, Some(alice_grp_id)).await?; tcm.exec_securejoin_qr(bob, alice, &qr).await; let bob_alice_contact = bob.add_or_lookup_contact(alice).await; assert!(bob_alice_contact.is_verified(bob).await?); let bob_alice_chat = bob.create_chat(alice).await; - assert!(bob_alice_chat.is_protected()); - let bob_unprotected_grp_id = bob - .create_group_with_members(ProtectionStatus::Unprotected, "Group", &[alice]) - .await; + let bob_unprotected_grp_id = bob.create_group_with_members("Group", &[alice]).await; tcm.change_addr(alice, "alice@someotherdomain.xyz").await; let sent = alice.send_text(alice_grp_id, "Hello!").await; @@ -260,7 +244,6 @@ async fn test_write_to_alice_after_aeap() -> Result<()> { assert!(bob_alice_contact.is_verified(bob).await?); let bob_alice_chat = Chat::load_from_db(bob, bob_alice_chat.id).await?; - assert!(bob_alice_chat.is_protected()); let mut msg = Message::new_text("hi".to_string()); chat::send_msg(bob, bob_alice_chat.id, &mut msg).await?; diff --git a/src/tests/verified_chats.rs b/src/tests/verified_chats.rs index fbee49fc21..cc0aab7594 100644 --- a/src/tests/verified_chats.rs +++ b/src/tests/verified_chats.rs @@ -2,9 +2,7 @@ use anyhow::Result; use pretty_assertions::assert_eq; use crate::chat::resend_msgs; -use crate::chat::{ - self, Chat, ProtectionStatus, add_contact_to_chat, remove_contact_from_chat, send_msg, -}; +use crate::chat::{self, Chat, add_contact_to_chat, remove_contact_from_chat, send_msg}; use crate::config::Config; use crate::constants::Chattype; use crate::contact::{Contact, ContactId}; @@ -39,8 +37,8 @@ async fn check_verified_oneonone_chat_protection_not_broken(by_classical_email: tcm.execute_securejoin(&alice, &bob).await; - assert_verified(&alice, &bob, ProtectionStatus::Protected).await; - assert_verified(&bob, &alice, ProtectionStatus::Protected).await; + assert_verified(&alice, &bob).await; + assert_verified(&bob, &alice).await; if by_classical_email { tcm.section("Bob uses a classical MUA to send a message to Alice"); @@ -60,7 +58,7 @@ async fn check_verified_oneonone_chat_protection_not_broken(by_classical_email: .unwrap(); let contact = alice.add_or_lookup_contact(&bob).await; assert_eq!(contact.is_verified(&alice).await.unwrap(), true); - assert_verified(&alice, &bob, ProtectionStatus::Protected).await; + assert_verified(&alice, &bob).await; } else { tcm.section("Bob sets up another Delta Chat device"); let bob2 = tcm.unconfigured().await; @@ -72,7 +70,7 @@ async fn check_verified_oneonone_chat_protection_not_broken(by_classical_email: .await; let contact = alice.add_or_lookup_contact(&bob2).await; assert_eq!(contact.is_verified(&alice).await.unwrap(), false); - assert_verified(&alice, &bob, ProtectionStatus::Protected).await; + assert_verified(&alice, &bob).await; } tcm.section("Bob sends another message from DC"); @@ -80,7 +78,7 @@ async fn check_verified_oneonone_chat_protection_not_broken(by_classical_email: tcm.send_recv(&bob, &alice, "Using DC again").await; // Bob's chat is marked as verified again - assert_verified(&alice, &bob, ProtectionStatus::Protected).await; + assert_verified(&alice, &bob).await; } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] @@ -93,21 +91,17 @@ async fn test_create_verified_oneonone_chat() -> Result<()> { tcm.execute_securejoin(&alice, &bob).await; tcm.execute_securejoin(&bob, &fiona).await; - assert_verified(&alice, &bob, ProtectionStatus::Protected).await; - assert_verified(&bob, &alice, ProtectionStatus::Protected).await; - assert_verified(&bob, &fiona, ProtectionStatus::Protected).await; - assert_verified(&fiona, &bob, ProtectionStatus::Protected).await; + assert_verified(&alice, &bob).await; + assert_verified(&bob, &alice).await; + assert_verified(&bob, &fiona).await; + assert_verified(&fiona, &bob).await; let group_id = bob - .create_group_with_members( - ProtectionStatus::Protected, - "Group with everyone", - &[&alice, &fiona], - ) + .create_group_with_members("Group with everyone", &[&alice, &fiona]) .await; assert_eq!( get_chat_msg(&bob, group_id, 0, 1).await.get_info_type(), - SystemMessage::ChatProtectionEnabled + SystemMessage::ChatE2ee ); { @@ -119,7 +113,7 @@ async fn test_create_verified_oneonone_chat() -> Result<()> { get_chat_msg(&fiona, msg.chat_id, 0, 2) .await .get_info_type(), - SystemMessage::ChatProtectionEnabled + SystemMessage::ChatE2ee ); } @@ -127,26 +121,6 @@ async fn test_create_verified_oneonone_chat() -> Result<()> { let alice_fiona_contact = alice.add_or_lookup_contact(&fiona).await; assert!(alice_fiona_contact.is_verified(&alice).await.unwrap(),); - // Alice should have a hidden protected chat with Fiona - { - let chat = alice.get_chat(&fiona).await; - assert!(chat.is_protected()); - - let msg = get_chat_msg(&alice, chat.id, 0, 1).await; - let expected_text = stock_str::messages_e2e_encrypted(&alice).await; - assert_eq!(msg.text, expected_text); - } - - // Fiona should have a hidden protected chat with Alice - { - let chat = fiona.get_chat(&alice).await; - assert!(chat.is_protected()); - - let msg0 = get_chat_msg(&fiona, chat.id, 0, 1).await; - let expected_text = stock_str::messages_e2e_encrypted(&fiona).await; - assert_eq!(msg0.text, expected_text); - } - tcm.section("Fiona reinstalls DC"); drop(fiona); @@ -158,19 +132,12 @@ async fn test_create_verified_oneonone_chat() -> Result<()> { tcm.send_recv(&fiona_new, &alice, "I have a new device") .await; - // Alice gets a new unprotected chat with new Fiona contact. + // Alice gets a new chat with new Fiona contact. { let chat = alice.get_chat(&fiona_new).await; - assert!(!chat.is_protected()); let msg = get_chat_msg(&alice, chat.id, 1, E2EE_INFO_MSGS + 1).await; assert_eq!(msg.text, "I have a new device"); - - // After recreating the chat, it should still be unprotected - chat.id.delete(&alice).await?; - - let chat = alice.create_chat(&fiona_new).await; - assert!(!chat.is_protected()); } Ok(()) @@ -184,7 +151,7 @@ async fn test_missing_key_reexecute_securejoin() -> Result<()> { enable_verified_oneonone_chats(&[alice, bob]).await; let chat_id = tcm.execute_securejoin(bob, alice).await; let chat = Chat::load_from_db(bob, chat_id).await?; - assert!(chat.is_protected()); + assert!(chat.can_send(bob).await?); bob.sql .execute( "DELETE FROM public_keys WHERE fingerprint=?", @@ -195,44 +162,12 @@ async fn test_missing_key_reexecute_securejoin() -> Result<()> { .hex(),), ) .await?; - let chat_id = tcm.execute_securejoin(bob, alice).await; let chat = Chat::load_from_db(bob, chat_id).await?; - assert!(chat.is_protected()); - Ok(()) -} - -#[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn test_create_unverified_oneonone_chat() -> Result<()> { - let mut tcm = TestContextManager::new(); - let alice = tcm.alice().await; - let bob = tcm.bob().await; - enable_verified_oneonone_chats(&[&alice, &bob]).await; - - // A chat with an unknown contact should be created unprotected - let chat = alice.create_chat(&bob).await; - assert!(!chat.is_protected()); + assert!(!chat.can_send(bob).await?); - receive_imf( - &alice, - b"From: Bob \n\ - To: alice@example.org\n\ - Message-ID: <1234-2@example.org>\n\ - \n\ - hello\n", - false, - ) - .await?; - - chat.id.delete(&alice).await.unwrap(); - // Now Bob is a known contact, new chats should still be created unprotected - let chat = alice.create_chat(&bob).await; - assert!(!chat.is_protected()); - - tcm.send_recv(&bob, &alice, "hi").await; - chat.id.delete(&alice).await.unwrap(); - // Now we have a public key, new chats should still be created unprotected - let chat = alice.create_chat(&bob).await; - assert!(!chat.is_protected()); + let chat_id = tcm.execute_securejoin(bob, alice).await; + let chat = Chat::load_from_db(bob, chat_id).await?; + assert!(chat.can_send(bob).await?); Ok(()) } @@ -251,7 +186,6 @@ async fn test_degrade_verified_oneonone_chat() -> Result<()> { mark_as_verified(&alice, &bob).await; let alice_chat = alice.create_chat(&bob).await; - assert!(alice_chat.is_protected()); receive_imf( &alice, @@ -267,7 +201,7 @@ async fn test_degrade_verified_oneonone_chat() -> Result<()> { let msg0 = get_chat_msg(&alice, alice_chat.id, 0, 1).await; let enabled = stock_str::messages_e2e_encrypted(&alice).await; assert_eq!(msg0.text, enabled); - assert_eq!(msg0.param.get_cmd(), SystemMessage::ChatProtectionEnabled); + assert_eq!(msg0.param.get_cmd(), SystemMessage::ChatE2ee); let email_chat = alice.get_email_chat(&bob).await; assert!(!email_chat.is_encrypted(&alice).await?); @@ -376,7 +310,7 @@ async fn test_mdn_doesnt_disable_verification() -> Result<()> { let body = rendered_msg.message; receive_imf(&alice, body.as_bytes(), false).await.unwrap(); - assert_verified(&alice, &bob, ProtectionStatus::Protected).await; + assert_verified(&alice, &bob).await; Ok(()) } @@ -392,7 +326,7 @@ async fn test_outgoing_mua_msg() -> Result<()> { mark_as_verified(&bob, &alice).await; tcm.send_recv_accept(&bob, &alice, "Heyho from DC").await; - assert_verified(&alice, &bob, ProtectionStatus::Protected).await; + assert_verified(&alice, &bob).await; let sent = receive_imf( &alice, @@ -509,7 +443,7 @@ async fn test_message_from_old_dc_setup() -> Result<()> { mark_as_verified(bob, alice).await; tcm.send_recv(bob, alice, "Now i have it!").await; - assert_verified(alice, bob, ProtectionStatus::Protected).await; + assert_verified(alice, bob).await; let msg = alice.recv_msg(&sent_old).await; assert!(msg.get_showpadlock()); @@ -518,8 +452,6 @@ async fn test_message_from_old_dc_setup() -> Result<()> { // The outdated Bob's Autocrypt header isn't applied // and the message goes to another chat, so the verification preserves. assert!(contact.is_verified(alice).await.unwrap()); - let chat = alice.get_chat(bob).await; - assert!(chat.is_protected()); Ok(()) } @@ -541,7 +473,7 @@ async fn test_verify_then_verify_again() -> Result<()> { mark_as_verified(&bob, &alice).await; alice.create_chat(&bob).await; - assert_verified(&alice, &bob, ProtectionStatus::Protected).await; + assert_verified(&alice, &bob).await; tcm.section("Bob reinstalls DC"); drop(bob); @@ -551,42 +483,39 @@ async fn test_verify_then_verify_again() -> Result<()> { e2ee::ensure_secret_key_exists(&bob_new).await?; tcm.execute_securejoin(&bob_new, &alice).await; - assert_verified(&alice, &bob_new, ProtectionStatus::Protected).await; + assert_verified(&alice, &bob_new).await; Ok(()) } -/// Tests that on the second device of a protected group creator the first message is -/// `SystemMessage::ChatProtectionEnabled` and the second one is the message populating the group. +/// Tests that on the second device of a group creator the first message is +/// `SystemMessage::ChatE2ee` and the second one is the message populating the group. #[tokio::test(flavor = "multi_thread", worker_threads = 2)] -async fn test_create_protected_grp_multidev() -> Result<()> { +async fn test_create_grp_multidev() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = &tcm.alice().await; let alice1 = &tcm.alice().await; - let group_id = alice - .create_group_with_members(ProtectionStatus::Protected, "Group", &[]) - .await; + let group_id = alice.create_group_with_members("Group", &[]).await; assert_eq!( get_chat_msg(alice, group_id, 0, 1).await.get_info_type(), - SystemMessage::ChatProtectionEnabled + SystemMessage::ChatE2ee ); let sent = alice.send_text(group_id, "Hey").await; // This time shift is necessary to reproduce the bug when the original message is sorted over - // the "protection enabled" message so that these messages have different timestamps. + // the "Messages are end-to-end encrypted" message so that these messages have different timestamps. SystemTime::shift(std::time::Duration::from_secs(3600)); let msg = alice1.recv_msg(&sent).await; let group1 = Chat::load_from_db(alice1, msg.chat_id).await?; assert_eq!(group1.get_type(), Chattype::Group); - assert!(group1.is_protected()); assert_eq!( chat::get_chat_contacts(alice1, group1.id).await?, vec![ContactId::SELF] ); assert_eq!( get_chat_msg(alice1, group1.id, 0, 2).await.get_info_type(), - SystemMessage::ChatProtectionEnabled + SystemMessage::ChatE2ee ); assert_eq!(get_chat_msg(alice1, group1.id, 1, 2).await.id, msg.id); @@ -607,10 +536,8 @@ async fn test_verified_member_added_reordering() -> Result<()> { tcm.execute_securejoin(bob, alice).await; tcm.execute_securejoin(fiona, alice).await; - // Alice creates protected group with Bob. - let alice_chat_id = alice - .create_group_with_members(ProtectionStatus::Protected, "Group", &[bob]) - .await; + // Alice creates a group with Bob. + let alice_chat_id = alice.create_group_with_members("Group", &[bob]).await; let alice_sent_group_promotion = alice.send_text(alice_chat_id, "I created a group").await; let msg = bob.recv_msg(&alice_sent_group_promotion).await; let bob_chat_id = msg.chat_id; @@ -629,15 +556,13 @@ async fn test_verified_member_added_reordering() -> Result<()> { // "Member added" message, so unverified group is created. let fiona_received_message = fiona.recv_msg(&bob_sent_message).await; let fiona_chat = Chat::load_from_db(fiona, fiona_received_message.chat_id).await?; + assert!(!fiona_chat.can_send(fiona).await?); assert_eq!(fiona_received_message.get_text(), "Hi"); - assert_eq!(fiona_chat.is_protected(), false); // Fiona receives late "Member added" message // and the chat becomes protected. fiona.recv_msg(&alice_sent_member_added).await; - let fiona_chat = Chat::load_from_db(fiona, fiona_received_message.chat_id).await?; - assert_eq!(fiona_chat.is_protected(), true); Ok(()) } @@ -681,9 +606,7 @@ async fn test_verified_lost_member_added() -> Result<()> { tcm.execute_securejoin(bob, alice).await; tcm.execute_securejoin(fiona, alice).await; - let alice_chat_id = alice - .create_group_with_members(ProtectionStatus::Protected, "Group", &[bob]) - .await; + let alice_chat_id = alice.create_group_with_members("Group", &[bob]).await; let alice_sent = alice.send_text(alice_chat_id, "Hi!").await; let bob_chat_id = bob.recv_msg(&alice_sent).await.chat_id; assert_eq!(chat::get_chat_contacts(bob, bob_chat_id).await?.len(), 2); @@ -744,9 +667,7 @@ async fn test_verified_chat_editor_reordering() -> Result<()> { tcm.execute_securejoin(alice, bob).await; tcm.section("Alice creates a protected group with Bob"); - let alice_chat_id = alice - .create_group_with_members(ProtectionStatus::Protected, "Group", &[bob]) - .await; + let alice_chat_id = alice.create_group_with_members("Group", &[bob]).await; let alice_sent = alice.send_text(alice_chat_id, "Hi!").await; let bob_chat_id = bob.recv_msg(&alice_sent).await.chat_id; @@ -822,7 +743,7 @@ async fn test_no_reverification() -> Result<()> { tcm.section("Alice creates a protected group with Bob, Charlie and Fiona"); let alice_chat_id = alice - .create_group_with_members(ProtectionStatus::Protected, "Group", &[bob, charlie, fiona]) + .create_group_with_members("Group", &[bob, charlie, fiona]) .await; let alice_sent = alice.send_text(alice_chat_id, "Hi!").await; let bob_rcvd_msg = bob.recv_msg(&alice_sent).await; @@ -870,18 +791,49 @@ async fn test_no_reverification() -> Result<()> { Ok(()) } -// ============== Helper Functions ============== +/// Tests that if our second device observes +/// us gossiping a verification, +/// it is not treated as direct verification. +/// +/// Direct verifications should only happen +/// as a result of SecureJoin. +/// If we see our second device gossiping +/// a verification of some contact, +/// it may be indirect verification, +/// so we should mark the contact as verified, +/// but with unknown verifier. +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn test_no_direct_verification_via_bcc() -> Result<()> { + let mut tcm = TestContextManager::new(); + let alice = &tcm.alice().await; + let alice2 = &tcm.alice().await; + let bob = &tcm.bob().await; -async fn assert_verified(this: &TestContext, other: &TestContext, protected: ProtectionStatus) { - let contact = this.add_or_lookup_contact(other).await; - assert_eq!(contact.is_verified(this).await.unwrap(), true); + mark_as_verified(alice, bob).await; + + let alice_chat_id = alice.create_chat_id(bob).await; + let alice_sent_msg = alice.send_text(alice_chat_id, "Hello!").await; + alice2.recv_msg(&alice_sent_msg).await; - let chat = this.get_chat(other).await; + // Alice 2 observes Alice 1 gossiping verification for Bob. + // Alice 2 does not know if Alice 1 has verified Bob directly though. + let alice2_bob_contact = alice2.add_or_lookup_contact(bob).await; + assert_eq!(alice2_bob_contact.is_verified(alice2).await?, true); + + // There is some verifier, but it is unknown to Alice's second device. assert_eq!( - chat.is_protected(), - protected == ProtectionStatus::Protected + alice2_bob_contact.get_verifier_id(alice2).await?, + Some(None) ); - assert_eq!(chat.is_protection_broken(), false); + + Ok(()) +} + +// ============== Helper Functions ============== + +async fn assert_verified(this: &TestContext, other: &TestContext) { + let contact = this.add_or_lookup_contact(other).await; + assert_eq!(contact.is_verified(this).await.unwrap(), true); } async fn enable_verified_oneonone_chats(test_contexts: &[&TestContext]) { diff --git a/src/webxdc/maps_integration.rs b/src/webxdc/maps_integration.rs index 7f398e6e06..6fa9a85401 100644 --- a/src/webxdc/maps_integration.rs +++ b/src/webxdc/maps_integration.rs @@ -169,7 +169,7 @@ pub(crate) async fn intercept_get_updates( #[cfg(test)] mod tests { - use crate::chat::{ChatId, ProtectionStatus, create_group_chat}; + use crate::chat::{ChatId, create_group_chat}; use crate::chatlist::Chatlist; use crate::contact::Contact; use crate::message::Message; @@ -231,7 +231,7 @@ mod tests { assert_eq!(msg.chat_id, bob_chat_id); // Integrate Webxdc into another group - let group_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let group_id = create_group_chat(&t, "foo").await?; let integration_id = t.init_webxdc_integration(Some(group_id)).await?.unwrap(); let locations = location::get_range(&t, Some(group_id), None, 0, 0).await?; diff --git a/src/webxdc/webxdc_tests.rs b/src/webxdc/webxdc_tests.rs index 35039459ed..354675ee07 100644 --- a/src/webxdc/webxdc_tests.rs +++ b/src/webxdc/webxdc_tests.rs @@ -5,8 +5,8 @@ use serde_json::json; use super::*; use crate::chat::{ - ChatId, ProtectionStatus, add_contact_to_chat, create_broadcast, create_group_chat, - forward_msgs, remove_contact_from_chat, resend_msgs, send_msg, send_text_msg, + ChatId, add_contact_to_chat, create_broadcast, create_group_chat, forward_msgs, + remove_contact_from_chat, resend_msgs, send_msg, send_text_msg, }; use crate::chatlist::Chatlist; use crate::config::Config; @@ -78,7 +78,7 @@ async fn send_webxdc_instance(t: &TestContext, chat_id: ChatId) -> Result Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; // send as .xdc file let instance = send_webxdc_instance(&t, chat_id).await?; @@ -97,7 +97,7 @@ async fn test_send_webxdc_instance() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_send_invalid_webxdc() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; // sending invalid .xdc as file is possible, but must not result in Viewtype::Webxdc let mut instance = create_webxdc_instance( @@ -126,7 +126,7 @@ async fn test_send_invalid_webxdc() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_set_draft_invalid_webxdc() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let mut instance = create_webxdc_instance( &t, @@ -143,7 +143,7 @@ async fn test_set_draft_invalid_webxdc() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_send_special_webxdc_format() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; // chess.xdc is failing for some zip-versions, see #3476, if we know more details about why, we can have a nicer name for the test :) let mut instance = create_webxdc_instance( @@ -164,7 +164,7 @@ async fn test_send_special_webxdc_format() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_forward_webxdc_instance() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let instance = send_webxdc_instance(&t, chat_id).await?; t.send_webxdc_status_update( instance.id, @@ -177,7 +177,7 @@ async fn test_forward_webxdc_instance() -> Result<()> { .await?, r#"[{"payload":42,"info":"foo","document":"doc","summary":"bar","serial":1,"max_serial":1}]"# ); - assert_eq!(chat_id.get_msg_cnt(&t).await?, 2); // instance and info + assert_eq!(chat_id.get_msg_cnt(&t).await?, 3); // "Messages are end-to-end encrypted", instance and info let info = Message::load_from_db(&t, instance.id) .await? .get_webxdc_info(&t) @@ -194,7 +194,7 @@ async fn test_forward_webxdc_instance() -> Result<()> { .await?, "[]" ); - assert_eq!(chat_id.get_msg_cnt(&t).await?, 3); // two instances, only one info + assert_eq!(chat_id.get_msg_cnt(&t).await?, 4); // "Messages are end-to-end encrypted", two instances, only one info let info = Message::load_from_db(&t, instance2.id) .await? .get_webxdc_info(&t) @@ -213,16 +213,16 @@ async fn test_resend_webxdc_instance_and_info() -> Result<()> { // Alice uses webxdc in a group alice.set_config_bool(Config::BccSelf, false).await?; - let alice_grp = create_group_chat(&alice, ProtectionStatus::Unprotected, "grp").await?; + let alice_grp = create_group_chat(&alice, "grp").await?; let alice_instance = send_webxdc_instance(&alice, alice_grp).await?; - assert_eq!(alice_grp.get_msg_cnt(&alice).await?, 1); + assert_eq!(alice_grp.get_msg_cnt(&alice).await?, 2); alice .send_webxdc_status_update( alice_instance.id, r#"{"payload":7,"info": "i","summary":"s"}"#, ) .await?; - assert_eq!(alice_grp.get_msg_cnt(&alice).await?, 2); + assert_eq!(alice_grp.get_msg_cnt(&alice).await?, 3); assert!(alice.get_last_msg_in(alice_grp).await.is_info()); // Alice adds Bob and resends already used webxdc @@ -232,7 +232,7 @@ async fn test_resend_webxdc_instance_and_info() -> Result<()> { alice.add_or_lookup_contact_id(&bob).await, ) .await?; - assert_eq!(alice_grp.get_msg_cnt(&alice).await?, 3); + assert_eq!(alice_grp.get_msg_cnt(&alice).await?, 4); resend_msgs(&alice, &[alice_instance.id]).await?; let sent1 = alice.pop_sent_msg().await; alice.flush_status_updates().await?; @@ -395,7 +395,7 @@ async fn test_webxdc_update_for_not_downloaded_instance() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_delete_webxdc_instance() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let instance = send_webxdc_instance(&t, chat_id).await?; let now = tools::time(); t.receive_status_update( @@ -428,7 +428,7 @@ async fn test_delete_webxdc_instance() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_delete_chat_with_webxdc() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let instance = send_webxdc_instance(&t, chat_id).await?; let now = tools::time(); t.receive_status_update( @@ -461,7 +461,7 @@ async fn test_delete_chat_with_webxdc() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_delete_webxdc_draft() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let mut instance = create_webxdc_instance( &t, @@ -498,7 +498,7 @@ async fn test_delete_webxdc_draft() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_create_status_update_record() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let instance = send_webxdc_instance(&t, chat_id).await?; assert_eq!( @@ -633,7 +633,7 @@ async fn test_create_status_update_record() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_receive_status_update() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let instance = send_webxdc_instance(&t, chat_id).await?; let now = tools::time(); @@ -904,7 +904,7 @@ async fn test_send_big_webxdc_status_update() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_render_webxdc_status_update_object() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "a chat").await?; + let chat_id = create_group_chat(&t, "a chat").await?; let mut instance = create_webxdc_instance( &t, "minimal.xdc", @@ -932,7 +932,7 @@ async fn test_render_webxdc_status_update_object() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_render_webxdc_status_update_object_range() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "a chat").await?; + let chat_id = create_group_chat(&t, "a chat").await?; let instance = send_webxdc_instance(&t, chat_id).await?; t.send_webxdc_status_update(instance.id, r#"{"payload": 1}"#) .await?; @@ -979,7 +979,7 @@ async fn test_render_webxdc_status_update_object_range() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_pop_status_update() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "a chat").await?; + let chat_id = create_group_chat(&t, "a chat").await?; let instance1 = send_webxdc_instance(&t, chat_id).await?; let instance2 = send_webxdc_instance(&t, chat_id).await?; let instance3 = send_webxdc_instance(&t, chat_id).await?; @@ -1109,7 +1109,7 @@ async fn test_draft_and_send_webxdc_status_update() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_send_webxdc_status_update_to_non_webxdc() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let msg_id = send_text_msg(&t, chat_id, "ho!".to_string()).await?; assert!( t.send_webxdc_status_update(msg_id, r#"{"foo":"bar"}"#) @@ -1122,7 +1122,7 @@ async fn test_send_webxdc_status_update_to_non_webxdc() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_get_webxdc_blob() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let instance = send_webxdc_instance(&t, chat_id).await?; let buf = instance.get_webxdc_blob(&t, "index.html").await?; @@ -1141,7 +1141,7 @@ async fn test_get_webxdc_blob() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_get_webxdc_blob_default_icon() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let instance = send_webxdc_instance(&t, chat_id).await?; let buf = instance.get_webxdc_blob(&t, WEBXDC_DEFAULT_ICON).await?; @@ -1153,7 +1153,7 @@ async fn test_get_webxdc_blob_default_icon() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_get_webxdc_blob_with_absolute_paths() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let instance = send_webxdc_instance(&t, chat_id).await?; let buf = instance.get_webxdc_blob(&t, "/index.html").await?; @@ -1166,7 +1166,7 @@ async fn test_get_webxdc_blob_with_absolute_paths() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_get_webxdc_blob_with_subdirs() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let mut instance = create_webxdc_instance( &t, "some-files.xdc", @@ -1265,7 +1265,7 @@ async fn test_parse_webxdc_manifest_source_code_url() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_webxdc_min_api_too_large() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "chat").await?; + let chat_id = create_group_chat(&t, "chat").await?; let mut instance = create_webxdc_instance( &t, "with-min-api-1001.xdc", @@ -1283,7 +1283,7 @@ async fn test_webxdc_min_api_too_large() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_get_webxdc_info() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let instance = send_webxdc_instance(&t, chat_id).await?; let info = instance.get_webxdc_info(&t).await?; @@ -1363,7 +1363,7 @@ async fn test_get_webxdc_info() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_get_webxdc_self_addr() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&t, "foo").await?; let instance = send_webxdc_instance(&t, chat_id).await?; let info1 = instance.get_webxdc_info(&t).await?; @@ -1601,17 +1601,17 @@ async fn test_webxdc_info_msg_cleanup_series() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_webxdc_info_msg_no_cleanup_on_interrupted_series() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "c").await?; + let chat_id = create_group_chat(&t, "c").await?; let instance = send_webxdc_instance(&t, chat_id).await?; t.send_webxdc_status_update(instance.id, r#"{"info":"i1", "payload":1}"#) .await?; - assert_eq!(chat_id.get_msg_cnt(&t).await?, 2); + assert_eq!(chat_id.get_msg_cnt(&t).await?, E2EE_INFO_MSGS + 2); send_text_msg(&t, chat_id, "msg between info".to_string()).await?; - assert_eq!(chat_id.get_msg_cnt(&t).await?, 3); + assert_eq!(chat_id.get_msg_cnt(&t).await?, E2EE_INFO_MSGS + 3); t.send_webxdc_status_update(instance.id, r#"{"info":"i2", "payload":2}"#) .await?; - assert_eq!(chat_id.get_msg_cnt(&t).await?, 4); + assert_eq!(chat_id.get_msg_cnt(&t).await?, E2EE_INFO_MSGS + 4); Ok(()) } @@ -1623,7 +1623,7 @@ async fn test_webxdc_no_internet_access() -> Result<()> { let t = TestContext::new_alice().await; let self_id = t.get_self_chat().await.id; let single_id = t.create_chat_with_contact("bob", "bob@e.com").await.id; - let group_id = create_group_chat(&t, ProtectionStatus::Unprotected, "chat").await?; + let group_id = create_group_chat(&t, "chat").await?; let broadcast_id = create_broadcast(&t, "Channel".to_string()).await?; for chat_id in [self_id, single_id, group_id, broadcast_id] { @@ -1655,7 +1655,7 @@ async fn test_webxdc_no_internet_access() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_webxdc_chatlist_summary() -> Result<()> { let t = TestContext::new_alice().await; - let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "chat").await?; + let chat_id = create_group_chat(&t, "chat").await?; let mut instance = create_webxdc_instance( &t, "with-minimal-manifest.xdc", @@ -1727,7 +1727,7 @@ async fn test_webxdc_reject_updates_from_non_groupmembers() -> Result<()> { let alice = &tcm.alice().await; let bob = &tcm.bob().await; let contact_bob = alice.add_or_lookup_contact_id(bob).await; - let chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?; + let chat_id = create_group_chat(alice, "Group").await?; add_contact_to_chat(alice, chat_id, contact_bob).await?; let instance = send_webxdc_instance(alice, chat_id).await?; bob.recv_msg(&alice.pop_sent_msg().await).await; @@ -1758,7 +1758,7 @@ async fn test_webxdc_reject_updates_from_non_groupmembers() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_webxdc_delete_event() -> Result<()> { let alice = TestContext::new_alice().await; - let chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "foo").await?; + let chat_id = create_group_chat(&alice, "foo").await?; let instance = send_webxdc_instance(&alice, chat_id).await?; message::delete_msgs(&alice, &[instance.id]).await?; alice @@ -1912,7 +1912,7 @@ async fn test_webxdc_notify_one() -> Result<()> { let fiona = tcm.fiona().await; let grp_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "grp", &[&bob, &fiona]) + .create_group_with_members("grp", &[&bob, &fiona]) .await; let alice_instance = send_webxdc_instance(&alice, grp_id).await?; let sent1 = alice.pop_sent_msg().await; @@ -1958,7 +1958,7 @@ async fn test_webxdc_notify_multiple() -> Result<()> { let fiona = tcm.fiona().await; let grp_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "grp", &[&bob, &fiona]) + .create_group_with_members("grp", &[&bob, &fiona]) .await; let alice_instance = send_webxdc_instance(&alice, grp_id).await?; let sent1 = alice.pop_sent_msg().await; @@ -2001,9 +2001,7 @@ async fn test_webxdc_no_notify_self() -> Result<()> { let alice = tcm.alice().await; let alice2 = tcm.alice().await; - let grp_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "grp", &[]) - .await; + let grp_id = alice.create_group_with_members("grp", &[]).await; let alice_instance = send_webxdc_instance(&alice, grp_id).await?; let sent1 = alice.pop_sent_msg().await; let alice2_instance = alice2.recv_msg(&sent1).await; @@ -2043,7 +2041,7 @@ async fn test_webxdc_notify_all() -> Result<()> { let fiona = tcm.fiona().await; let grp_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "grp", &[&bob, &fiona]) + .create_group_with_members("grp", &[&bob, &fiona]) .await; let alice_instance = send_webxdc_instance(&alice, grp_id).await?; let sent1 = alice.pop_sent_msg().await; @@ -2083,7 +2081,7 @@ async fn test_webxdc_notify_bob_and_all() -> Result<()> { let fiona = tcm.fiona().await; let grp_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "grp", &[&bob, &fiona]) + .create_group_with_members("grp", &[&bob, &fiona]) .await; let alice_instance = send_webxdc_instance(&alice, grp_id).await?; let sent1 = alice.pop_sent_msg().await; @@ -2117,7 +2115,7 @@ async fn test_webxdc_notify_all_and_bob() -> Result<()> { let fiona = tcm.fiona().await; let grp_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "grp", &[&bob, &fiona]) + .create_group_with_members("grp", &[&bob, &fiona]) .await; let alice_instance = send_webxdc_instance(&alice, grp_id).await?; let sent1 = alice.pop_sent_msg().await; @@ -2149,9 +2147,7 @@ async fn test_webxdc_href() -> Result<()> { let alice = tcm.alice().await; let bob = tcm.bob().await; - let grp_id = alice - .create_group_with_members(ProtectionStatus::Unprotected, "grp", &[&bob]) - .await; + let grp_id = alice.create_group_with_members("grp", &[&bob]).await; let instance = send_webxdc_instance(&alice, grp_id).await?; let sent1 = alice.pop_sent_msg().await; @@ -2181,9 +2177,7 @@ async fn test_webxdc_href() -> Result<()> { async fn test_self_addr_consistency() -> Result<()> { let mut tcm = TestContextManager::new(); let alice = &tcm.alice().await; - let alice_chat = alice - .create_group_with_members(ProtectionStatus::Unprotected, "No friends :(", &[]) - .await; + let alice_chat = alice.create_group_with_members("No friends :(", &[]).await; let mut instance = create_webxdc_instance( alice, "minimal.xdc", @@ -2195,6 +2189,5 @@ async fn test_self_addr_consistency() -> Result<()> { let sent = alice.send_msg(alice_chat, &mut instance).await; let db_msg = Message::load_from_db(alice, sent.sender_msg_id).await?; assert_eq!(db_msg.get_webxdc_self_addr(alice).await?, self_addr); - assert_eq!(alice_chat.get_msg_cnt(alice).await?, 1); Ok(()) } diff --git a/test-data/golden/chat_test_parallel_member_remove b/test-data/golden/chat_test_parallel_member_remove index b2442e855a..421d750bfd 100644 --- a/test-data/golden/chat_test_parallel_member_remove +++ b/test-data/golden/chat_test_parallel_member_remove @@ -1,4 +1,4 @@ -Group#Chat#10: Group chat [3 member(s)] +Group#Chat#10: Group chat [3 member(s)] -------------------------------------------------------------------------------- Msg#10: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO] Msg#11πŸ”’: (Contact#Contact#10): Hi! I created a group. [FRESH] diff --git a/test-data/golden/receive_imf_delayed_removal_is_ignored b/test-data/golden/receive_imf_delayed_removal_is_ignored index 43c918f7f2..1e8363ba70 100644 --- a/test-data/golden/receive_imf_delayed_removal_is_ignored +++ b/test-data/golden/receive_imf_delayed_removal_is_ignored @@ -1,9 +1,10 @@ -Group#Chat#10: Group [5 member(s)] +Group#Chat#10: Group [5 member(s)] -------------------------------------------------------------------------------- -Msg#10πŸ”’: Me (Contact#Contact#Self): populate √ -Msg#11: info (Contact#Contact#Info): Member dom@example.net added. [NOTICED][INFO] -Msg#12: info (Contact#Contact#Info): Member fiona@example.net removed. [NOTICED][INFO] -Msg#13πŸ”’: (Contact#Contact#10): Member elena@example.net added by bob@example.net. [FRESH][INFO] -Msg#14πŸ”’: Me (Contact#Contact#Self): You added member fiona@example.net. [INFO] o -Msg#15πŸ”’: (Contact#Contact#10): Member fiona@example.net removed by bob@example.net. [FRESH][INFO] +Msg#10: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO] +Msg#11πŸ”’: Me (Contact#Contact#Self): populate √ +Msg#12: info (Contact#Contact#Info): Member dom@example.net added. [NOTICED][INFO] +Msg#13: info (Contact#Contact#Info): Member fiona@example.net removed. [NOTICED][INFO] +Msg#14πŸ”’: (Contact#Contact#10): Member elena@example.net added by bob@example.net. [FRESH][INFO] +Msg#15πŸ”’: Me (Contact#Contact#Self): You added member fiona@example.net. [INFO] o +Msg#16πŸ”’: (Contact#Contact#10): Member fiona@example.net removed by bob@example.net. [FRESH][INFO] -------------------------------------------------------------------------------- diff --git a/test-data/golden/receive_imf_older_message_from_2nd_device b/test-data/golden/receive_imf_older_message_from_2nd_device index abc38ad339..4d036f98e2 100644 --- a/test-data/golden/receive_imf_older_message_from_2nd_device +++ b/test-data/golden/receive_imf_older_message_from_2nd_device @@ -1,4 +1,4 @@ -Single#Chat#10: bob@example.net [bob@example.net] Icon: 4138c52e5bc1c576cda7dd44d088c07.png +Single#Chat#10: bob@example.net [bob@example.net] Icon: 4138c52e5bc1c576cda7dd44d088c07.png -------------------------------------------------------------------------------- Msg#10: Me (Contact#Contact#Self): We share this account √ Msg#11: Me (Contact#Contact#Self): I'm Alice too √ diff --git a/test-data/golden/test_old_message_5 b/test-data/golden/test_old_message_5 index 624838a43c..9a847dce0d 100644 --- a/test-data/golden/test_old_message_5 +++ b/test-data/golden/test_old_message_5 @@ -1,4 +1,4 @@ -Single#Chat#10: Bob [bob@example.net] Icon: 4138c52e5bc1c576cda7dd44d088c07.png +Single#Chat#10: Bob [bob@example.net] Icon: 4138c52e5bc1c576cda7dd44d088c07.png -------------------------------------------------------------------------------- Msg#10: Me (Contact#Contact#Self): Happy birthday, Bob! √ Msg#11: (Contact#Contact#10): Happy birthday to me, Alice! [FRESH] diff --git a/test-data/golden/test_outgoing_encrypted_msg b/test-data/golden/test_outgoing_encrypted_msg index 06cecece6a..cf76258032 100644 --- a/test-data/golden/test_outgoing_encrypted_msg +++ b/test-data/golden/test_outgoing_encrypted_msg @@ -1,5 +1,5 @@ -Single#Chat#10: bob@example.net [KEY bob@example.net] πŸ›‘οΈ +Single#Chat#10: bob@example.net [KEY bob@example.net] -------------------------------------------------------------------------------- -Msg#10: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO πŸ›‘οΈ] +Msg#10: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO] Msg#11πŸ”’: Me (Contact#Contact#Self): Test – This is encrypted, signed, and has an Autocrypt Header without prefer-encrypt=mutual. √ -------------------------------------------------------------------------------- diff --git a/test-data/golden/test_outgoing_mua_msg b/test-data/golden/test_outgoing_mua_msg index 5d4a0f2ee9..db73265bb3 100644 --- a/test-data/golden/test_outgoing_mua_msg +++ b/test-data/golden/test_outgoing_mua_msg @@ -1,4 +1,4 @@ -Single#Chat#11: bob@example.net [bob@example.net] Icon: 4138c52e5bc1c576cda7dd44d088c07.png +Single#Chat#11: bob@example.net [bob@example.net] Icon: 4138c52e5bc1c576cda7dd44d088c07.png -------------------------------------------------------------------------------- Msg#12: Me (Contact#Contact#Self): One classical MUA message √ -------------------------------------------------------------------------------- diff --git a/test-data/golden/test_outgoing_mua_msg_pgp b/test-data/golden/test_outgoing_mua_msg_pgp index 1a128d5286..b71ee08730 100644 --- a/test-data/golden/test_outgoing_mua_msg_pgp +++ b/test-data/golden/test_outgoing_mua_msg_pgp @@ -1,6 +1,6 @@ -Single#Chat#10: bob@example.net [KEY bob@example.net] πŸ›‘οΈ +Single#Chat#10: bob@example.net [KEY bob@example.net] -------------------------------------------------------------------------------- -Msg#10: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO πŸ›‘οΈ] +Msg#10: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO] Msg#11πŸ”’: (Contact#Contact#10): Heyho from DC [FRESH] Msg#13πŸ”’: Me (Contact#Contact#Self): Sending with DC again √ -------------------------------------------------------------------------------- diff --git a/test-data/golden/two_group_securejoins b/test-data/golden/two_group_securejoins index 3684034fd7..fe3f5efc1c 100644 --- a/test-data/golden/two_group_securejoins +++ b/test-data/golden/two_group_securejoins @@ -1,9 +1,9 @@ -Group#Chat#11: Group [3 member(s)] πŸ›‘οΈ +Group#Chat#11: Group [3 member(s)] -------------------------------------------------------------------------------- -Msg#11: info (Contact#Contact#Info): alice@example.org invited you to join this group. +Msg#13: info (Contact#Contact#Info): alice@example.org invited you to join this group. Waiting for the device of alice@example.org to reply… [NOTICED][INFO] -Msg#13: info (Contact#Contact#Info): alice@example.org replied, waiting for being added to the group… [NOTICED][INFO] -Msg#17: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO πŸ›‘οΈ] -Msg#18πŸ”’: (Contact#Contact#10): Member Me added by alice@example.org. [FRESH][INFO] +Msg#15: info (Contact#Contact#Info): alice@example.org replied, waiting for being added to the group… [NOTICED][INFO] +Msg#12: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO] +Msg#17πŸ”’: (Contact#Contact#10): Member Me added by alice@example.org. [FRESH][INFO] -------------------------------------------------------------------------------- diff --git a/test-data/message/verification-gossip-also-sent-to-from.eml b/test-data/message/verification-gossip-also-sent-to-from.eml index 27ee04a50c..f867fb7bf9 100644 --- a/test-data/message/verification-gossip-also-sent-to-from.eml +++ b/test-data/message/verification-gossip-also-sent-to-from.eml @@ -34,88 +34,112 @@ Content-Transfer-Encoding: 7bit -----BEGIN PGP MESSAGE----- -wU4D5tq63hTeebASAQdATHbs7R5uRADpjsyAvrozHqQ/9nSrspwbLN6XJKuR3xcg -eksHRdiKf6qnSIrSA5M5f8+jr1zmi6sUZQP/IziqRWnBwEwD49jcm8SO4yIBB/9K -EASmrVqvRHc8VZhDR3VUYM8VFtbi+gbcu+/av7fII43AgN3qoluv6Wqj6jrf3zF2 -psDjegkrDp3GNMYOGR/qDTsouoEM46tqLHhrYB870c/JbVfk/6HbSb4nmrjur3DT -63hWoqmh2SCdUAdGBuQMFE+3edrNX3AD3a8wsSVRuK8dpSacY8TgrAwmtaB+Epgv -DZQocmOZqJZ6TgOrEeZ2xpn17Yiu3w+WMerfbIFqyD22W8EnxFRp9AAca7pY4KIx -WVA1J311E3hmStN8kFKa5hM94Ihgo77YF/45KsLMjKblufvYbC05KExpyHFmrW09 -tn5KBedjkoUcD0eA8k6SwcBMA1Kpnh2oYq7LAQf/STVBew4ly3d9mFWw9JiBAMbb -hFi6NbnwIR/ZynrhA3pK8EW9vYd/xb85/5cBjc+gc/rtDIKaskI2THPaTnfrk1X+ -EVIYRgua6v9JvPq+599j0rL1neHNPCgVw/zVF5BhI+nx5FfiRBez3GRoJV7sOpjH -ftf+zwBT1cZ2z0WkUDHKXUATIqi9nH0ATCYAd7VzIPmlL4GLH5jh2OW9zWlE2sCn -RvfRjL/izhAUmFW1Ks+HMTG15Qcok4rpdYRwFCfX3S5EaxLEgnruTKeDjDMEew0t -Kzm8FsyW8nL62Jz/OGcCTprCtn8ex4AjgrWnru7PTcXb/4aKh39AGjmytAEYVtLL -7gGGoqxH4N3BZ4KeWLzd86gcXEEATg6Wrj211BlSkdFSvL2XHBpLNDjj/MfGKRfa -3PSRl+P3bNLF6by7HkdXPAIBqGn3qi1YQ3Bu7JQOSDJ/A0ypjS2TARcAL9c5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