On startup after 30+ days, delete local encryption info
This commit is contained in:
parent
2481784ab2
commit
9cda14c4f2
1 changed files with 69 additions and 59 deletions
|
@ -430,6 +430,15 @@
|
||||||
await storage.put('indexeddb-delete-needed', true);
|
await storage.put('indexeddb-delete-needed', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currentStartup = Date.now();
|
||||||
|
const lastStartup = storage.get('lastStartup');
|
||||||
|
await storage.put('lastStartup', currentStartup);
|
||||||
|
const THIRTY_DAYS = 30 * 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
|
if (lastStartup > 0 && currentStartup - lastStartup > THIRTY_DAYS) {
|
||||||
|
await unlinkAndDisconnect();
|
||||||
|
}
|
||||||
|
|
||||||
const currentVersion = window.getVersion();
|
const currentVersion = window.getVersion();
|
||||||
const lastVersion = storage.get('version');
|
const lastVersion = storage.get('version');
|
||||||
newVersion = !lastVersion || currentVersion !== lastVersion;
|
newVersion = !lastVersion || currentVersion !== lastVersion;
|
||||||
|
@ -1662,15 +1671,7 @@
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onError(ev) {
|
async function unlinkAndDisconnect() {
|
||||||
const { error } = ev;
|
|
||||||
window.log.error('background onError:', Errors.toLogFormat(error));
|
|
||||||
|
|
||||||
if (
|
|
||||||
error &&
|
|
||||||
error.name === 'HTTPError' &&
|
|
||||||
(error.code === 401 || error.code === 403)
|
|
||||||
) {
|
|
||||||
Whisper.events.trigger('unauthorized');
|
Whisper.events.trigger('unauthorized');
|
||||||
|
|
||||||
if (messageReceiver) {
|
if (messageReceiver) {
|
||||||
|
@ -1695,9 +1696,7 @@
|
||||||
const IS_MIGRATION_COMPLETE_KEY = 'attachmentMigration_isComplete';
|
const IS_MIGRATION_COMPLETE_KEY = 'attachmentMigration_isComplete';
|
||||||
|
|
||||||
const previousNumberId = textsecure.storage.get(NUMBER_ID_KEY);
|
const previousNumberId = textsecure.storage.get(NUMBER_ID_KEY);
|
||||||
const lastProcessedIndex = textsecure.storage.get(
|
const lastProcessedIndex = textsecure.storage.get(LAST_PROCESSED_INDEX_KEY);
|
||||||
LAST_PROCESSED_INDEX_KEY
|
|
||||||
);
|
|
||||||
const isMigrationComplete = textsecure.storage.get(
|
const isMigrationComplete = textsecure.storage.get(
|
||||||
IS_MIGRATION_COMPLETE_KEY
|
IS_MIGRATION_COMPLETE_KEY
|
||||||
);
|
);
|
||||||
|
@ -1729,7 +1728,18 @@
|
||||||
eraseError && eraseError.stack ? eraseError.stack : eraseError
|
eraseError && eraseError.stack ? eraseError.stack : eraseError
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onError(ev) {
|
||||||
|
const { error } = ev;
|
||||||
|
window.log.error('background onError:', Errors.toLogFormat(error));
|
||||||
|
|
||||||
|
if (
|
||||||
|
error &&
|
||||||
|
error.name === 'HTTPError' &&
|
||||||
|
(error.code === 401 || error.code === 403)
|
||||||
|
) {
|
||||||
|
await unlinkAndDisconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue