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 @@ -60,11 +60,6 @@ jsi::Runtime &rt, std::string backupSecret, std::string backupMessage); - jsi::Value restoreBackupInternal( - jsi::Runtime &rt, - std::string backupSecret, - std::string backupID, - std::string maxVersion); virtual jsi::Value getDraft(jsi::Runtime &rt, jsi::String key) override; virtual jsi::Value @@ -230,11 +225,6 @@ jsi::String backupSecret, jsi::String maxVersion, jsi::String backupID) override; - virtual jsi::Value restoreSIWEBackup( - jsi::Runtime &rt, - jsi::String backupSecret, - jsi::String backupID, - jsi::String maxVersion) override; virtual jsi::Value restoreBackupData( jsi::Runtime &rt, jsi::String backupID, @@ -249,7 +239,6 @@ virtual jsi::Value setSIWEBackupSecrets( jsi::Runtime &rt, jsi::Object siweBackupSecrets) override; - virtual jsi::Value retrieveLatestSIWEBackupData(jsi::Runtime &rt) override; virtual jsi::Value getSIWEBackupSecrets(jsi::Runtime &rt) override; virtual jsi::Value getAllInboundP2PMessages(jsi::Runtime &rt) override; virtual jsi::Value 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 @@ -2554,23 +2554,6 @@ return createNewBackupInternal(rt, backupSecretStr, siweBackupMsgStr); } -jsi::Value CommCoreModule::restoreBackupInternal( - jsi::Runtime &rt, - std::string backupSecret, - std::string backupID, - std::string maxVersion) { - return createPromiseAsJSIValue( - rt, [=](jsi::Runtime &innerRt, std::shared_ptr promise) { - auto currentID = RustPromiseManager::instance.addPromise( - {promise, this->jsInvoker_, innerRt}); - ::restoreBackup( - rust::string(backupSecret), - rust::string(backupID), - rust::string(maxVersion), - currentID); - }); -} - jsi::Value CommCoreModule::restoreBackup( jsi::Runtime &rt, jsi::String backupSecret, @@ -2580,18 +2563,16 @@ std::string maxVersionStr = maxVersion.utf8(rt); std::string backupIDStr = backupID.utf8(rt); - return restoreBackupInternal(rt, backupSecretStr, backupIDStr, maxVersionStr); -} - -jsi::Value CommCoreModule::restoreSIWEBackup( - jsi::Runtime &rt, - jsi::String backupSecret, - jsi::String backupID, - jsi::String maxVersion) { - std::string backupSecretStr = backupSecret.utf8(rt); - std::string backupIDStr = backupID.utf8(rt); - std::string maxVersionStr = maxVersion.utf8(rt); - return restoreBackupInternal(rt, backupSecretStr, backupIDStr, maxVersionStr); + return createPromiseAsJSIValue( + rt, [=](jsi::Runtime &innerRt, std::shared_ptr promise) { + auto currentID = RustPromiseManager::instance.addPromise( + {promise, this->jsInvoker_, innerRt}); + ::restoreBackup( + rust::string(backupSecretStr), + rust::string(backupIDStr), + rust::string(maxVersionStr), + currentID); + }); } jsi::Value CommCoreModule::restoreBackupData( @@ -2640,15 +2621,6 @@ }); } -jsi::Value CommCoreModule::retrieveLatestSIWEBackupData(jsi::Runtime &rt) { - return createPromiseAsJSIValue( - rt, [=](jsi::Runtime &innerRt, std::shared_ptr promise) { - auto currentID = RustPromiseManager::instance.addPromise( - {promise, this->jsInvoker_, innerRt}); - ::retrieveLatestSIWEBackupData(currentID); - }); -} - jsi::Value CommCoreModule::setSIWEBackupSecrets( jsi::Runtime &rt, jsi::Object siweBackupSecrets) { 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 @@ -190,9 +190,6 @@ static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreBackup(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->restoreBackup(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt)); } -static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_restoreSIWEBackup(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { - return static_cast(&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(&turboModule)->restoreBackupData(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt)); } @@ -202,9 +199,6 @@ static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_retrieveLatestBackupInfo(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->retrieveLatestBackupInfo(rt, args[0].asString(rt)); } -static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_retrieveLatestSIWEBackupData(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { - return static_cast(&turboModule)->retrieveLatestSIWEBackupData(rt); -} static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setSIWEBackupSecrets(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->setSIWEBackupSecrets(rt, args[0].asObject(rt)); } @@ -307,11 +301,9 @@ methodMap_["createNewBackup"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_createNewBackup}; methodMap_["createNewSIWEBackup"] = MethodMetadata {2, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_createNewSIWEBackup}; methodMap_["restoreBackup"] = MethodMetadata {3, __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_["retrieveLatestBackupInfo"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_retrieveLatestBackupInfo}; - methodMap_["retrieveLatestSIWEBackupData"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_retrieveLatestSIWEBackupData}; methodMap_["setSIWEBackupSecrets"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_setSIWEBackupSecrets}; methodMap_["getSIWEBackupSecrets"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getSIWEBackupSecrets}; methodMap_["getAllInboundP2PMessages"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getAllInboundP2PMessages}; 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 @@ -77,11 +77,9 @@ 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, jsi::String maxVersion, jsi::String backupID) = 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 retrieveLatestBackupInfo(jsi::Runtime &rt, jsi::String userIdentifier) = 0; - virtual jsi::Value retrieveLatestSIWEBackupData(jsi::Runtime &rt) = 0; virtual jsi::Value setSIWEBackupSecrets(jsi::Runtime &rt, jsi::Object siweBackupSecrets) = 0; virtual jsi::Value getSIWEBackupSecrets(jsi::Runtime &rt) = 0; virtual jsi::Value getAllInboundP2PMessages(jsi::Runtime &rt) = 0; @@ -573,14 +571,6 @@ return bridging::callFromJs( rt, &T::restoreBackup, jsInvoker_, instance_, std::move(backupSecret), std::move(maxVersion), std::move(backupID)); } - jsi::Value restoreSIWEBackup(jsi::Runtime &rt, jsi::String backupSecret, jsi::String backupID, jsi::String maxVersion) override { - static_assert( - bridging::getParameterCount(&T::restoreSIWEBackup) == 4, - "Expected restoreSIWEBackup(...) to have 4 parameters"); - - return bridging::callFromJs( - 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, jsi::String maxVersion) override { static_assert( bridging::getParameterCount(&T::restoreBackupData) == 5, @@ -605,14 +595,6 @@ return bridging::callFromJs( rt, &T::retrieveLatestBackupInfo, jsInvoker_, instance_, std::move(userIdentifier)); } - jsi::Value retrieveLatestSIWEBackupData(jsi::Runtime &rt) override { - static_assert( - bridging::getParameterCount(&T::retrieveLatestSIWEBackupData) == 1, - "Expected retrieveLatestSIWEBackupData(...) to have 1 parameters"); - - return bridging::callFromJs( - rt, &T::retrieveLatestSIWEBackupData, jsInvoker_, instance_); - } jsi::Value setSIWEBackupSecrets(jsi::Runtime &rt, jsi::Object siweBackupSecrets) override { static_assert( bridging::getParameterCount(&T::setSIWEBackupSecrets) == 2, 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 @@ -229,51 +229,6 @@ siwe_backup_msg_issued_at, }) } - pub fn retrieve_latest_siwe_backup_data(promise_id: u32) { - RUNTIME.spawn(async move { - let result = download_latest_backup_id() - .await - .map_err(|err| err.to_string()); - - let result = match result { - Ok(result) => result, - Err(error) => { - string_callback(error, promise_id, "".to_string()); - return; - } - }; - - let LatestBackupInfoResponse { - backup_id, - user_id, - siwe_backup_msg, - } = result; - - let siwe_backup_data = match siwe_backup_msg { - Some(siwe_backup_msg_value) => { - match get_siwe_backup_data_from_msg(backup_id, siwe_backup_msg_value) - { - Ok(data) => data, - Err(err) => { - string_callback(err, promise_id, "".to_string()); - return; - } - } - } - None => { - string_callback( - "Backup message unavailable".to_string(), - promise_id, - "".to_string(), - ); - return; - } - }; - - let serialize_result = serde_json::to_string(&siwe_backup_data); - handle_string_result_as_callback(serialize_result, promise_id); - }); - } pub fn retrieve_latest_backup_info(user_identifier: String, promise_id: u32) { RUNTIME.spawn(async move { 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 @@ -456,9 +456,6 @@ #[cxx_name = "retrieveBackupKeys"] fn retrieve_backup_keys(backup_secret: String, promise_id: u32); - #[cxx_name = "retrieveLatestSIWEBackupData"] - fn retrieve_latest_siwe_backup_data(promise_id: u32); - #[cxx_name = "retrieveLatestBackupInfo"] fn retrieve_latest_backup_info(user_identifier: String, promise_id: u32); } diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js --- a/native/schema/CommCoreModuleSchema.js +++ b/native/schema/CommCoreModuleSchema.js @@ -166,11 +166,6 @@ maxVersion: string, backupID: string, ) => Promise; - +restoreSIWEBackup: ( - backupSecret: string, - backupID: string, - maxVersion: string, - ) => Promise; +restoreBackupData: ( backupID: string, backupDataKey: string, @@ -179,7 +174,6 @@ ) => Promise; +retrieveBackupKeys: (backupSecret: string) => Promise; +retrieveLatestBackupInfo: (userIdentifier: string) => Promise; - +retrieveLatestSIWEBackupData: () => Promise; +setSIWEBackupSecrets: (siweBackupSecrets: Object) => Promise; +getSIWEBackupSecrets: () => Promise; +getAllInboundP2PMessages: () => Promise>;