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

Method signMessage

native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp:1993–2018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1991}
1992
1993jsi::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
2020jsi::Value CommCoreModule::signMessageUsingAccount(
2021 jsi::Runtime &rt,

Callers 2

getUserPublicKeyMethod · 0.45

Calls 3

rejectMethod · 0.80
resolveMethod · 0.80
scheduleTaskMethod · 0.80

Tested by

no test coverage detected