Page MenuHomePhabricator

D11081.diff
No OneTemporary

D11081.diff

diff --git a/native/cpp/CommonCpp/NativeModules/CommRustModule.h b/native/cpp/CommonCpp/NativeModules/CommRustModule.h
--- a/native/cpp/CommonCpp/NativeModules/CommRustModule.h
+++ b/native/cpp/CommonCpp/NativeModules/CommRustModule.h
@@ -36,6 +36,18 @@
jsi::String notifPrekeySignature,
jsi::Array contentOneTimeKeys,
jsi::Array notifOneTimeKeys) override;
+ virtual jsi::Value registerWalletUser(
+ 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) override;
virtual jsi::Value logInWalletUser(
jsi::Runtime &rt,
jsi::String siweMessage,
diff --git a/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp b/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp
--- a/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp
+++ b/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp
@@ -137,6 +137,59 @@
});
}
+jsi::Value CommRustModule::registerWalletUser(
+ 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) {
+ auto siweMessageRust = jsiStringToRustString(siweMessage, rt);
+ auto siweSignatureRust = jsiStringToRustString(siweSignature, rt);
+ auto keyPayloadRust = jsiStringToRustString(keyPayload, rt);
+ auto keyPayloadSignatureRust = jsiStringToRustString(keyPayloadSignature, rt);
+ auto contentPrekeyRust = jsiStringToRustString(contentPrekey, rt);
+ auto contentPrekeySignatureRust =
+ jsiStringToRustString(contentPrekeySignature, rt);
+ auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt);
+ auto notifPrekeySignatureRust =
+ jsiStringToRustString(notifPrekeySignature, rt);
+ auto contentOneTimeKeysRust = jsiStringArrayToRustVec(contentOneTimeKeys, rt);
+ auto notifOneTimeKeysRust = jsiStringArrayToRustVec(notifOneTimeKeys, 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});
+ identityRegisterWalletUser(
+ siweMessageRust,
+ siweSignatureRust,
+ keyPayloadRust,
+ keyPayloadSignatureRust,
+ contentPrekeyRust,
+ contentPrekeySignatureRust,
+ notifPrekeyRust,
+ notifPrekeySignatureRust,
+ contentOneTimeKeysRust,
+ notifOneTimeKeysRust,
+ currentID);
+ } catch (const std::exception &e) {
+ error = e.what();
+ };
+ if (!error.empty()) {
+ this->jsInvoker_->invokeAsync(
+ [error, promise]() { promise->reject(error); });
+ }
+ });
+}
+
jsi::Value CommRustModule::logInWalletUser(
jsi::Runtime &rt,
jsi::String siweMessage,
diff --git a/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp b/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp
--- a/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp
+++ b/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp
@@ -21,6 +21,9 @@
static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInPasswordUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommRustModuleSchemaCxxSpecJSI *>(&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_CommRustModuleSchemaCxxSpecJSI_registerWalletUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ return static_cast<CommRustModuleSchemaCxxSpecJSI *>(&turboModule)->registerWalletUser(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_CommRustModuleSchemaCxxSpecJSI_logInWalletUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommRustModuleSchemaCxxSpecJSI *>(&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));
}
@@ -60,6 +63,7 @@
methodMap_["generateNonce"] = MethodMetadata {0, __hostFunction_CommRustModuleSchemaCxxSpecJSI_generateNonce};
methodMap_["registerPasswordUser"] = MethodMetadata {10, __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerPasswordUser};
methodMap_["logInPasswordUser"] = MethodMetadata {10, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInPasswordUser};
+ methodMap_["registerWalletUser"] = MethodMetadata {10, __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerWalletUser};
methodMap_["logInWalletUser"] = MethodMetadata {10, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInWalletUser};
methodMap_["updatePassword"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_updatePassword};
methodMap_["deleteUser"] = MethodMetadata {3, __hostFunction_CommRustModuleSchemaCxxSpecJSI_deleteUser};
diff --git a/native/cpp/CommonCpp/_generated/rustJSI.h b/native/cpp/CommonCpp/_generated/rustJSI.h
--- a/native/cpp/CommonCpp/_generated/rustJSI.h
+++ b/native/cpp/CommonCpp/_generated/rustJSI.h
@@ -23,6 +23,7 @@
virtual jsi::Value generateNonce(jsi::Runtime &rt) = 0;
virtual jsi::Value registerPasswordUser(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 registerWalletUser(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) = 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) = 0;
virtual jsi::Value updatePassword(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String password) = 0;
virtual jsi::Value deleteUser(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) = 0;
@@ -79,6 +80,14 @@
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 registerWalletUser(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) override {
+ static_assert(
+ bridging::getParameterCount(&T::registerWalletUser) == 11,
+ "Expected registerWalletUser(...) to have 11 parameters");
+
+ return bridging::callFromJs<jsi::Value>(
+ rt, &T::registerWalletUser, 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));
+ }
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) override {
static_assert(
bridging::getParameterCount(&T::logInWalletUser) == 11,
diff --git a/native/schema/CommRustModuleSchema.js b/native/schema/CommRustModuleSchema.js
--- a/native/schema/CommRustModuleSchema.js
+++ b/native/schema/CommRustModuleSchema.js
@@ -31,6 +31,18 @@
contentOneTimeKeys: $ReadOnlyArray<string>,
notifOneTimeKeys: $ReadOnlyArray<string>,
) => Promise<string>;
+ +registerWalletUser: (
+ siweMessage: string,
+ siweSignature: 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,

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 11:34 AM (21 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2579482
Default Alt Text
D11081.diff (10 KB)

Event Timeline