Page MenuHomePhabricator

D11044.id37335.diff
No OneTemporary

D11044.id37335.diff

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

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)

Event Timeline