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

Method uploadOneTimeKeys

native/cpp/CommonCpp/NativeModules/CommRustModule.cpp:598–634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596}
597
598jsi::Value CommRustModule::uploadOneTimeKeys(
599 jsi::Runtime &rt,
600 jsi::String authUserID,
601 jsi::String authDeviceID,
602 jsi::String authAccessToken,
603 jsi::Array contentOneTimePreKeys,
604 jsi::Array notifOneTimePreKeys) {
605 auto authUserIDRust = jsiStringToRustString(authUserID, rt);
606 auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt);
607 auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt);
608 auto contentOneTimePreKeysRust =
609 jsiStringArrayToRustVec(contentOneTimePreKeys, rt);
610 auto notifOneTimePreKeysRust =
611 jsiStringArrayToRustVec(notifOneTimePreKeys, rt);
612
613 return createPromiseAsJSIValue(
614 rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
615 std::string error;
616 try {
617 auto currentID = RustPromiseManager::instance.addPromise(
618 {promise, this->jsInvoker_, innerRt});
619 identityUploadOneTimeKeys(
620 authUserIDRust,
621 authDeviceIDRust,
622 authAccessTokenRust,
623 contentOneTimePreKeysRust,
624 notifOneTimePreKeysRust,
625 currentID);
626 } catch (const std::exception &e) {
627 error = e.what();
628 };
629 if (!error.empty()) {
630 this->jsInvoker_->invokeAsync(
631 [error, promise]() { promise->reject(error); });
632 }
633 });
634}
635
636jsi::Value CommRustModule::getKeyserverKeys(
637 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