Skip to content

Commit 562e59b

Browse files
committed
test: test that changing default private key breaks backward verification
1 parent c864678 commit 562e59b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

deltachat-rpc-client/tests/test_securejoin.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from deltachat_rpc_client import Chat, SpecialContactId
44

55

6-
def test_qr_setup_contact(acfactory) -> None:
6+
def test_qr_setup_contact(acfactory, tmp_path) -> None:
77
alice, bob = acfactory.get_online_accounts(2)
88

99
qr_code, _svg = alice.get_qr_code()
@@ -23,6 +23,18 @@ def test_qr_setup_contact(acfactory) -> None:
2323
bob_contact_alice_snapshot = bob_contact_alice.get_snapshot()
2424
assert bob_contact_alice_snapshot.is_verified
2525

26+
# Test that if Bob changes the key, backwards verification is lost.
27+
logging.info("Bob 2 is created")
28+
bob2 = acfactory.new_configured_account()
29+
bob2.export_self_keys(tmp_path)
30+
31+
logging.info("Bob imports a key")
32+
bob.import_self_keys(tmp_path / "private-key-default.asc")
33+
34+
assert bob.get_config("key_id") == "2"
35+
bob_contact_alice_snapshot = bob_contact_alice.get_snapshot()
36+
assert not bob_contact_alice_snapshot.is_verified
37+
2638

2739
def test_qr_securejoin(acfactory):
2840
alice, bob = acfactory.get_online_accounts(2)

0 commit comments

Comments
 (0)