-
-
Notifications
You must be signed in to change notification settings - Fork 100
PGP contacts #6796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
PGP contacts #6796
Conversation
7acd920
to
280e5dd
Compare
7e5dab4
to
479879a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just 3 small things I was wondering while skimming over
ebe2a09
to
cac8d20
Compare
a way to know if a chat is an encrypted chat is missing, currently there is only "isPgpContact" that can be used to mark contacts/1:1 chat but for unencrypted groups/threads of classic email non-pgp contacts there is no API to recognize such chats and also put the "classic email" marker as for classic email contacts |
625f8f4
to
c87c241
Compare
@@ -187,6 +191,7 @@ impl BasicChat { | |||
id: chat_id, | |||
name: chat.name.clone(), | |||
is_protected: chat.is_protected(), | |||
is_encrypted: chat.is_encrypted(context).await?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds up to 2 additional database calls to loading BasicChat
, though I can't think of a good way to avoid it, so maybe it's fine. Or maybe it should only be added to FullChat
, idk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One idea might be to have a separate chattype, SingleUnencrypted.
if !fingerprint.is_empty() { | ||
let fingerprint_self = load_self_public_key(context).await?.dc_fingerprint().hex(); | ||
if fingerprint == fingerprint_self { | ||
return Ok((ContactId::SELF, sth_modified)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loading the self fingerprint everytime a contact is looked up, just to check whether it's ContactId::SELF, seems unnecessarily slow to me.
I wonder if we can simplify & speed up things by not using the kepairs
table anymore, and instead storing the private and public key in configs. This would mean that it's not possible to have multiple self keys anymore, but I'm not sure there is anyone who is actually making use of the fact that DC theoretically supports using multiple self keys. It would also mean that we have to store the key as base64, not sure about the consequences there.
An alternative would be to store the self fingerprint in a OnceCell on Context, since we don't allow changing the primary key anyway.
But we can open an issue for this, and do it in a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@link2xt agrees with the second alternative (caching fingerprint in memory).
fb034c4
to
ea48d78
Compare
918277f
to
9cf065a
Compare
1cff5d4
to
907628e
Compare
dbade62
to
b7284c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another day, another set of review comments
let to_ids: Vec<Option<ContactId>>; | ||
let past_ids: Vec<Option<ContactId>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a lot of code to calculate the to and past ids, would be nice to extract a function here:
async fn get_to_and_past_contacts(
context: &Context,
mime_parser: &MimeMessage,
incoming_origin: Origin,
) -> Result<(Vec<Option<ContactId>>, Vec<Option<ContactId>>)> {
let chat_id = if let Some(grpid) = mime_parser.get_chat_group_id() {
...
past_ids = add_or_lookup_contacts_by_address_list(
context,
&mime_parser.past_members,
Origin::Hidden,
)
.await?;
};
Ok((to_ids, past_ids))
}
let (to_ids, past_ids) =
get_to_and_past_contacts(context, &mime_parser, incoming_origin).await?;
/// * `is_partial_download`: the message is partially downloaded. | ||
/// We only know the email address and not the contact fingerprint, | ||
/// but try to assign the message to some PGP-contact. | ||
/// If we get it wrong, the message will be placed into the correct | ||
/// chat after downloading. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about unencrypted emails that are partially downloaded? They should be assigned to the email contact, not to some PGP contact with this email address. Maybe there is some code for this already and I just haven't seen it, otherwise we need a check for whether Content-Type is multipart/encrypted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't know if partially downloaded email is encrypted or not, we don't even prefetch content-type. Messages are assigned to some PGP-contact. After downloading, they will go to email-contact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this is not about prefetch but about partial downloads? And for partial downloads, we fetch the full headers, which includes Content-Type:
const BODY_PARTIAL: &str = "(FLAGS RFC822.SIZE BODY.PEEK[HEADER])";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, wait, this is both about prefetch and about actual partial downloading.
What about this:
- Rename
is_partial_download
parameter tofind_pgp_contact_by_addr
- In
receive_imf_inner()
, replaceis_partial_download.is_some()
with (pseudocode)is_partial_download.is_some() && headers.get("Content-Type") == "multipart/encrypted"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@link2xt agrees if it's easy to do
There is a problem with 1:1 chat assignment. If there is no Autocrypt-Gossip on outgoing message, then to_id gets converted to email contact. If there is also a Chat-Verified header, receive_imf fails with an error like |
Co-authored-by: Hocuri <hocuri@gmx.de>
Co-authored-by: Hocuri <hocuri@gmx.de>
ac64daa
to
55e6ecf
Compare
55e6ecf
to
af4e3fe
Compare
…6856) Particularly, this fixes a scenario when the second device sends a message to the 1:1 chat right after SecureJoin.
With this branch Instant Onboarding with group invite link does not work any more. At least with desktop when pasting a group invite code in Scanning the invite code with an existing user works fine. |
1cc8e8b
to
dff076c
Compare
dff076c
to
72614b0
Compare
JSON-RPC:
reset_contact_encryption
API is removed.In deltachat-rpc-client API
Contact.reset_encryption
is removed."Group tracking plugin" in legacy Python API was removed because it relied on parsing email addresses from system messages with regexps.
Known multi-device (non-)issue: pinning a 1:1 chat from legacy client pins email chat via sync message.
Still missing, not all of this should be fixed before merging but at least CI should pass:
Chat-Group-Member-Fpr
header.test_prefer_encrypt_mutual_if_encrypted
has TODOs for assigning to chat by issuer fingerprint. This should also work if the key is attached and no Autocrypt header is sent.Signed-only messages should probably go to PGP-chat without a padlock. Fixing this is out of scope of this PR.Signed-only messages to to email-contact. If Thunderbird is configured to send Autocrypt header, chatting should work, this is already tested.Chat-Group-Member-Fpr
format should be fixed before release.