Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3356239
D11044.id37335.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.id37335.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
@@ -1,6 +1,7 @@
// @flow
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 { getProcessingStoreOpsExceptionMessage } from './process-operations.js';
@@ -20,7 +21,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');
@@ -59,6 +62,15 @@
} catch (err) {
throw new Error(getProcessingStoreOpsExceptionMessage(err, dbModule));
}
+
+ await client.downloadLogs(userIdentity, backupID, async log => {
+ const content = await decryptCommon(crypto, decryptionKey, log);
+ try {
+ sqliteQueryExecutor.restoreFromBackupLog(content);
+ } catch (err) {
+ throw new Error(getProcessingStoreOpsExceptionMessage(err, dbModule));
+ }
+ });
}
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
@@ -255,6 +255,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:36 PM (19 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576887
Default Alt Text
D11044.id37335.diff (1 KB)
Attached To
Mode
D11044: [web] Restore logs
Attached
Detach File
Event Timeline
Log In to Comment