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

Method getOutboundKeysForUser

native/cpp/CommonCpp/NativeModules/CommRustModule.cpp:508–542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506}
507
508jsi::Value CommRustModule::getOutboundKeysForUser(
509 jsi::Runtime &rt,
510 jsi::String authUserID,
511 jsi::String authDeviceID,
512 jsi::String authAccessToken,
513 jsi::String userID,
514 jsi::Array selectedDeviceIDs) {
515 auto authUserIDRust = jsiStringToRustString(authUserID, rt);
516 auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt);
517 auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt);
518 auto userIDRust = jsiStringToRustString(userID, rt);
519 auto selectedDeviceIDsRust = jsiStringArrayToRustVec(selectedDeviceIDs, rt);
520
521 return createPromiseAsJSIValue(
522 rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
523 std::string error;
524 try {
525 auto currentID = RustPromiseManager::instance.addPromise(
526 {promise, this->jsInvoker_, innerRt});
527 identityGetOutboundKeysForUser(
528 authUserIDRust,
529 authDeviceIDRust,
530 authAccessTokenRust,
531 userIDRust,
532 selectedDeviceIDsRust,
533 currentID);
534 } catch (const std::exception &e) {
535 error = e.what();
536 };
537 if (!error.empty()) {
538 this->jsInvoker_->invokeAsync(
539 [error, promise]() { promise->reject(error); });
540 }
541 });
542}
543
544jsi::Value CommRustModule::getInboundKeysForUser(
545 jsi::Runtime &rt,

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected