Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3356245
D11044.id37073.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11044.id37073.diff
View Options
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
@@ -3,6 +3,7 @@
import { BackupClient, RequestedData } from 'backup-client-wasm';
import backupService from 'lib/facts/backup-service.js';
+import { decryptCommon } from 'lib/media/aes-crypto-utils-common.js';
import type { AuthMetadata } from 'lib/shared/identity-client-context.js';
import { completeRootKey } from '../../redux/persist-constants.js';
@@ -17,7 +18,9 @@
authMetadata: AuthMetadata,
backupID: string,
backupDataKey: string,
+ backupLogDataKey: string,
) {
+ const decryptionKey = new TextEncoder().encode(backupLogDataKey);
const { userID, deviceID, accessToken } = authMetadata;
if (!userID || !deviceID || !accessToken) {
throw new Error('Backup restore requires full authMetadata');
@@ -49,6 +52,11 @@
);
sqliteQueryExecutor.setPersistStorageItem(completeRootKey, reduxPersistData);
+
+ await client.downloadLogs(userIdentity, backupID, async log => {
+ const content = await decryptCommon(crypto, decryptionKey, log);
+ sqliteQueryExecutor.restoreFromBackupLog(content);
+ });
}
export { restoreBackup };
diff --git a/web/database/worker/db-worker.js b/web/database/worker/db-worker.js
--- a/web/database/worker/db-worker.js
+++ b/web/database/worker/db-worker.js
@@ -251,6 +251,7 @@
message.authMetadata,
message.backupID,
message.backupDataKey,
+ message.backupLogDataKey,
);
}
diff --git a/web/types/worker-types.js b/web/types/worker-types.js
--- a/web/types/worker-types.js
+++ b/web/types/worker-types.js
@@ -90,6 +90,7 @@
+authMetadata: AuthMetadata,
+backupID: string,
+backupDataKey: string,
+ +backupLogDataKey: string,
};
export type WorkerRequestMessage =
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 5:40 PM (20 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576891
Default Alt Text
D11044.id37073.diff (1 KB)
Attached To
Mode
D11044: [web] Restore logs
Attached
Detach File
Event Timeline
Log In to Comment