| 542 | } |
| 543 | |
| 544 | jsi::Value CommRustModule::getInboundKeysForUser( |
| 545 | jsi::Runtime &rt, |
| 546 | jsi::String authUserID, |
| 547 | jsi::String authDeviceID, |
| 548 | jsi::String authAccessToken, |
| 549 | jsi::String userID, |
| 550 | jsi::Array selectedDeviceIDs) { |
| 551 | auto authUserIDRust = jsiStringToRustString(authUserID, rt); |
| 552 | auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt); |
| 553 | auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt); |
| 554 | auto userIDRust = jsiStringToRustString(userID, rt); |
| 555 | auto selectedDeviceIDsRust = jsiStringArrayToRustVec(selectedDeviceIDs, rt); |
| 556 | |
| 557 | return createPromiseAsJSIValue( |
| 558 | rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) { |
| 559 | std::string error; |
| 560 | try { |
| 561 | auto currentID = RustPromiseManager::instance.addPromise( |
| 562 | {promise, this->jsInvoker_, innerRt}); |
| 563 | identityGetInboundKeysForUser( |
| 564 | authUserIDRust, |
| 565 | authDeviceIDRust, |
| 566 | authAccessTokenRust, |
| 567 | userIDRust, |
| 568 | selectedDeviceIDsRust, |
| 569 | currentID); |
| 570 | } catch (const std::exception &e) { |
| 571 | error = e.what(); |
| 572 | }; |
| 573 | if (!error.empty()) { |
| 574 | this->jsInvoker_->invokeAsync( |
| 575 | [error, promise]() { promise->reject(error); }); |
| 576 | } |
| 577 | }); |
| 578 | } |
| 579 | |
| 580 | jsi::Value CommRustModule::versionSupported(jsi::Runtime &rt) { |
| 581 | return createPromiseAsJSIValue( |
nothing calls this directly
no test coverage detected