mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 23:03:46 +00:00
Deprecate usage of the signaling key.
This commit is contained in:
parent
57ef0e9024
commit
e6b4249cf3
@ -95,6 +95,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
|||||||
public static final int WORKMANAGER_MIGRATION = 408;
|
public static final int WORKMANAGER_MIGRATION = 408;
|
||||||
public static final int COLOR_MIGRATION = 412;
|
public static final int COLOR_MIGRATION = 412;
|
||||||
public static final int UNIDENTIFIED_DELIVERY = 422;
|
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>() {{
|
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
|
||||||
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
|
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
|
||||||
@ -121,6 +122,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
|||||||
add(WORKMANAGER_MIGRATION);
|
add(WORKMANAGER_MIGRATION);
|
||||||
add(COLOR_MIGRATION);
|
add(COLOR_MIGRATION);
|
||||||
add(UNIDENTIFIED_DELIVERY);
|
add(UNIDENTIFIED_DELIVERY);
|
||||||
|
add(SIGNALING_KEY_DEPRECATION);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private MasterSecret masterSecret;
|
private MasterSecret masterSecret;
|
||||||
@ -371,6 +373,13 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
|||||||
.add(new RefreshAttributesJob(context));
|
.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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,9 +713,7 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
|
|||||||
TextSecurePreferences.setLocalRegistrationId(RegistrationActivity.this, registrationId);
|
TextSecurePreferences.setLocalRegistrationId(RegistrationActivity.this, registrationId);
|
||||||
SessionUtil.archiveAllSessions(RegistrationActivity.this);
|
SessionUtil.archiveAllSessions(RegistrationActivity.this);
|
||||||
|
|
||||||
String signalingKey = Util.getSecret(52);
|
accountManager.verifyAccountWithCode(code, null, registrationId, !registrationState.gcmToken.isPresent(), pin,
|
||||||
|
|
||||||
accountManager.verifyAccountWithCode(code, signalingKey, registrationId, !registrationState.gcmToken.isPresent(), pin,
|
|
||||||
unidentifiedAccessKey, universalUnidentifiedAccess);
|
unidentifiedAccessKey, universalUnidentifiedAccess);
|
||||||
|
|
||||||
IdentityKeyPair identityKey = IdentityKeyUtil.getIdentityKeyPair(RegistrationActivity.this);
|
IdentityKeyPair identityKey = IdentityKeyUtil.getIdentityKeyPair(RegistrationActivity.this);
|
||||||
@ -741,7 +739,6 @@ public class RegistrationActivity extends BaseActionBarActivity implements Verif
|
|||||||
TextSecurePreferences.setPushRegistered(RegistrationActivity.this, true);
|
TextSecurePreferences.setPushRegistered(RegistrationActivity.this, true);
|
||||||
TextSecurePreferences.setLocalNumber(RegistrationActivity.this, registrationState.e164number);
|
TextSecurePreferences.setLocalNumber(RegistrationActivity.this, registrationState.e164number);
|
||||||
TextSecurePreferences.setPushServerPassword(RegistrationActivity.this, registrationState.password);
|
TextSecurePreferences.setPushServerPassword(RegistrationActivity.this, registrationState.password);
|
||||||
TextSecurePreferences.setSignalingKey(RegistrationActivity.this, signalingKey);
|
|
||||||
TextSecurePreferences.setSignedPreKeyRegistered(RegistrationActivity.this, true);
|
TextSecurePreferences.setSignedPreKeyRegistered(RegistrationActivity.this, true);
|
||||||
TextSecurePreferences.setPromptedPushRegistration(RegistrationActivity.this, true);
|
TextSecurePreferences.setPromptedPushRegistration(RegistrationActivity.this, true);
|
||||||
TextSecurePreferences.setUnauthorizedReceived(RegistrationActivity.this, false);
|
TextSecurePreferences.setUnauthorizedReceived(RegistrationActivity.this, false);
|
||||||
|
@ -52,14 +52,13 @@ public class RefreshAttributesJob extends ContextJob implements InjectableType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRun() throws IOException {
|
public void onRun() throws IOException {
|
||||||
String signalingKey = TextSecurePreferences.getSignalingKey(context);
|
|
||||||
int registrationId = TextSecurePreferences.getLocalRegistrationId(context);
|
int registrationId = TextSecurePreferences.getLocalRegistrationId(context);
|
||||||
boolean fetchesMessages = TextSecurePreferences.isGcmDisabled(context);
|
boolean fetchesMessages = TextSecurePreferences.isGcmDisabled(context);
|
||||||
String pin = TextSecurePreferences.getRegistrationLockPin(context);
|
String pin = TextSecurePreferences.getRegistrationLockPin(context);
|
||||||
byte[] unidentifiedAccessKey = UnidentifiedAccessUtil.getSelfUnidentifiedAccessKey(context);
|
byte[] unidentifiedAccessKey = UnidentifiedAccessUtil.getSelfUnidentifiedAccessKey(context);
|
||||||
boolean universalUnidentifiedAccess = TextSecurePreferences.isUniversalUnidentifiedAccess(context);
|
boolean universalUnidentifiedAccess = TextSecurePreferences.isUniversalUnidentifiedAccess(context);
|
||||||
|
|
||||||
signalAccountManager.setAccountAttributes(signalingKey, registrationId, fetchesMessages, pin,
|
signalAccountManager.setAccountAttributes(null, registrationId, fetchesMessages, pin,
|
||||||
unidentifiedAccessKey, universalUnidentifiedAccess);
|
unidentifiedAccessKey, universalUnidentifiedAccess);
|
||||||
|
|
||||||
ApplicationContext.getInstance(context)
|
ApplicationContext.getInstance(context)
|
||||||
|
@ -620,10 +620,6 @@ public class TextSecurePreferences {
|
|||||||
setStringPreference(context, GCM_PASSWORD_PREF, password);
|
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) {
|
public static String getSignalingKey(Context context) {
|
||||||
return getStringPreference(context, SIGNALING_KEY_PREF, null);
|
return getStringPreference(context, SIGNALING_KEY_PREF, null);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user