Deprecate usage of the signaling key.

This commit is contained in:
Greyson Parrelli 2019-01-17 15:36:53 -08:00
parent 57ef0e9024
commit e6b4249cf3
4 changed files with 11 additions and 10 deletions

View File

@ -95,6 +95,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
public static final int WORKMANAGER_MIGRATION = 408;
public static final int COLOR_MIGRATION = 412;
public static final int UNIDENTIFIED_DELIVERY = 422;
public static final int SIGNALING_KEY_DEPRECATION = 447;
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
@ -121,6 +122,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
add(WORKMANAGER_MIGRATION);
add(COLOR_MIGRATION);
add(UNIDENTIFIED_DELIVERY);
add(SIGNALING_KEY_DEPRECATION);
}};
private MasterSecret masterSecret;
@ -371,6 +373,13 @@ public class DatabaseUpgradeActivity extends BaseActivity {
.add(new RefreshAttributesJob(context));
}
if (params[0] < SIGNALING_KEY_DEPRECATION) {
Log.i(TAG, "Scheduling a RefreshAttributesJob to remove the signaling key remotely.");
ApplicationContext.getInstance(context)
.getJobManager()
.add(new RefreshAttributesJob(context));
}
return null;
}

View File

@ -713,9 +713,7 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
TextSecurePreferences.setLocalRegistrationId(RegistrationActivity.this, registrationId);
SessionUtil.archiveAllSessions(RegistrationActivity.this);
String signalingKey = Util.getSecret(52);
accountManager.verifyAccountWithCode(code, signalingKey, registrationId, !registrationState.gcmToken.isPresent(), pin,
accountManager.verifyAccountWithCode(code, null, registrationId, !registrationState.gcmToken.isPresent(), pin,
unidentifiedAccessKey, universalUnidentifiedAccess);
IdentityKeyPair identityKey = IdentityKeyUtil.getIdentityKeyPair(RegistrationActivity.this);
@ -741,7 +739,6 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
TextSecurePreferences.setPushRegistered(RegistrationActivity.this, true);
TextSecurePreferences.setLocalNumber(RegistrationActivity.this, registrationState.e164number);
TextSecurePreferences.setPushServerPassword(RegistrationActivity.this, registrationState.password);
TextSecurePreferences.setSignalingKey(RegistrationActivity.this, signalingKey);
TextSecurePreferences.setSignedPreKeyRegistered(RegistrationActivity.this, true);
TextSecurePreferences.setPromptedPushRegistration(RegistrationActivity.this, true);
TextSecurePreferences.setUnauthorizedReceived(RegistrationActivity.this, false);

View File

@ -52,14 +52,13 @@ public class RefreshAttributesJob extends ContextJob implements InjectableType {
@Override
public void onRun() throws IOException {
String signalingKey = TextSecurePreferences.getSignalingKey(context);
int registrationId = TextSecurePreferences.getLocalRegistrationId(context);
boolean fetchesMessages = TextSecurePreferences.isGcmDisabled(context);
String pin = TextSecurePreferences.getRegistrationLockPin(context);
byte[] unidentifiedAccessKey = UnidentifiedAccessUtil.getSelfUnidentifiedAccessKey(context);
boolean universalUnidentifiedAccess = TextSecurePreferences.isUniversalUnidentifiedAccess(context);
signalAccountManager.setAccountAttributes(signalingKey, registrationId, fetchesMessages, pin,
signalAccountManager.setAccountAttributes(null, registrationId, fetchesMessages, pin,
unidentifiedAccessKey, universalUnidentifiedAccess);
ApplicationContext.getInstance(context)

View File

@ -620,10 +620,6 @@ public class TextSecurePreferences {
setStringPreference(context, GCM_PASSWORD_PREF, password);
}
public static void setSignalingKey(Context context, String signalingKey) {
setStringPreference(context, SIGNALING_KEY_PREF, signalingKey);
}
public static String getSignalingKey(Context context) {
return getStringPreference(context, SIGNALING_KEY_PREF, null);
}