Page MenuHomePhabricator

D12585.id41753.diff
No OneTemporary

D12585.id41753.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
@@ -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

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)

Event Timeline