Page MenuHomePhabricator

D7707.diff
No OneTemporary

D7707.diff

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
@@ -78,6 +78,18 @@
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;
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
@@ -1297,4 +1297,52 @@
});
}
+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,
+ &notifPrekey,
+ &notifPrekeySignature,
+ &contentOneTimeKeys,
+ &notifOneTimeKeys](
+ 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();
+ };
+ });
+}
+
} // 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
@@ -100,6 +100,9 @@
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));
+}
CommCoreModuleSchemaCxxSpecJSI::CommCoreModuleSchemaCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
: TurboModule("CommTurboModule", jsInvoker) {
@@ -131,6 +134,7 @@
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};
}
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
@@ -48,6 +48,7 @@
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;
};
@@ -293,6 +294,14 @@
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));
+ }
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,6 +79,18 @@
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>;
}
export default (TurboModuleRegistry.getEnforcing<Spec>(

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 3:53 PM (20 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2601528
Default Alt Text
D7707.diff (7 KB)

Event Timeline