From 645bf66424424e8608d8affc12dc5262bb08d5a2 Mon Sep 17 00:00:00 2001 From: Harris Date: Wed, 9 Jun 2021 11:31:45 +1000 Subject: [PATCH] feat: only FORCE upgrade if not upgraded yet --- .../org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java b/app/src/main/java/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java index c3ed88e896..2ca215c894 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java +++ b/app/src/main/java/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java @@ -53,6 +53,7 @@ public class IdentityKeyUtil { public static final String ED25519_PUBLIC_KEY = "pref_ed25519_public_key"; public static final String ED25519_SECRET_KEY = "pref_ed25519_secret_key"; public static final String LOKI_SEED = "loki_seed"; + public static final String HAS_MIGRATED_KEY = "has_migrated_keys"; public static boolean hasIdentityKey(Context context) { SharedPreferences preferences = context.getSharedPreferences(MASTER_SECRET_UTIL_PREFERENCES_NAME, 0); @@ -63,8 +64,10 @@ public class IdentityKeyUtil { preferences.contains(IDENTITY_PRIVATE_KEY_PREF+ENCRYPTED_SUFFIX)); // check if any keys are not migrated - if (hasIdentityKey) { + if (hasIdentityKey && !preferences.getBoolean(HAS_MIGRATED_KEY, false)) { + // this will retrieve and force upgrade if possible checkUpdate(context); + preferences.edit().putBoolean(HAS_MIGRATED_KEY, true).apply(); } return hasIdentityKey;