Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3526305
D8654.id29291.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
18 KB
Referenced Files
None
Subscribers
None
D8654.id29291.diff
View Options
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
@@ -4,7 +4,6 @@
#include "../Tools/CommSecureStore.h"
#include "../Tools/WorkerThread.h"
#include "../_generated/commJSI.h"
-#include "JSIRust.h"
#include "PersistentStorageUtilities/DataStores/DraftStore.h"
#include "PersistentStorageUtilities/DataStores/MessageStore.h"
#include "PersistentStorageUtilities/DataStores/ReportStore.h"
@@ -86,44 +85,6 @@
virtual jsi::Value clearSensitiveData(jsi::Runtime &rt) override;
virtual bool checkIfDatabaseNeedsDeletion(jsi::Runtime &rt) override;
virtual void reportDBOperationsFailure(jsi::Runtime &rt) override;
- virtual jsi::Value generateNonce(jsi::Runtime &rt) override;
- virtual jsi::Value registerUser(
- jsi::Runtime &rt,
- jsi::String username,
- jsi::String password,
- jsi::String keyPayload,
- jsi::String keyPayloadSignature,
- jsi::String contentPrekey,
- jsi::String contentPrekeySignature,
- jsi::String notifPrekey,
- jsi::String notifPrekeySignature,
- jsi::Array contentOneTimeKeys,
- jsi::Array notifOneTimeKeys) override;
- virtual jsi::Value loginPasswordUser(
- jsi::Runtime &rt,
- jsi::String username,
- jsi::String password,
- jsi::String keyPayload,
- jsi::String keyPayloadSignature,
- jsi::String contentPrekey,
- jsi::String contentPrekeySignature,
- jsi::String notifPrekey,
- jsi::String notifPrekeySignature,
- jsi::Array contentOneTimeKeys,
- jsi::Array notifOneTimeKeys) override;
- virtual jsi::Value loginWalletUser(
- jsi::Runtime &rt,
- jsi::String siweMessage,
- jsi::String siweSignature,
- jsi::String keyPayload,
- jsi::String keyPayloadSignature,
- jsi::String contentPrekey,
- jsi::String contentPrekeySignature,
- jsi::String notifPrekey,
- jsi::String notifPrekeySignature,
- jsi::Array contentOneTimeKeys,
- jsi::Array notifOneTimeKeys,
- jsi::String socialProof) override;
public:
CommCoreModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
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
@@ -4,10 +4,8 @@
#include "BaseDataStore.h"
#include "DatabaseManager.h"
#include "InternalModules/GlobalDBSingleton.h"
-#include "InternalModules/RustPromiseManager.h"
#include "NativeModuleUtils.h"
#include "TerminateApp.h"
-#include "lib.rs.h"
#include <ReactCommon/TurboModuleUtils.h>
#include <folly/dynamic.h>
@@ -806,164 +804,4 @@
DatabaseManager::reportDBOperationsFailure();
}
-jsi::Value CommCoreModule::generateNonce(jsi::Runtime &rt) {
- return createPromiseAsJSIValue(
- rt, [this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
- std::string error;
- try {
- auto currentID = RustPromiseManager::instance.addPromise(
- promise, this->jsInvoker_, innerRt);
- identityGenerateNonce(currentID);
- } catch (const std::exception &e) {
- error = e.what();
- };
- });
-}
-
-jsi::Value CommCoreModule::registerUser(
- jsi::Runtime &rt,
- jsi::String username,
- jsi::String password,
- jsi::String keyPayload,
- jsi::String keyPayloadSignature,
- jsi::String contentPrekey,
- jsi::String contentPrekeySignature,
- jsi::String notifPrekey,
- jsi::String notifPrekeySignature,
- jsi::Array contentOneTimeKeys,
- jsi::Array notifOneTimeKeys) {
- return createPromiseAsJSIValue(
- rt,
- [this,
- &username,
- &password,
- &keyPayload,
- &keyPayloadSignature,
- &contentPrekey,
- &contentPrekeySignature,
- ¬ifPrekey,
- ¬ifPrekeySignature,
- &contentOneTimeKeys,
- ¬ifOneTimeKeys](
- jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
- std::string error;
- try {
- auto currentID = RustPromiseManager::instance.addPromise(
- promise, this->jsInvoker_, innerRt);
- identityRegisterUser(
- jsiStringToRustString(username, innerRt),
- jsiStringToRustString(password, innerRt),
- jsiStringToRustString(keyPayload, innerRt),
- jsiStringToRustString(keyPayloadSignature, innerRt),
- jsiStringToRustString(contentPrekey, innerRt),
- jsiStringToRustString(contentPrekeySignature, innerRt),
- jsiStringToRustString(notifPrekey, innerRt),
- jsiStringToRustString(notifPrekeySignature, innerRt),
- jsiStringArrayToRustVec(contentOneTimeKeys, innerRt),
- jsiStringArrayToRustVec(notifOneTimeKeys, innerRt),
- currentID);
- } catch (const std::exception &e) {
- error = e.what();
- };
- });
-}
-
-jsi::Value CommCoreModule::loginPasswordUser(
- jsi::Runtime &rt,
- jsi::String username,
- jsi::String password,
- jsi::String keyPayload,
- jsi::String keyPayloadSignature,
- jsi::String contentPrekey,
- jsi::String contentPrekeySignature,
- jsi::String notifPrekey,
- jsi::String notifPrekeySignature,
- jsi::Array contentOneTimeKeys,
- jsi::Array notifOneTimeKeys) {
- return createPromiseAsJSIValue(
- rt,
- [this,
- &username,
- &password,
- &keyPayload,
- &keyPayloadSignature,
- &contentPrekey,
- &contentPrekeySignature,
- ¬ifPrekey,
- ¬ifPrekeySignature,
- &contentOneTimeKeys,
- ¬ifOneTimeKeys](
- jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
- std::string error;
- try {
- auto currentID = RustPromiseManager::instance.addPromise(
- promise, this->jsInvoker_, innerRt);
- identityLoginPasswordUser(
- jsiStringToRustString(username, innerRt),
- jsiStringToRustString(password, innerRt),
- jsiStringToRustString(keyPayload, innerRt),
- jsiStringToRustString(keyPayloadSignature, innerRt),
- jsiStringToRustString(contentPrekey, innerRt),
- jsiStringToRustString(contentPrekeySignature, innerRt),
- jsiStringToRustString(notifPrekey, innerRt),
- jsiStringToRustString(notifPrekeySignature, innerRt),
- jsiStringArrayToRustVec(contentOneTimeKeys, innerRt),
- jsiStringArrayToRustVec(notifOneTimeKeys, innerRt),
- currentID);
- } catch (const std::exception &e) {
- error = e.what();
- };
- });
-}
-
-jsi::Value CommCoreModule::loginWalletUser(
- jsi::Runtime &rt,
- jsi::String siweMessage,
- jsi::String siweSignature,
- jsi::String keyPayload,
- jsi::String keyPayloadSignature,
- jsi::String contentPrekey,
- jsi::String contentPrekeySignature,
- jsi::String notifPrekey,
- jsi::String notifPrekeySignature,
- jsi::Array contentOneTimeKeys,
- jsi::Array notifOneTimeKeys,
- jsi::String socialProof) {
- return createPromiseAsJSIValue(
- rt,
- [this,
- &siweMessage,
- &siweSignature,
- &keyPayload,
- &keyPayloadSignature,
- &contentPrekey,
- &contentPrekeySignature,
- ¬ifPrekey,
- ¬ifPrekeySignature,
- &contentOneTimeKeys,
- ¬ifOneTimeKeys,
- &socialProof](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
- std::string error;
- try {
- auto currentID = RustPromiseManager::instance.addPromise(
- promise, this->jsInvoker_, innerRt);
- identityLoginWalletUser(
- jsiStringToRustString(siweMessage, innerRt),
- jsiStringToRustString(siweSignature, innerRt),
- jsiStringToRustString(keyPayload, innerRt),
- jsiStringToRustString(keyPayloadSignature, innerRt),
- jsiStringToRustString(contentPrekey, innerRt),
- jsiStringToRustString(contentPrekeySignature, innerRt),
- jsiStringToRustString(notifPrekey, innerRt),
- jsiStringToRustString(notifPrekeySignature, innerRt),
- jsiStringArrayToRustVec(contentOneTimeKeys, innerRt),
- jsiStringArrayToRustVec(notifOneTimeKeys, innerRt),
- jsiStringToRustString(socialProof, innerRt),
- currentID);
- } catch (const std::exception &e) {
- error = e.what();
- };
- });
-}
-
} // namespace comm
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
@@ -107,18 +107,6 @@
static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->reportDBOperationsFailure(rt);
return jsi::Value::undefined();
}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_generateNonce(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->generateNonce(rt);
-}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_registerUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->registerUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asObject(rt).asArray(rt), args[9].asObject(rt).asArray(rt));
-}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_loginPasswordUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->loginPasswordUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asObject(rt).asArray(rt), args[9].asObject(rt).asArray(rt));
-}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_loginWalletUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->loginWalletUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asObject(rt).asArray(rt), args[9].asObject(rt).asArray(rt), args[10].asString(rt));
-}
CommCoreModuleSchemaCxxSpecJSI::CommCoreModuleSchemaCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
: TurboModule("CommTurboModule", jsInvoker) {
@@ -152,10 +140,6 @@
methodMap_["clearSensitiveData"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_clearSensitiveData};
methodMap_["checkIfDatabaseNeedsDeletion"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_checkIfDatabaseNeedsDeletion};
methodMap_["reportDBOperationsFailure"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_reportDBOperationsFailure};
- methodMap_["generateNonce"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_generateNonce};
- methodMap_["registerUser"] = MethodMetadata {10, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_registerUser};
- methodMap_["loginPasswordUser"] = MethodMetadata {10, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_loginPasswordUser};
- methodMap_["loginWalletUser"] = MethodMetadata {11, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_loginWalletUser};
}
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
@@ -50,10 +50,6 @@
virtual jsi::Value clearSensitiveData(jsi::Runtime &rt) = 0;
virtual bool checkIfDatabaseNeedsDeletion(jsi::Runtime &rt) = 0;
virtual void reportDBOperationsFailure(jsi::Runtime &rt) = 0;
- virtual jsi::Value generateNonce(jsi::Runtime &rt) = 0;
- virtual jsi::Value registerUser(jsi::Runtime &rt, jsi::String username, jsi::String password, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) = 0;
- virtual jsi::Value loginPasswordUser(jsi::Runtime &rt, jsi::String username, jsi::String password, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) = 0;
- virtual jsi::Value loginWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys, jsi::String socialProof) = 0;
};
@@ -315,38 +311,6 @@
return bridging::callFromJs<void>(
rt, &T::reportDBOperationsFailure, jsInvoker_, instance_);
}
- jsi::Value generateNonce(jsi::Runtime &rt) override {
- static_assert(
- bridging::getParameterCount(&T::generateNonce) == 1,
- "Expected generateNonce(...) to have 1 parameters");
-
- return bridging::callFromJs<jsi::Value>(
- rt, &T::generateNonce, jsInvoker_, instance_);
- }
- jsi::Value registerUser(jsi::Runtime &rt, jsi::String username, jsi::String password, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) override {
- static_assert(
- bridging::getParameterCount(&T::registerUser) == 11,
- "Expected registerUser(...) to have 11 parameters");
-
- return bridging::callFromJs<jsi::Value>(
- rt, &T::registerUser, jsInvoker_, instance_, std::move(username), std::move(password), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys));
- }
- jsi::Value loginPasswordUser(jsi::Runtime &rt, jsi::String username, jsi::String password, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) override {
- static_assert(
- bridging::getParameterCount(&T::loginPasswordUser) == 11,
- "Expected loginPasswordUser(...) to have 11 parameters");
-
- return bridging::callFromJs<jsi::Value>(
- rt, &T::loginPasswordUser, jsInvoker_, instance_, std::move(username), std::move(password), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys));
- }
- jsi::Value loginWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys, jsi::String socialProof) override {
- static_assert(
- bridging::getParameterCount(&T::loginWalletUser) == 12,
- "Expected loginWalletUser(...) to have 12 parameters");
-
- return bridging::callFromJs<jsi::Value>(
- rt, &T::loginWalletUser, jsInvoker_, instance_, std::move(siweMessage), std::move(siweSignature), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys), std::move(socialProof));
- }
private:
T *instance_;
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -79,44 +79,6 @@
+clearSensitiveData: () => Promise<void>;
+checkIfDatabaseNeedsDeletion: () => boolean;
+reportDBOperationsFailure: () => void;
- +generateNonce: () => Promise<string>;
- +registerUser: (
- username: string,
- password: string,
- keyPayload: string,
- keyPayloadSignature: string,
- contentPrekey: string,
- contentPrekeySignature: string,
- notifPrekey: string,
- notifPrekeySignature: string,
- contentOneTimeKeys: $ReadOnlyArray<string>,
- notifOneTimeKeys: $ReadOnlyArray<string>,
- ) => Promise<string>;
- +loginPasswordUser: (
- username: string,
- password: string,
- keyPayload: string,
- keyPayloadSignature: string,
- contentPrekey: string,
- contentPrekeySignature: string,
- notifPrekey: string,
- notifPrekeySignature: string,
- contentOneTimeKeys: $ReadOnlyArray<string>,
- notifOneTimeKeys: $ReadOnlyArray<string>,
- ) => Promise<string>;
- +loginWalletUser: (
- siweMessage: string,
- siweSignature: string,
- keyPayload: string,
- keyPayloadSignature: string,
- contentPrekey: string,
- contentPrekeySignature: string,
- notifPrekey: string,
- notifPrekeySignature: string,
- contentOneTimeKeys: $ReadOnlyArray<string>,
- notifOneTimeKeys: $ReadOnlyArray<string>,
- socialProof: string,
- ) => Promise<string>;
}
export default (TurboModuleRegistry.getEnforcing<Spec>(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 9:32 PM (3 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2700334
Default Alt Text
D8654.id29291.diff (18 KB)
Attached To
Mode
D8654: [native] remove rust related methods from CommCoreModule
Attached
Detach File
Event Timeline
Log In to Comment