mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Reset cached storage manifest after provisioning/registering
This commit is contained in:
parent
9553b1ef00
commit
c586f58286
1 changed files with 14 additions and 2 deletions
|
@ -371,6 +371,7 @@ public class SignalAccount implements Closeable {
|
||||||
this.lastReceiveTimestamp = 0;
|
this.lastReceiveTimestamp = 0;
|
||||||
this.pinMasterKey = null;
|
this.pinMasterKey = null;
|
||||||
this.storageManifestVersion = -1;
|
this.storageManifestVersion = -1;
|
||||||
|
this.setStorageManifest(null);
|
||||||
this.storageKey = null;
|
this.storageKey = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1329,9 +1330,19 @@ public class SignalAccount implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStorageManifest(SignalStorageManifest manifest) {
|
public void setStorageManifest(SignalStorageManifest manifest) {
|
||||||
final var manifestBytes = manifest.serialize();
|
|
||||||
|
|
||||||
final var storageManifestFile = getStorageManifestFile(dataPath, accountPath);
|
final var storageManifestFile = getStorageManifestFile(dataPath, accountPath);
|
||||||
|
if (manifest == null) {
|
||||||
|
if (storageManifestFile.exists()) {
|
||||||
|
try {
|
||||||
|
Files.delete(storageManifestFile.toPath());
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("Failed to delete local storage manifest.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final var manifestBytes = manifest.serialize();
|
||||||
try (var outputStream = new FileOutputStream(storageManifestFile)) {
|
try (var outputStream = new FileOutputStream(storageManifestFile)) {
|
||||||
outputStream.write(manifestBytes);
|
outputStream.write(manifestBytes);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -1406,6 +1417,7 @@ public class SignalAccount implements Closeable {
|
||||||
public void finishRegistration(final ACI aci, final PNI pni, final MasterKey masterKey, final String pin) {
|
public void finishRegistration(final ACI aci, final PNI pni, final MasterKey masterKey, final String pin) {
|
||||||
this.pinMasterKey = masterKey;
|
this.pinMasterKey = masterKey;
|
||||||
this.storageManifestVersion = -1;
|
this.storageManifestVersion = -1;
|
||||||
|
this.setStorageManifest(null);
|
||||||
this.storageKey = null;
|
this.storageKey = null;
|
||||||
this.encryptedDeviceName = null;
|
this.encryptedDeviceName = null;
|
||||||
this.deviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
|
this.deviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue