-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Save contact name from SecureJoin QR to
authname
, not to name
(
#6115) 3f9242a saves name from all QR codes to `name` (i.e. manually edited name), but for SecureJoin QR codes the name should be saved to `authname` because such QR codes are generated by the inviter. Other QR codes may be generated locally and not only by Delta Chat, so the name from them mustn't go to `authname` and be revealed to the network or other contacts.
- Loading branch information
Showing
3 changed files
with
30 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -446,7 +446,7 @@ async fn decode_openpgp(context: &Context, qr: &str) -> Result<Qr> { | |
if let (Some(addr), Some(invitenumber), Some(authcode)) = (&addr, invitenumber, authcode) { | ||
let addr = ContactAddress::new(addr)?; | ||
let (contact_id, _) = | ||
Contact::add_or_lookup(context, &name, &addr, Origin::UnhandledQrScan) | ||
Contact::add_or_lookup(context, &name, &addr, Origin::UnhandledSecurejoinQrScan) | ||
.await | ||
.with_context(|| format!("failed to add or lookup contact for address {addr:?}"))?; | ||
|
||
|
@@ -1270,7 +1270,8 @@ mod tests { | |
if let Qr::AskVerifyContact { contact_id, .. } = qr { | ||
let contact = Contact::get_by_id(&ctx.ctx, contact_id).await?; | ||
assert_eq!(contact.get_addr(), "[email protected]"); | ||
assert_eq!(contact.get_name(), "Jörn P. P."); | ||
assert_eq!(contact.get_authname(), "Jörn P. P."); | ||
assert_eq!(contact.get_name(), ""); | ||
} else { | ||
bail!("Wrong QR code type"); | ||
} | ||
|
@@ -1285,6 +1286,7 @@ mod tests { | |
if let Qr::AskVerifyContact { contact_id, .. } = qr { | ||
let contact = Contact::get_by_id(&ctx.ctx, contact_id).await?; | ||
assert_eq!(contact.get_addr(), "[email protected]"); | ||
assert_eq!(contact.get_authname(), ""); | ||
assert_eq!(contact.get_name(), ""); | ||
} else { | ||
bail!("Wrong QR code type"); | ||
|
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