-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make it impossible to overwrite default key
Replacing default key when a profile is already part of verified groups results in `[The message was sent with non-verified encryption. See 'Info' for more details]` messages for other users. It is still possible to import the default key before Delta Chat generates the key.
- Loading branch information
Showing
13 changed files
with
129 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import pytest | ||
|
||
from deltachat_rpc_client import EventType | ||
from deltachat_rpc_client.rpc import JsonRpcError | ||
|
||
|
||
def wait_for_autocrypt_setup_message(account): | ||
while True: | ||
event = account.wait_for_event() | ||
if event.kind == EventType.MSGS_CHANGED and event.msg_id != 0: | ||
msg_id = event.msg_id | ||
msg = account.get_message_by_id(msg_id) | ||
if msg.get_snapshot().is_setupmessage: | ||
return msg | ||
|
||
|
||
def test_autocrypt_setup_message_key_transfer(acfactory): | ||
alice1 = acfactory.get_online_account() | ||
|
||
alice2 = acfactory.get_unconfigured_account() | ||
alice2.set_config("addr", alice1.get_config("addr")) | ||
alice2.set_config("mail_pw", alice1.get_config("mail_pw")) | ||
alice2.configure() | ||
|
||
setup_code = alice1.initiate_autocrypt_key_transfer() | ||
msg = wait_for_autocrypt_setup_message(alice2) | ||
|
||
# Test that entering wrong code returns an error. | ||
with pytest.raises(JsonRpcError): | ||
msg.continue_autocrypt_key_transfer("7037-0673-6287-3013-4095-7956-5617-6806-6756") | ||
|
||
msg.continue_autocrypt_key_transfer(setup_code) | ||
|
||
|
||
def test_ac_setup_message_twice(acfactory): | ||
alice1 = acfactory.get_online_account() | ||
alice2 = acfactory.get_unconfigured_account() | ||
alice2.set_config("addr", alice1.get_config("addr")) | ||
alice2.set_config("mail_pw", alice1.get_config("mail_pw")) | ||
alice2.configure() | ||
|
||
# Send the first Autocrypt Setup Message and ignore it. | ||
_setup_code = alice1.initiate_autocrypt_key_transfer() | ||
wait_for_autocrypt_setup_message(alice2) | ||
|
||
# Send the second Autocrypt Setup Message and import it. | ||
setup_code = alice1.initiate_autocrypt_key_transfer() | ||
msg = wait_for_autocrypt_setup_message(alice2) | ||
|
||
msg.continue_autocrypt_key_transfer(setup_code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.