Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3513650
D12013.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
23 KB
Referenced Files
None
Subscribers
None
D12013.diff
View Options
diff --git a/native/backup/restore-siwe-backup.react.js b/native/backup/restore-siwe-backup.react.js
--- a/native/backup/restore-siwe-backup.react.js
+++ b/native/backup/restore-siwe-backup.react.js
@@ -11,6 +11,7 @@
import { commCoreModule } from '../native-modules.js';
import { type RootNavigationProp } from '../navigation/root-navigator.react.js';
import { type NavigationRoute } from '../navigation/route-names.js';
+import { persistConfig } from '../redux/persist.js';
import { useStyles } from '../themes/colors.js';
export type RestoreSIWEBackupParams = {
@@ -39,7 +40,11 @@
const { signature } = result;
let message = 'success';
try {
- await commCoreModule.restoreSIWEBackup(signature, backupID);
+ await commCoreModule.restoreSIWEBackup(
+ signature,
+ backupID,
+ persistConfig.version.toString(),
+ );
} catch (e) {
message = `Backup restore error: ${String(
getMessageForException(e),
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
@@ -9,6 +9,7 @@
import { fetchNativeKeychainCredentials } from '../account/native-credentials.js';
import { commCoreModule } from '../native-modules.js';
+import { persistConfig } from '../redux/persist.js';
import { useSelector } from '../redux/redux-utils.js';
type SIWEBackupData = {
@@ -102,7 +103,10 @@
await setMockCommServicesAuthMetadata();
const backupSecret = await getBackupSecret();
- await commCoreModule.restoreBackup(backupSecret);
+ await commCoreModule.restoreBackup(
+ backupSecret,
+ persistConfig.version.toString(),
+ );
console.info('Backup restored.');
return;
diff --git a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
--- a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
+++ b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
@@ -137,7 +137,8 @@
virtual std::string getMetadata(std::string entry_name) const = 0;
virtual void restoreFromMainCompaction(
std::string mainCompactionPath,
- std::string mainCompactionEncryptionKey) const = 0;
+ std::string mainCompactionEncryptionKey,
+ std::string maxVersion) const = 0;
virtual void
restoreFromBackupLog(const std::vector<std::uint8_t> &backupLog) const = 0;
virtual void addOutboundP2PMessages(
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
@@ -39,6 +39,8 @@
static SQLiteConnectionManager connectionManager;
#endif
+ std::optional<int> getSyncedDatabaseVersion(sqlite3 *db) const;
+
public:
static std::string sqliteFilePath;
static std::string encryptionKey;
@@ -146,7 +148,8 @@
std::string getMetadata(std::string entry_name) const override;
void restoreFromMainCompaction(
std::string mainCompactionPath,
- std::string mainCompactionEncryptionKey) const override;
+ std::string mainCompactionEncryptionKey,
+ std::string maxVersion) const override;
void restoreFromBackupLog(
const std::vector<std::uint8_t> &backupLog) const override;
void addOutboundP2PMessages(
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
@@ -1881,6 +1881,20 @@
SQLiteQueryExecutor::getConnection(), getAllSyncedMetadataSQL);
}
+std::optional<int>
+SQLiteQueryExecutor::getSyncedDatabaseVersion(sqlite3 *db) const {
+ static std::string getDBVersionSyncedMetadataSQL =
+ "SELECT * "
+ "FROM synced_metadata "
+ "WHERE name=\"db_version\";";
+ std::vector<SyncedMetadataEntry> entries =
+ getAllEntities<SyncedMetadataEntry>(db, getDBVersionSyncedMetadataSQL);
+ for (auto &entry : entries) {
+ return std::stoi(entry.data);
+ }
+ return std::nullopt;
+}
+
void SQLiteQueryExecutor::replaceAuxUserInfo(
const AuxUserInfo &aux_user_info) const {
static std::string replaceAuxUserInfoSQL =
@@ -2549,7 +2563,8 @@
void SQLiteQueryExecutor::restoreFromMainCompaction(
std::string mainCompactionPath,
- std::string mainCompactionEncryptionKey) const {
+ std::string mainCompactionEncryptionKey,
+ std::string maxVersion) const {
if (!file_exists(mainCompactionPath)) {
throw std::runtime_error("Restore attempt but backup file does not exist.");
@@ -2609,6 +2624,17 @@
set_encryption_key(backupDB, mainCompactionEncryptionKey);
#endif
+ int version = this->getSyncedDatabaseVersion(backupDB).value_or(-1);
+ if (version > std::stoi(maxVersion)) {
+ std::stringstream error_message;
+ error_message << "Failed to restore a backup because it was created "
+ << "with version " << version
+ << " that is newer than the max supported version "
+ << maxVersion << std::endl;
+ sqlite3_close(backupDB);
+ throw std::runtime_error(error_message.str());
+ }
+
sqlite3_backup *backupObj = sqlite3_backup_init(
SQLiteQueryExecutor::getConnection(), "main", backupDB, "main");
if (!backupObj) {
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
@@ -57,7 +57,8 @@
jsi::Value restoreBackupInternal(
jsi::Runtime &rt,
std::string backupSecret,
- std::string backupID);
+ std::string backupID,
+ std::string maxVersion);
virtual jsi::Value getDraft(jsi::Runtime &rt, jsi::String key) override;
virtual jsi::Value
@@ -193,17 +194,21 @@
jsi::Runtime &rt,
jsi::String backupSecret,
jsi::String siweBackupMsg) override;
- virtual jsi::Value
- restoreBackup(jsi::Runtime &rt, jsi::String backupSecret) override;
+ virtual jsi::Value restoreBackup(
+ jsi::Runtime &rt,
+ jsi::String backupSecret,
+ jsi::String maxVersion) override;
virtual jsi::Value restoreSIWEBackup(
jsi::Runtime &rt,
jsi::String backupSecret,
- jsi::String backupID) override;
+ jsi::String backupID,
+ jsi::String maxVersion) override;
virtual jsi::Value restoreBackupData(
jsi::Runtime &rt,
jsi::String backupID,
jsi::String backupDataKey,
- jsi::String backupLogDataKey) override;
+ jsi::String backupLogDataKey,
+ jsi::String maxVersion) override;
virtual jsi::Value
retrieveBackupKeys(jsi::Runtime &rt, jsi::String backupSecret) override;
virtual jsi::Value setSIWEBackupSecrets(
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
@@ -2171,39 +2171,50 @@
jsi::Value CommCoreModule::restoreBackupInternal(
jsi::Runtime &rt,
std::string backupSecret,
- std::string backupID) {
+ std::string backupID,
+ std::string maxVersion) {
return createPromiseAsJSIValue(
rt, [=](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
auto currentID = RustPromiseManager::instance.addPromise(
{promise, this->jsInvoker_, innerRt});
::restoreBackup(
- rust::string(backupSecret), rust::string(backupID), currentID);
+ rust::string(backupSecret),
+ rust::string(backupID),
+ rust::string(maxVersion),
+ currentID);
});
}
-jsi::Value
-CommCoreModule::restoreBackup(jsi::Runtime &rt, jsi::String backupSecret) {
+jsi::Value CommCoreModule::restoreBackup(
+ jsi::Runtime &rt,
+ jsi::String backupSecret,
+ jsi::String maxVersion) {
std::string backupSecretStr = backupSecret.utf8(rt);
- return restoreBackupInternal(rt, backupSecretStr, "");
+ std::string maxVersionStr = maxVersion.utf8(rt);
+ return restoreBackupInternal(rt, backupSecretStr, "", maxVersionStr);
}
jsi::Value CommCoreModule::restoreSIWEBackup(
jsi::Runtime &rt,
jsi::String backupSecret,
- jsi::String backupID) {
+ jsi::String backupID,
+ jsi::String maxVersion) {
std::string backupSecretStr = backupSecret.utf8(rt);
std::string backupIDStr = backupID.utf8(rt);
- return restoreBackupInternal(rt, backupSecretStr, backupIDStr);
+ std::string maxVersionStr = maxVersion.utf8(rt);
+ return restoreBackupInternal(rt, backupSecretStr, backupIDStr, maxVersionStr);
}
jsi::Value CommCoreModule::restoreBackupData(
jsi::Runtime &rt,
jsi::String backupID,
jsi::String backupDataKey,
- jsi::String backupLogDataKey) {
+ jsi::String backupLogDataKey,
+ jsi::String maxVersion) {
std::string backupIDStr = backupID.utf8(rt);
std::string backupDataKeyStr = backupDataKey.utf8(rt);
std::string backupLogDataKeyStr = backupLogDataKey.utf8(rt);
+ std::string maxVersionStr = maxVersion.utf8(rt);
return createPromiseAsJSIValue(
rt, [=](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
auto currentID = RustPromiseManager::instance.addPromise(
@@ -2212,6 +2223,7 @@
rust::string(backupIDStr),
rust::string(backupDataKeyStr),
rust::string(backupLogDataKeyStr),
+ rust::string(maxVersionStr),
currentID);
});
}
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.h
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.h
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.h
@@ -10,6 +10,7 @@
static void restoreFromMainCompaction(
std::string mainCompactionPath,
std::string mainCompactionEncryptionKey,
+ std::string maxVersion,
size_t futureID);
static void restoreFromBackupLog(
const std::vector<std::uint8_t> &backupLog,
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.cpp
@@ -26,11 +26,15 @@
void BackupOperationsExecutor::restoreFromMainCompaction(
std::string mainCompactionPath,
std::string mainCompactionEncryptionKey,
+ std::string maxVersion,
size_t futureID) {
- taskType job = [mainCompactionPath, mainCompactionEncryptionKey, futureID]() {
+ taskType job = [mainCompactionPath,
+ mainCompactionEncryptionKey,
+ maxVersion,
+ futureID]() {
try {
DatabaseManager::getQueryExecutor().restoreFromMainCompaction(
- mainCompactionPath, mainCompactionEncryptionKey);
+ mainCompactionPath, mainCompactionEncryptionKey, maxVersion);
::resolveUnitFuture(futureID);
} catch (const std::exception &e) {
std::string errorDetails = std::string(e.what());
diff --git a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
--- a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
+++ b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
@@ -167,13 +167,13 @@
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->createNewSIWEBackup(rt, args[0].asString(rt), args[1].asString(rt));
}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreBackup(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->restoreBackup(rt, args[0].asString(rt));
+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->restoreBackup(rt, args[0].asString(rt), args[1].asString(rt));
}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreSIWEBackup(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->restoreSIWEBackup(rt, args[0].asString(rt), args[1].asString(rt));
+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->restoreSIWEBackup(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt));
}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreBackupData(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->restoreBackupData(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt));
+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->restoreBackupData(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt));
}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_retrieveBackupKeys(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->retrieveBackupKeys(rt, args[0].asString(rt));
@@ -257,9 +257,9 @@
methodMap_["stopBackupHandler"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_stopBackupHandler};
methodMap_["createNewBackup"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_createNewBackup};
methodMap_["createNewSIWEBackup"] = MethodMetadata {2, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_createNewSIWEBackup};
- methodMap_["restoreBackup"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreBackup};
- methodMap_["restoreSIWEBackup"] = MethodMetadata {2, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreSIWEBackup};
- methodMap_["restoreBackupData"] = MethodMetadata {3, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreBackupData};
+ methodMap_["restoreBackup"] = MethodMetadata {2, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreBackup};
+ methodMap_["restoreSIWEBackup"] = MethodMetadata {3, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreSIWEBackup};
+ methodMap_["restoreBackupData"] = MethodMetadata {4, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreBackupData};
methodMap_["retrieveBackupKeys"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_retrieveBackupKeys};
methodMap_["retrieveLatestSIWEBackupData"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_retrieveLatestSIWEBackupData};
methodMap_["setSIWEBackupSecrets"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setSIWEBackupSecrets};
diff --git a/native/cpp/CommonCpp/_generated/commJSI.h b/native/cpp/CommonCpp/_generated/commJSI.h
--- a/native/cpp/CommonCpp/_generated/commJSI.h
+++ b/native/cpp/CommonCpp/_generated/commJSI.h
@@ -69,9 +69,9 @@
virtual void stopBackupHandler(jsi::Runtime &rt) = 0;
virtual jsi::Value createNewBackup(jsi::Runtime &rt, jsi::String backupSecret) = 0;
virtual jsi::Value createNewSIWEBackup(jsi::Runtime &rt, jsi::String backupSecret, jsi::String siweBackupMsg) = 0;
- virtual jsi::Value restoreBackup(jsi::Runtime &rt, jsi::String backupSecret) = 0;
- virtual jsi::Value restoreSIWEBackup(jsi::Runtime &rt, jsi::String backupSecret, jsi::String backupID) = 0;
- virtual jsi::Value restoreBackupData(jsi::Runtime &rt, jsi::String backupID, jsi::String backupDataKey, jsi::String backupLogDataKey) = 0;
+ virtual jsi::Value restoreBackup(jsi::Runtime &rt, jsi::String backupSecret, jsi::String maxVersion) = 0;
+ virtual jsi::Value restoreSIWEBackup(jsi::Runtime &rt, jsi::String backupSecret, jsi::String backupID, jsi::String maxVersion) = 0;
+ virtual jsi::Value restoreBackupData(jsi::Runtime &rt, jsi::String backupID, jsi::String backupDataKey, jsi::String backupLogDataKey, jsi::String maxVersion) = 0;
virtual jsi::Value retrieveBackupKeys(jsi::Runtime &rt, jsi::String backupSecret) = 0;
virtual jsi::Value retrieveLatestSIWEBackupData(jsi::Runtime &rt) = 0;
virtual jsi::Value setSIWEBackupSecrets(jsi::Runtime &rt, jsi::Object siweBackupSecrets) = 0;
@@ -495,29 +495,29 @@
return bridging::callFromJs<jsi::Value>(
rt, &T::createNewSIWEBackup, jsInvoker_, instance_, std::move(backupSecret), std::move(siweBackupMsg));
}
- jsi::Value restoreBackup(jsi::Runtime &rt, jsi::String backupSecret) override {
+ jsi::Value restoreBackup(jsi::Runtime &rt, jsi::String backupSecret, jsi::String maxVersion) override {
static_assert(
- bridging::getParameterCount(&T::restoreBackup) == 2,
- "Expected restoreBackup(...) to have 2 parameters");
+ bridging::getParameterCount(&T::restoreBackup) == 3,
+ "Expected restoreBackup(...) to have 3 parameters");
return bridging::callFromJs<jsi::Value>(
- rt, &T::restoreBackup, jsInvoker_, instance_, std::move(backupSecret));
+ rt, &T::restoreBackup, jsInvoker_, instance_, std::move(backupSecret), std::move(maxVersion));
}
- jsi::Value restoreSIWEBackup(jsi::Runtime &rt, jsi::String backupSecret, jsi::String backupID) override {
+ jsi::Value restoreSIWEBackup(jsi::Runtime &rt, jsi::String backupSecret, jsi::String backupID, jsi::String maxVersion) override {
static_assert(
- bridging::getParameterCount(&T::restoreSIWEBackup) == 3,
- "Expected restoreSIWEBackup(...) to have 3 parameters");
+ bridging::getParameterCount(&T::restoreSIWEBackup) == 4,
+ "Expected restoreSIWEBackup(...) to have 4 parameters");
return bridging::callFromJs<jsi::Value>(
- rt, &T::restoreSIWEBackup, jsInvoker_, instance_, std::move(backupSecret), std::move(backupID));
+ rt, &T::restoreSIWEBackup, jsInvoker_, instance_, std::move(backupSecret), std::move(backupID), std::move(maxVersion));
}
- jsi::Value restoreBackupData(jsi::Runtime &rt, jsi::String backupID, jsi::String backupDataKey, jsi::String backupLogDataKey) override {
+ jsi::Value restoreBackupData(jsi::Runtime &rt, jsi::String backupID, jsi::String backupDataKey, jsi::String backupLogDataKey, jsi::String maxVersion) override {
static_assert(
- bridging::getParameterCount(&T::restoreBackupData) == 4,
- "Expected restoreBackupData(...) to have 4 parameters");
+ bridging::getParameterCount(&T::restoreBackupData) == 5,
+ "Expected restoreBackupData(...) to have 5 parameters");
return bridging::callFromJs<jsi::Value>(
- rt, &T::restoreBackupData, jsInvoker_, instance_, std::move(backupID), std::move(backupDataKey), std::move(backupLogDataKey));
+ rt, &T::restoreBackupData, jsInvoker_, instance_, std::move(backupID), std::move(backupDataKey), std::move(backupLogDataKey), std::move(maxVersion));
}
jsi::Value retrieveBackupKeys(jsi::Runtime &rt, jsi::String backupSecret) override {
static_assert(
diff --git a/native/native_rust_library/RustBackupExecutor.h b/native/native_rust_library/RustBackupExecutor.h
--- a/native/native_rust_library/RustBackupExecutor.h
+++ b/native/native_rust_library/RustBackupExecutor.h
@@ -14,6 +14,7 @@
void restoreFromMainCompaction(
rust::Str mainCompactionPath,
rust::Str mainCompactionEncryptionKey,
+ rust::Str maxVersion,
size_t futureID);
void restoreFromBackupLog(rust::Vec<std::uint8_t> backupLog, size_t futureID);
diff --git a/native/native_rust_library/RustBackupExecutor.cpp b/native/native_rust_library/RustBackupExecutor.cpp
--- a/native/native_rust_library/RustBackupExecutor.cpp
+++ b/native/native_rust_library/RustBackupExecutor.cpp
@@ -39,10 +39,12 @@
void restoreFromMainCompaction(
rust::Str mainCompactionPath,
rust::Str mainCompactionEncryptionKey,
+ rust::Str maxVersion,
size_t futureID) {
BackupOperationsExecutor::restoreFromMainCompaction(
std::string(mainCompactionPath),
std::string(mainCompactionEncryptionKey),
+ std::string(maxVersion),
futureID);
}
diff --git a/native/native_rust_library/src/backup.rs b/native/native_rust_library/src/backup.rs
--- a/native/native_rust_library/src/backup.rs
+++ b/native/native_rust_library/src/backup.rs
@@ -79,6 +79,7 @@
pub fn restore_backup(
backup_secret: String,
backup_id: String,
+ max_version: String,
promise_id: u32,
) {
RUNTIME.spawn(async move {
@@ -99,6 +100,7 @@
restore_from_main_compaction(
&result.backup_restoration_path.to_string_lossy(),
&result.backup_data_key,
+ &max_version,
future_id,
);
@@ -154,6 +156,7 @@
backup_id: String,
backup_data_key: String,
backup_log_data_key: String,
+ max_version: String,
promise_id: u32,
) {
RUNTIME.spawn(async move {
@@ -178,6 +181,7 @@
restore_from_main_compaction(
&result.backup_restoration_path.to_string_lossy(),
&result.backup_data_key,
+ &max_version,
future_id,
);
diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs
--- a/native/native_rust_library/src/lib.rs
+++ b/native/native_rust_library/src/lib.rs
@@ -419,6 +419,7 @@
fn restore_backup(
backup_secret: String,
backup_id: String,
+ max_version: String,
promise_id: u32,
);
@@ -427,6 +428,7 @@
backup_id: String,
backup_data_key: String,
backup_log_data_key: String,
+ max_version: String,
promise_id: u32,
);
@@ -484,6 +486,7 @@
fn restore_from_main_compaction(
main_compaction_path: &str,
main_compaction_encryption_key: &str,
+ max_version: &str,
future_id: usize,
);
diff --git a/native/qr-code/qr-code-screen.react.js b/native/qr-code/qr-code-screen.react.js
--- a/native/qr-code/qr-code-screen.react.js
+++ b/native/qr-code/qr-code-screen.react.js
@@ -20,6 +20,7 @@
} from './qr-code-utils.js';
import { commCoreModule } from '../native-modules.js';
import type { NavigationRoute } from '../navigation/route-names.js';
+import { persistConfig } from '../redux/persist.js';
import { useStyles } from '../themes/colors.js';
import * as AES from '../utils/aes-crypto-module.js';
import {
@@ -39,6 +40,7 @@
backupID,
backupDataKey,
backupLogDataKey,
+ persistConfig.version.toString(),
);
}
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -136,15 +136,17 @@
backupSecret: string,
siweBackupMsg: string,
) => Promise<void>;
- +restoreBackup: (backupSecret: string) => Promise<string>;
+ +restoreBackup: (backupSecret: string, maxVersion: string) => Promise<string>;
+restoreSIWEBackup: (
backupSecret: string,
backupID: string,
+ maxVersion: string,
) => Promise<string>;
+restoreBackupData: (
backupID: string,
backupDataKey: string,
backupLogDataKey: string,
+ maxVersion: string,
) => Promise<void>;
+retrieveBackupKeys: (backupSecret: string) => Promise<string>;
+retrieveLatestSIWEBackupData: () => Promise<string>;
diff --git a/web/shared-worker/_generated/comm_query_executor.wasm b/web/shared-worker/_generated/comm_query_executor.wasm
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 1:02 AM (19 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693077
Default Alt Text
D12013.diff (23 KB)
Attached To
Mode
D12013: [native] Verify if the backup version is correct
Attached
Detach File
Event Timeline
Log In to Comment