Changeset View
Changeset View
Standalone View
Standalone View
native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
Show First 20 Lines • Show All 1,291 Lines • ▼ Show 20 Lines | return createPromiseAsJSIValue( | ||||
jsiStringArrayToRustVec(notifOneTimeKeys, innerRt), | jsiStringArrayToRustVec(notifOneTimeKeys, innerRt), | ||||
currentID); | currentID); | ||||
} catch (const std::exception &e) { | } catch (const std::exception &e) { | ||||
error = e.what(); | error = e.what(); | ||||
}; | }; | ||||
}); | }); | ||||
} | } | ||||
jsi::Value CommCoreModule::loginPasswordUser( | |||||
jsi::Runtime &rt, | |||||
jsi::String username, | |||||
jsi::String password, | |||||
jsi::String keyPayload, | |||||
jsi::String keyPayloadSignature, | |||||
jsi::String contentPrekey, | |||||
jsi::String contentPrekeySignature, | |||||
jsi::String notifPrekey, | |||||
jsi::String notifPrekeySignature, | |||||
jsi::Array contentOneTimeKeys, | |||||
jsi::Array notifOneTimeKeys) { | |||||
return createPromiseAsJSIValue( | |||||
rt, | |||||
[this, | |||||
&username, | |||||
&password, | |||||
&keyPayload, | |||||
&keyPayloadSignature, | |||||
&contentPrekey, | |||||
&contentPrekeySignature, | |||||
¬ifPrekey, | |||||
¬ifPrekeySignature, | |||||
&contentOneTimeKeys, | |||||
¬ifOneTimeKeys]( | |||||
jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) { | |||||
std::string error; | |||||
try { | |||||
auto currentID = RustPromiseManager::instance.addPromise( | |||||
promise, this->jsInvoker_, innerRt); | |||||
identityLoginPasswordUser( | |||||
jsiStringToRustString(username, innerRt), | |||||
jsiStringToRustString(password, innerRt), | |||||
jsiStringToRustString(keyPayload, innerRt), | |||||
jsiStringToRustString(keyPayloadSignature, innerRt), | |||||
jsiStringToRustString(contentPrekey, innerRt), | |||||
jsiStringToRustString(contentPrekeySignature, innerRt), | |||||
jsiStringToRustString(notifPrekey, innerRt), | |||||
jsiStringToRustString(notifPrekeySignature, innerRt), | |||||
jsiStringArrayToRustVec(contentOneTimeKeys, innerRt), | |||||
jsiStringArrayToRustVec(notifOneTimeKeys, innerRt), | |||||
currentID); | |||||
} catch (const std::exception &e) { | |||||
error = e.what(); | |||||
}; | |||||
}); | |||||
} | |||||
} // namespace comm | } // namespace comm |