mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Always use inferred PIN state.
Saving the PIN state could lead to it being stale or mismanaged, and tbh we were using the inferred state to _set_ the value anyway.
This commit is contained in:
@@ -73,8 +73,6 @@ public final class PinState {
|
||||
SignalStore.kbsValues().clearRegistrationLockAndPin();
|
||||
TextSecurePreferences.setV1RegistrationLockEnabled(context, false);
|
||||
}
|
||||
|
||||
updateState(buildInferredStateFromOtherFields());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,8 +88,6 @@ public final class PinState {
|
||||
SignalStore.storageService().setNeedsAccountRestore(false);
|
||||
resetPinRetryCount(context, pin);
|
||||
ClearFallbackKbsEnclaveJob.clearAll();
|
||||
|
||||
updateState(buildInferredStateFromOtherFields());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,8 +97,6 @@ public final class PinState {
|
||||
SignalStore.kbsValues().clearRegistrationLockAndPin();
|
||||
SignalStore.storageService().setNeedsAccountRestore(false);
|
||||
SignalStore.kbsValues().setPinForgottenOrSkipped(true);
|
||||
|
||||
updateState(buildInferredStateFromOtherFields());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,8 +130,6 @@ public final class PinState {
|
||||
} else {
|
||||
Log.i(TAG, "Not the first time setting a PIN. Enclave: " + kbsEnclave.getEnclaveName());
|
||||
}
|
||||
|
||||
updateState(buildInferredStateFromOtherFields());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,8 +151,6 @@ public final class PinState {
|
||||
assertState(State.PIN_WITH_REGISTRATION_LOCK_DISABLED, State.NO_REGISTRATION_LOCK);
|
||||
|
||||
optOutOfPin();
|
||||
|
||||
updateState(buildInferredStateFromOtherFields());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,8 +176,6 @@ public final class PinState {
|
||||
.newPinChangeSession(SignalStore.kbsValues().getRegistrationLockTokenResponse())
|
||||
.enableRegistrationLock(SignalStore.kbsValues().getOrCreateMasterKey());
|
||||
SignalStore.kbsValues().setV2RegistrationLockEnabled(true);
|
||||
|
||||
updateState(State.PIN_WITH_REGISTRATION_LOCK_ENABLED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,8 +197,6 @@ public final class PinState {
|
||||
.newPinChangeSession(SignalStore.kbsValues().getRegistrationLockTokenResponse())
|
||||
.disableRegistrationLock();
|
||||
SignalStore.kbsValues().setV2RegistrationLockEnabled(false);
|
||||
|
||||
updateState(State.PIN_WITH_REGISTRATION_LOCK_DISABLED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,8 +222,6 @@ public final class PinState {
|
||||
|
||||
kbsValues.setKbsMasterKey(kbsData, pin);
|
||||
TextSecurePreferences.clearRegistrationLockV1(context);
|
||||
|
||||
updateState(buildInferredStateFromOtherFields());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -346,24 +330,7 @@ public final class PinState {
|
||||
}
|
||||
}
|
||||
|
||||
private static @NonNull State getState() {
|
||||
String serialized = SignalStore.pinValues().getPinState();
|
||||
|
||||
if (serialized != null) {
|
||||
return State.deserialize(serialized);
|
||||
} else {
|
||||
State state = buildInferredStateFromOtherFields();
|
||||
SignalStore.pinValues().setPinState(state.serialize());
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
private static void updateState(@NonNull State state) {
|
||||
Log.i(TAG, "Updating state to: " + state);
|
||||
SignalStore.pinValues().setPinState(state.serialize());
|
||||
}
|
||||
|
||||
private static @NonNull State buildInferredStateFromOtherFields() {
|
||||
public static @NonNull State getState() {
|
||||
Context context = ApplicationDependencies.getApplication();
|
||||
KbsValues kbsValues = SignalStore.kbsValues();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user