Skip to content

Commit 018a376

Browse files
committed
feat: Be more generous with marking contacts as verified for now
Context: PR #7116 is backwards-incompatible with versions older than v2.20, 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 (we should reset them in a few months then, but this is just so that we can release from main again, and release e.g. channels).
1 parent c682446 commit 018a376

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
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.21.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: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,16 +1261,6 @@ 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-
}
1273-
12741264
inc_and_check(&mut migration_version, 135)?;
12751265
if dbversion < migration_version {
12761266
sql.execute_migration(

0 commit comments

Comments
 (0)