Skip to content

Commit cbd4662

Browse files
committed
add key missing note to chat encryption info
1 parent 24edee8 commit cbd4662

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/chat.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,11 @@ impl ChatId {
13401340
let fingerprint = contact
13411341
.fingerprint()
13421342
.context("Contact does not have a fingerprint in encrypted chat")?;
1343-
ret += &format!("\n{addr}\n{fingerprint}\n");
1343+
if contact.public_key(context).await?.is_some() {
1344+
ret += &format!("\n{addr}\n{fingerprint}\n");
1345+
} else {
1346+
ret += &format!("\n{addr}\n(key missing)\n{fingerprint}\n");
1347+
}
13441348
}
13451349

13461350
Ok(ret.trim().to_string())

src/chat/chat_tests.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,6 +2765,22 @@ async fn test_chat_get_encryption_info() -> Result<()> {
27652765
"No encryption"
27662766
);
27672767

2768+
alice.sql.execute("DELETE FROM public_keys", ()).await?;
2769+
assert_eq!(
2770+
chat_id.get_encryption_info(alice).await?,
2771+
"End-to-end encryption available\n\
2772+
\n\
2773+
fiona@example.net\n\
2774+
(key missing)\n\
2775+
C8BA 50BF 4AC1 2FAF 38D7\n\
2776+
F657 DDFC 8E9F 3C79 9195\n\
2777+
\n\
2778+
bob@example.net\n\
2779+
(key missing)\n\
2780+
CCCB 5AA9 F6E1 141C 9431\n\
2781+
65F1 DB18 B18C BCF7 0487"
2782+
);
2783+
27682784
Ok(())
27692785
}
27702786

0 commit comments

Comments
 (0)