Skip to content

Commit 19d7799

Browse files
Hocurilink2xt
andauthored
feat: Be more generous with marking contacts as verified for now (#7336)
Context: PR #7116 is backwards-incompatible with versions older than v2.21, and since the release hasn't reached all users yet, we currently can't release from main; for details see #7326. Issue #7326 explains how we can make this less breaking, but this only works if many contacts are verified. So, this PR here proposes to postpone the stricter rules for who is verified a bit: - Set verification timeout for invite codes to 1 week (this is still stricter than no timeout at all, which we had in the past) - Don't reset indirect verifications yet In a few months (when everyone has v2.22.0), we can revert the PR here, then. --------- Co-authored-by: l <[email protected]>
1 parent 24e18c1 commit 19d7799

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/securejoin.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ pub(crate) use qrinvite::QrInvite;
3333

3434
use crate::token::Namespace;
3535

36+
/// Only new QR codes cause a verification on Alice's side.
37+
/// When a QR code is too old, it is assumed that there was no direct QR scan,
38+
/// and that the QR code was potentially published on a website,
39+
/// so, Alice doesn't mark Bob as verified.
40+
// TODO For backwards compatibility reasons, this is still using a rather large value.
41+
// Set this to a lower value (e.g. 10 minutes)
42+
// when Delta Chat v2.22.0 is sufficiently rolled out
43+
const VERIFICATION_TIMEOUT_SECONDS: i64 = 7 * 24 * 3600;
44+
3645
fn inviter_progress(
3746
context: &Context,
3847
contact_id: ContactId,
@@ -465,8 +474,8 @@ pub(crate) async fn handle_securejoin_handshake(
465474
}
466475
info!(context, "Fingerprint verified via Auth code.",);
467476

468-
// Mark the contact as verified if auth code is 600 seconds old.
469-
if time() < timestamp + 600 {
477+
// Mark the contact as verified if auth code is less than VERIFICATION_TIMEOUT_SECONDS seconds old.
478+
if time() < timestamp + VERIFICATION_TIMEOUT_SECONDS {
470479
mark_contact_id_as_verified(context, contact_id, Some(ContactId::SELF)).await?;
471480
}
472481
contact_id.regossip_keys(context).await?;

src/sql/migrations.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,15 +1261,7 @@ CREATE INDEX gossip_timestamp_index ON gossip_timestamp (chat_id, fingerprint);
12611261
.await?;
12621262
}
12631263

1264-
inc_and_check(&mut migration_version, 134)?;
1265-
if dbversion < migration_version {
1266-
// Reset all indirect verifications.
1267-
sql.execute_migration(
1268-
"UPDATE contacts SET verifier=0 WHERE verifier!=1",
1269-
migration_version,
1270-
)
1271-
.await?;
1272-
}
1264+
inc_and_check(&mut migration_version, 134)?; // Migration 134 was removed
12731265

12741266
inc_and_check(&mut migration_version, 135)?;
12751267
if dbversion < migration_version {

0 commit comments

Comments
 (0)