Skip to content

Commit 1a8e615

Browse files
committed
Remove last usage of E2eeEnabled
1 parent 875c182 commit 1a8e615

File tree

8 files changed

+21
-115
lines changed

8 files changed

+21
-115
lines changed

python/src/deltachat/testplugin.py

-2
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,6 @@ def get_next_liveconfig(self):
423423
where we can make valid SMTP and IMAP connections with.
424424
"""
425425
configdict = next(self._liveconfig_producer).copy()
426-
if "e2ee_enabled" not in configdict:
427-
configdict["e2ee_enabled"] = "1"
428426

429427
if self.pytestconfig.getoption("--strict-tls"):
430428
# Enable strict certificate checks for online accounts

src/chat/chat_tests.rs

-8
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,6 @@ async fn test_member_add_remove() -> Result<()> {
299299
let alice = tcm.alice().await;
300300
let bob = tcm.bob().await;
301301

302-
// Disable encryption so we can inspect raw message contents.
303-
alice.set_config(Config::E2eeEnabled, Some("0")).await?;
304-
bob.set_config(Config::E2eeEnabled, Some("0")).await?;
305-
306302
// Create contact for Bob on the Alice side with name "robert".
307303
let alice_bob_contact_id = Contact::create(&alice, "robert", "[email protected]").await?;
308304

@@ -373,9 +369,6 @@ async fn test_parallel_member_remove() -> Result<()> {
373369
let alice = tcm.alice().await;
374370
let bob = tcm.bob().await;
375371

376-
alice.set_config(Config::E2eeEnabled, Some("0")).await?;
377-
bob.set_config(Config::E2eeEnabled, Some("0")).await?;
378-
379372
let alice_bob_contact_id = Contact::create(&alice, "Bob", "[email protected]").await?;
380373
let alice_fiona_contact_id = Contact::create(&alice, "Fiona", "[email protected]").await?;
381374
let alice_claire_contact_id = Contact::create(&alice, "Claire", "[email protected]").await?;
@@ -2681,7 +2674,6 @@ async fn test_chat_get_encryption_info() -> Result<()> {
26812674
26822675
);
26832676

2684-
bob.set_config(Config::E2eeEnabled, Some("0")).await?;
26852677
send_text_msg(&bob, direct_chat.id, "Hello!".to_string()).await?;
26862678
alice.recv_msg(&bob.pop_sent_msg().await).await;
26872679

src/config/config_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async fn test_set_config_bool() -> Result<()> {
8686
let t = TestContext::new().await;
8787

8888
// We need some config that defaults to true
89-
let c = Config::E2eeEnabled;
89+
let c = Config::MdnsEnabled;
9090
assert_eq!(t.get_config_bool(c).await?, true);
9191
t.set_config_bool(c, false).await?;
9292
assert_eq!(t.get_config_bool(c).await?, false);

src/configure.rs

-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ async fn configure(ctx: &Context, param: &EnteredLoginParam) -> Result<Configure
442442
ctx.set_config(Config::MvboxMove, Some("0")).await?;
443443
ctx.set_config(Config::OnlyFetchMvbox, None).await?;
444444
ctx.set_config(Config::ShowEmails, None).await?;
445-
ctx.set_config(Config::E2eeEnabled, Some("1")).await?;
446445
}
447446

448447
let create_mvbox = !is_chatmail;

src/context.rs

-2
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,6 @@ impl Context {
796796
.query_get_value("PRAGMA journal_mode;", ())
797797
.await?
798798
.unwrap_or_else(|| "unknown".to_string());
799-
let e2ee_enabled = self.get_config_int(Config::E2eeEnabled).await?;
800799
let mdns_enabled = self.get_config_int(Config::MdnsEnabled).await?;
801800
let bcc_self = self.get_config_int(Config::BccSelf).await?;
802801
let sync_msgs = self.get_config_int(Config::SyncMsgs).await?;
@@ -937,7 +936,6 @@ impl Context {
937936
res.insert("configured_mvbox_folder", configured_mvbox_folder);
938937
res.insert("configured_trash_folder", configured_trash_folder);
939938
res.insert("mdns_enabled", mdns_enabled.to_string());
940-
res.insert("e2ee_enabled", e2ee_enabled.to_string());
941939
res.insert("bcc_self", bcc_self.to_string());
942940
res.insert("sync_msgs", sync_msgs.to_string());
943941
res.insert("disable_idle", disable_idle.to_string());

src/e2ee.rs

-55
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ Sent with my Delta Chat Messenger: https://delta.chat";
312312
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
313313
async fn test_should_encrypt() -> Result<()> {
314314
let t = TestContext::new_alice().await;
315-
assert!(t.get_config_bool(Config::E2eeEnabled).await?);
316315
let encrypt_helper = EncryptHelper::new(&t).await.unwrap();
317316

318317
let ps = new_peerstates(EncryptPreference::NoPreference);
@@ -335,60 +334,6 @@ Sent with my Delta Chat Messenger: https://delta.chat";
335334
Ok(())
336335
}
337336

338-
// Tests that when encryption is not preferred, we encrypt anyway when we can.
339-
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
340-
async fn test_should_encrypt_e2ee_disabled() -> Result<()> {
341-
let t = &TestContext::new_alice().await;
342-
t.set_config_bool(Config::E2eeEnabled, false).await?;
343-
let encrypt_helper = EncryptHelper::new(t).await.unwrap();
344-
345-
let ps = new_peerstates(EncryptPreference::NoPreference);
346-
assert!(encrypt_helper.should_encrypt(t, false, &ps).await?);
347-
348-
let ps = new_peerstates(EncryptPreference::Reset);
349-
assert!(encrypt_helper.should_encrypt(t, true, &ps).await?);
350-
351-
let mut ps = new_peerstates(EncryptPreference::Mutual);
352-
assert!(encrypt_helper.should_encrypt(t, false, &ps).await?);
353-
354-
ps.push(ps[0].clone());
355-
assert!(encrypt_helper.should_encrypt(t, false, &ps).await?);
356-
357-
// Test with missing peerstate.
358-
let ps = vec![(None, "[email protected]".to_string())];
359-
assert!(encrypt_helper.should_encrypt(t, true, &ps).await.is_err());
360-
Ok(())
361-
}
362-
363-
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
364-
async fn test_chatmail_prefers_to_encrypt() -> Result<()> {
365-
let mut tcm = TestContextManager::new();
366-
let alice = &tcm.alice().await;
367-
let bob = &tcm.bob().await;
368-
bob.set_config_bool(Config::IsChatmail, true).await?;
369-
370-
let bob_chat_id = tcm
371-
.send_recv_accept(alice, bob, "Hello from DC")
372-
.await
373-
.chat_id;
374-
receive_imf(
375-
bob,
376-
b"From: [email protected]\n\
377-
378-
Message-ID: <[email protected]>\n\
379-
Date: Sun, 22 Mar 3000 22:37:58 +0000\n\
380-
\n\
381-
Hello from another MUA\n",
382-
false,
383-
)
384-
.await?;
385-
send_text_msg(bob, bob_chat_id, "hi".to_string()).await?;
386-
let sent_msg = bob.pop_sent_msg().await;
387-
let msg = Message::load_from_db(bob, sent_msg.sender_msg_id).await?;
388-
assert!(msg.get_showpadlock());
389-
Ok(())
390-
}
391-
392337
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
393338
async fn test_chatmail_can_send_unencrypted() -> Result<()> {
394339
let mut tcm = TestContextManager::new();

src/imex.rs

-23
Original file line numberDiff line numberDiff line change
@@ -143,29 +143,6 @@ async fn set_self_key(context: &Context, armored: &str) -> Result<()> {
143143
// try hard to only modify key-state
144144
let (private_key, header) = SignedSecretKey::from_asc(armored)?;
145145
let public_key = private_key.split_public_key()?;
146-
if let Some(preferencrypt) = header.get("Autocrypt-Prefer-Encrypt") {
147-
let e2ee_enabled = match preferencrypt.as_str() {
148-
"nopreference" => 0,
149-
"mutual" => 1,
150-
_ => {
151-
bail!("invalid Autocrypt-Prefer-Encrypt header: {:?}", header);
152-
}
153-
};
154-
context
155-
.sql
156-
.set_raw_config_int("e2ee_enabled", e2ee_enabled)
157-
.await?;
158-
} else {
159-
// `Autocrypt-Prefer-Encrypt` is not included
160-
// in keys exported to file.
161-
//
162-
// `Autocrypt-Prefer-Encrypt` also SHOULD be sent
163-
// in Autocrypt Setup Message according to Autocrypt specification,
164-
// but K-9 6.802 does not include this header.
165-
//
166-
// We keep current setting in this case.
167-
info!(context, "No Autocrypt-Prefer-Encrypt header.");
168-
};
169146

170147
let keypair = pgp::KeyPair {
171148
public: public_key,

src/webxdc/webxdc_tests.rs

+20-23
Original file line numberDiff line numberDiff line change
@@ -1648,29 +1648,26 @@ async fn test_webxdc_no_internet_access() -> Result<()> {
16481648
let group_id = create_group_chat(&t, ProtectionStatus::Unprotected, "chat").await?;
16491649
let broadcast_id = create_broadcast_list(&t).await?;
16501650

1651-
for e2ee in ["1", "0"] {
1652-
t.set_config(Config::E2eeEnabled, Some(e2ee)).await?;
1653-
for chat_id in [self_id, single_id, group_id, broadcast_id] {
1654-
for internet_xdc in [true, false] {
1655-
let mut instance = create_webxdc_instance(
1656-
&t,
1657-
"foo.xdc",
1658-
if internet_xdc {
1659-
include_bytes!("../../test-data/webxdc/request-internet-access.xdc")
1660-
} else {
1661-
include_bytes!("../../test-data/webxdc/minimal.xdc")
1662-
},
1663-
)?;
1664-
let instance_id = send_msg(&t, chat_id, &mut instance).await?;
1665-
t.send_webxdc_status_update(
1666-
instance_id,
1667-
r#"{"summary":"real summary", "payload": 42}"#,
1668-
)
1669-
.await?;
1670-
let instance = Message::load_from_db(&t, instance_id).await?;
1671-
let info = instance.get_webxdc_info(&t).await?;
1672-
assert_eq!(info.internet_access, false);
1673-
}
1651+
for chat_id in [self_id, single_id, group_id, broadcast_id] {
1652+
for internet_xdc in [true, false] {
1653+
let mut instance = create_webxdc_instance(
1654+
&t,
1655+
"foo.xdc",
1656+
if internet_xdc {
1657+
include_bytes!("../../test-data/webxdc/request-internet-access.xdc")
1658+
} else {
1659+
include_bytes!("../../test-data/webxdc/minimal.xdc")
1660+
},
1661+
)?;
1662+
let instance_id = send_msg(&t, chat_id, &mut instance).await?;
1663+
t.send_webxdc_status_update(
1664+
instance_id,
1665+
r#"{"summary":"real summary", "payload": 42}"#,
1666+
)
1667+
.await?;
1668+
let instance = Message::load_from_db(&t, instance_id).await?;
1669+
let info = instance.get_webxdc_info(&t).await?;
1670+
assert_eq!(info.internet_access, false);
16741671
}
16751672
}
16761673

0 commit comments

Comments
 (0)