Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3332636
D12585.id41753.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D12585.id41753.diff
View Options
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
@@ -98,6 +98,12 @@
jsi::String userID,
jsi::String deviceID,
jsi::String accessToken) override;
+ virtual jsi::Value logOutPrimaryDevice(
+ jsi::Runtime &rt,
+ jsi::String userID,
+ jsi::String deviceID,
+ jsi::String accessToken,
+ jsi::String signedDeviceList) override;
virtual jsi::Value logOutSecondaryDevice(
jsi::Runtime &rt,
jsi::String userID,
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
@@ -427,6 +427,39 @@
});
}
+jsi::Value CommRustModule::logOutPrimaryDevice(
+ jsi::Runtime &rt,
+ jsi::String userID,
+ jsi::String deviceID,
+ jsi::String accessToken,
+ jsi::String signedDeviceList) {
+ auto userIDRust = jsiStringToRustString(userID, rt);
+ auto deviceIDRust = jsiStringToRustString(deviceID, rt);
+ auto accessTokenRust = jsiStringToRustString(accessToken, rt);
+ auto deviceListRust = jsiStringToRustString(signedDeviceList, 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});
+ identityLogOutPrimaryDevice(
+ userIDRust,
+ deviceIDRust,
+ accessTokenRust,
+ deviceListRust,
+ currentID);
+ } catch (const std::exception &e) {
+ error = e.what();
+ };
+ if (!error.empty()) {
+ this->jsInvoker_->invokeAsync(
+ [error, promise]() { promise->reject(error); });
+ }
+ });
+}
+
jsi::Value CommRustModule::logOutSecondaryDevice(
jsi::Runtime &rt,
jsi::String userID,
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
@@ -42,6 +42,9 @@
static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_logOut(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommRustModuleSchemaCxxSpecJSI *>(&turboModule)->logOut(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt));
}
+static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_logOutPrimaryDevice(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ return static_cast<CommRustModuleSchemaCxxSpecJSI *>(&turboModule)->logOutPrimaryDevice(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt));
+}
static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_logOutSecondaryDevice(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommRustModuleSchemaCxxSpecJSI *>(&turboModule)->logOutSecondaryDevice(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt));
}
@@ -109,6 +112,7 @@
methodMap_["deletePasswordUser"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_deletePasswordUser};
methodMap_["deleteWalletUser"] = MethodMetadata {3, __hostFunction_CommRustModuleSchemaCxxSpecJSI_deleteWalletUser};
methodMap_["logOut"] = MethodMetadata {3, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logOut};
+ methodMap_["logOutPrimaryDevice"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logOutPrimaryDevice};
methodMap_["logOutSecondaryDevice"] = MethodMetadata {3, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logOutSecondaryDevice};
methodMap_["getOutboundKeysForUser"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_getOutboundKeysForUser};
methodMap_["getInboundKeysForUser"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_getInboundKeysForUser};
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
@@ -30,6 +30,7 @@
virtual jsi::Value deletePasswordUser(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String password) = 0;
virtual jsi::Value deleteWalletUser(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) = 0;
virtual jsi::Value logOut(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) = 0;
+ virtual jsi::Value logOutPrimaryDevice(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String signedDeviceList) = 0;
virtual jsi::Value logOutSecondaryDevice(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) = 0;
virtual jsi::Value getOutboundKeysForUser(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID) = 0;
virtual jsi::Value getInboundKeysForUser(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID) = 0;
@@ -149,6 +150,14 @@
return bridging::callFromJs<jsi::Value>(
rt, &T::logOut, jsInvoker_, instance_, std::move(userID), std::move(deviceID), std::move(accessToken));
}
+ jsi::Value logOutPrimaryDevice(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String signedDeviceList) override {
+ static_assert(
+ bridging::getParameterCount(&T::logOutPrimaryDevice) == 5,
+ "Expected logOutPrimaryDevice(...) to have 5 parameters");
+
+ return bridging::callFromJs<jsi::Value>(
+ rt, &T::logOutPrimaryDevice, jsInvoker_, instance_, std::move(userID), std::move(deviceID), std::move(accessToken), std::move(signedDeviceList));
+ }
jsi::Value logOutSecondaryDevice(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) override {
static_assert(
bridging::getParameterCount(&T::logOutSecondaryDevice) == 4,
diff --git a/native/schema/CommRustModuleSchema.js b/native/schema/CommRustModuleSchema.js
--- a/native/schema/CommRustModuleSchema.js
+++ b/native/schema/CommRustModuleSchema.js
@@ -93,6 +93,12 @@
deviceID: string,
accessToken: string,
) => Promise<void>;
+ +logOutPrimaryDevice: (
+ userID: string,
+ deviceID: string,
+ accessToken: string,
+ signedDeviceList: string,
+ ) => Promise<void>;
+logOutSecondaryDevice: (
userID: string,
deviceID: string,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 12:37 AM (16 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2559216
Default Alt Text
D12585.id41753.diff (6 KB)
Attached To
Mode
D12585: [native] Add logOutPrimaryDevice to JSI
Attached
Detach File
Event Timeline
Log In to Comment