MCPcopy Create free account
hub / github.com/CommE2E/comm / logOutPrimaryDevice

Method logOutPrimaryDevice

native/cpp/CommonCpp/NativeModules/CommRustModule.cpp:448–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446}
447
448jsi::Value CommRustModule::logOutPrimaryDevice(
449 jsi::Runtime &rt,
450 jsi::String userID,
451 jsi::String deviceID,
452 jsi::String accessToken,
453 jsi::String signedDeviceList) {
454 auto userIDRust = jsiStringToRustString(userID, rt);
455 auto deviceIDRust = jsiStringToRustString(deviceID, rt);
456 auto accessTokenRust = jsiStringToRustString(accessToken, rt);
457 auto deviceListRust = jsiStringToRustString(signedDeviceList, rt);
458
459 return createPromiseAsJSIValue(
460 rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
461 std::string error;
462 try {
463 auto currentID = RustPromiseManager::instance.addPromise(
464 {promise, this->jsInvoker_, innerRt});
465 identityLogOutPrimaryDevice(
466 userIDRust,
467 deviceIDRust,
468 accessTokenRust,
469 deviceListRust,
470 currentID);
471 } catch (const std::exception &e) {
472 error = e.what();
473 };
474 if (!error.empty()) {
475 this->jsInvoker_->invokeAsync(
476 [error, promise]() { promise->reject(error); });
477 }
478 });
479}
480
481jsi::Value CommRustModule::logOutSecondaryDevice(
482 jsi::Runtime &rt,

Callers

nothing calls this directly

Calls 4

jsiStringToRustStringFunction · 0.85
addPromiseMethod · 0.80
rejectMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected