MCPcopy Create free account
hub / github.com/CommE2E/comm / getSIWEBackupMessage

Function getSIWEBackupMessage

native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp:2345–2367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2343}
2344
2345std::string getSIWEBackupMessage() {
2346 std::promise<std::string> backupSIWEMessagePromise;
2347 std::future<std::string> backupSIWEMessageFuture =
2348 backupSIWEMessagePromise.get_future();
2349 GlobalDBSingleton::instance.scheduleOrRunCancellable(
2350 [&backupSIWEMessagePromise]() {
2351 try {
2352 std::string backupSecrets =
2353 DatabaseManager::getQueryExecutor().getMetadata(
2354 "siweBackupSecrets");
2355 if (!backupSecrets.size()) {
2356 backupSIWEMessagePromise.set_value("");
2357 } else {
2358 folly::dynamic backupSecretsJSON = folly::parseJson(backupSecrets);
2359 std::string message = backupSecretsJSON["message"].asString();
2360 backupSIWEMessagePromise.set_value(message);
2361 }
2362 } catch (std::system_error &e) {
2363 backupSIWEMessagePromise.set_exception(std::make_exception_ptr(e));
2364 }
2365 });
2366 return backupSIWEMessageFuture.get();
2367}
2368
2369jsi::Value CommCoreModule::createFullBackup(
2370 jsi::Runtime &rt,

Callers 3

createFullBackupMethod · 0.85
createUserKeysBackupMethod · 0.85
restoreUserMethod · 0.85

Calls 3

getMethod · 0.65
getMetadataMethod · 0.45

Tested by

no test coverage detected