Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3354847
D11077.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11077.diff
View Options
diff --git a/lib/ops/keyserver-store-ops.js b/lib/ops/keyserver-store-ops.js
--- a/lib/ops/keyserver-store-ops.js
+++ b/lib/ops/keyserver-store-ops.js
@@ -130,7 +130,32 @@
},
};
+function removeDeviceSpecificInfoFromDBKeyserverStoreOps(
+ keyservers: $ReadOnlyArray<ClientDBKeyserverInfo>,
+): $ReadOnlyArray<ClientDBKeyserverStoreOperation> {
+ const keyserverInfos =
+ keyserverStoreOpsHandlers.translateClientDBData(keyservers);
+ const operations: ReplaceKeyserverOperation[] = [];
+ for (const keyserverID in keyserverInfos) {
+ operations.push({
+ type: 'replace_keyserver',
+ payload: {
+ id: keyserverID,
+ keyserverInfo: {
+ ...keyserverInfos[keyserverID],
+ cookie: null,
+ lastCommunicatedPlatformDetails: null,
+ deviceToken: null,
+ updatesCurrentAsOf: 0,
+ },
+ },
+ });
+ }
+ return keyserverStoreOpsHandlers.convertOpsToClientDBOps(operations);
+}
+
export {
keyserverStoreOpsHandlers,
convertKeyserverInfoToClientDBKeyserverInfo,
+ removeDeviceSpecificInfoFromDBKeyserverStoreOps,
};
diff --git a/native/backup/use-client-backup.js b/native/backup/use-client-backup.js
--- a/native/backup/use-client-backup.js
+++ b/native/backup/use-client-backup.js
@@ -2,6 +2,7 @@
import * as React from 'react';
+import { removeDeviceSpecificInfoFromDBKeyserverStoreOps } from 'lib/ops/keyserver-store-ops.js';
import { isLoggedIn } from 'lib/selectors/user-selectors.js';
import { fetchNativeKeychainCredentials } from '../account/native-credentials.js';
@@ -67,6 +68,11 @@
const backupSecret = await getBackupSecret();
await commCoreModule.restoreBackup(backupSecret);
+ const { keyservers } = await commCoreModule.getClientDBStore();
+ const operations =
+ removeDeviceSpecificInfoFromDBKeyserverStoreOps(keyservers);
+ await commCoreModule.processKeyserverStoreOperations(operations);
+
console.info('Backup restored.');
}, [currentUserID, loggedIn, setMockCommServicesAuthMetadata]);
diff --git a/web/database/worker/backup.js b/web/database/worker/backup.js
--- a/web/database/worker/backup.js
+++ b/web/database/worker/backup.js
@@ -4,8 +4,10 @@
import backupService from 'lib/facts/backup-service.js';
import { decryptCommon } from 'lib/media/aes-crypto-utils-common.js';
+import { removeDeviceSpecificInfoFromDBKeyserverStoreOps } from 'lib/ops/keyserver-store-ops.js';
import type { AuthMetadata } from 'lib/shared/identity-client-context.js';
+import { processKeyserverStoreOperations } from './process-operations.js';
import { completeRootKey } from '../../redux/persist-constants.js';
import type { EmscriptenModule } from '../types/module.js';
import type { SQLiteQueryExecutor } from '../types/sqlite-query-executor.js';
@@ -53,6 +55,11 @@
sqliteQueryExecutor.setPersistStorageItem(completeRootKey, reduxPersistData);
+ const keyservers = sqliteQueryExecutor.getAllKeyservers();
+ const operations =
+ removeDeviceSpecificInfoFromDBKeyserverStoreOps(keyservers);
+ processKeyserverStoreOperations(sqliteQueryExecutor, operations, dbModule);
+
await client.downloadLogs(userIdentity, backupID, async log => {
const content = await decryptCommon(crypto, decryptionKey, log);
sqliteQueryExecutor.restoreFromBackupLog(content);
diff --git a/web/database/worker/process-operations.js b/web/database/worker/process-operations.js
--- a/web/database/worker/process-operations.js
+++ b/web/database/worker/process-operations.js
@@ -220,4 +220,8 @@
};
}
-export { processDBStoreOperations, getClientStoreFromQueryExecutor };
+export {
+ processDBStoreOperations,
+ getClientStoreFromQueryExecutor,
+ processKeyserverStoreOperations,
+};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 1:25 PM (21 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2575974
Default Alt Text
D11077.diff (3 KB)
Attached To
Mode
D11077: [web/native] Clear device specific data after restoration
Attached
Detach File
Event Timeline
Log In to Comment