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

Method logInWalletUser

native/cpp/CommonCpp/NativeModules/CommRustModule.cpp:273–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271}
272
273jsi::Value CommRustModule::logInWalletUser(
274 jsi::Runtime &rt,
275 jsi::String siweMessage,
276 jsi::String siweSignature,
277 jsi::String keyPayload,
278 jsi::String keyPayloadSignature,
279 jsi::String contentPrekey,
280 jsi::String contentPrekeySignature,
281 jsi::String notifPrekey,
282 jsi::String notifPrekeySignature,
283 jsi::Array contentOneTimeKeys,
284 jsi::Array notifOneTimeKeys) {
285 auto siweMessageRust = jsiStringToRustString(siweMessage, rt);
286 auto siweSignatureRust = jsiStringToRustString(siweSignature, rt);
287 auto keyPayloadRust = jsiStringToRustString(keyPayload, rt);
288 auto keyPayloadSignatureRust = jsiStringToRustString(keyPayloadSignature, rt);
289 auto contentPrekeyRust = jsiStringToRustString(contentPrekey, rt);
290 auto contentPrekeySignatureRust =
291 jsiStringToRustString(contentPrekeySignature, rt);
292 auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt);
293 auto notifPrekeySignatureRust =
294 jsiStringToRustString(notifPrekeySignature, rt);
295 auto contentOneTimeKeysRust = jsiStringArrayToRustVec(contentOneTimeKeys, rt);
296 auto notifOneTimeKeysRust = jsiStringArrayToRustVec(notifOneTimeKeys, rt);
297
298 return createPromiseAsJSIValue(
299 rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
300 std::string error;
301 try {
302 auto currentID = RustPromiseManager::instance.addPromise(
303 {promise, this->jsInvoker_, innerRt});
304 identityLogInWalletUser(
305 siweMessageRust,
306 siweSignatureRust,
307 keyPayloadRust,
308 keyPayloadSignatureRust,
309 contentPrekeyRust,
310 contentPrekeySignatureRust,
311 notifPrekeyRust,
312 notifPrekeySignatureRust,
313 contentOneTimeKeysRust,
314 notifOneTimeKeysRust,
315 currentID);
316 } catch (const std::exception &e) {
317 error = e.what();
318 };
319 if (!error.empty()) {
320 this->jsInvoker_->invokeAsync(
321 [error, promise]() { promise->reject(error); });
322 }
323 });
324}
325
326jsi::Value CommRustModule::updatePassword(
327 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