| 1991 | } |
| 1992 | |
| 1993 | jsi::Value CommCoreModule::signMessage(jsi::Runtime &rt, jsi::String message) { |
| 1994 | std::string messageStr = message.utf8(rt); |
| 1995 | return createPromiseAsJSIValue( |
| 1996 | rt, [=](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) { |
| 1997 | taskType job = [=, &innerRt]() { |
| 1998 | std::string error; |
| 1999 | std::string signature; |
| 2000 | try { |
| 2001 | signature = this->contentCryptoModule->signMessage(messageStr); |
| 2002 | } catch (const std::exception &e) { |
| 2003 | error = "signing message failed with: " + std::string(e.what()); |
| 2004 | } |
| 2005 | |
| 2006 | this->jsInvoker_->invokeAsync([=, &innerRt]() { |
| 2007 | if (error.size()) { |
| 2008 | promise->reject(error); |
| 2009 | return; |
| 2010 | } |
| 2011 | |
| 2012 | auto jsiSignature{jsi::String::createFromUtf8(innerRt, signature)}; |
| 2013 | promise->resolve(std::move(jsiSignature)); |
| 2014 | }); |
| 2015 | }; |
| 2016 | this->cryptoThread->scheduleTask(job); |
| 2017 | }); |
| 2018 | } |
| 2019 | |
| 2020 | jsi::Value CommCoreModule::signMessageUsingAccount( |
| 2021 | jsi::Runtime &rt, |
no test coverage detected