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

Method registerPasswordUser

native/cpp/CommonCpp/NativeModules/CommRustModule.cpp:34–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34jsi::Value CommRustModule::registerPasswordUser(
35 jsi::Runtime &rt,
36 jsi::String username,
37 jsi::String password,
38 jsi::String keyPayload,
39 jsi::String keyPayloadSignature,
40 jsi::String contentPrekey,
41 jsi::String contentPrekeySignature,
42 jsi::String notifPrekey,
43 jsi::String notifPrekeySignature,
44 jsi::Array contentOneTimeKeys,
45 jsi::Array notifOneTimeKeys,
46 jsi::String farcasterID,
47 jsi::String initialDeviceList,
48 jsi::String farcasterDCsToken) {
49 auto usernameRust = jsiStringToRustString(username, rt);
50 auto passwordRust = jsiStringToRustString(password, rt);
51 auto keyPayloadRust = jsiStringToRustString(keyPayload, rt);
52 auto keyPayloadSignatureRust = jsiStringToRustString(keyPayloadSignature, rt);
53 auto contentPrekeyRust = jsiStringToRustString(contentPrekey, rt);
54 auto contentPrekeySignatureRust =
55 jsiStringToRustString(contentPrekeySignature, rt);
56 auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt);
57 auto notifPrekeySignatureRust =
58 jsiStringToRustString(notifPrekeySignature, rt);
59 auto contentOneTimeKeysRust = jsiStringArrayToRustVec(contentOneTimeKeys, rt);
60 auto notifOneTimeKeysRust = jsiStringArrayToRustVec(notifOneTimeKeys, rt);
61 auto farcasterIDRust = jsiStringToRustString(farcasterID, rt);
62 auto initialDeviceListRust = jsiStringToRustString(initialDeviceList, rt);
63 auto farcasterDCsTokenRust = jsiStringToRustString(farcasterDCsToken, rt);
64
65 return createPromiseAsJSIValue(
66 rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
67 std::string error;
68 try {
69 auto currentID = RustPromiseManager::instance.addPromise(
70 {promise, this->jsInvoker_, innerRt});
71 identityRegisterPasswordUser(
72 usernameRust,
73 passwordRust,
74 keyPayloadRust,
75 keyPayloadSignatureRust,
76 contentPrekeyRust,
77 contentPrekeySignatureRust,
78 notifPrekeyRust,
79 notifPrekeySignatureRust,
80 contentOneTimeKeysRust,
81 notifOneTimeKeysRust,
82 farcasterIDRust,
83 initialDeviceListRust,
84 currentID,
85 farcasterDCsTokenRust);
86 } catch (const std::exception &e) {
87 error = e.what();
88 };
89 if (!error.empty()) {
90 this->jsInvoker_->invokeAsync(
91 [error, promise]() { promise->reject(error); });

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