diff --git a/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp b/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp index cc17a6d20..4f6d85dea 100644 --- a/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp +++ b/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp @@ -1,1038 +1,1041 @@ #include "CommRustModule.h" #include "InternalModules/RustPromiseManager.h" #include "JSIRust.h" #include "lib.rs.h" #include namespace comm { using namespace facebook::react; CommRustModule::CommRustModule(std::shared_ptr jsInvoker) : CommRustModuleSchemaCxxSpecJSI(jsInvoker) { } jsi::Value CommRustModule::generateNonce(jsi::Runtime &rt) { return createPromiseAsJSIValue( rt, [this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityGenerateNonce(currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::registerPasswordUser( 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, jsi::String farcasterID, jsi::String initialDeviceList) { auto usernameRust = jsiStringToRustString(username, rt); auto passwordRust = jsiStringToRustString(password, rt); auto keyPayloadRust = jsiStringToRustString(keyPayload, rt); auto keyPayloadSignatureRust = jsiStringToRustString(keyPayloadSignature, rt); auto contentPrekeyRust = jsiStringToRustString(contentPrekey, rt); auto contentPrekeySignatureRust = jsiStringToRustString(contentPrekeySignature, rt); auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt); auto notifPrekeySignatureRust = jsiStringToRustString(notifPrekeySignature, rt); auto contentOneTimeKeysRust = jsiStringArrayToRustVec(contentOneTimeKeys, rt); auto notifOneTimeKeysRust = jsiStringArrayToRustVec(notifOneTimeKeys, rt); auto farcasterIDRust = jsiStringToRustString(farcasterID, rt); auto initialDeviceListRust = jsiStringToRustString(initialDeviceList, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityRegisterPasswordUser( usernameRust, passwordRust, keyPayloadRust, keyPayloadSignatureRust, contentPrekeyRust, contentPrekeySignatureRust, notifPrekeyRust, notifPrekeySignatureRust, contentOneTimeKeysRust, notifOneTimeKeysRust, farcasterIDRust, initialDeviceListRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::registerReservedPasswordUser( 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, jsi::String keyserverMessage, jsi::String keyserverSignature, jsi::String initialDeviceList) { auto usernameRust = jsiStringToRustString(username, rt); auto passwordRust = jsiStringToRustString(password, rt); auto keyPayloadRust = jsiStringToRustString(keyPayload, rt); auto keyPayloadSignatureRust = jsiStringToRustString(keyPayloadSignature, rt); auto contentPrekeyRust = jsiStringToRustString(contentPrekey, rt); auto contentPrekeySignatureRust = jsiStringToRustString(contentPrekeySignature, rt); auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt); auto notifPrekeySignatureRust = jsiStringToRustString(notifPrekeySignature, rt); auto contentOneTimeKeysRust = jsiStringArrayToRustVec(contentOneTimeKeys, rt); auto notifOneTimeKeysRust = jsiStringArrayToRustVec(notifOneTimeKeys, rt); auto keyserverMessageRust = jsiStringToRustString(keyserverMessage, rt); auto keyserverSignatureRust = jsiStringToRustString(keyserverSignature, rt); auto initialDeviceListRust = jsiStringToRustString(initialDeviceList, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityRegisterReservedPasswordUser( usernameRust, passwordRust, keyPayloadRust, keyPayloadSignatureRust, contentPrekeyRust, contentPrekeySignatureRust, notifPrekeyRust, notifPrekeySignatureRust, contentOneTimeKeysRust, notifOneTimeKeysRust, keyserverMessageRust, keyserverSignatureRust, initialDeviceListRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::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) { auto usernameRust = jsiStringToRustString(username, rt); auto passwordRust = jsiStringToRustString(password, rt); auto keyPayloadRust = jsiStringToRustString(keyPayload, rt); auto keyPayloadSignatureRust = jsiStringToRustString(keyPayloadSignature, rt); auto contentPrekeyRust = jsiStringToRustString(contentPrekey, rt); auto contentPrekeySignatureRust = jsiStringToRustString(contentPrekeySignature, rt); auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt); auto notifPrekeySignatureRust = jsiStringToRustString(notifPrekeySignature, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityLogInPasswordUser( usernameRust, passwordRust, keyPayloadRust, keyPayloadSignatureRust, contentPrekeyRust, contentPrekeySignatureRust, notifPrekeyRust, notifPrekeySignatureRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::registerWalletUser( jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys, jsi::String farcasterID, jsi::String initialDeviceList) { auto siweMessageRust = jsiStringToRustString(siweMessage, rt); auto siweSignatureRust = jsiStringToRustString(siweSignature, rt); auto keyPayloadRust = jsiStringToRustString(keyPayload, rt); auto keyPayloadSignatureRust = jsiStringToRustString(keyPayloadSignature, rt); auto contentPrekeyRust = jsiStringToRustString(contentPrekey, rt); auto contentPrekeySignatureRust = jsiStringToRustString(contentPrekeySignature, rt); auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt); auto notifPrekeySignatureRust = jsiStringToRustString(notifPrekeySignature, rt); auto contentOneTimeKeysRust = jsiStringArrayToRustVec(contentOneTimeKeys, rt); auto notifOneTimeKeysRust = jsiStringArrayToRustVec(notifOneTimeKeys, rt); auto farcasterIDRust = jsiStringToRustString(farcasterID, rt); auto initialDeviceListRust = jsiStringToRustString(initialDeviceList, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityRegisterWalletUser( siweMessageRust, siweSignatureRust, keyPayloadRust, keyPayloadSignatureRust, contentPrekeyRust, contentPrekeySignatureRust, notifPrekeyRust, notifPrekeySignatureRust, contentOneTimeKeysRust, notifOneTimeKeysRust, farcasterIDRust, initialDeviceListRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::registerReservedWalletUser( jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys, jsi::String keyserverMessage, jsi::String keyserverSignature, jsi::String initialDeviceList) { auto siweMessageRust = jsiStringToRustString(siweMessage, rt); auto siweSignatureRust = jsiStringToRustString(siweSignature, rt); auto keyPayloadRust = jsiStringToRustString(keyPayload, rt); auto keyPayloadSignatureRust = jsiStringToRustString(keyPayloadSignature, rt); auto contentPrekeyRust = jsiStringToRustString(contentPrekey, rt); auto contentPrekeySignatureRust = jsiStringToRustString(contentPrekeySignature, rt); auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt); auto notifPrekeySignatureRust = jsiStringToRustString(notifPrekeySignature, rt); auto contentOneTimeKeysRust = jsiStringArrayToRustVec(contentOneTimeKeys, rt); auto notifOneTimeKeysRust = jsiStringArrayToRustVec(notifOneTimeKeys, rt); auto keyserverMessageRust = jsiStringToRustString(keyserverMessage, rt); auto keyserverSignatureRust = jsiStringToRustString(keyserverSignature, rt); auto initialDeviceListRust = jsiStringToRustString(initialDeviceList, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityRegisterReservedWalletUser( siweMessageRust, siweSignatureRust, keyPayloadRust, keyPayloadSignatureRust, contentPrekeyRust, contentPrekeySignatureRust, notifPrekeyRust, notifPrekeySignatureRust, contentOneTimeKeysRust, notifOneTimeKeysRust, keyserverMessageRust, keyserverSignatureRust, initialDeviceListRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::logInWalletUser( jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature) { auto siweMessageRust = jsiStringToRustString(siweMessage, rt); auto siweSignatureRust = jsiStringToRustString(siweSignature, rt); auto keyPayloadRust = jsiStringToRustString(keyPayload, rt); auto keyPayloadSignatureRust = jsiStringToRustString(keyPayloadSignature, rt); auto contentPrekeyRust = jsiStringToRustString(contentPrekey, rt); auto contentPrekeySignatureRust = jsiStringToRustString(contentPrekeySignature, rt); auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt); auto notifPrekeySignatureRust = jsiStringToRustString(notifPrekeySignature, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityLogInWalletUser( siweMessageRust, siweSignatureRust, keyPayloadRust, keyPayloadSignatureRust, contentPrekeyRust, contentPrekeySignatureRust, notifPrekeyRust, notifPrekeySignatureRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::updatePassword( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, - jsi::String password) { + jsi::String oldPassword, + jsi::String newPassword) { auto userIDRust = jsiStringToRustString(userID, rt); auto deviceIDRust = jsiStringToRustString(deviceID, rt); auto accessTokenRust = jsiStringToRustString(accessToken, rt); - auto passwordRust = jsiStringToRustString(password, rt); + auto oldPasswordRust = jsiStringToRustString(oldPassword, rt); + auto newPasswordRust = jsiStringToRustString(newPassword, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityUpdateUserPassword( userIDRust, deviceIDRust, accessTokenRust, - passwordRust, + oldPasswordRust, + newPasswordRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::deletePasswordUser( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String password) { auto userIDRust = jsiStringToRustString(userID, rt); auto deviceIDRust = jsiStringToRustString(deviceID, rt); auto accessTokenRust = jsiStringToRustString(accessToken, rt); auto passwordRust = jsiStringToRustString(password, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityDeletePasswordUser( userIDRust, deviceIDRust, accessTokenRust, passwordRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::deleteWalletUser( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) { auto userIDRust = jsiStringToRustString(userID, rt); auto deviceIDRust = jsiStringToRustString(deviceID, rt); auto accessTokenRust = jsiStringToRustString(accessToken, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityDeleteWalletUser( userIDRust, deviceIDRust, accessTokenRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::logOut( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) { auto userIDRust = jsiStringToRustString(userID, rt); auto deviceIDRust = jsiStringToRustString(deviceID, rt); auto accessTokenRust = jsiStringToRustString(accessToken, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityLogOut(userIDRust, deviceIDRust, accessTokenRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::logOutSecondaryDevice( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) { auto userIDRust = jsiStringToRustString(userID, rt); auto deviceIDRust = jsiStringToRustString(deviceID, rt); auto accessTokenRust = jsiStringToRustString(accessToken, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityLogOutSecondaryDevice( userIDRust, deviceIDRust, accessTokenRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::getOutboundKeysForUser( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID) { auto authUserIDRust = jsiStringToRustString(authUserID, rt); auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt); auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt); auto userIDRust = jsiStringToRustString(userID, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityGetOutboundKeysForUser( authUserIDRust, authDeviceIDRust, authAccessTokenRust, userIDRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::getInboundKeysForUser( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID) { auto authUserIDRust = jsiStringToRustString(authUserID, rt); auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt); auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt); auto userIDRust = jsiStringToRustString(userID, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityGetInboundKeysForUser( authUserIDRust, authDeviceIDRust, authAccessTokenRust, userIDRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::versionSupported(jsi::Runtime &rt) { return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityVersionSupported(currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::uploadOneTimeKeys( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array contentOneTimePreKeys, jsi::Array notifOneTimePreKeys) { auto authUserIDRust = jsiStringToRustString(authUserID, rt); auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt); auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt); auto contentOneTimePreKeysRust = jsiStringArrayToRustVec(contentOneTimePreKeys, rt); auto notifOneTimePreKeysRust = jsiStringArrayToRustVec(notifOneTimePreKeys, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityUploadOneTimeKeys( authUserIDRust, authDeviceIDRust, authAccessTokenRust, contentOneTimePreKeysRust, notifOneTimePreKeysRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::getKeyserverKeys( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String keyserverID) { auto authUserIDRust = jsiStringToRustString(authUserID, rt); auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt); auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt); auto keyserverIDRust = jsiStringToRustString(keyserverID, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityGetKeyserverKeys( authUserIDRust, authDeviceIDRust, authAccessTokenRust, keyserverIDRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::getDeviceListForUser( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID, std::optional sinceTimestamp) { auto authUserIDRust = jsiStringToRustString(authUserID, rt); auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt); auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt); auto userIDRust = jsiStringToRustString(userID, rt); auto timestampI64 = static_cast(sinceTimestamp.value_or(0)); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityGetDeviceListForUser( authUserIDRust, authDeviceIDRust, authAccessTokenRust, userIDRust, timestampI64, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::getDeviceListsForUsers( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array userIDs) { auto authUserIDRust = jsiStringToRustString(authUserID, rt); auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt); auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt); auto userIDsRust = jsiStringArrayToRustVec(userIDs, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityGetDeviceListsForUsers( authUserIDRust, authDeviceIDRust, authAccessTokenRust, userIDsRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::updateDeviceList( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String updatePayload) { auto authUserIDRust = jsiStringToRustString(authUserID, rt); auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt); auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt); auto updatePayloadRust = jsiStringToRustString(updatePayload, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityUpdateDeviceList( authUserIDRust, authDeviceIDRust, authAccessTokenRust, updatePayloadRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::syncPlatformDetails( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken) { auto authUserIDRust = jsiStringToRustString(authUserID, rt); auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt); auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identitySyncPlatformDetails( authUserIDRust, authDeviceIDRust, authAccessTokenRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::uploadSecondaryDeviceKeysAndLogIn( jsi::Runtime &rt, jsi::String userID, jsi::String nonce, jsi::String nonceSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) { auto userIDRust = jsiStringToRustString(userID, rt); auto nonceRust = jsiStringToRustString(nonce, rt); auto nonceSignatureRust = jsiStringToRustString(nonceSignature, rt); auto keyPayloadRust = jsiStringToRustString(keyPayload, rt); auto keyPayloadSignatureRust = jsiStringToRustString(keyPayloadSignature, rt); auto contentPrekeyRust = jsiStringToRustString(contentPrekey, rt); auto contentPrekeySignatureRust = jsiStringToRustString(contentPrekeySignature, rt); auto notifPrekeyRust = jsiStringToRustString(notifPrekey, rt); auto notifPrekeySignatureRust = jsiStringToRustString(notifPrekeySignature, rt); auto contentOneTimeKeysRust = jsiStringArrayToRustVec(contentOneTimeKeys, rt); auto notifOneTimeKeysRust = jsiStringArrayToRustVec(notifOneTimeKeys, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityUploadSecondaryDeviceKeysAndLogIn( userIDRust, nonceRust, nonceSignatureRust, keyPayloadRust, keyPayloadSignatureRust, contentPrekeyRust, contentPrekeySignatureRust, notifPrekeyRust, notifPrekeySignatureRust, contentOneTimeKeysRust, notifOneTimeKeysRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::logInExistingDevice( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String nonce, jsi::String nonceSignature) { auto userIDRust = jsiStringToRustString(userID, rt); auto deviceIDRust = jsiStringToRustString(deviceID, rt); auto nonceRust = jsiStringToRustString(nonce, rt); auto nonceSignatureRust = jsiStringToRustString(nonceSignature, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityLogInExistingDevice( userIDRust, deviceIDRust, nonceRust, nonceSignatureRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::findUserIDForWalletAddress( jsi::Runtime &rt, jsi::String walletAddress) { auto walletAddressRust = jsiStringToRustString(walletAddress, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityFindUserIDForWalletAddress(walletAddressRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::findUserIDForUsername(jsi::Runtime &rt, jsi::String username) { auto usernameRust = jsiStringToRustString(username, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityFindUserIDForUsername(usernameRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::getFarcasterUsers(jsi::Runtime &rt, jsi::Array farcasterIDs) { auto farcasterIDsRust = jsiStringArrayToRustVec(farcasterIDs, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityGetFarcasterUsers(farcasterIDsRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::linkFarcasterAccount( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String farcasterID) { auto userIDRust = jsiStringToRustString(userID, rt); auto deviceIDRust = jsiStringToRustString(deviceID, rt); auto accessTokenRust = jsiStringToRustString(accessToken, rt); auto farcasterIDRust = jsiStringToRustString(farcasterID, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityLinkFarcasterAccount( userIDRust, deviceIDRust, accessTokenRust, farcasterIDRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::unlinkFarcasterAccount( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) { auto userIDRust = jsiStringToRustString(userID, rt); auto deviceIDRust = jsiStringToRustString(deviceID, rt); auto accessTokenRust = jsiStringToRustString(accessToken, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityUnlinkFarcasterAccount( userIDRust, deviceIDRust, accessTokenRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } jsi::Value CommRustModule::findUserIdentities( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array userIDs) { auto authUserIDRust = jsiStringToRustString(authUserID, rt); auto authDeviceIDRust = jsiStringToRustString(authDeviceID, rt); auto authAccessTokenRust = jsiStringToRustString(authAccessToken, rt); auto userIDsRust = jsiStringArrayToRustVec(userIDs, rt); return createPromiseAsJSIValue( rt, [=, this](jsi::Runtime &innerRt, std::shared_ptr promise) { std::string error; try { auto currentID = RustPromiseManager::instance.addPromise( {promise, this->jsInvoker_, innerRt}); identityFindUserIdentities( authUserIDRust, authDeviceIDRust, authAccessTokenRust, userIDsRust, currentID); } catch (const std::exception &e) { error = e.what(); }; if (!error.empty()) { this->jsInvoker_->invokeAsync( [error, promise]() { promise->reject(error); }); } }); } } // namespace comm diff --git a/native/cpp/CommonCpp/NativeModules/CommRustModule.h b/native/cpp/CommonCpp/NativeModules/CommRustModule.h index d2d368f4f..b637eef2d 100644 --- a/native/cpp/CommonCpp/NativeModules/CommRustModule.h +++ b/native/cpp/CommonCpp/NativeModules/CommRustModule.h @@ -1,218 +1,219 @@ #pragma once #include "../_generated/rustJSI.h" #include #include #include namespace comm { namespace jsi = facebook::jsi; class CommRustModule : public facebook::react::CommRustModuleSchemaCxxSpecJSI { virtual jsi::Value generateNonce(jsi::Runtime &rt) override; virtual jsi::Value registerPasswordUser( 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, jsi::String farcasterID, jsi::String initialDeviceList) override; virtual jsi::Value registerReservedPasswordUser( 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, jsi::String keyserverMessage, jsi::String keyserverSignature, jsi::String initialDeviceList) override; virtual jsi::Value 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) override; virtual jsi::Value registerWalletUser( jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys, jsi::String farcasterID, jsi::String initialDeviceList) override; virtual jsi::Value registerReservedWalletUser( jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys, jsi::String keyserverMessage, jsi::String keyserverSignature, jsi::String initialDeviceList) override; virtual jsi::Value logInWalletUser( jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature) override; virtual jsi::Value updatePassword( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, - jsi::String password) override; + jsi::String oldPassword, + jsi::String newPassword) override; virtual jsi::Value deletePasswordUser( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String password) override; virtual jsi::Value deleteWalletUser( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) override; virtual jsi::Value logOut( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) override; virtual jsi::Value logOutSecondaryDevice( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) override; virtual jsi::Value getOutboundKeysForUser( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID) override; virtual jsi::Value getInboundKeysForUser( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID) override; virtual jsi::Value versionSupported(jsi::Runtime &rt) override; virtual jsi::Value uploadOneTimeKeys( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array contentOneTimePreKeys, jsi::Array notifOneTimePreKeys) override; virtual jsi::Value getKeyserverKeys( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String keyserverID) override; virtual jsi::Value getDeviceListForUser( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID, std::optional sinceTimestamp) override; virtual jsi::Value getDeviceListsForUsers( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array userIDs) override; virtual jsi::Value updateDeviceList( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String updatePayload) override; virtual jsi::Value syncPlatformDetails( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken) override; virtual jsi::Value uploadSecondaryDeviceKeysAndLogIn( jsi::Runtime &rt, jsi::String userID, jsi::String nonce, jsi::String nonceSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) override; virtual jsi::Value logInExistingDevice( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String nonce, jsi::String nonceSignature) override; virtual jsi::Value findUserIDForWalletAddress( jsi::Runtime &rt, jsi::String walletAddress) override; virtual jsi::Value findUserIDForUsername(jsi::Runtime &rt, jsi::String username) override; virtual jsi::Value getFarcasterUsers(jsi::Runtime &rt, jsi::Array farcasterIDs) override; virtual jsi::Value linkFarcasterAccount( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String farcasterID) override; virtual jsi::Value unlinkFarcasterAccount( jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) override; virtual jsi::Value findUserIdentities( jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array userIDs) override; public: CommRustModule(std::shared_ptr jsInvoker); }; } // namespace comm diff --git a/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp b/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp index 96dee072c..074ceb442 100644 --- a/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp +++ b/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp @@ -1,138 +1,138 @@ /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ #include "rustJSI.h" namespace facebook { namespace react { static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_generateNonce(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->generateNonce(rt); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerPasswordUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->registerPasswordUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asObject(rt).asArray(rt), args[9].asObject(rt).asArray(rt), args[10].asString(rt), args[11].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerReservedPasswordUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->registerReservedPasswordUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asObject(rt).asArray(rt), args[9].asObject(rt).asArray(rt), args[10].asString(rt), args[11].asString(rt), args[12].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInPasswordUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->logInPasswordUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerWalletUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->registerWalletUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asObject(rt).asArray(rt), args[9].asObject(rt).asArray(rt), args[10].asString(rt), args[11].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerReservedWalletUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->registerReservedWalletUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asObject(rt).asArray(rt), args[9].asObject(rt).asArray(rt), args[10].asString(rt), args[11].asString(rt), args[12].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInWalletUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->logInWalletUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_updatePassword(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { - return static_cast(&turboModule)->updatePassword(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt)); + return static_cast(&turboModule)->updatePassword(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_deletePasswordUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->deletePasswordUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_deleteWalletUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->deleteWalletUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_logOut(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->logOut(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_logOutSecondaryDevice(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->logOutSecondaryDevice(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_getOutboundKeysForUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->getOutboundKeysForUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_getInboundKeysForUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->getInboundKeysForUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_versionSupported(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->versionSupported(rt); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_uploadOneTimeKeys(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->uploadOneTimeKeys(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asObject(rt).asArray(rt), args[4].asObject(rt).asArray(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_getKeyserverKeys(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->getKeyserverKeys(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_getDeviceListForUser(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->getDeviceListForUser(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].isNull() || args[4].isUndefined() ? std::nullopt : std::make_optional(args[4].asNumber())); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_getDeviceListsForUsers(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->getDeviceListsForUsers(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asObject(rt).asArray(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_updateDeviceList(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->updateDeviceList(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_syncPlatformDetails(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->syncPlatformDetails(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_uploadSecondaryDeviceKeysAndLogIn(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->uploadSecondaryDeviceKeysAndLogIn(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt), args[4].asString(rt), args[5].asString(rt), args[6].asString(rt), args[7].asString(rt), args[8].asString(rt), args[9].asObject(rt).asArray(rt), args[10].asObject(rt).asArray(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInExistingDevice(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->logInExistingDevice(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_findUserIDForWalletAddress(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->findUserIDForWalletAddress(rt, args[0].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_findUserIDForUsername(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->findUserIDForUsername(rt, args[0].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_getFarcasterUsers(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->getFarcasterUsers(rt, args[0].asObject(rt).asArray(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_linkFarcasterAccount(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->linkFarcasterAccount(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_unlinkFarcasterAccount(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->unlinkFarcasterAccount(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt)); } static jsi::Value __hostFunction_CommRustModuleSchemaCxxSpecJSI_findUserIdentities(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->findUserIdentities(rt, args[0].asString(rt), args[1].asString(rt), args[2].asString(rt), args[3].asObject(rt).asArray(rt)); } CommRustModuleSchemaCxxSpecJSI::CommRustModuleSchemaCxxSpecJSI(std::shared_ptr jsInvoker) : TurboModule("CommRustTurboModule", jsInvoker) { methodMap_["generateNonce"] = MethodMetadata {0, __hostFunction_CommRustModuleSchemaCxxSpecJSI_generateNonce}; methodMap_["registerPasswordUser"] = MethodMetadata {12, __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerPasswordUser}; methodMap_["registerReservedPasswordUser"] = MethodMetadata {13, __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerReservedPasswordUser}; methodMap_["logInPasswordUser"] = MethodMetadata {8, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInPasswordUser}; methodMap_["registerWalletUser"] = MethodMetadata {12, __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerWalletUser}; methodMap_["registerReservedWalletUser"] = MethodMetadata {13, __hostFunction_CommRustModuleSchemaCxxSpecJSI_registerReservedWalletUser}; methodMap_["logInWalletUser"] = MethodMetadata {8, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInWalletUser}; - methodMap_["updatePassword"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_updatePassword}; + methodMap_["updatePassword"] = MethodMetadata {5, __hostFunction_CommRustModuleSchemaCxxSpecJSI_updatePassword}; methodMap_["deletePasswordUser"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_deletePasswordUser}; methodMap_["deleteWalletUser"] = MethodMetadata {3, __hostFunction_CommRustModuleSchemaCxxSpecJSI_deleteWalletUser}; methodMap_["logOut"] = MethodMetadata {3, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logOut}; methodMap_["logOutSecondaryDevice"] = MethodMetadata {3, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logOutSecondaryDevice}; methodMap_["getOutboundKeysForUser"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_getOutboundKeysForUser}; methodMap_["getInboundKeysForUser"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_getInboundKeysForUser}; methodMap_["versionSupported"] = MethodMetadata {0, __hostFunction_CommRustModuleSchemaCxxSpecJSI_versionSupported}; methodMap_["uploadOneTimeKeys"] = MethodMetadata {5, __hostFunction_CommRustModuleSchemaCxxSpecJSI_uploadOneTimeKeys}; methodMap_["getKeyserverKeys"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_getKeyserverKeys}; methodMap_["getDeviceListForUser"] = MethodMetadata {5, __hostFunction_CommRustModuleSchemaCxxSpecJSI_getDeviceListForUser}; methodMap_["getDeviceListsForUsers"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_getDeviceListsForUsers}; methodMap_["updateDeviceList"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_updateDeviceList}; methodMap_["syncPlatformDetails"] = MethodMetadata {3, __hostFunction_CommRustModuleSchemaCxxSpecJSI_syncPlatformDetails}; methodMap_["uploadSecondaryDeviceKeysAndLogIn"] = MethodMetadata {11, __hostFunction_CommRustModuleSchemaCxxSpecJSI_uploadSecondaryDeviceKeysAndLogIn}; methodMap_["logInExistingDevice"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_logInExistingDevice}; methodMap_["findUserIDForWalletAddress"] = MethodMetadata {1, __hostFunction_CommRustModuleSchemaCxxSpecJSI_findUserIDForWalletAddress}; methodMap_["findUserIDForUsername"] = MethodMetadata {1, __hostFunction_CommRustModuleSchemaCxxSpecJSI_findUserIDForUsername}; methodMap_["getFarcasterUsers"] = MethodMetadata {1, __hostFunction_CommRustModuleSchemaCxxSpecJSI_getFarcasterUsers}; methodMap_["linkFarcasterAccount"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_linkFarcasterAccount}; methodMap_["unlinkFarcasterAccount"] = MethodMetadata {3, __hostFunction_CommRustModuleSchemaCxxSpecJSI_unlinkFarcasterAccount}; methodMap_["findUserIdentities"] = MethodMetadata {4, __hostFunction_CommRustModuleSchemaCxxSpecJSI_findUserIdentities}; } } // namespace react } // namespace facebook diff --git a/native/cpp/CommonCpp/_generated/rustJSI.h b/native/cpp/CommonCpp/_generated/rustJSI.h index 917fa6f8d..e2f047708 100644 --- a/native/cpp/CommonCpp/_generated/rustJSI.h +++ b/native/cpp/CommonCpp/_generated/rustJSI.h @@ -1,314 +1,314 @@ /** * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * * Do not edit this file as changes may cause incorrect behavior and will be lost * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ #pragma once #include #include namespace facebook { namespace react { class JSI_EXPORT CommRustModuleSchemaCxxSpecJSI : public TurboModule { protected: CommRustModuleSchemaCxxSpecJSI(std::shared_ptr jsInvoker); public: virtual jsi::Value generateNonce(jsi::Runtime &rt) = 0; virtual jsi::Value registerPasswordUser(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, jsi::String farcasterID, jsi::String initialDeviceList) = 0; virtual jsi::Value registerReservedPasswordUser(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, jsi::String keyserverMessage, jsi::String keyserverSignature, jsi::String initialDeviceList) = 0; virtual jsi::Value 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) = 0; virtual jsi::Value registerWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys, jsi::String farcasterID, jsi::String initialDeviceList) = 0; virtual jsi::Value registerReservedWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys, jsi::String keyserverMessage, jsi::String keyserverSignature, jsi::String initialDeviceList) = 0; virtual jsi::Value logInWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature) = 0; - virtual jsi::Value updatePassword(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String password) = 0; + virtual jsi::Value updatePassword(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String oldPassword, jsi::String newPassword) = 0; virtual jsi::Value deletePasswordUser(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String password) = 0; virtual jsi::Value deleteWalletUser(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) = 0; virtual jsi::Value logOut(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) = 0; virtual jsi::Value logOutSecondaryDevice(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) = 0; virtual jsi::Value getOutboundKeysForUser(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID) = 0; virtual jsi::Value getInboundKeysForUser(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID) = 0; virtual jsi::Value versionSupported(jsi::Runtime &rt) = 0; virtual jsi::Value uploadOneTimeKeys(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array contentOneTimePreKeys, jsi::Array notifOneTimePreKeys) = 0; virtual jsi::Value getKeyserverKeys(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String keyserverID) = 0; virtual jsi::Value getDeviceListForUser(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID, std::optional sinceTimestamp) = 0; virtual jsi::Value getDeviceListsForUsers(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array userIDs) = 0; virtual jsi::Value updateDeviceList(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String updatePayload) = 0; virtual jsi::Value syncPlatformDetails(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken) = 0; virtual jsi::Value uploadSecondaryDeviceKeysAndLogIn(jsi::Runtime &rt, jsi::String userID, jsi::String nonce, jsi::String nonceSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) = 0; virtual jsi::Value logInExistingDevice(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String nonce, jsi::String nonceSignature) = 0; virtual jsi::Value findUserIDForWalletAddress(jsi::Runtime &rt, jsi::String walletAddress) = 0; virtual jsi::Value findUserIDForUsername(jsi::Runtime &rt, jsi::String username) = 0; virtual jsi::Value getFarcasterUsers(jsi::Runtime &rt, jsi::Array farcasterIDs) = 0; virtual jsi::Value linkFarcasterAccount(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String farcasterID) = 0; virtual jsi::Value unlinkFarcasterAccount(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) = 0; virtual jsi::Value findUserIdentities(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array userIDs) = 0; }; template class JSI_EXPORT CommRustModuleSchemaCxxSpec : public TurboModule { public: jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override { return delegate_.get(rt, propName); } protected: CommRustModuleSchemaCxxSpec(std::shared_ptr jsInvoker) : TurboModule("CommRustTurboModule", jsInvoker), delegate_(static_cast(this), jsInvoker) {} private: class Delegate : public CommRustModuleSchemaCxxSpecJSI { public: Delegate(T *instance, std::shared_ptr jsInvoker) : CommRustModuleSchemaCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {} jsi::Value generateNonce(jsi::Runtime &rt) override { static_assert( bridging::getParameterCount(&T::generateNonce) == 1, "Expected generateNonce(...) to have 1 parameters"); return bridging::callFromJs( rt, &T::generateNonce, jsInvoker_, instance_); } jsi::Value registerPasswordUser(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, jsi::String farcasterID, jsi::String initialDeviceList) override { static_assert( bridging::getParameterCount(&T::registerPasswordUser) == 13, "Expected registerPasswordUser(...) to have 13 parameters"); return bridging::callFromJs( rt, &T::registerPasswordUser, jsInvoker_, instance_, std::move(username), std::move(password), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys), std::move(farcasterID), std::move(initialDeviceList)); } jsi::Value registerReservedPasswordUser(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, jsi::String keyserverMessage, jsi::String keyserverSignature, jsi::String initialDeviceList) override { static_assert( bridging::getParameterCount(&T::registerReservedPasswordUser) == 14, "Expected registerReservedPasswordUser(...) to have 14 parameters"); return bridging::callFromJs( rt, &T::registerReservedPasswordUser, jsInvoker_, instance_, std::move(username), std::move(password), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys), std::move(keyserverMessage), std::move(keyserverSignature), std::move(initialDeviceList)); } jsi::Value 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) override { static_assert( bridging::getParameterCount(&T::logInPasswordUser) == 9, "Expected logInPasswordUser(...) to have 9 parameters"); return bridging::callFromJs( rt, &T::logInPasswordUser, jsInvoker_, instance_, std::move(username), std::move(password), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature)); } jsi::Value registerWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys, jsi::String farcasterID, jsi::String initialDeviceList) override { static_assert( bridging::getParameterCount(&T::registerWalletUser) == 13, "Expected registerWalletUser(...) to have 13 parameters"); return bridging::callFromJs( rt, &T::registerWalletUser, jsInvoker_, instance_, std::move(siweMessage), std::move(siweSignature), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys), std::move(farcasterID), std::move(initialDeviceList)); } jsi::Value registerReservedWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys, jsi::String keyserverMessage, jsi::String keyserverSignature, jsi::String initialDeviceList) override { static_assert( bridging::getParameterCount(&T::registerReservedWalletUser) == 14, "Expected registerReservedWalletUser(...) to have 14 parameters"); return bridging::callFromJs( rt, &T::registerReservedWalletUser, jsInvoker_, instance_, std::move(siweMessage), std::move(siweSignature), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys), std::move(keyserverMessage), std::move(keyserverSignature), std::move(initialDeviceList)); } jsi::Value logInWalletUser(jsi::Runtime &rt, jsi::String siweMessage, jsi::String siweSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature) override { static_assert( bridging::getParameterCount(&T::logInWalletUser) == 9, "Expected logInWalletUser(...) to have 9 parameters"); return bridging::callFromJs( rt, &T::logInWalletUser, jsInvoker_, instance_, std::move(siweMessage), std::move(siweSignature), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature)); } - jsi::Value updatePassword(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String password) override { + jsi::Value updatePassword(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String oldPassword, jsi::String newPassword) override { static_assert( - bridging::getParameterCount(&T::updatePassword) == 5, - "Expected updatePassword(...) to have 5 parameters"); + bridging::getParameterCount(&T::updatePassword) == 6, + "Expected updatePassword(...) to have 6 parameters"); return bridging::callFromJs( - rt, &T::updatePassword, jsInvoker_, instance_, std::move(userID), std::move(deviceID), std::move(accessToken), std::move(password)); + rt, &T::updatePassword, jsInvoker_, instance_, std::move(userID), std::move(deviceID), std::move(accessToken), std::move(oldPassword), std::move(newPassword)); } jsi::Value deletePasswordUser(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String password) override { static_assert( bridging::getParameterCount(&T::deletePasswordUser) == 5, "Expected deletePasswordUser(...) to have 5 parameters"); return bridging::callFromJs( rt, &T::deletePasswordUser, jsInvoker_, instance_, std::move(userID), std::move(deviceID), std::move(accessToken), std::move(password)); } jsi::Value deleteWalletUser(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) override { static_assert( bridging::getParameterCount(&T::deleteWalletUser) == 4, "Expected deleteWalletUser(...) to have 4 parameters"); return bridging::callFromJs( rt, &T::deleteWalletUser, jsInvoker_, instance_, std::move(userID), std::move(deviceID), std::move(accessToken)); } jsi::Value logOut(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) override { static_assert( bridging::getParameterCount(&T::logOut) == 4, "Expected logOut(...) to have 4 parameters"); return bridging::callFromJs( rt, &T::logOut, jsInvoker_, instance_, std::move(userID), std::move(deviceID), std::move(accessToken)); } jsi::Value logOutSecondaryDevice(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) override { static_assert( bridging::getParameterCount(&T::logOutSecondaryDevice) == 4, "Expected logOutSecondaryDevice(...) to have 4 parameters"); return bridging::callFromJs( rt, &T::logOutSecondaryDevice, jsInvoker_, instance_, std::move(userID), std::move(deviceID), std::move(accessToken)); } jsi::Value getOutboundKeysForUser(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID) override { static_assert( bridging::getParameterCount(&T::getOutboundKeysForUser) == 5, "Expected getOutboundKeysForUser(...) to have 5 parameters"); return bridging::callFromJs( rt, &T::getOutboundKeysForUser, jsInvoker_, instance_, std::move(authUserID), std::move(authDeviceID), std::move(authAccessToken), std::move(userID)); } jsi::Value getInboundKeysForUser(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID) override { static_assert( bridging::getParameterCount(&T::getInboundKeysForUser) == 5, "Expected getInboundKeysForUser(...) to have 5 parameters"); return bridging::callFromJs( rt, &T::getInboundKeysForUser, jsInvoker_, instance_, std::move(authUserID), std::move(authDeviceID), std::move(authAccessToken), std::move(userID)); } jsi::Value versionSupported(jsi::Runtime &rt) override { static_assert( bridging::getParameterCount(&T::versionSupported) == 1, "Expected versionSupported(...) to have 1 parameters"); return bridging::callFromJs( rt, &T::versionSupported, jsInvoker_, instance_); } jsi::Value uploadOneTimeKeys(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array contentOneTimePreKeys, jsi::Array notifOneTimePreKeys) override { static_assert( bridging::getParameterCount(&T::uploadOneTimeKeys) == 6, "Expected uploadOneTimeKeys(...) to have 6 parameters"); return bridging::callFromJs( rt, &T::uploadOneTimeKeys, jsInvoker_, instance_, std::move(authUserID), std::move(authDeviceID), std::move(authAccessToken), std::move(contentOneTimePreKeys), std::move(notifOneTimePreKeys)); } jsi::Value getKeyserverKeys(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String keyserverID) override { static_assert( bridging::getParameterCount(&T::getKeyserverKeys) == 5, "Expected getKeyserverKeys(...) to have 5 parameters"); return bridging::callFromJs( rt, &T::getKeyserverKeys, jsInvoker_, instance_, std::move(authUserID), std::move(authDeviceID), std::move(authAccessToken), std::move(keyserverID)); } jsi::Value getDeviceListForUser(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String userID, std::optional sinceTimestamp) override { static_assert( bridging::getParameterCount(&T::getDeviceListForUser) == 6, "Expected getDeviceListForUser(...) to have 6 parameters"); return bridging::callFromJs( rt, &T::getDeviceListForUser, jsInvoker_, instance_, std::move(authUserID), std::move(authDeviceID), std::move(authAccessToken), std::move(userID), std::move(sinceTimestamp)); } jsi::Value getDeviceListsForUsers(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array userIDs) override { static_assert( bridging::getParameterCount(&T::getDeviceListsForUsers) == 5, "Expected getDeviceListsForUsers(...) to have 5 parameters"); return bridging::callFromJs( rt, &T::getDeviceListsForUsers, jsInvoker_, instance_, std::move(authUserID), std::move(authDeviceID), std::move(authAccessToken), std::move(userIDs)); } jsi::Value updateDeviceList(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::String updatePayload) override { static_assert( bridging::getParameterCount(&T::updateDeviceList) == 5, "Expected updateDeviceList(...) to have 5 parameters"); return bridging::callFromJs( rt, &T::updateDeviceList, jsInvoker_, instance_, std::move(authUserID), std::move(authDeviceID), std::move(authAccessToken), std::move(updatePayload)); } jsi::Value syncPlatformDetails(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken) override { static_assert( bridging::getParameterCount(&T::syncPlatformDetails) == 4, "Expected syncPlatformDetails(...) to have 4 parameters"); return bridging::callFromJs( rt, &T::syncPlatformDetails, jsInvoker_, instance_, std::move(authUserID), std::move(authDeviceID), std::move(authAccessToken)); } jsi::Value uploadSecondaryDeviceKeysAndLogIn(jsi::Runtime &rt, jsi::String userID, jsi::String nonce, jsi::String nonceSignature, jsi::String keyPayload, jsi::String keyPayloadSignature, jsi::String contentPrekey, jsi::String contentPrekeySignature, jsi::String notifPrekey, jsi::String notifPrekeySignature, jsi::Array contentOneTimeKeys, jsi::Array notifOneTimeKeys) override { static_assert( bridging::getParameterCount(&T::uploadSecondaryDeviceKeysAndLogIn) == 12, "Expected uploadSecondaryDeviceKeysAndLogIn(...) to have 12 parameters"); return bridging::callFromJs( rt, &T::uploadSecondaryDeviceKeysAndLogIn, jsInvoker_, instance_, std::move(userID), std::move(nonce), std::move(nonceSignature), std::move(keyPayload), std::move(keyPayloadSignature), std::move(contentPrekey), std::move(contentPrekeySignature), std::move(notifPrekey), std::move(notifPrekeySignature), std::move(contentOneTimeKeys), std::move(notifOneTimeKeys)); } jsi::Value logInExistingDevice(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String nonce, jsi::String nonceSignature) override { static_assert( bridging::getParameterCount(&T::logInExistingDevice) == 5, "Expected logInExistingDevice(...) to have 5 parameters"); return bridging::callFromJs( rt, &T::logInExistingDevice, jsInvoker_, instance_, std::move(userID), std::move(deviceID), std::move(nonce), std::move(nonceSignature)); } jsi::Value findUserIDForWalletAddress(jsi::Runtime &rt, jsi::String walletAddress) override { static_assert( bridging::getParameterCount(&T::findUserIDForWalletAddress) == 2, "Expected findUserIDForWalletAddress(...) to have 2 parameters"); return bridging::callFromJs( rt, &T::findUserIDForWalletAddress, jsInvoker_, instance_, std::move(walletAddress)); } jsi::Value findUserIDForUsername(jsi::Runtime &rt, jsi::String username) override { static_assert( bridging::getParameterCount(&T::findUserIDForUsername) == 2, "Expected findUserIDForUsername(...) to have 2 parameters"); return bridging::callFromJs( rt, &T::findUserIDForUsername, jsInvoker_, instance_, std::move(username)); } jsi::Value getFarcasterUsers(jsi::Runtime &rt, jsi::Array farcasterIDs) override { static_assert( bridging::getParameterCount(&T::getFarcasterUsers) == 2, "Expected getFarcasterUsers(...) to have 2 parameters"); return bridging::callFromJs( rt, &T::getFarcasterUsers, jsInvoker_, instance_, std::move(farcasterIDs)); } jsi::Value linkFarcasterAccount(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken, jsi::String farcasterID) override { static_assert( bridging::getParameterCount(&T::linkFarcasterAccount) == 5, "Expected linkFarcasterAccount(...) to have 5 parameters"); return bridging::callFromJs( rt, &T::linkFarcasterAccount, jsInvoker_, instance_, std::move(userID), std::move(deviceID), std::move(accessToken), std::move(farcasterID)); } jsi::Value unlinkFarcasterAccount(jsi::Runtime &rt, jsi::String userID, jsi::String deviceID, jsi::String accessToken) override { static_assert( bridging::getParameterCount(&T::unlinkFarcasterAccount) == 4, "Expected unlinkFarcasterAccount(...) to have 4 parameters"); return bridging::callFromJs( rt, &T::unlinkFarcasterAccount, jsInvoker_, instance_, std::move(userID), std::move(deviceID), std::move(accessToken)); } jsi::Value findUserIdentities(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken, jsi::Array userIDs) override { static_assert( bridging::getParameterCount(&T::findUserIdentities) == 5, "Expected findUserIdentities(...) to have 5 parameters"); return bridging::callFromJs( rt, &T::findUserIdentities, jsInvoker_, instance_, std::move(authUserID), std::move(authDeviceID), std::move(authAccessToken), std::move(userIDs)); } private: T *instance_; }; Delegate delegate_; }; } // namespace react } // namespace facebook diff --git a/native/native_rust_library/src/identity/account_actions.rs b/native/native_rust_library/src/identity/account_actions.rs index a34e7459b..3599155ae 100644 --- a/native/native_rust_library/src/identity/account_actions.rs +++ b/native/native_rust_library/src/identity/account_actions.rs @@ -1,241 +1,256 @@ use comm_opaque2::client::{Login, Registration}; use grpc_clients::identity::get_auth_client; use grpc_clients::identity::protos::auth::{ DeletePasswordUserFinishRequest, DeletePasswordUserStartRequest, UpdateUserPasswordFinishRequest, UpdateUserPasswordStartRequest, }; use grpc_clients::identity::protos::unauth::Empty; use crate::identity::AuthInfo; use crate::utils::jsi_callbacks::handle_void_result_as_callback; use crate::{Error, IDENTITY_SOCKET_ADDR, RUNTIME}; use super::PLATFORM_METADATA; pub mod ffi { use super::*; pub fn update_user_password( user_id: String, device_id: String, access_token: String, - password: String, + old_password: String, + new_password: String, promise_id: u32, ) { RUNTIME.spawn(async move { let update_password_info = UpdatePasswordInfo { access_token, user_id, device_id, - password, + old_password, + new_password, }; let result = update_user_password_helper(update_password_info).await; handle_void_result_as_callback(result, promise_id); }); } pub fn delete_wallet_user( user_id: String, device_id: String, access_token: String, promise_id: u32, ) { RUNTIME.spawn(async move { let auth_info = AuthInfo { access_token, user_id, device_id, }; let result = delete_wallet_user_helper(auth_info).await; handle_void_result_as_callback(result, promise_id); }); } pub fn delete_password_user( user_id: String, device_id: String, access_token: String, password: String, promise_id: u32, ) { RUNTIME.spawn(async move { let auth_info = AuthInfo { access_token, user_id, device_id, }; let result = delete_password_user_helper(auth_info, password).await; handle_void_result_as_callback(result, promise_id); }); } pub fn log_out( user_id: String, device_id: String, access_token: String, promise_id: u32, ) { RUNTIME.spawn(async move { let auth_info = AuthInfo { access_token, user_id, device_id, }; let result = log_out_helper(auth_info, LogOutType::Legacy).await; handle_void_result_as_callback(result, promise_id); }); } pub fn log_out_secondary_device( user_id: String, device_id: String, access_token: String, promise_id: u32, ) { RUNTIME.spawn(async move { let auth_info = AuthInfo { access_token, user_id, device_id, }; let result = log_out_helper(auth_info, LogOutType::SecondaryDevice).await; handle_void_result_as_callback(result, promise_id); }); } } struct UpdatePasswordInfo { user_id: String, device_id: String, access_token: String, - password: String, + old_password: String, + new_password: String, } async fn update_user_password_helper( update_password_info: UpdatePasswordInfo, ) -> Result<(), Error> { + let mut client_login = Login::new(); + let opaque_login_request = client_login + .start(&update_password_info.old_password) + .map_err(crate::handle_error)?; + let mut client_registration = Registration::new(); let opaque_registration_request = client_registration - .start(&update_password_info.password) + .start(&update_password_info.new_password) .map_err(crate::handle_error)?; + let update_password_start_request = UpdateUserPasswordStartRequest { + opaque_login_request, opaque_registration_request, }; let mut identity_client = get_auth_client( IDENTITY_SOCKET_ADDR, update_password_info.user_id, update_password_info.device_id, update_password_info.access_token, PLATFORM_METADATA.clone(), ) .await?; let response = identity_client .update_user_password_start(update_password_start_request) .await?; let update_password_start_response = response.into_inner(); + let opaque_login_upload = client_login + .finish(&update_password_start_response.opaque_login_response) + .map_err(crate::handle_error)?; + let opaque_registration_upload = client_registration .finish( - &update_password_info.password, + &update_password_info.new_password, &update_password_start_response.opaque_registration_response, ) .map_err(crate::handle_error)?; let update_password_finish_request = UpdateUserPasswordFinishRequest { session_id: update_password_start_response.session_id, + opaque_login_upload, opaque_registration_upload, }; identity_client .update_user_password_finish(update_password_finish_request) .await?; Ok(()) } async fn delete_wallet_user_helper(auth_info: AuthInfo) -> Result<(), Error> { let mut identity_client = get_auth_client( IDENTITY_SOCKET_ADDR, auth_info.user_id, auth_info.device_id, auth_info.access_token, PLATFORM_METADATA.clone(), ) .await?; identity_client.delete_wallet_user(Empty {}).await?; Ok(()) } async fn delete_password_user_helper( auth_info: AuthInfo, password: String, ) -> Result<(), Error> { let mut identity_client = get_auth_client( IDENTITY_SOCKET_ADDR, auth_info.user_id, auth_info.device_id, auth_info.access_token, PLATFORM_METADATA.clone(), ) .await?; let mut client_login = Login::new(); let opaque_login_request = client_login.start(&password).map_err(crate::handle_error)?; let delete_start_request = DeletePasswordUserStartRequest { opaque_login_request, }; let response = identity_client .delete_password_user_start(delete_start_request) .await?; let delete_start_response = response.into_inner(); let opaque_login_upload = client_login .finish(&delete_start_response.opaque_login_response) .map_err(crate::handle_error)?; let delete_finish_request = DeletePasswordUserFinishRequest { session_id: delete_start_response.session_id, opaque_login_upload, }; identity_client .delete_password_user_finish(delete_finish_request) .await?; Ok(()) } enum LogOutType { Legacy, SecondaryDevice, } async fn log_out_helper( auth_info: AuthInfo, log_out_type: LogOutType, ) -> Result<(), Error> { let mut identity_client = get_auth_client( IDENTITY_SOCKET_ADDR, auth_info.user_id, auth_info.device_id, auth_info.access_token, PLATFORM_METADATA.clone(), ) .await?; match log_out_type { LogOutType::Legacy => identity_client.log_out_user(Empty {}).await?, LogOutType::SecondaryDevice => { identity_client.log_out_secondary_device(Empty {}).await? } }; Ok(()) } diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs index 3528928dc..e086f8244 100644 --- a/native/native_rust_library/src/lib.rs +++ b/native/native_rust_library/src/lib.rs @@ -1,544 +1,545 @@ use comm_opaque2::grpc::opaque_error_to_grpc_status as handle_error; use grpc_clients::identity::protos::unauth::DeviceType; use lazy_static::lazy_static; use std::sync::Arc; use tokio::runtime::{Builder, Runtime}; use tonic::Status; mod argon2_tools; mod backup; mod constants; mod identity; mod utils; use crate::argon2_tools::compute_backup_key_str; use crate::utils::jsi_callbacks::{ handle_string_result_as_callback, handle_void_result_as_callback, }; mod generated { // We get the CODE_VERSION from this generated file include!(concat!(env!("OUT_DIR"), "/version.rs")); // We get the IDENTITY_SOCKET_ADDR from this generated file include!(concat!(env!("OUT_DIR"), "/socket_config.rs")); } pub use generated::CODE_VERSION; pub use generated::{BACKUP_SOCKET_ADDR, IDENTITY_SOCKET_ADDR}; #[cfg(not(target_os = "android"))] pub const DEVICE_TYPE: DeviceType = DeviceType::Ios; #[cfg(target_os = "android")] pub const DEVICE_TYPE: DeviceType = DeviceType::Android; lazy_static! { static ref RUNTIME: Arc = Arc::new(Builder::new_multi_thread().enable_all().build().unwrap()); } // ffi uses use backup::ffi::*; use identity::ffi::*; use utils::future_manager::ffi::*; #[allow(clippy::too_many_arguments)] #[cxx::bridge] mod ffi { // Identity Service APIs extern "Rust" { #[cxx_name = "identityRegisterPasswordUser"] fn register_password_user( username: String, password: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, farcaster_id: String, initial_device_list: String, promise_id: u32, ); #[cxx_name = "identityRegisterReservedPasswordUser"] fn register_reserved_password_user( username: String, password: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, keyserver_message: String, keyserver_signature: String, initial_device_list: String, promise_id: u32, ); #[cxx_name = "identityLogInPasswordUser"] fn log_in_password_user( username: String, password: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, promise_id: u32, ); #[cxx_name = "identityRegisterWalletUser"] fn register_wallet_user( siwe_message: String, siwe_signature: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, farcaster_id: String, initial_device_list: String, promise_id: u32, ); #[cxx_name = "identityRegisterReservedWalletUser"] fn register_reserved_wallet_user( siwe_message: String, siwe_signature: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, keyserver_message: String, keyserver_signature: String, initial_device_list: String, promise_id: u32, ); #[cxx_name = "identityLogInWalletUser"] fn log_in_wallet_user( siwe_message: String, siwe_signature: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, promise_id: u32, ); #[cxx_name = "identityUpdateUserPassword"] fn update_user_password( user_id: String, device_id: String, access_token: String, - password: String, + old_password: String, + new_password: String, promise_id: u32, ); #[cxx_name = "identityDeleteWalletUser"] fn delete_wallet_user( user_id: String, device_id: String, access_token: String, promise_id: u32, ); #[cxx_name = "identityDeletePasswordUser"] fn delete_password_user( user_id: String, device_id: String, access_token: String, password: String, promise_id: u32, ); #[cxx_name = "identityLogOut"] fn log_out( user_id: String, device_id: String, access_token: String, promise_id: u32, ); #[cxx_name = "identityLogOutSecondaryDevice"] fn log_out_secondary_device( user_id: String, device_id: String, access_token: String, promise_id: u32, ); #[cxx_name = "identityGetOutboundKeysForUser"] fn get_outbound_keys_for_user( auth_user_id: String, auth_device_id: String, auth_access_token: String, user_id: String, promise_id: u32, ); #[cxx_name = "identityGetInboundKeysForUser"] fn get_inbound_keys_for_user( auth_user_id: String, auth_device_id: String, auth_access_token: String, user_id: String, promise_id: u32, ); #[cxx_name = "identityRefreshUserPrekeys"] fn refresh_user_prekeys( auth_user_id: String, auth_device_id: String, auth_access_token: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, promise_id: u32, ); #[cxx_name = "identityGenerateNonce"] fn generate_nonce(promise_id: u32); #[cxx_name = "identityVersionSupported"] fn version_supported(promise_id: u32); #[cxx_name = "identityUploadOneTimeKeys"] fn upload_one_time_keys( auth_user_id: String, auth_device_id: String, auth_access_token: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, promise_id: u32, ); #[cxx_name = "identityGetKeyserverKeys"] fn get_keyserver_keys( user_id: String, device_id: String, access_token: String, keyserver_id: String, promise_id: u32, ); #[cxx_name = "identityGetDeviceListForUser"] fn get_device_list_for_user( auth_user_id: String, auth_device_id: String, auth_access_token: String, user_id: String, since_timestamp: i64, promise_id: u32, ); #[cxx_name = "identityGetDeviceListsForUsers"] fn get_device_lists_for_users( auth_user_id: String, auth_device_id: String, auth_access_token: String, user_ids: Vec, promise_id: u32, ); #[cxx_name = "identityUpdateDeviceList"] fn update_device_list( auth_user_id: String, auth_device_id: String, auth_access_token: String, update_payload: String, promise_id: u32, ); #[cxx_name = "identitySyncPlatformDetails"] fn sync_platform_details( auth_user_id: String, auth_device_id: String, auth_access_token: String, promise_id: u32, ); #[cxx_name = "identityUploadSecondaryDeviceKeysAndLogIn"] fn upload_secondary_device_keys_and_log_in( user_id: String, nonce: String, nonce_signature: String, key_payload: String, key_payload_signature: String, content_prekey: String, content_prekey_signature: String, notif_prekey: String, notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, promise_id: u32, ); #[cxx_name = "identityLogInExistingDevice"] fn log_in_existing_device( user_id: String, device_id: String, nonce: String, nonce_signature: String, promise_id: u32, ); #[cxx_name = "identityFindUserIDForWalletAddress"] fn find_user_id_for_wallet_address(wallet_address: String, promise_id: u32); #[cxx_name = "identityFindUserIDForUsername"] fn find_user_id_for_username(username: String, promise_id: u32); // Farcaster #[cxx_name = "identityGetFarcasterUsers"] fn get_farcaster_users(farcaster_ids: Vec, promise_id: u32); #[cxx_name = "identityLinkFarcasterAccount"] fn link_farcaster_account( user_id: String, device_id: String, access_token: String, farcaster_id: String, promise_id: u32, ); #[cxx_name = "identityUnlinkFarcasterAccount"] fn unlink_farcaster_account( user_id: String, device_id: String, access_token: String, promise_id: u32, ); #[cxx_name = "identityFindUserIdentities"] fn find_user_identities( user_id: String, device_id: String, access_token: String, user_ids: Vec, promise_id: u32, ); // Argon2 #[cxx_name = "compute_backup_key"] fn compute_backup_key_str( password: &str, backup_id: &str, ) -> Result<[u8; 32]>; } unsafe extern "C++" { include!("RustCallback.h"); #[namespace = "comm"] #[cxx_name = "stringCallback"] fn string_callback(error: String, promise_id: u32, ret: String); #[namespace = "comm"] #[cxx_name = "voidCallback"] fn void_callback(error: String, promise_id: u32); #[namespace = "comm"] #[cxx_name = "boolCallback"] fn bool_callback(error: String, promise_id: u32, ret: bool); } // AES cryptography #[namespace = "comm"] unsafe extern "C++" { include!("RustAESCrypto.h"); #[allow(unused)] #[cxx_name = "aesGenerateKey"] fn generate_key(buffer: &mut [u8]) -> Result<()>; /// The first two argument aren't mutated but creation of Java ByteBuffer /// requires the underlying bytes to be mutable. #[allow(unused)] #[cxx_name = "aesEncrypt"] fn encrypt( key: &mut [u8], plaintext: &mut [u8], sealed_data: &mut [u8], ) -> Result<()>; /// The first two argument aren't mutated but creation of Java ByteBuffer /// requires the underlying bytes to be mutable. #[allow(unused)] #[cxx_name = "aesDecrypt"] fn decrypt( key: &mut [u8], sealed_data: &mut [u8], plaintext: &mut [u8], ) -> Result<()>; } // Comm Services Auth Metadata Emission #[namespace = "comm"] unsafe extern "C++" { include!("RustCSAMetadataEmitter.h"); #[allow(unused)] #[cxx_name = "sendAuthMetadataToJS"] fn send_auth_metadata_to_js( access_token: String, user_id: String, ) -> Result<()>; } // Backup extern "Rust" { #[cxx_name = "startBackupHandler"] fn start_backup_handler() -> Result<()>; #[cxx_name = "stopBackupHandler"] fn stop_backup_handler() -> Result<()>; #[cxx_name = "triggerBackupFileUpload"] fn trigger_backup_file_upload(); #[cxx_name = "createBackup"] fn create_backup( backup_id: String, backup_secret: String, pickle_key: String, pickled_account: String, siwe_backup_msg: String, promise_id: u32, ); #[cxx_name = "restoreBackup"] fn restore_backup( backup_secret: String, backup_id: String, max_version: String, promise_id: u32, ); #[cxx_name = "restoreBackupData"] fn restore_backup_data( backup_id: String, backup_data_key: String, backup_log_data_key: String, max_version: String, promise_id: u32, ); #[cxx_name = "retrieveBackupKeys"] fn retrieve_backup_keys(backup_secret: String, promise_id: u32); #[cxx_name = "retrieveLatestSIWEBackupData"] fn retrieve_latest_siwe_backup_data(promise_id: u32); } // Secure store #[namespace = "comm"] unsafe extern "C++" { include!("RustSecureStore.h"); #[allow(unused)] #[cxx_name = "secureStoreSet"] fn secure_store_set(key: &str, value: String) -> Result<()>; #[cxx_name = "secureStoreGet"] fn secure_store_get(key: &str) -> Result; } // C++ Backup creation #[namespace = "comm"] unsafe extern "C++" { include!("RustBackupExecutor.h"); #[cxx_name = "getBackupDirectoryPath"] fn get_backup_directory_path() -> Result; #[cxx_name = "getBackupFilePath"] fn get_backup_file_path( backup_id: &str, is_attachments: bool, ) -> Result; #[cxx_name = "getBackupLogFilePath"] fn get_backup_log_file_path( backup_id: &str, log_id: &str, is_attachments: bool, ) -> Result; #[cxx_name = "getBackupUserKeysFilePath"] fn get_backup_user_keys_file_path(backup_id: &str) -> Result; #[cxx_name = "getSIWEBackupMessagePath"] fn get_siwe_backup_message_path(backup_id: &str) -> Result; #[cxx_name = "createMainCompaction"] fn create_main_compaction(backup_id: &str, future_id: usize); #[cxx_name = "restoreFromMainCompaction"] fn restore_from_main_compaction( main_compaction_path: &str, main_compaction_encryption_key: &str, max_version: &str, future_id: usize, ); #[cxx_name = "restoreFromBackupLog"] fn restore_from_backup_log(backup_log: Vec, future_id: usize); } // Future handling from C++ extern "Rust" { #[cxx_name = "resolveUnitFuture"] fn resolve_unit_future(future_id: usize); #[cxx_name = "rejectFuture"] fn reject_future(future_id: usize, error: String); } } #[derive( Debug, derive_more::Display, derive_more::From, derive_more::Error, )] pub enum Error { #[display(fmt = "{}", "_0.message()")] TonicGRPC(Status), #[display(fmt = "{}", "_0")] SerdeJson(serde_json::Error), #[display(fmt = "Missing response data")] MissingResponseData, #[display(fmt = "{}", "_0")] GRPClient(grpc_clients::error::Error), } #[cfg(test)] #[allow(clippy::assertions_on_constants)] mod tests { use super::{BACKUP_SOCKET_ADDR, CODE_VERSION, IDENTITY_SOCKET_ADDR}; #[test] fn test_code_version_exists() { assert!(CODE_VERSION > 0); } #[test] fn test_identity_socket_addr_exists() { assert!(!IDENTITY_SOCKET_ADDR.is_empty()); assert!(!BACKUP_SOCKET_ADDR.is_empty()); } } diff --git a/native/schema/CommRustModuleSchema.js b/native/schema/CommRustModuleSchema.js index 7406652ce..af4e5bf75 100644 --- a/native/schema/CommRustModuleSchema.js +++ b/native/schema/CommRustModuleSchema.js @@ -1,208 +1,209 @@ // @flow 'use strict'; import { TurboModuleRegistry } from 'react-native'; import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport.js'; export interface Spec extends TurboModule { +generateNonce: () => Promise; +registerPasswordUser: ( username: string, password: string, keyPayload: string, keyPayloadSignature: string, contentPrekey: string, contentPrekeySignature: string, notifPrekey: string, notifPrekeySignature: string, contentOneTimeKeys: $ReadOnlyArray, notifOneTimeKeys: $ReadOnlyArray, farcasterID: string, initialDeviceList: string, ) => Promise; +registerReservedPasswordUser: ( username: string, password: string, keyPayload: string, keyPayloadSignature: string, contentPrekey: string, contentPrekeySignature: string, notifPrekey: string, notifPrekeySignature: string, contentOneTimeKeys: $ReadOnlyArray, notifOneTimeKeys: $ReadOnlyArray, keyserverMessage: string, keyserverSignature: string, initialDeviceList: string, ) => Promise; +logInPasswordUser: ( username: string, password: string, keyPayload: string, keyPayloadSignature: string, contentPrekey: string, contentPrekeySignature: string, notifPrekey: string, notifPrekeySignature: string, ) => Promise; +registerWalletUser: ( siweMessage: string, siweSignature: string, keyPayload: string, keyPayloadSignature: string, contentPrekey: string, contentPrekeySignature: string, notifPrekey: string, notifPrekeySignature: string, contentOneTimeKeys: $ReadOnlyArray, notifOneTimeKeys: $ReadOnlyArray, farcasterID: string, initialDeviceList: string, ) => Promise; +registerReservedWalletUser: ( siweMessage: string, siweSignature: string, keyPayload: string, keyPayloadSignature: string, contentPrekey: string, contentPrekeySignature: string, notifPrekey: string, notifPrekeySignature: string, contentOneTimeKeys: $ReadOnlyArray, notifOneTimeKeys: $ReadOnlyArray, keyserverMessage: string, keyserverSignature: string, initialDeviceList: string, ) => Promise; +logInWalletUser: ( siweMessage: string, siweSignature: string, keyPayload: string, keyPayloadSignature: string, contentPrekey: string, contentPrekeySignature: string, notifPrekey: string, notifPrekeySignature: string, ) => Promise; +updatePassword: ( userID: string, deviceID: string, accessToken: string, - password: string, + oldPassword: string, + newPassword: string, ) => Promise; +deletePasswordUser: ( userID: string, deviceID: string, accessToken: string, password: string, ) => Promise; +deleteWalletUser: ( userID: string, deviceID: string, accessToken: string, ) => Promise; +logOut: ( userID: string, deviceID: string, accessToken: string, ) => Promise; +logOutSecondaryDevice: ( userID: string, deviceID: string, accessToken: string, ) => Promise; +getOutboundKeysForUser: ( authUserID: string, authDeviceID: string, authAccessToken: string, userID: string, ) => Promise; +getInboundKeysForUser: ( authUserID: string, authDeviceID: string, authAccessToken: string, userID: string, ) => Promise; +versionSupported: () => Promise; +uploadOneTimeKeys: ( authUserID: string, authDeviceID: string, authAccessToken: string, contentOneTimePreKeys: $ReadOnlyArray, notifOneTimePreKeys: $ReadOnlyArray, ) => Promise; +getKeyserverKeys: ( authUserID: string, authDeviceID: string, authAccessToken: string, keyserverID: string, ) => Promise; +getDeviceListForUser: ( authUserID: string, authDeviceID: string, authAccessToken: string, userID: string, sinceTimestamp: ?number, ) => Promise; +getDeviceListsForUsers: ( authUserID: string, authDeviceID: string, authAccessToken: string, userIDs: $ReadOnlyArray, ) => Promise; +updateDeviceList: ( authUserID: string, authDeviceID: string, authAccessToken: string, updatePayload: string, ) => Promise; +syncPlatformDetails: ( authUserID: string, authDeviceID: string, authAccessToken: string, ) => Promise; +uploadSecondaryDeviceKeysAndLogIn: ( userID: string, nonce: string, nonceSignature: string, keyPayload: string, keyPayloadSignature: string, contentPrekey: string, contentPrekeySignature: string, notifPrekey: string, notifPrekeySignature: string, contentOneTimeKeys: $ReadOnlyArray, notifOneTimeKeys: $ReadOnlyArray, ) => Promise; +logInExistingDevice: ( userID: string, deviceID: string, nonce: string, nonceSignature: string, ) => Promise; +findUserIDForWalletAddress: (walletAddress: string) => Promise; +findUserIDForUsername: (username: string) => Promise; +getFarcasterUsers: (farcasterIDs: $ReadOnlyArray) => Promise; +linkFarcasterAccount: ( userID: string, deviceID: string, accessToken: string, farcasterID: string, ) => Promise; +unlinkFarcasterAccount: ( userID: string, deviceID: string, accessToken: string, ) => Promise; +findUserIdentities: ( authUserID: string, authDeviceID: string, authAccessToken: string, userIDs: $ReadOnlyArray, ) => Promise; } export default (TurboModuleRegistry.getEnforcing( 'CommRustTurboModule', ): Spec); diff --git a/services/identity/src/client_service.rs b/services/identity/src/client_service.rs index af6c22811..f5802d8c9 100644 --- a/services/identity/src/client_service.rs +++ b/services/identity/src/client_service.rs @@ -1,1304 +1,1299 @@ // Standard library imports use std::str::FromStr; // External crate imports use comm_lib::aws::DynamoDBError; use comm_lib::shared::reserved_users::RESERVED_USERNAME_SET; use comm_opaque2::grpc::protocol_error_to_grpc_status; use rand::rngs::OsRng; use serde::{Deserialize, Serialize}; use siwe::eip55; use tonic::Response; use tracing::{debug, error, info, warn}; // Workspace crate imports use crate::config::CONFIG; use crate::constants::{error_types, tonic_status_messages}; use crate::database::{ DBDeviceTypeInt, DatabaseClient, DeviceType, KeyPayload }; use crate::device_list::SignedDeviceList; use crate::error::{DeviceListError, Error as DBError}; -use crate::grpc_services::authenticated::DeletePasswordUserInfo; +use crate::grpc_services::authenticated::{DeletePasswordUserInfo, UpdatePasswordInfo}; use crate::grpc_services::protos::unauth::{ find_user_id_request, AddReservedUsernamesRequest, AuthResponse, Empty, ExistingDeviceLoginRequest, FindUserIdRequest, FindUserIdResponse, GenerateNonceResponse, OpaqueLoginFinishRequest, OpaqueLoginStartRequest, OpaqueLoginStartResponse, RegistrationFinishRequest, RegistrationStartRequest, RegistrationStartResponse, RemoveReservedUsernameRequest, ReservedRegistrationStartRequest, ReservedWalletRegistrationRequest, SecondaryDeviceKeysUploadRequest, VerifyUserAccessTokenRequest, VerifyUserAccessTokenResponse, WalletAuthRequest, GetFarcasterUsersRequest, GetFarcasterUsersResponse }; use crate::grpc_services::shared::get_platform_metadata; use crate::grpc_utils::{ DeviceKeyUploadActions, RegistrationActions, SignedNonce }; use crate::nonce::generate_nonce_data; use crate::reserved_users::{ validate_account_ownership_message_and_get_user_id, validate_add_reserved_usernames_message, validate_remove_reserved_username_message, }; use crate::siwe::{ is_valid_ethereum_address, parse_and_verify_siwe_message, SocialProof, }; use crate::token::{AccessTokenData, AuthType}; pub use crate::grpc_services::protos::unauth::identity_client_service_server::{ IdentityClientService, IdentityClientServiceServer, }; use crate::regex::is_valid_username; #[derive(Clone, Serialize, Deserialize)] pub enum WorkflowInProgress { Registration(Box), Login(Box), - Update(UpdateState), + Update(Box), PasswordUserDeletion(Box), } #[derive(Clone, Serialize, Deserialize)] pub struct UserRegistrationInfo { pub username: String, pub flattened_device_key_upload: FlattenedDeviceKeyUpload, pub user_id: Option, pub farcaster_id: Option, pub initial_device_list: Option, } #[derive(Clone, Serialize, Deserialize)] pub struct UserLoginInfo { pub user_id: String, pub username: String, pub flattened_device_key_upload: FlattenedDeviceKeyUpload, pub opaque_server_login: comm_opaque2::server::Login, pub device_to_remove: Option, } -#[derive(Clone, Serialize, Deserialize)] -pub struct UpdateState { - pub user_id: String, -} - #[derive(Clone, Serialize, Deserialize)] pub struct FlattenedDeviceKeyUpload { pub device_id_key: String, pub key_payload: String, pub key_payload_signature: String, pub content_prekey: String, pub content_prekey_signature: String, pub content_one_time_keys: Vec, pub notif_prekey: String, pub notif_prekey_signature: String, pub notif_one_time_keys: Vec, pub device_type: DeviceType, } #[derive(derive_more::Constructor)] pub struct ClientService { client: DatabaseClient, } #[tonic::async_trait] impl IdentityClientService for ClientService { #[tracing::instrument(skip_all)] async fn register_password_user_start( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); debug!("Received registration request for: {}", message.username); if !is_valid_username(&message.username) || is_valid_ethereum_address(&message.username) { return Err(tonic::Status::invalid_argument( tonic_status_messages::INVALID_USERNAME, )); } self.check_username_taken(&message.username).await?; let username_in_reserved_usernames_table = self .client .username_in_reserved_usernames_table(&message.username) .await .map_err(handle_db_error)?; if username_in_reserved_usernames_table { return Err(tonic::Status::already_exists( tonic_status_messages::USERNAME_ALREADY_EXISTS, )); } if RESERVED_USERNAME_SET.contains(&message.username) { return Err(tonic::Status::invalid_argument( tonic_status_messages::USERNAME_RESERVED, )); } if let Some(fid) = &message.farcaster_id { self.check_farcaster_id_taken(fid).await?; } let registration_state = construct_user_registration_info( &message, None, message.username.clone(), message.farcaster_id.clone(), )?; self .check_device_id_taken( ®istration_state.flattened_device_key_upload, None, ) .await?; let server_registration = comm_opaque2::server::Registration::new(); let server_message = server_registration .start( &CONFIG.server_setup, &message.opaque_registration_request, message.username.as_bytes(), ) .map_err(protocol_error_to_grpc_status)?; let session_id = self .client .insert_workflow(WorkflowInProgress::Registration(Box::new( registration_state, ))) .await .map_err(handle_db_error)?; let response = RegistrationStartResponse { session_id, opaque_registration_response: server_message, }; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn register_reserved_password_user_start( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); self.check_username_taken(&message.username).await?; if RESERVED_USERNAME_SET.contains(&message.username) { return Err(tonic::Status::invalid_argument( tonic_status_messages::USERNAME_RESERVED, )); } let username_in_reserved_usernames_table = self .client .username_in_reserved_usernames_table(&message.username) .await .map_err(handle_db_error)?; if !username_in_reserved_usernames_table { return Err(tonic::Status::permission_denied( tonic_status_messages::USERNAME_NOT_RESERVED, )); } let user_id = validate_account_ownership_message_and_get_user_id( &message.username, &message.keyserver_message, &message.keyserver_signature, )?; let registration_state = construct_user_registration_info( &message, Some(user_id), message.username.clone(), None, )?; self .check_device_id_taken( ®istration_state.flattened_device_key_upload, None, ) .await?; let server_registration = comm_opaque2::server::Registration::new(); let server_message = server_registration .start( &CONFIG.server_setup, &message.opaque_registration_request, message.username.as_bytes(), ) .map_err(protocol_error_to_grpc_status)?; let session_id = self .client .insert_workflow(WorkflowInProgress::Registration(Box::new( registration_state, ))) .await .map_err(handle_db_error)?; let response = RegistrationStartResponse { session_id, opaque_registration_response: server_message, }; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn register_password_user_finish( &self, request: tonic::Request, ) -> Result, tonic::Status> { let platform_metadata = get_platform_metadata(&request)?; let message = request.into_inner(); if let Some(WorkflowInProgress::Registration(state)) = self .client .get_workflow(message.session_id) .await .map_err(handle_db_error)? { let server_registration = comm_opaque2::server::Registration::new(); let password_file = server_registration .finish(&message.opaque_registration_upload) .map_err(protocol_error_to_grpc_status)?; let login_time = chrono::Utc::now(); let device_id = state.flattened_device_key_upload.device_id_key.clone(); let username = state.username.clone(); let user_id = self .client .add_password_user_to_users_table( *state, password_file, platform_metadata, login_time, ) .await .map_err(handle_db_error)?; // Create access token let token = AccessTokenData::with_created_time( user_id.clone(), device_id, login_time, crate::token::AuthType::Password, &mut OsRng, ); let access_token = token.access_token.clone(); self .client .put_access_token_data(token) .await .map_err(handle_db_error)?; let response = AuthResponse { user_id, access_token, username, }; Ok(Response::new(response)) } else { Err(tonic::Status::not_found( tonic_status_messages::SESSION_NOT_FOUND, )) } } #[tracing::instrument(skip_all)] async fn log_in_password_user_start( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); debug!("Attempting to log in user: {:?}", &message.username); let user_id_and_password_file = self .client .get_user_id_and_password_file_from_username(&message.username) .await .map_err(handle_db_error)?; let (user_id, password_file_bytes) = if let Some(data) = user_id_and_password_file { data } else { // It's possible that the user attempting login is already registered // on Ashoat's keyserver. If they are, we should send back a gRPC status // code instructing them to get a signed message from Ashoat's keyserver // in order to claim their username and register with the Identity // service. let username_in_reserved_usernames_table = self .client .username_in_reserved_usernames_table(&message.username) .await .map_err(handle_db_error)?; if username_in_reserved_usernames_table { return Err(tonic::Status::permission_denied( tonic_status_messages::NEED_KEYSERVER_MESSAGE_TO_CLAIM_USERNAME, )); } return Err(tonic::Status::not_found( tonic_status_messages::USER_NOT_FOUND, )); }; let flattened_device_key_upload = construct_flattened_device_key_upload(&message)?; self .check_device_id_taken(&flattened_device_key_upload, Some(&user_id)) .await?; let maybe_device_to_remove = self .get_keyserver_device_to_remove( &user_id, &flattened_device_key_upload.device_id_key, message.force.unwrap_or(false), &flattened_device_key_upload.device_type, ) .await?; let mut server_login = comm_opaque2::server::Login::new(); let server_response = server_login .start( &CONFIG.server_setup, &password_file_bytes, &message.opaque_login_request, message.username.as_bytes(), ) .map_err(protocol_error_to_grpc_status)?; let login_state = construct_user_login_info( user_id, message.username, server_login, flattened_device_key_upload, maybe_device_to_remove, )?; let session_id = self .client .insert_workflow(WorkflowInProgress::Login(Box::new(login_state))) .await .map_err(handle_db_error)?; let response = Response::new(OpaqueLoginStartResponse { session_id, opaque_login_response: server_response, }); Ok(response) } #[tracing::instrument(skip_all)] async fn log_in_password_user_finish( &self, request: tonic::Request, ) -> Result, tonic::Status> { let platform_metadata = get_platform_metadata(&request)?; let message = request.into_inner(); - if let Some(WorkflowInProgress::Login(state)) = self + let Some(WorkflowInProgress::Login(state)) = self .client .get_workflow(message.session_id) .await .map_err(handle_db_error)? - { - let mut server_login = state.opaque_server_login.clone(); - server_login - .finish(&message.opaque_login_upload) - .map_err(protocol_error_to_grpc_status)?; + else { + return Err(tonic::Status::not_found( + tonic_status_messages::SESSION_NOT_FOUND, + )); + }; - if let Some(device_to_remove) = state.device_to_remove { - self - .client - .remove_device(state.user_id.clone(), device_to_remove) - .await - .map_err(handle_db_error)?; - } + let mut server_login = state.opaque_server_login; + server_login + .finish(&message.opaque_login_upload) + .map_err(protocol_error_to_grpc_status)?; - let login_time = chrono::Utc::now(); + if let Some(device_to_remove) = state.device_to_remove { self .client - .add_user_device( - state.user_id.clone(), - state.flattened_device_key_upload.clone(), - platform_metadata, - login_time, - ) + .remove_device(state.user_id.clone(), device_to_remove) .await .map_err(handle_db_error)?; + } - // Create access token - let token = AccessTokenData::with_created_time( + let login_time = chrono::Utc::now(); + self + .client + .add_user_device( state.user_id.clone(), - state.flattened_device_key_upload.device_id_key, + state.flattened_device_key_upload.clone(), + platform_metadata, login_time, - crate::token::AuthType::Password, - &mut OsRng, - ); + ) + .await + .map_err(handle_db_error)?; - let access_token = token.access_token.clone(); + // Create access token + let token = AccessTokenData::with_created_time( + state.user_id.clone(), + state.flattened_device_key_upload.device_id_key, + login_time, + crate::token::AuthType::Password, + &mut OsRng, + ); - self - .client - .put_access_token_data(token) - .await - .map_err(handle_db_error)?; + let access_token = token.access_token.clone(); - let response = AuthResponse { - user_id: state.user_id, - access_token, - username: state.username, - }; - Ok(Response::new(response)) - } else { - Err(tonic::Status::not_found( - tonic_status_messages::SESSION_NOT_FOUND, - )) - } + self + .client + .put_access_token_data(token) + .await + .map_err(handle_db_error)?; + + let response = AuthResponse { + user_id: state.user_id, + access_token, + username: state.username, + }; + Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn log_in_wallet_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let platform_metadata = get_platform_metadata(&request)?; let message = request.into_inner(); // WalletAuthRequest is used for both log_in_wallet_user and register_wallet_user if !message.initial_device_list.is_empty() { return Err(tonic::Status::invalid_argument( tonic_status_messages::UNEXPECTED_INITIAL_DEVICE_LIST, )); } let parsed_message = parse_and_verify_siwe_message( &message.siwe_message, &message.siwe_signature, )?; self.verify_and_remove_nonce(&parsed_message.nonce).await?; let wallet_address = eip55(&parsed_message.address); let flattened_device_key_upload = construct_flattened_device_key_upload(&message)?; let login_time = chrono::Utc::now(); let Some(user_id) = self .client .get_user_id_from_user_info(wallet_address.clone(), &AuthType::Wallet) .await .map_err(handle_db_error)? else { // It's possible that the user attempting login is already registered // on Ashoat's keyserver. If they are, we should send back a gRPC status // code instructing them to get a signed message from Ashoat's keyserver // in order to claim their wallet address and register with the Identity // service. let username_in_reserved_usernames_table = self .client .username_in_reserved_usernames_table(&wallet_address) .await .map_err(handle_db_error)?; if username_in_reserved_usernames_table { return Err(tonic::Status::permission_denied( tonic_status_messages::NEED_KEYSERVER_MESSAGE_TO_CLAIM_USERNAME, )); } return Err(tonic::Status::not_found( tonic_status_messages::USER_NOT_FOUND, )); }; self .check_device_id_taken(&flattened_device_key_upload, Some(&user_id)) .await?; self .client .add_user_device( user_id.clone(), flattened_device_key_upload.clone(), platform_metadata, chrono::Utc::now(), ) .await .map_err(handle_db_error)?; // Create access token let token = AccessTokenData::with_created_time( user_id.clone(), flattened_device_key_upload.device_id_key, login_time, crate::token::AuthType::Wallet, &mut OsRng, ); let access_token = token.access_token.clone(); self .client .put_access_token_data(token) .await .map_err(handle_db_error)?; let response = AuthResponse { user_id, access_token, username: wallet_address, }; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn register_wallet_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let platform_metadata = get_platform_metadata(&request)?; let message = request.into_inner(); let parsed_message = parse_and_verify_siwe_message( &message.siwe_message, &message.siwe_signature, )?; match self .client .get_nonce_from_nonces_table(&parsed_message.nonce) .await .map_err(handle_db_error)? { None => { return Err(tonic::Status::invalid_argument( tonic_status_messages::INVALID_NONCE, )) } Some(nonce) if nonce.is_expired() => { // we don't need to remove the nonce from the table here // because the DynamoDB TTL will take care of it return Err(tonic::Status::aborted( tonic_status_messages::NONCE_EXPIRED, )); } Some(_) => self .client .remove_nonce_from_nonces_table(&parsed_message.nonce) .await .map_err(handle_db_error)?, }; let wallet_address = eip55(&parsed_message.address); self.check_wallet_address_taken(&wallet_address).await?; let username_in_reserved_usernames_table = self .client .username_in_reserved_usernames_table(&wallet_address) .await .map_err(handle_db_error)?; if username_in_reserved_usernames_table { return Err(tonic::Status::already_exists( tonic_status_messages::WALLET_ADDRESS_TAKEN, )); } if let Some(fid) = &message.farcaster_id { self.check_farcaster_id_taken(fid).await?; } let flattened_device_key_upload = construct_flattened_device_key_upload(&message)?; self .check_device_id_taken(&flattened_device_key_upload, None) .await?; let login_time = chrono::Utc::now(); let initial_device_list = message.get_and_verify_initial_device_list()?; let social_proof = SocialProof::new(message.siwe_message, message.siwe_signature); let user_id = self .client .add_wallet_user_to_users_table( flattened_device_key_upload.clone(), wallet_address.clone(), social_proof, None, platform_metadata, login_time, message.farcaster_id, initial_device_list, ) .await .map_err(handle_db_error)?; // Create access token let token = AccessTokenData::with_created_time( user_id.clone(), flattened_device_key_upload.device_id_key, login_time, crate::token::AuthType::Wallet, &mut OsRng, ); let access_token = token.access_token.clone(); self .client .put_access_token_data(token) .await .map_err(handle_db_error)?; let response = AuthResponse { user_id, access_token, username: wallet_address, }; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn register_reserved_wallet_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let platform_metadata = get_platform_metadata(&request)?; let message = request.into_inner(); let parsed_message = parse_and_verify_siwe_message( &message.siwe_message, &message.siwe_signature, )?; self.verify_and_remove_nonce(&parsed_message.nonce).await?; let wallet_address = eip55(&parsed_message.address); self.check_wallet_address_taken(&wallet_address).await?; let wallet_address_in_reserved_usernames_table = self .client .username_in_reserved_usernames_table(&wallet_address) .await .map_err(handle_db_error)?; if !wallet_address_in_reserved_usernames_table { return Err(tonic::Status::permission_denied( tonic_status_messages::WALLET_ADDRESS_NOT_RESERVED, )); } let user_id = validate_account_ownership_message_and_get_user_id( &wallet_address, &message.keyserver_message, &message.keyserver_signature, )?; let flattened_device_key_upload = construct_flattened_device_key_upload(&message)?; self .check_device_id_taken(&flattened_device_key_upload, None) .await?; let initial_device_list = message.get_and_verify_initial_device_list()?; let social_proof = SocialProof::new(message.siwe_message, message.siwe_signature); let login_time = chrono::Utc::now(); self .client .add_wallet_user_to_users_table( flattened_device_key_upload.clone(), wallet_address.clone(), social_proof, Some(user_id.clone()), platform_metadata, login_time, None, initial_device_list, ) .await .map_err(handle_db_error)?; let token = AccessTokenData::with_created_time( user_id.clone(), flattened_device_key_upload.device_id_key, login_time, crate::token::AuthType::Wallet, &mut OsRng, ); let access_token = token.access_token.clone(); self .client .put_access_token_data(token) .await .map_err(handle_db_error)?; let response = AuthResponse { user_id, access_token, username: wallet_address, }; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn upload_keys_for_registered_device_and_log_in( &self, request: tonic::Request, ) -> Result, tonic::Status> { let platform_metadata = get_platform_metadata(&request)?; let message = request.into_inner(); let challenge_response = SignedNonce::try_from(&message)?; let flattened_device_key_upload = construct_flattened_device_key_upload(&message)?; let user_id = message.user_id; let device_id = flattened_device_key_upload.device_id_key.clone(); let nonce = challenge_response.verify_and_get_nonce(&device_id)?; self.verify_and_remove_nonce(&nonce).await?; self .check_device_id_taken(&flattened_device_key_upload, Some(&user_id)) .await?; let user_identity = self .client .get_user_identity(&user_id) .await .map_err(handle_db_error)? .ok_or_else(|| { tonic::Status::not_found(tonic_status_messages::USER_NOT_FOUND) })?; let Some(device_list) = self .client .get_current_device_list(&user_id) .await .map_err(handle_db_error)? else { warn!("User {} does not have valid device list. Secondary device auth impossible.", user_id); return Err(tonic::Status::aborted( tonic_status_messages::DEVICE_LIST_ERROR, )); }; if !device_list.device_ids.contains(&device_id) { return Err(tonic::Status::permission_denied( tonic_status_messages::DEVICE_NOT_IN_DEVICE_LIST, )); } let login_time = chrono::Utc::now(); let identifier = user_identity.identifier; let username = identifier.username().to_string(); let token = AccessTokenData::with_created_time( user_id.clone(), device_id, login_time, identifier.into(), &mut OsRng, ); let access_token = token.access_token.clone(); self .client .put_access_token_data(token) .await .map_err(handle_db_error)?; self .client .put_device_data( &user_id, flattened_device_key_upload, platform_metadata, login_time, ) .await .map_err(handle_db_error)?; let response = AuthResponse { user_id, access_token, username, }; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn log_in_existing_device( &self, request: tonic::Request, ) -> std::result::Result, tonic::Status> { let message = request.into_inner(); let challenge_response = SignedNonce::try_from(&message)?; let ExistingDeviceLoginRequest { user_id, device_id, .. } = message; let nonce = challenge_response.verify_and_get_nonce(&device_id)?; self.verify_and_remove_nonce(&nonce).await?; let (identity_response, device_list_response) = tokio::join!( self.client.get_user_identity(&user_id), self.client.get_current_device_list(&user_id) ); let user_identity = identity_response.map_err(handle_db_error)?.ok_or_else(|| { tonic::Status::not_found(tonic_status_messages::USER_NOT_FOUND) })?; let device_list = device_list_response .map_err(handle_db_error)? .ok_or_else(|| { warn!("User {} does not have a valid device list.", user_id); tonic::Status::aborted(tonic_status_messages::DEVICE_LIST_ERROR) })?; if !device_list.device_ids.contains(&device_id) { return Err(tonic::Status::permission_denied( tonic_status_messages::DEVICE_NOT_IN_DEVICE_LIST, )); } let login_time = chrono::Utc::now(); let identifier = user_identity.identifier; let username = identifier.username().to_string(); let token = AccessTokenData::with_created_time( user_id.clone(), device_id, login_time, identifier.into(), &mut OsRng, ); let access_token = token.access_token.clone(); self .client .put_access_token_data(token) .await .map_err(handle_db_error)?; let response = AuthResponse { user_id, access_token, username, }; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn generate_nonce( &self, _request: tonic::Request, ) -> Result, tonic::Status> { let nonce_data = generate_nonce_data(&mut OsRng); match self .client .add_nonce_to_nonces_table(nonce_data.clone()) .await { Ok(_) => Ok(Response::new(GenerateNonceResponse { nonce: nonce_data.nonce, })), Err(e) => Err(handle_db_error(e)), } } #[tracing::instrument(skip_all)] async fn verify_user_access_token( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); debug!("Verifying device: {}", &message.device_id); let token_valid = self .client .verify_access_token( message.user_id, message.device_id.clone(), message.access_token, ) .await .map_err(handle_db_error)?; let response = Response::new(VerifyUserAccessTokenResponse { token_valid }); debug!( "device {} was verified: {}", &message.device_id, token_valid ); Ok(response) } #[tracing::instrument(skip_all)] async fn add_reserved_usernames( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let user_details = validate_add_reserved_usernames_message( &message.message, &message.signature, )?; let filtered_user_details = self .client .filter_out_taken_usernames(user_details) .await .map_err(handle_db_error)?; self .client .add_usernames_to_reserved_usernames_table(filtered_user_details) .await .map_err(handle_db_error)?; let response = Response::new(Empty {}); Ok(response) } #[tracing::instrument(skip_all)] async fn remove_reserved_username( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let username = validate_remove_reserved_username_message( &message.message, &message.signature, )?; self .client .delete_username_from_reserved_usernames_table(username) .await .map_err(handle_db_error)?; let response = Response::new(Empty {}); Ok(response) } #[tracing::instrument(skip_all)] async fn ping( &self, _request: tonic::Request, ) -> Result, tonic::Status> { let response = Response::new(Empty {}); Ok(response) } #[tracing::instrument(skip_all)] async fn find_user_id( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); use find_user_id_request::Identifier; let (user_ident, auth_type) = match message.identifier { None => { return Err(tonic::Status::invalid_argument( tonic_status_messages::NO_IDENTIFIER_PROVIDED, )) } Some(Identifier::Username(username)) => (username, AuthType::Password), Some(Identifier::WalletAddress(address)) => (address, AuthType::Wallet), }; let (is_reserved_result, user_id_result) = tokio::join!( self .client .username_in_reserved_usernames_table(&user_ident), self .client .get_user_id_from_user_info(user_ident.clone(), &auth_type), ); let is_reserved = is_reserved_result.map_err(handle_db_error)?; let user_id = user_id_result.map_err(handle_db_error)?; Ok(Response::new(FindUserIdResponse { user_id, is_reserved, })) } #[tracing::instrument(skip_all)] async fn get_farcaster_users( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let farcaster_users = self .client .get_farcaster_users(message.farcaster_ids) .await .map_err(handle_db_error)? .into_iter() .map(|d| d.0) .collect(); Ok(Response::new(GetFarcasterUsersResponse { farcaster_users })) } } impl ClientService { async fn check_username_taken( &self, username: &str, ) -> Result<(), tonic::Status> { let username_taken = self .client .username_taken(username.to_string()) .await .map_err(handle_db_error)?; if username_taken { return Err(tonic::Status::already_exists( tonic_status_messages::USERNAME_ALREADY_EXISTS, )); } Ok(()) } async fn check_wallet_address_taken( &self, wallet_address: &str, ) -> Result<(), tonic::Status> { let wallet_address_taken = self .client .wallet_address_taken(wallet_address.to_string()) .await .map_err(handle_db_error)?; if wallet_address_taken { return Err(tonic::Status::already_exists( tonic_status_messages::WALLET_ADDRESS_TAKEN, )); } Ok(()) } async fn check_farcaster_id_taken( &self, farcaster_id: &str, ) -> Result<(), tonic::Status> { let fid_already_registered = !self .client .get_farcaster_users(vec![farcaster_id.to_string()]) .await .map_err(handle_db_error)? .is_empty(); if fid_already_registered { return Err(tonic::Status::already_exists( tonic_status_messages::FID_TAKEN, )); } Ok(()) } async fn check_device_id_taken( &self, key_upload: &FlattenedDeviceKeyUpload, requesting_user_id: Option<&str>, ) -> Result<(), tonic::Status> { let device_id = key_upload.device_id_key.as_str(); let Some(existing_device_user_id) = self .client .find_user_id_for_device(device_id) .await .map_err(handle_db_error)? else { // device ID doesn't exist return Ok(()); }; // allow already-existing device ID for the same user match requesting_user_id { Some(user_id) if user_id == existing_device_user_id => { debug!( "Found already-existing device {} for user {}", device_id, user_id ); Ok(()) } _ => { warn!("Device ID already exists: {device_id}"); Err(tonic::Status::already_exists( tonic_status_messages::DEVICE_ID_ALREADY_EXISTS, )) } } } async fn verify_and_remove_nonce( &self, nonce: &str, ) -> Result<(), tonic::Status> { match self .client .get_nonce_from_nonces_table(nonce) .await .map_err(handle_db_error)? { None => { return Err(tonic::Status::invalid_argument( tonic_status_messages::INVALID_NONCE, )) } Some(nonce) if nonce.is_expired() => { // we don't need to remove the nonce from the table here // because the DynamoDB TTL will take care of it return Err(tonic::Status::aborted( tonic_status_messages::NONCE_EXPIRED, )); } Some(nonce_data) => self .client .remove_nonce_from_nonces_table(&nonce_data.nonce) .await .map_err(handle_db_error)?, }; Ok(()) } async fn get_keyserver_device_to_remove( &self, user_id: &str, new_keyserver_device_id: &str, force: bool, device_type: &DeviceType, ) -> Result, tonic::Status> { if device_type != &DeviceType::Keyserver { return Ok(None); } let maybe_keyserver_device_id = self .client .get_keyserver_device_id_for_user(user_id) .await .map_err(handle_db_error)?; let Some(existing_keyserver_device_id) = maybe_keyserver_device_id else { return Ok(None); }; if new_keyserver_device_id == existing_keyserver_device_id { return Ok(None); } if force { info!( "keyserver {} will be removed from the device list", existing_keyserver_device_id ); Ok(Some(existing_keyserver_device_id)) } else { Err(tonic::Status::already_exists( tonic_status_messages::USER_ALREADY_HAS_KEYSERVER, )) } } } #[tracing::instrument(skip_all)] pub fn handle_db_error(db_error: DBError) -> tonic::Status { match db_error { DBError::AwsSdk(DynamoDBError::InternalServerError(_)) | DBError::AwsSdk(DynamoDBError::ProvisionedThroughputExceededException( _, )) | DBError::AwsSdk(DynamoDBError::RequestLimitExceeded(_)) => { tonic::Status::unavailable(tonic_status_messages::RETRY) } DBError::DeviceList(DeviceListError::InvalidDeviceListUpdate) => { tonic::Status::invalid_argument( tonic_status_messages::INVALID_DEVICE_LIST_UPDATE, ) } DBError::DeviceList(DeviceListError::InvalidSignature) => { tonic::Status::invalid_argument( tonic_status_messages::INVALID_DEVICE_LIST_SIGNATURE, ) } e => { error!( errorType = error_types::GENERIC_DB_LOG, "Encountered an unexpected error: {}", e ); tonic::Status::failed_precondition( tonic_status_messages::UNEXPECTED_ERROR, ) } } } fn construct_user_registration_info( message: &(impl DeviceKeyUploadActions + RegistrationActions), user_id: Option, username: String, farcaster_id: Option, ) -> Result { Ok(UserRegistrationInfo { username, flattened_device_key_upload: construct_flattened_device_key_upload( message, )?, user_id, farcaster_id, initial_device_list: message.get_and_verify_initial_device_list()?, }) } fn construct_user_login_info( user_id: String, username: String, opaque_server_login: comm_opaque2::server::Login, flattened_device_key_upload: FlattenedDeviceKeyUpload, device_to_remove: Option, ) -> Result { Ok(UserLoginInfo { user_id, username, flattened_device_key_upload, opaque_server_login, device_to_remove, }) } fn construct_flattened_device_key_upload( message: &impl DeviceKeyUploadActions, ) -> Result { let key_info = KeyPayload::from_str(&message.payload()?).map_err(|_| { tonic::Status::invalid_argument(tonic_status_messages::MALFORMED_PAYLOAD) })?; let flattened_device_key_upload = FlattenedDeviceKeyUpload { device_id_key: key_info.primary_identity_public_keys.ed25519, key_payload: message.payload()?, key_payload_signature: message.payload_signature()?, content_prekey: message.content_prekey()?, content_prekey_signature: message.content_prekey_signature()?, content_one_time_keys: message.one_time_content_prekeys()?, notif_prekey: message.notif_prekey()?, notif_prekey_signature: message.notif_prekey_signature()?, notif_one_time_keys: message.one_time_notif_prekeys()?, device_type: DeviceType::try_from(DBDeviceTypeInt(message.device_type()?)) .map_err(handle_db_error)?, }; Ok(flattened_device_key_upload) } diff --git a/services/identity/src/constants.rs b/services/identity/src/constants.rs index c396743c8..ae190cf00 100644 --- a/services/identity/src/constants.rs +++ b/services/identity/src/constants.rs @@ -1,344 +1,345 @@ use tokio::time::Duration; // Secrets pub const SECRETS_DIRECTORY: &str = "secrets"; pub const SECRETS_SETUP_FILE: &str = "server_setup.txt"; // DynamoDB // User table information, supporting opaque_ke 2.0 and X3DH information // Users can sign in either through username+password or Eth wallet. // // This structure should be aligned with the messages defined in // shared/protos/identity_unauthenticated.proto // // Structure for a user should be: // { // userID: String, // opaqueRegistrationData: Option, // username: Option, // walletAddress: Option, // devices: HashMap // } // // A device is defined as: // { // deviceType: String, # client or keyserver // keyPayload: String, // keyPayloadSignature: String, // identityPreKey: String, // identityPreKeySignature: String, // identityOneTimeKeys: Vec, // notifPreKey: String, // notifPreKeySignature: String, // notifOneTimeKeys: Vec, // socialProof: Option // } // } // // Additional context: // "devices" uses the signing public identity key of the device as a key for the devices map // "keyPayload" is a JSON encoded string containing identity and notif keys (both signature and verification) // if "deviceType" == "keyserver", then the device will not have any notif key information pub const USERS_TABLE: &str = "identity-users"; pub const USERS_TABLE_PARTITION_KEY: &str = "userID"; pub const USERS_TABLE_REGISTRATION_ATTRIBUTE: &str = "opaqueRegistrationData"; pub const USERS_TABLE_USERNAME_ATTRIBUTE: &str = "username"; pub const USERS_TABLE_DEVICES_MAP_DEVICE_TYPE_ATTRIBUTE_NAME: &str = "deviceType"; pub const USERS_TABLE_WALLET_ADDRESS_ATTRIBUTE: &str = "walletAddress"; pub const USERS_TABLE_SOCIAL_PROOF_ATTRIBUTE_NAME: &str = "socialProof"; pub const USERS_TABLE_DEVICELIST_TIMESTAMP_ATTRIBUTE_NAME: &str = "deviceListTimestamp"; pub const USERS_TABLE_FARCASTER_ID_ATTRIBUTE_NAME: &str = "farcasterID"; pub const USERS_TABLE_USERNAME_INDEX: &str = "username-index"; pub const USERS_TABLE_WALLET_ADDRESS_INDEX: &str = "walletAddress-index"; pub const USERS_TABLE_FARCASTER_ID_INDEX: &str = "farcasterID-index"; pub mod token_table { pub const NAME: &str = "identity-tokens"; pub const PARTITION_KEY: &str = "userID"; pub const SORT_KEY: &str = "signingPublicKey"; pub const ATTR_CREATED: &str = "created"; pub const ATTR_AUTH_TYPE: &str = "authType"; pub const ATTR_VALID: &str = "valid"; pub const ATTR_TOKEN: &str = "token"; } pub const NONCE_TABLE: &str = "identity-nonces"; pub const NONCE_TABLE_PARTITION_KEY: &str = "nonce"; pub const NONCE_TABLE_CREATED_ATTRIBUTE: &str = "created"; pub const NONCE_TABLE_EXPIRATION_TIME_ATTRIBUTE: &str = "expirationTime"; pub const NONCE_TABLE_EXPIRATION_TIME_UNIX_ATTRIBUTE: &str = "expirationTimeUnix"; pub const WORKFLOWS_IN_PROGRESS_TABLE: &str = "identity-workflows-in-progress"; pub const WORKFLOWS_IN_PROGRESS_PARTITION_KEY: &str = "id"; pub const WORKFLOWS_IN_PROGRESS_WORKFLOW_ATTRIBUTE: &str = "workflow"; pub const WORKFLOWS_IN_PROGRESS_TABLE_EXPIRATION_TIME_UNIX_ATTRIBUTE: &str = "expirationTimeUnix"; // Usernames reserved because they exist in Ashoat's keyserver already pub const RESERVED_USERNAMES_TABLE: &str = "identity-reserved-usernames"; pub const RESERVED_USERNAMES_TABLE_PARTITION_KEY: &str = "username"; pub const RESERVED_USERNAMES_TABLE_USER_ID_ATTRIBUTE: &str = "userID"; // Users table social proof attribute pub const SOCIAL_PROOF_MESSAGE_ATTRIBUTE: &str = "siweMessage"; pub const SOCIAL_PROOF_SIGNATURE_ATTRIBUTE: &str = "siweSignature"; pub mod devices_table { /// table name pub const NAME: &str = "identity-devices"; pub const TIMESTAMP_INDEX_NAME: &str = "deviceList-timestamp-index"; pub const DEVICE_ID_INDEX_NAME: &str = "deviceID-index"; /// partition key pub const ATTR_USER_ID: &str = "userID"; /// sort key pub const ATTR_ITEM_ID: &str = "itemID"; // itemID prefixes (one shouldn't be a prefix of the other) pub const DEVICE_ITEM_KEY_PREFIX: &str = "device-"; pub const DEVICE_LIST_KEY_PREFIX: &str = "devicelist-"; // device-specific attrs pub const ATTR_DEVICE_KEY_INFO: &str = "deviceKeyInfo"; pub const ATTR_CONTENT_PREKEY: &str = "contentPreKey"; pub const ATTR_NOTIF_PREKEY: &str = "notifPreKey"; pub const ATTR_PLATFORM_DETAILS: &str = "platformDetails"; pub const ATTR_LOGIN_TIME: &str = "loginTime"; // IdentityKeyInfo constants pub const ATTR_KEY_PAYLOAD: &str = "keyPayload"; pub const ATTR_KEY_PAYLOAD_SIGNATURE: &str = "keyPayloadSignature"; // PreKey constants pub const ATTR_PREKEY: &str = "preKey"; pub const ATTR_PREKEY_SIGNATURE: &str = "preKeySignature"; // PlatformDetails constants pub const ATTR_DEVICE_TYPE: &str = "deviceType"; pub const ATTR_CODE_VERSION: &str = "codeVersion"; pub const ATTR_STATE_VERSION: &str = "stateVersion"; pub const ATTR_MAJOR_DESKTOP_VERSION: &str = "majorDesktopVersion"; // device-list-specific attrs pub const ATTR_TIMESTAMP: &str = "timestamp"; pub const ATTR_DEVICE_IDS: &str = "deviceIDs"; pub const ATTR_CURRENT_SIGNATURE: &str = "curPrimarySignature"; pub const ATTR_LAST_SIGNATURE: &str = "lastPrimarySignature"; // one-time key constants pub const ATTR_CONTENT_OTK_COUNT: &str = "contentOTKCount"; pub const ATTR_NOTIF_OTK_COUNT: &str = "notifOTKCount"; // deprecated attributes pub const OLD_ATTR_DEVICE_TYPE: &str = "deviceType"; pub const OLD_ATTR_CODE_VERSION: &str = "codeVersion"; } // One time keys table, which need to exist in their own table to ensure // atomicity of additions and removals pub mod one_time_keys_table { pub const NAME: &str = "identity-one-time-keys"; pub const PARTITION_KEY: &str = "userID#deviceID#olmAccount"; pub const SORT_KEY: &str = "timestamp#keyNumber"; pub const ATTR_ONE_TIME_KEY: &str = "oneTimeKey"; } // Tokio pub const MPSC_CHANNEL_BUFFER_CAPACITY: usize = 1; pub const IDENTITY_SERVICE_SOCKET_ADDR: &str = "[::]:50054"; pub const IDENTITY_SERVICE_WEBSOCKET_ADDR: &str = "[::]:51004"; pub const SOCKET_HEARTBEAT_TIMEOUT: Duration = Duration::from_secs(3); // Token pub const ACCESS_TOKEN_LENGTH: usize = 512; // Temporary config pub const AUTH_TOKEN: &str = "COMM_IDENTITY_SERVICE_AUTH_TOKEN"; pub const KEYSERVER_PUBLIC_KEY: &str = "KEYSERVER_PUBLIC_KEY"; // Nonce pub const NONCE_LENGTH: usize = 17; pub const NONCE_TTL_DURATION: Duration = Duration::from_secs(120); // seconds // Device list pub const DEVICE_LIST_TIMESTAMP_VALID_FOR: Duration = Duration::from_secs(300); // Workflows in progress pub const WORKFLOWS_IN_PROGRESS_TTL_DURATION: Duration = Duration::from_secs(120); // LocalStack pub const LOCALSTACK_ENDPOINT: &str = "LOCALSTACK_ENDPOINT"; // OPAQUE Server Setup pub const OPAQUE_SERVER_SETUP: &str = "OPAQUE_SERVER_SETUP"; // Identity Search pub const OPENSEARCH_ENDPOINT: &str = "OPENSEARCH_ENDPOINT"; pub const DEFAULT_OPENSEARCH_ENDPOINT: &str = "identity-search-domain.us-east-2.opensearch.localhost.localstack.cloud:4566"; pub const IDENTITY_SEARCH_INDEX: &str = "users"; pub const IDENTITY_SEARCH_RESULT_SIZE: u32 = 20; // Log Error Types pub mod error_types { pub const GENERIC_DB_LOG: &str = "DB Error"; pub const OTK_DB_LOG: &str = "One-time Key DB Error"; pub const DEVICE_LIST_DB_LOG: &str = "Device List DB Error"; pub const TOKEN_DB_LOG: &str = "Token DB Error"; pub const FARCASTER_DB_LOG: &str = "Farcaster DB Error"; pub const SYNC_LOG: &str = "Sync Error"; pub const SEARCH_LOG: &str = "Search Error"; pub const SIWE_LOG: &str = "SIWE Error"; pub const GRPC_SERVICES_LOG: &str = "gRPC Services Error"; pub const TUNNELBROKER_LOG: &str = "Tunnelbroker Error"; pub const HTTP_LOG: &str = "HTTP Error"; } // Tonic Status Messages pub mod tonic_status_messages { pub const UNEXPECTED_MESSAGE_DATA: &str = "unexpected_message_data"; pub const SIGNATURE_INVALID: &str = "signature_invalid"; pub const MALFORMED_KEY: &str = "malformed_key"; pub const VERIFICATION_FAILED: &str = "verification_failed"; pub const MALFORMED_PAYLOAD: &str = "malformed_payload"; pub const INVALID_DEVICE_LIST_PAYLOAD: &str = "invalid_device_list_payload"; pub const USERNAME_ALREADY_EXISTS: &str = "username_already_exists"; pub const USERNAME_RESERVED: &str = "username_reserved"; pub const WALLET_ADDRESS_TAKEN: &str = "wallet_address_taken"; pub const WALLET_ADDRESS_NOT_RESERVED: &str = "wallet_address_not_reserved"; pub const DEVICE_ID_ALREADY_EXISTS: &str = "device_id_already_exists"; pub const USER_NOT_FOUND: &str = "user_not_found"; pub const INVALID_NONCE: &str = "invalid_nonce"; pub const NONCE_EXPIRED: &str = "nonce_expired"; pub const FID_TAKEN: &str = "fid_taken"; pub const CANNOT_LINK_FID: &str = "cannot_link_fid"; pub const INVALID_PLATFORM_METADATA: &str = "invalid_platform_metadata"; pub const MISSING_CREDENTIALS: &str = "missing_credentials"; pub const BAD_CREDENTIALS: &str = "bad_credentials"; pub const SESSION_NOT_FOUND: &str = "session_not_found"; pub const INVALID_TIMESTAMP: &str = "invalid_timestamp"; pub const INVALID_USERNAME: &str = "invalid_username"; pub const USERNAME_NOT_RESERVED: &str = "username_not_reserved"; pub const NEED_KEYSERVER_MESSAGE_TO_CLAIM_USERNAME: &str = "need_keyserver_message_to_claim_username"; pub const UNEXPECTED_INITIAL_DEVICE_LIST: &str = "unexpected_initial_device_list"; pub const DEVICE_LIST_ERROR: &str = "device_list_error"; pub const DEVICE_NOT_IN_DEVICE_LIST: &str = "device_not_in_device_list"; pub const NO_IDENTIFIER_PROVIDED: &str = "no_identifier_provided"; pub const USER_ALREADY_HAS_KEYSERVER: &str = "user_already_has_keyserver"; pub const RETRY: &str = "retry"; pub const INVALID_DEVICE_LIST_UPDATE: &str = "invalid_device_list_update"; pub const INVALID_DEVICE_LIST_SIGNATURE: &str = "invalid_device_list_signature"; pub const UNEXPECTED_ERROR: &str = "unexpected_error"; pub const NO_DEVICE_LIST: &str = "no_device_list"; pub const USER_ID_MISSING: &str = "user_id_missing"; pub const DEVICE_ID_MISSING: &str = "device_id_missing"; pub const MISSING_CONTENT_KEYS: &str = "missing_content_keys"; pub const MISSING_NOTIF_KEYS: &str = "missing_notif_keys"; pub const KEYSERVER_NOT_FOUND: &str = "keyserver_not_found"; pub const PASSWORD_USER: &str = "password_user"; + pub const WALLET_USER: &str = "wallet_user"; pub const INVALID_MESSAGE: &str = "invalid_message"; pub const INVALID_MESSAGE_FORMAT: &str = "invalid_message_format"; pub const MISSING_PLATFORM_OR_CODE_VERSION_METADATA: &str = "missing_platform_or_code_version_metadata"; pub const MISSING_KEY: &str = "missing_key"; pub const MESSAGE_NOT_AUTHENTICATED: &str = "message_not_authenticated"; } // Tunnelbroker pub const TUNNELBROKER_GRPC_ENDPOINT: &str = "TUNNELBROKER_GRPC_ENDPOINT"; pub const DEFAULT_TUNNELBROKER_ENDPOINT: &str = "http://localhost:50051"; // X3DH key management // Threshold for requesting more one_time keys pub const ONE_TIME_KEY_MINIMUM_THRESHOLD: usize = 5; // Number of keys to be refreshed when below the threshold pub const ONE_TIME_KEY_REFRESH_NUMBER: u32 = 5; // Minimum supported code versions pub const MIN_SUPPORTED_NATIVE_VERSION: u64 = 270; // Request metadata pub mod request_metadata { pub const CODE_VERSION: &str = "code_version"; pub const STATE_VERSION: &str = "state_version"; pub const MAJOR_DESKTOP_VERSION: &str = "major_desktop_version"; pub const DEVICE_TYPE: &str = "device_type"; pub const USER_ID: &str = "user_id"; pub const DEVICE_ID: &str = "device_id"; pub const ACCESS_TOKEN: &str = "access_token"; } // CORS pub mod cors { use std::time::Duration; pub const DEFAULT_MAX_AGE: Duration = Duration::from_secs(24 * 60 * 60); pub const DEFAULT_EXPOSED_HEADERS: [&str; 3] = ["grpc-status", "grpc-message", "grpc-status-details-bin"]; pub const DEFAULT_ALLOW_HEADERS: [&str; 11] = [ "x-grpc-web", "content-type", "x-user-agent", "grpc-timeout", super::request_metadata::CODE_VERSION, super::request_metadata::STATE_VERSION, super::request_metadata::MAJOR_DESKTOP_VERSION, super::request_metadata::DEVICE_TYPE, super::request_metadata::USER_ID, super::request_metadata::DEVICE_ID, super::request_metadata::ACCESS_TOKEN, ]; pub const ALLOW_ORIGIN_LIST: &str = "ALLOW_ORIGIN_LIST"; pub const PROD_ORIGIN_HOST_STR: &str = "web.comm.app"; } // Tracing pub const COMM_SERVICES_USE_JSON_LOGS: &str = "COMM_SERVICES_USE_JSON_LOGS"; // Regex pub const VALID_USERNAME_REGEX_STRING: &str = r"^[a-zA-Z0-9][a-zA-Z0-9-_]{0,190}$"; // Retry // TODO: Replace this with `ExponentialBackoffConfig` from `comm-lib` pub mod retry { pub const MAX_ATTEMPTS: usize = 8; pub const CONDITIONAL_CHECK_FAILED: &str = "ConditionalCheckFailed"; pub const TRANSACTION_CONFLICT: &str = "TransactionConflict"; } // One-time keys pub const ONE_TIME_KEY_UPLOAD_LIMIT_PER_ACCOUNT: usize = 24; pub const ONE_TIME_KEY_SIZE: usize = 43; // as defined in olm pub const MAX_ONE_TIME_KEYS: usize = 100; // as defined in olm diff --git a/services/identity/src/grpc_services/authenticated.rs b/services/identity/src/grpc_services/authenticated.rs index 601b10a4a..2002ab057 100644 --- a/services/identity/src/grpc_services/authenticated.rs +++ b/services/identity/src/grpc_services/authenticated.rs @@ -1,869 +1,900 @@ use std::collections::HashMap; use crate::config::CONFIG; use crate::database::{DeviceListUpdate, PlatformDetails}; use crate::device_list::SignedDeviceList; use crate::error::consume_error; use crate::{ - client_service::{handle_db_error, UpdateState, WorkflowInProgress}, + client_service::{handle_db_error, WorkflowInProgress}, constants::{error_types, request_metadata, tonic_status_messages}, database::DatabaseClient, grpc_services::shared::{get_platform_metadata, get_value}, }; use chrono::DateTime; use comm_opaque2::grpc::protocol_error_to_grpc_status; use tonic::{Request, Response, Status}; use tracing::{debug, error, trace, warn}; use super::protos::auth::{ identity_client_service_server::IdentityClientService, DeletePasswordUserFinishRequest, DeletePasswordUserStartRequest, DeletePasswordUserStartResponse, GetDeviceListRequest, GetDeviceListResponse, InboundKeyInfo, InboundKeysForUserRequest, InboundKeysForUserResponse, KeyserverKeysResponse, LinkFarcasterAccountRequest, OutboundKeyInfo, OutboundKeysForUserRequest, OutboundKeysForUserResponse, PeersDeviceListsRequest, PeersDeviceListsResponse, RefreshUserPrekeysRequest, UpdateDeviceListRequest, UpdateUserPasswordFinishRequest, UpdateUserPasswordStartRequest, UpdateUserPasswordStartResponse, UploadOneTimeKeysRequest, UserDevicesPlatformDetails, UserIdentitiesRequest, UserIdentitiesResponse, }; use super::protos::unauth::Empty; #[derive(derive_more::Constructor)] pub struct AuthenticatedService { db_client: DatabaseClient, } fn get_auth_info(req: &Request<()>) -> Option<(String, String, String)> { trace!("Retrieving auth info for request: {:?}", req); let user_id = get_value(req, request_metadata::USER_ID)?; let device_id = get_value(req, request_metadata::DEVICE_ID)?; let access_token = get_value(req, request_metadata::ACCESS_TOKEN)?; Some((user_id, device_id, access_token)) } pub fn auth_interceptor( req: Request<()>, db_client: &DatabaseClient, ) -> Result, Status> { trace!("Intercepting request to check auth info: {:?}", req); let (user_id, device_id, access_token) = get_auth_info(&req).ok_or_else(|| { Status::unauthenticated(tonic_status_messages::MISSING_CREDENTIALS) })?; let handle = tokio::runtime::Handle::current(); let new_db_client = db_client.clone(); // This function cannot be `async`, yet must call the async db call // Force tokio to resolve future in current thread without an explicit .await let valid_token = tokio::task::block_in_place(move || { handle .block_on(new_db_client.verify_access_token( user_id, device_id, access_token, )) .map_err(handle_db_error) })?; if !valid_token { return Err(Status::aborted(tonic_status_messages::BAD_CREDENTIALS)); } Ok(req) } pub fn get_user_and_device_id( request: &Request, ) -> Result<(String, String), Status> { let user_id = get_value(request, request_metadata::USER_ID).ok_or_else(|| { Status::unauthenticated(tonic_status_messages::USER_ID_MISSING) })?; let device_id = get_value(request, request_metadata::DEVICE_ID).ok_or_else(|| { Status::unauthenticated(tonic_status_messages::DEVICE_ID_MISSING) })?; Ok((user_id, device_id)) } #[tonic::async_trait] impl IdentityClientService for AuthenticatedService { #[tracing::instrument(skip_all)] async fn refresh_user_prekeys( &self, request: Request, ) -> Result, Status> { let (user_id, device_id) = get_user_and_device_id(&request)?; let message = request.into_inner(); debug!("Refreshing prekeys for user: {}", user_id); let content_key = message.new_content_prekey.ok_or_else(|| { Status::invalid_argument(tonic_status_messages::MISSING_CONTENT_KEYS) })?; let notif_key = message.new_notif_prekey.ok_or_else(|| { Status::invalid_argument(tonic_status_messages::MISSING_NOTIF_KEYS) })?; self .db_client .update_device_prekeys( user_id, device_id, content_key.into(), notif_key.into(), ) .await .map_err(handle_db_error)?; let response = Response::new(Empty {}); Ok(response) } #[tracing::instrument(skip_all)] async fn get_outbound_keys_for_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let user_id = &message.user_id; let devices_map = self .db_client .get_keys_for_user(user_id, true) .await .map_err(handle_db_error)? .ok_or_else(|| { tonic::Status::not_found(tonic_status_messages::USER_NOT_FOUND) })?; let transformed_devices = devices_map .into_iter() .map(|(key, device_info)| (key, OutboundKeyInfo::from(device_info))) .collect::>(); Ok(tonic::Response::new(OutboundKeysForUserResponse { devices: transformed_devices, })) } #[tracing::instrument(skip_all)] async fn get_inbound_keys_for_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let user_id = &message.user_id; let devices_map = self .db_client .get_keys_for_user(user_id, false) .await .map_err(handle_db_error)? .ok_or_else(|| { tonic::Status::not_found(tonic_status_messages::USER_NOT_FOUND) })?; let transformed_devices = devices_map .into_iter() .map(|(key, device_info)| (key, InboundKeyInfo::from(device_info))) .collect::>(); let identifier = self .db_client .get_user_identity(user_id) .await .map_err(handle_db_error)? .ok_or_else(|| { tonic::Status::not_found(tonic_status_messages::USER_NOT_FOUND) })?; Ok(tonic::Response::new(InboundKeysForUserResponse { devices: transformed_devices, identity: Some(identifier.into()), })) } #[tracing::instrument(skip_all)] async fn get_keyserver_keys( &self, request: Request, ) -> Result, Status> { let message = request.into_inner(); let identifier = self .db_client .get_user_identity(&message.user_id) .await .map_err(handle_db_error)? .ok_or_else(|| { tonic::Status::not_found(tonic_status_messages::USER_NOT_FOUND) })?; let Some(keyserver_info) = self .db_client .get_keyserver_keys_for_user(&message.user_id) .await .map_err(handle_db_error)? else { return Err(Status::not_found( tonic_status_messages::KEYSERVER_NOT_FOUND, )); }; let primary_device_data = self .db_client .get_primary_device_data(&message.user_id) .await .map_err(handle_db_error)?; let primary_device_keys = primary_device_data.device_key_info; let response = Response::new(KeyserverKeysResponse { keyserver_info: Some(keyserver_info.into()), identity: Some(identifier.into()), primary_device_identity_info: Some(primary_device_keys.into()), }); return Ok(response); } #[tracing::instrument(skip_all)] async fn upload_one_time_keys( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, device_id) = get_user_and_device_id(&request)?; let message = request.into_inner(); debug!("Attempting to update one time keys for user: {}", user_id); self .db_client .append_one_time_prekeys( &user_id, &device_id, &message.content_one_time_prekeys, &message.notif_one_time_prekeys, ) .await .map_err(handle_db_error)?; Ok(tonic::Response::new(Empty {})) } #[tracing::instrument(skip_all)] async fn update_user_password_start( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _) = get_user_and_device_id(&request)?; + + let Some((username, password_file)) = self + .db_client + .get_username_and_password_file(&user_id) + .await + .map_err(handle_db_error)? + else { + return Err(tonic::Status::permission_denied( + tonic_status_messages::WALLET_USER, + )); + }; + let message = request.into_inner(); + let mut server_login = comm_opaque2::server::Login::new(); + let login_response = server_login + .start( + &CONFIG.server_setup, + &password_file, + &message.opaque_login_request, + username.as_bytes(), + ) + .map_err(protocol_error_to_grpc_status)?; + let server_registration = comm_opaque2::server::Registration::new(); - let server_message = server_registration + let registration_response = server_registration .start( &CONFIG.server_setup, &message.opaque_registration_request, - user_id.as_bytes(), + username.as_bytes(), ) .map_err(protocol_error_to_grpc_status)?; - let update_state = UpdateState { user_id }; + let update_state = UpdatePasswordInfo::new(server_login); let session_id = self .db_client - .insert_workflow(WorkflowInProgress::Update(update_state)) + .insert_workflow(WorkflowInProgress::Update(Box::new(update_state))) .await .map_err(handle_db_error)?; let response = UpdateUserPasswordStartResponse { session_id, - opaque_registration_response: server_message, + opaque_registration_response: registration_response, + opaque_login_response: login_response, }; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn update_user_password_finish( &self, request: tonic::Request, ) -> Result, tonic::Status> { + let (user_id, _) = get_user_and_device_id(&request)?; + let message = request.into_inner(); let Some(WorkflowInProgress::Update(state)) = self .db_client .get_workflow(message.session_id) .await .map_err(handle_db_error)? else { return Err(tonic::Status::not_found( tonic_status_messages::SESSION_NOT_FOUND, )); }; + let mut server_login = state.opaque_server_login; + server_login + .finish(&message.opaque_login_upload) + .map_err(protocol_error_to_grpc_status)?; + let server_registration = comm_opaque2::server::Registration::new(); let password_file = server_registration .finish(&message.opaque_registration_upload) .map_err(protocol_error_to_grpc_status)?; self .db_client - .update_user_password(state.user_id, password_file) + .update_user_password(user_id, password_file) .await .map_err(handle_db_error)?; let response = Empty {}; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn log_out_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, device_id) = get_user_and_device_id(&request)?; self .db_client .remove_device(&user_id, &device_id) .await .map_err(handle_db_error)?; self .db_client .delete_otks_table_rows_for_user_device(&user_id, &device_id) .await .map_err(handle_db_error)?; self .db_client .delete_access_token_data(&user_id, device_id) .await .map_err(handle_db_error)?; let device_list = self .db_client .get_current_device_list(&user_id) .await .map_err(|err| { error!( user_id, errorType = error_types::GRPC_SERVICES_LOG, "Failed fetching device list: {err}" ); handle_db_error(err) })?; let Some(device_list) = device_list else { error!( user_id, errorType = error_types::GRPC_SERVICES_LOG, "User has no device list!" ); return Err(Status::failed_precondition("no device list")); }; tokio::spawn(async move { debug!( "Sending device list updates to {:?}", device_list.device_ids ); let device_ids: Vec<&str> = device_list.device_ids.iter().map(AsRef::as_ref).collect(); let result = crate::tunnelbroker::send_device_list_update(&device_ids).await; consume_error(result); }); let response = Empty {}; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn log_out_secondary_device( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, device_id) = get_user_and_device_id(&request)?; debug!( "Secondary device logout request for user_id={}, device_id={}", user_id, device_id ); self .verify_device_on_device_list( &user_id, &device_id, DeviceListItemKind::Secondary, ) .await?; self .db_client .delete_access_token_data(&user_id, &device_id) .await .map_err(handle_db_error)?; self .db_client .delete_otks_table_rows_for_user_device(&user_id, &device_id) .await .map_err(handle_db_error)?; let response = Empty {}; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn delete_wallet_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _) = get_user_and_device_id(&request)?; debug!("Attempting to delete wallet user: {}", user_id); let maybe_username_and_password_file = self .db_client .get_username_and_password_file(&user_id) .await .map_err(handle_db_error)?; if maybe_username_and_password_file.is_some() { return Err(tonic::Status::permission_denied( tonic_status_messages::PASSWORD_USER, )); } self .db_client .delete_user(user_id) .await .map_err(handle_db_error)?; let response = Empty {}; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn delete_password_user_start( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _) = get_user_and_device_id(&request)?; let message = request.into_inner(); debug!("Attempting to start deleting password user: {}", user_id); let maybe_username_and_password_file = self .db_client .get_username_and_password_file(&user_id) .await .map_err(handle_db_error)?; let Some((username, password_file_bytes)) = maybe_username_and_password_file else { return Err(tonic::Status::not_found( tonic_status_messages::USER_NOT_FOUND, )); }; let mut server_login = comm_opaque2::server::Login::new(); let server_response = server_login .start( &CONFIG.server_setup, &password_file_bytes, &message.opaque_login_request, username.as_bytes(), ) .map_err(protocol_error_to_grpc_status)?; - let delete_state = construct_delete_password_user_info(server_login); + let delete_state = DeletePasswordUserInfo::new(server_login); let session_id = self .db_client .insert_workflow(WorkflowInProgress::PasswordUserDeletion(Box::new( delete_state, ))) .await .map_err(handle_db_error)?; let response = Response::new(DeletePasswordUserStartResponse { session_id, opaque_login_response: server_response, }); Ok(response) } #[tracing::instrument(skip_all)] async fn delete_password_user_finish( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _) = get_user_and_device_id(&request)?; let message = request.into_inner(); debug!("Attempting to finish deleting password user: {}", user_id); let Some(WorkflowInProgress::PasswordUserDeletion(state)) = self .db_client .get_workflow(message.session_id) .await .map_err(handle_db_error)? else { return Err(tonic::Status::not_found( tonic_status_messages::SESSION_NOT_FOUND, )); }; let mut server_login = state.opaque_server_login; server_login .finish(&message.opaque_login_upload) .map_err(protocol_error_to_grpc_status)?; self .db_client .delete_user(user_id) .await .map_err(handle_db_error)?; let response = Empty {}; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn get_device_list_for_user( &self, request: tonic::Request, ) -> Result, tonic::Status> { let GetDeviceListRequest { user_id, since_timestamp, } = request.into_inner(); let since = since_timestamp .map(|timestamp| { DateTime::from_timestamp_millis(timestamp).ok_or_else(|| { tonic::Status::invalid_argument( tonic_status_messages::INVALID_TIMESTAMP, ) }) }) .transpose()?; let mut db_result = self .db_client .get_device_list_history(user_id, since) .await .map_err(handle_db_error)?; // these should be sorted already, but just in case db_result.sort_by_key(|list| list.timestamp); let device_list_updates: Vec = db_result .into_iter() .map(SignedDeviceList::try_from) .collect::, _>>()?; let stringified_updates = device_list_updates .iter() .map(SignedDeviceList::as_json_string) .collect::, _>>()?; Ok(Response::new(GetDeviceListResponse { device_list_updates: stringified_updates, })) } #[tracing::instrument(skip_all)] async fn get_device_lists_for_users( &self, request: tonic::Request, ) -> Result, tonic::Status> { let PeersDeviceListsRequest { user_ids } = request.into_inner(); use crate::database::{DeviceListRow, DeviceRow}; async fn get_current_device_list_and_data( db_client: DatabaseClient, user_id: &str, ) -> Result<(Option, Vec), crate::error::Error> { let (list_result, data_result) = tokio::join!( db_client.get_current_device_list(user_id), db_client.get_current_devices(user_id) ); Ok((list_result?, data_result?)) } // do all fetches concurrently let mut fetch_tasks = tokio::task::JoinSet::new(); let mut device_lists = HashMap::with_capacity(user_ids.len()); let mut users_devices_platform_details = HashMap::with_capacity(user_ids.len()); for user_id in user_ids { let db_client = self.db_client.clone(); fetch_tasks.spawn(async move { let result = get_current_device_list_and_data(db_client, &user_id).await; (user_id, result) }); } while let Some(task_result) = fetch_tasks.join_next().await { match task_result { Ok((user_id, Ok((device_list, devices_data)))) => { let Some(device_list_row) = device_list else { warn!(user_id, "User has no device list, skipping!"); continue; }; let signed_list = SignedDeviceList::try_from(device_list_row)?; let serialized_list = signed_list.as_json_string()?; device_lists.insert(user_id.clone(), serialized_list); let devices_platform_details = devices_data .into_iter() .map(|data| (data.device_id, data.platform_details.into())) .collect(); users_devices_platform_details.insert( user_id, UserDevicesPlatformDetails { devices_platform_details, }, ); } Ok((user_id, Err(err))) => { error!( user_id, errorType = error_types::GRPC_SERVICES_LOG, "Failed fetching device list: {err}" ); // abort fetching other users fetch_tasks.abort_all(); return Err(handle_db_error(err)); } Err(join_error) => { error!( errorType = error_types::GRPC_SERVICES_LOG, "Failed to join device list task: {join_error}" ); fetch_tasks.abort_all(); return Err(Status::aborted(tonic_status_messages::UNEXPECTED_ERROR)); } } } let response = PeersDeviceListsResponse { users_device_lists: device_lists, users_devices_platform_details, }; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn update_device_list( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _device_id) = get_user_and_device_id(&request)?; // TODO: when we stop doing "primary device rotation" (migration procedure) // we should verify if this RPC is called by primary device only let new_list = SignedDeviceList::try_from(request.into_inner())?; let update = DeviceListUpdate::try_from(new_list)?; self .db_client .apply_devicelist_update( &user_id, update, crate::device_list::validation::update_device_list_rpc_validator, ) .await .map_err(handle_db_error)?; Ok(Response::new(Empty {})) } #[tracing::instrument(skip_all)] async fn link_farcaster_account( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _) = get_user_and_device_id(&request)?; let message = request.into_inner(); let mut get_farcaster_users_response = self .db_client .get_farcaster_users(vec![message.farcaster_id.clone()]) .await .map_err(handle_db_error)?; if get_farcaster_users_response.len() > 1 { error!( errorType = error_types::GRPC_SERVICES_LOG, "multiple users associated with the same Farcaster ID" ); return Err(Status::failed_precondition( tonic_status_messages::CANNOT_LINK_FID, )); } if let Some(u) = get_farcaster_users_response.pop() { if u.0.user_id == user_id { return Ok(Response::new(Empty {})); } else { return Err(Status::already_exists(tonic_status_messages::FID_TAKEN)); } } self .db_client .add_farcaster_id(user_id, message.farcaster_id) .await .map_err(handle_db_error)?; let response = Empty {}; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn unlink_farcaster_account( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, _) = get_user_and_device_id(&request)?; self .db_client .remove_farcaster_id(user_id) .await .map_err(handle_db_error)?; let response = Empty {}; Ok(Response::new(response)) } #[tracing::instrument(skip_all)] async fn find_user_identities( &self, request: tonic::Request, ) -> Result, tonic::Status> { let message = request.into_inner(); let results = self .db_client .find_db_user_identities(message.user_ids) .await .map_err(handle_db_error)?; let mapped_results = results .into_iter() .map(|(user_id, identifier)| (user_id, identifier.into())) .collect(); let response = UserIdentitiesResponse { identities: mapped_results, }; return Ok(Response::new(response)); } #[tracing::instrument(skip_all)] async fn sync_platform_details( &self, request: tonic::Request, ) -> Result, tonic::Status> { let (user_id, device_id) = get_user_and_device_id(&request)?; let platform_metadata = get_platform_metadata(&request)?; let platform_details = PlatformDetails::new(platform_metadata, None) .map_err(|_| { Status::invalid_argument( tonic_status_messages::INVALID_PLATFORM_METADATA, ) })?; self .db_client .update_device_platform_details(user_id, device_id, platform_details) .await .map_err(handle_db_error)?; Ok(Response::new(Empty {})) } } #[allow(dead_code)] enum DeviceListItemKind { Any, Primary, Secondary, } impl AuthenticatedService { async fn verify_device_on_device_list( &self, user_id: &String, device_id: &String, device_kind: DeviceListItemKind, ) -> Result<(), tonic::Status> { let device_list = self .db_client .get_current_device_list(user_id) .await .map_err(|err| { error!( user_id, errorType = error_types::GRPC_SERVICES_LOG, "Failed fetching device list: {err}" ); handle_db_error(err) })?; let Some(device_list) = device_list else { error!( user_id, errorType = error_types::GRPC_SERVICES_LOG, "User has no device list!" ); return Err(Status::failed_precondition( tonic_status_messages::NO_DEVICE_LIST, )); }; use DeviceListItemKind as DeviceKind; let device_on_list = match device_kind { DeviceKind::Any => device_list.has_device(device_id), DeviceKind::Primary => device_list.is_primary_device(device_id), DeviceKind::Secondary => device_list.has_secondary_device(device_id), }; if !device_on_list { debug!( "Device {} not in device list for user {}", device_id, user_id ); return Err(Status::permission_denied( tonic_status_messages::DEVICE_NOT_IN_DEVICE_LIST, )); } Ok(()) } } -#[derive(Clone, serde::Serialize, serde::Deserialize)] +#[derive( + Clone, serde::Serialize, serde::Deserialize, derive_more::Constructor, +)] pub struct DeletePasswordUserInfo { pub opaque_server_login: comm_opaque2::server::Login, } -fn construct_delete_password_user_info( - opaque_server_login: comm_opaque2::server::Login, -) -> DeletePasswordUserInfo { - DeletePasswordUserInfo { - opaque_server_login, - } +#[derive( + Clone, serde::Serialize, serde::Deserialize, derive_more::Constructor, +)] +pub struct UpdatePasswordInfo { + pub opaque_server_login: comm_opaque2::server::Login, } diff --git a/shared/protos/identity_auth.proto b/shared/protos/identity_auth.proto index e8dc4a033..4425db401 100644 --- a/shared/protos/identity_auth.proto +++ b/shared/protos/identity_auth.proto @@ -1,297 +1,300 @@ syntax = "proto3"; import "identity_unauth.proto"; package identity.auth; // RPCs from a client (iOS, Android, or web) to identity service // // This service will assert authenticity of a device by verifying the access // token through an interceptor, thus avoiding the need to explicitly pass // the credentials on every request service IdentityClientService { /* X3DH actions */ // Replenish one-time preKeys rpc UploadOneTimeKeys(UploadOneTimeKeysRequest) returns (identity.unauth.Empty) {} // Rotate a device's prekey and prekey signature // Rotated for deniability of older messages rpc RefreshUserPrekeys(RefreshUserPrekeysRequest) returns (identity.unauth.Empty) {} // Called by clients to get all device keys associated with a user in order // to open a new channel of communication on any of their devices. // Specially, this will return the following per device: // - Identity keys (both Content and Notif Keys) // - Prekey (including prekey signature) // - One-time Prekey rpc GetOutboundKeysForUser(OutboundKeysForUserRequest) returns (OutboundKeysForUserResponse) {} // Called by receivers of a communication request. The reponse will return // identity keys (both content and notif keys) and related prekeys per device, // but will not contain one-time keys. Additionally, the response will contain // the other user's username. rpc GetInboundKeysForUser(InboundKeysForUserRequest) returns (InboundKeysForUserResponse) {} // Called by clients to get required keys for opening a connection // to a user's keyserver rpc GetKeyserverKeys(OutboundKeysForUserRequest) returns (KeyserverKeysResponse) {} /* Account actions */ - // Called by user to update password and receive new access token + // Called by user to update password rpc UpdateUserPasswordStart(UpdateUserPasswordStartRequest) returns (UpdateUserPasswordStartResponse) {} rpc UpdateUserPasswordFinish(UpdateUserPasswordFinishRequest) returns (identity.unauth.Empty) {} // Called by user to log out (clears device's keys and access token) rpc LogOutUser(identity.unauth.Empty) returns (identity.unauth.Empty) {} // Called by a ssecondary device to log out (clear its keys and access token) rpc LogOutSecondaryDevice(identity.unauth.Empty) returns (identity.unauth.Empty) {} // Called by a user to delete their own account rpc DeletePasswordUserStart(DeletePasswordUserStartRequest) returns (DeletePasswordUserStartResponse) {} rpc DeletePasswordUserFinish(DeletePasswordUserFinishRequest) returns (identity.unauth.Empty) {} rpc DeleteWalletUser(identity.unauth.Empty) returns (identity.unauth.Empty) {} /* Device list actions */ // Returns device list history rpc GetDeviceListForUser(GetDeviceListRequest) returns (GetDeviceListResponse) {} // Returns current device list for a set of users rpc GetDeviceListsForUsers (PeersDeviceListsRequest) returns (PeersDeviceListsResponse) {} rpc UpdateDeviceList(UpdateDeviceListRequest) returns (identity.unauth.Empty) {} /* Farcaster actions */ // Called by an existing user to link their Farcaster account rpc LinkFarcasterAccount(LinkFarcasterAccountRequest) returns (identity.unauth.Empty) {} // Called by an existing user to unlink their Farcaster account rpc UnlinkFarcasterAccount(identity.unauth.Empty) returns (identity.unauth.Empty) {} /* Miscellaneous actions */ rpc FindUserIdentities(UserIdentitiesRequest) returns (UserIdentitiesResponse) {} // Updates current device PlatformDetails stored on Identity Service. // It doesn't require any input - all values are passed via request metadata. rpc SyncPlatformDetails(identity.unauth.Empty) returns (identity.unauth.Empty) {} } // Helper types message EthereumIdentity { string wallet_address = 1; string siwe_message = 2; string siwe_signature = 3; } message Identity { // this is wallet address for Ethereum users string username = 1; optional EthereumIdentity eth_identity = 2; optional string farcaster_id = 3; } // UploadOneTimeKeys // As OPKs get exhausted, they need to be refreshed message UploadOneTimeKeysRequest { repeated string content_one_time_prekeys = 1; repeated string notif_one_time_prekeys = 2; } // RefreshUserPreKeys message RefreshUserPrekeysRequest { identity.unauth.Prekey new_content_prekey = 1; identity.unauth.Prekey new_notif_prekey = 2; } // Information needed when establishing communication to someone else's device message OutboundKeyInfo { identity.unauth.IdentityKeyInfo identity_info = 1; identity.unauth.Prekey content_prekey = 2; identity.unauth.Prekey notif_prekey = 3; optional string one_time_content_prekey = 4; optional string one_time_notif_prekey = 5; } message KeyserverKeysResponse { OutboundKeyInfo keyserver_info = 1; Identity identity = 2; identity.unauth.IdentityKeyInfo primary_device_identity_info = 3; } // GetOutboundKeysForUser message OutboundKeysForUserResponse { // Map is keyed on devices' public ed25519 key used for signing map devices = 1; } // Information needed by a device to establish communcation when responding // to a request. // The device receiving a request only needs the content key and prekey. message OutboundKeysForUserRequest { string user_id = 1; } // GetInboundKeysForUser message InboundKeyInfo { identity.unauth.IdentityKeyInfo identity_info = 1; identity.unauth.Prekey content_prekey = 2; identity.unauth.Prekey notif_prekey = 3; } message InboundKeysForUserResponse { // Map is keyed on devices' public ed25519 key used for signing map devices = 1; Identity identity = 2; } message InboundKeysForUserRequest { string user_id = 1; } // UpdateUserPassword -// Request for updating a user, similar to registration but need a -// access token to validate user before updating password message UpdateUserPasswordStartRequest { - // Message sent to initiate PAKE registration (step 1) + // Initiate PAKE registration with new password bytes opaque_registration_request = 1; + // Initiate PAKE login with old password + bytes opaque_login_request = 2; } -// Do a user registration, but overwrite the existing credentials -// after validation of user message UpdateUserPasswordFinishRequest { // Identifier used to correlate start and finish request string session_id = 1; - // Opaque client registration upload (step 3) + // Complete PAKE registration with new password bytes opaque_registration_upload = 2; + // Complete PAKE login with old password + bytes opaque_login_upload = 3; } message UpdateUserPasswordStartResponse { // Identifier used to correlate start request with finish request string session_id = 1; + // Continue PAKE registration on server with new password bytes opaque_registration_response = 2; + // Continue PAKE login on server with old password + bytes opaque_login_response = 3; } // DeletePasswordUser // First user must log in message DeletePasswordUserStartRequest { // Message sent to initiate PAKE login bytes opaque_login_request = 1; } // If login is successful, the user's account will be deleted message DeletePasswordUserFinishRequest { // Identifier used to correlate requests in the same workflow string session_id = 1; bytes opaque_login_upload = 2; } message DeletePasswordUserStartResponse { // Identifier used to correlate requests in the same workflow string session_id = 1; bytes opaque_login_response = 2; } // GetDeviceListForUser message GetDeviceListRequest { // User whose device lists we want to retrieve string user_id = 1; // UTC timestamp in milliseconds // If none, whole device list history will be retrieved optional int64 since_timestamp = 2; } message GetDeviceListResponse { // A list of stringified JSON objects of the following format: // { // "rawDeviceList": JSON.stringify({ // "devices": [, ...] // "timestamp": , // }) // } repeated string device_list_updates = 1; } // GetDeviceListsForUsers // platform details for single device message PlatformDetails { identity.unauth.DeviceType device_type = 1; uint64 code_version = 2; optional uint64 state_version = 3; optional uint64 major_desktop_version = 4; } // platform details for user's devices message UserDevicesPlatformDetails { // keys are device IDs map devices_platform_details = 1; } message PeersDeviceListsRequest { repeated string user_ids = 1; } message PeersDeviceListsResponse { // keys are user_id // values are JSON-stringified device list payloads // (see GetDeviceListResponse message for payload structure) map users_device_lists = 1; // keys are user IDs map users_devices_platform_details = 2; } // UpdateDeviceListForUser message UpdateDeviceListRequest { // A stringified JSON object of the following format: // { // "rawDeviceList": JSON.stringify({ // "devices": [, ...] // "timestamp": , // }) // } string new_device_list = 1; } // LinkFarcasterAccount message LinkFarcasterAccountRequest { string farcaster_id = 1; } // FindUserIdentities message UserIdentitiesRequest { // user IDs for which we want to get the identity repeated string user_ids = 1; } message UserIdentitiesResponse { map identities = 1; } diff --git a/web/protobufs/identity-auth-structs.cjs b/web/protobufs/identity-auth-structs.cjs index 4439f7fdc..367792723 100644 --- a/web/protobufs/identity-auth-structs.cjs +++ b/web/protobufs/identity-auth-structs.cjs @@ -1,5523 +1,5685 @@ // source: identity_auth.proto /** * @fileoverview * @enhanceable * @suppress {missingRequire} reports error on implicit type usages. * @suppress {messageConventions} JS Compiler reports an error if a variable or * field starts with 'MSG_' and isn't a translatable message. * @public * @generated */ // GENERATED CODE -- DO NOT EDIT! /* eslint-disable */ // @ts-nocheck var jspb = require('google-protobuf'); var goog = jspb; var global = (typeof globalThis !== 'undefined' && globalThis) || (typeof window !== 'undefined' && window) || (typeof global !== 'undefined' && global) || (typeof self !== 'undefined' && self) || (function () { return this; }).call(null) || Function('return this')(); var identity_unauth_pb = require('./identity-unauth-structs.cjs'); goog.object.extend(proto, identity_unauth_pb); goog.exportSymbol('proto.identity.auth.DeletePasswordUserFinishRequest', null, global); goog.exportSymbol('proto.identity.auth.DeletePasswordUserStartRequest', null, global); goog.exportSymbol('proto.identity.auth.DeletePasswordUserStartResponse', null, global); goog.exportSymbol('proto.identity.auth.EthereumIdentity', null, global); goog.exportSymbol('proto.identity.auth.GetDeviceListRequest', null, global); goog.exportSymbol('proto.identity.auth.GetDeviceListResponse', null, global); goog.exportSymbol('proto.identity.auth.Identity', null, global); goog.exportSymbol('proto.identity.auth.InboundKeyInfo', null, global); goog.exportSymbol('proto.identity.auth.InboundKeysForUserRequest', null, global); goog.exportSymbol('proto.identity.auth.InboundKeysForUserResponse', null, global); goog.exportSymbol('proto.identity.auth.KeyserverKeysResponse', null, global); goog.exportSymbol('proto.identity.auth.LinkFarcasterAccountRequest', null, global); goog.exportSymbol('proto.identity.auth.OutboundKeyInfo', null, global); goog.exportSymbol('proto.identity.auth.OutboundKeysForUserRequest', null, global); goog.exportSymbol('proto.identity.auth.OutboundKeysForUserResponse', null, global); goog.exportSymbol('proto.identity.auth.PeersDeviceListsRequest', null, global); goog.exportSymbol('proto.identity.auth.PeersDeviceListsResponse', null, global); goog.exportSymbol('proto.identity.auth.PlatformDetails', null, global); goog.exportSymbol('proto.identity.auth.RefreshUserPrekeysRequest', null, global); goog.exportSymbol('proto.identity.auth.UpdateDeviceListRequest', null, global); goog.exportSymbol('proto.identity.auth.UpdateUserPasswordFinishRequest', null, global); goog.exportSymbol('proto.identity.auth.UpdateUserPasswordStartRequest', null, global); goog.exportSymbol('proto.identity.auth.UpdateUserPasswordStartResponse', null, global); goog.exportSymbol('proto.identity.auth.UploadOneTimeKeysRequest', null, global); goog.exportSymbol('proto.identity.auth.UserDevicesPlatformDetails', null, global); goog.exportSymbol('proto.identity.auth.UserIdentitiesRequest', null, global); goog.exportSymbol('proto.identity.auth.UserIdentitiesResponse', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.EthereumIdentity = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.EthereumIdentity, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.EthereumIdentity.displayName = 'proto.identity.auth.EthereumIdentity'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.Identity = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.Identity, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.Identity.displayName = 'proto.identity.auth.Identity'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.UploadOneTimeKeysRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.identity.auth.UploadOneTimeKeysRequest.repeatedFields_, null); }; goog.inherits(proto.identity.auth.UploadOneTimeKeysRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UploadOneTimeKeysRequest.displayName = 'proto.identity.auth.UploadOneTimeKeysRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.RefreshUserPrekeysRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.RefreshUserPrekeysRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.RefreshUserPrekeysRequest.displayName = 'proto.identity.auth.RefreshUserPrekeysRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.OutboundKeyInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.OutboundKeyInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.OutboundKeyInfo.displayName = 'proto.identity.auth.OutboundKeyInfo'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.KeyserverKeysResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.KeyserverKeysResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.KeyserverKeysResponse.displayName = 'proto.identity.auth.KeyserverKeysResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.OutboundKeysForUserResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.OutboundKeysForUserResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.OutboundKeysForUserResponse.displayName = 'proto.identity.auth.OutboundKeysForUserResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.OutboundKeysForUserRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.OutboundKeysForUserRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.OutboundKeysForUserRequest.displayName = 'proto.identity.auth.OutboundKeysForUserRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.InboundKeyInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.InboundKeyInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.InboundKeyInfo.displayName = 'proto.identity.auth.InboundKeyInfo'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.InboundKeysForUserResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.InboundKeysForUserResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.InboundKeysForUserResponse.displayName = 'proto.identity.auth.InboundKeysForUserResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.InboundKeysForUserRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.InboundKeysForUserRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.InboundKeysForUserRequest.displayName = 'proto.identity.auth.InboundKeysForUserRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.UpdateUserPasswordStartRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UpdateUserPasswordStartRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UpdateUserPasswordStartRequest.displayName = 'proto.identity.auth.UpdateUserPasswordStartRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.UpdateUserPasswordFinishRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UpdateUserPasswordFinishRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UpdateUserPasswordFinishRequest.displayName = 'proto.identity.auth.UpdateUserPasswordFinishRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.UpdateUserPasswordStartResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UpdateUserPasswordStartResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UpdateUserPasswordStartResponse.displayName = 'proto.identity.auth.UpdateUserPasswordStartResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.DeletePasswordUserStartRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.DeletePasswordUserStartRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.DeletePasswordUserStartRequest.displayName = 'proto.identity.auth.DeletePasswordUserStartRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.DeletePasswordUserFinishRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.DeletePasswordUserFinishRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.DeletePasswordUserFinishRequest.displayName = 'proto.identity.auth.DeletePasswordUserFinishRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.DeletePasswordUserStartResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.DeletePasswordUserStartResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.DeletePasswordUserStartResponse.displayName = 'proto.identity.auth.DeletePasswordUserStartResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.GetDeviceListRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.GetDeviceListRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.GetDeviceListRequest.displayName = 'proto.identity.auth.GetDeviceListRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.GetDeviceListResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.identity.auth.GetDeviceListResponse.repeatedFields_, null); }; goog.inherits(proto.identity.auth.GetDeviceListResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.GetDeviceListResponse.displayName = 'proto.identity.auth.GetDeviceListResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.PlatformDetails = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.PlatformDetails, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.PlatformDetails.displayName = 'proto.identity.auth.PlatformDetails'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.UserDevicesPlatformDetails = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UserDevicesPlatformDetails, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UserDevicesPlatformDetails.displayName = 'proto.identity.auth.UserDevicesPlatformDetails'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.PeersDeviceListsRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.identity.auth.PeersDeviceListsRequest.repeatedFields_, null); }; goog.inherits(proto.identity.auth.PeersDeviceListsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.PeersDeviceListsRequest.displayName = 'proto.identity.auth.PeersDeviceListsRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.PeersDeviceListsResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.PeersDeviceListsResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.PeersDeviceListsResponse.displayName = 'proto.identity.auth.PeersDeviceListsResponse'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.UpdateDeviceListRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UpdateDeviceListRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UpdateDeviceListRequest.displayName = 'proto.identity.auth.UpdateDeviceListRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.LinkFarcasterAccountRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.LinkFarcasterAccountRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.LinkFarcasterAccountRequest.displayName = 'proto.identity.auth.LinkFarcasterAccountRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.UserIdentitiesRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.identity.auth.UserIdentitiesRequest.repeatedFields_, null); }; goog.inherits(proto.identity.auth.UserIdentitiesRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UserIdentitiesRequest.displayName = 'proto.identity.auth.UserIdentitiesRequest'; } /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.identity.auth.UserIdentitiesResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.auth.UserIdentitiesResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.auth.UserIdentitiesResponse.displayName = 'proto.identity.auth.UserIdentitiesResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.EthereumIdentity.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.EthereumIdentity.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.EthereumIdentity} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.EthereumIdentity.toObject = function(includeInstance, msg) { var f, obj = { walletAddress: jspb.Message.getFieldWithDefault(msg, 1, ""), siweMessage: jspb.Message.getFieldWithDefault(msg, 2, ""), siweSignature: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.EthereumIdentity} */ proto.identity.auth.EthereumIdentity.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.EthereumIdentity; return proto.identity.auth.EthereumIdentity.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.EthereumIdentity} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.EthereumIdentity} */ proto.identity.auth.EthereumIdentity.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setWalletAddress(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setSiweMessage(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setSiweSignature(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.EthereumIdentity.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.EthereumIdentity.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.EthereumIdentity} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.EthereumIdentity.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getWalletAddress(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getSiweMessage(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getSiweSignature(); if (f.length > 0) { writer.writeString( 3, f ); } }; /** * optional string wallet_address = 1; * @return {string} */ proto.identity.auth.EthereumIdentity.prototype.getWalletAddress = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.EthereumIdentity} returns this */ proto.identity.auth.EthereumIdentity.prototype.setWalletAddress = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string siwe_message = 2; * @return {string} */ proto.identity.auth.EthereumIdentity.prototype.getSiweMessage = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.auth.EthereumIdentity} returns this */ proto.identity.auth.EthereumIdentity.prototype.setSiweMessage = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string siwe_signature = 3; * @return {string} */ proto.identity.auth.EthereumIdentity.prototype.getSiweSignature = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value * @return {!proto.identity.auth.EthereumIdentity} returns this */ proto.identity.auth.EthereumIdentity.prototype.setSiweSignature = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.Identity.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.Identity.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.Identity} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.Identity.toObject = function(includeInstance, msg) { var f, obj = { username: jspb.Message.getFieldWithDefault(msg, 1, ""), ethIdentity: (f = msg.getEthIdentity()) && proto.identity.auth.EthereumIdentity.toObject(includeInstance, f), farcasterId: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.Identity} */ proto.identity.auth.Identity.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.Identity; return proto.identity.auth.Identity.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.Identity} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.Identity} */ proto.identity.auth.Identity.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setUsername(value); break; case 2: var value = new proto.identity.auth.EthereumIdentity; reader.readMessage(value,proto.identity.auth.EthereumIdentity.deserializeBinaryFromReader); msg.setEthIdentity(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setFarcasterId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.Identity.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.Identity.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.Identity} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.Identity.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUsername(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getEthIdentity(); if (f != null) { writer.writeMessage( 2, f, proto.identity.auth.EthereumIdentity.serializeBinaryToWriter ); } f = /** @type {string} */ (jspb.Message.getField(message, 3)); if (f != null) { writer.writeString( 3, f ); } }; /** * optional string username = 1; * @return {string} */ proto.identity.auth.Identity.prototype.getUsername = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.Identity} returns this */ proto.identity.auth.Identity.prototype.setUsername = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional EthereumIdentity eth_identity = 2; * @return {?proto.identity.auth.EthereumIdentity} */ proto.identity.auth.Identity.prototype.getEthIdentity = function() { return /** @type{?proto.identity.auth.EthereumIdentity} */ ( jspb.Message.getWrapperField(this, proto.identity.auth.EthereumIdentity, 2)); }; /** * @param {?proto.identity.auth.EthereumIdentity|undefined} value * @return {!proto.identity.auth.Identity} returns this */ proto.identity.auth.Identity.prototype.setEthIdentity = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.Identity} returns this */ proto.identity.auth.Identity.prototype.clearEthIdentity = function() { return this.setEthIdentity(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.Identity.prototype.hasEthIdentity = function() { return jspb.Message.getField(this, 2) != null; }; /** * optional string farcaster_id = 3; * @return {string} */ proto.identity.auth.Identity.prototype.getFarcasterId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value * @return {!proto.identity.auth.Identity} returns this */ proto.identity.auth.Identity.prototype.setFarcasterId = function(value) { return jspb.Message.setField(this, 3, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.auth.Identity} returns this */ proto.identity.auth.Identity.prototype.clearFarcasterId = function() { return jspb.Message.setField(this, 3, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.Identity.prototype.hasFarcasterId = function() { return jspb.Message.getField(this, 3) != null; }; /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.identity.auth.UploadOneTimeKeysRequest.repeatedFields_ = [1,2]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.UploadOneTimeKeysRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.UploadOneTimeKeysRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UploadOneTimeKeysRequest.toObject = function(includeInstance, msg) { var f, obj = { contentOneTimePrekeysList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f, notifOneTimePrekeysList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.UploadOneTimeKeysRequest} */ proto.identity.auth.UploadOneTimeKeysRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UploadOneTimeKeysRequest; return proto.identity.auth.UploadOneTimeKeysRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UploadOneTimeKeysRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UploadOneTimeKeysRequest} */ proto.identity.auth.UploadOneTimeKeysRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.addContentOneTimePrekeys(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.addNotifOneTimePrekeys(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.UploadOneTimeKeysRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.UploadOneTimeKeysRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UploadOneTimeKeysRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getContentOneTimePrekeysList(); if (f.length > 0) { writer.writeRepeatedString( 1, f ); } f = message.getNotifOneTimePrekeysList(); if (f.length > 0) { writer.writeRepeatedString( 2, f ); } }; /** * repeated string content_one_time_prekeys = 1; * @return {!Array} */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.getContentOneTimePrekeysList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** * @param {!Array} value * @return {!proto.identity.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.setContentOneTimePrekeysList = function(value) { return jspb.Message.setField(this, 1, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.addContentOneTimePrekeys = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** * Clears the list making it empty but non-null. * @return {!proto.identity.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.clearContentOneTimePrekeysList = function() { return this.setContentOneTimePrekeysList([]); }; /** * repeated string notif_one_time_prekeys = 2; * @return {!Array} */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.getNotifOneTimePrekeysList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; /** * @param {!Array} value * @return {!proto.identity.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.setNotifOneTimePrekeysList = function(value) { return jspb.Message.setField(this, 2, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.addNotifOneTimePrekeys = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; /** * Clears the list making it empty but non-null. * @return {!proto.identity.auth.UploadOneTimeKeysRequest} returns this */ proto.identity.auth.UploadOneTimeKeysRequest.prototype.clearNotifOneTimePrekeysList = function() { return this.setNotifOneTimePrekeysList([]); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.RefreshUserPrekeysRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.RefreshUserPrekeysRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.RefreshUserPrekeysRequest.toObject = function(includeInstance, msg) { var f, obj = { newContentPrekey: (f = msg.getNewContentPrekey()) && identity_unauth_pb.Prekey.toObject(includeInstance, f), newNotifPrekey: (f = msg.getNewNotifPrekey()) && identity_unauth_pb.Prekey.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.RefreshUserPrekeysRequest} */ proto.identity.auth.RefreshUserPrekeysRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.RefreshUserPrekeysRequest; return proto.identity.auth.RefreshUserPrekeysRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.RefreshUserPrekeysRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.RefreshUserPrekeysRequest} */ proto.identity.auth.RefreshUserPrekeysRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_pb.Prekey.deserializeBinaryFromReader); msg.setNewContentPrekey(value); break; case 2: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_pb.Prekey.deserializeBinaryFromReader); msg.setNewNotifPrekey(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.RefreshUserPrekeysRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.RefreshUserPrekeysRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.RefreshUserPrekeysRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNewContentPrekey(); if (f != null) { writer.writeMessage( 1, f, identity_unauth_pb.Prekey.serializeBinaryToWriter ); } f = message.getNewNotifPrekey(); if (f != null) { writer.writeMessage( 2, f, identity_unauth_pb.Prekey.serializeBinaryToWriter ); } }; /** * optional identity.unauth.Prekey new_content_prekey = 1; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.getNewContentPrekey = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 1)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.RefreshUserPrekeysRequest} returns this */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.setNewContentPrekey = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.RefreshUserPrekeysRequest} returns this */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.clearNewContentPrekey = function() { return this.setNewContentPrekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.hasNewContentPrekey = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional identity.unauth.Prekey new_notif_prekey = 2; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.getNewNotifPrekey = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 2)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.RefreshUserPrekeysRequest} returns this */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.setNewNotifPrekey = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.RefreshUserPrekeysRequest} returns this */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.clearNewNotifPrekey = function() { return this.setNewNotifPrekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.RefreshUserPrekeysRequest.prototype.hasNewNotifPrekey = function() { return jspb.Message.getField(this, 2) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.OutboundKeyInfo.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.OutboundKeyInfo.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.OutboundKeyInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.OutboundKeyInfo.toObject = function(includeInstance, msg) { var f, obj = { identityInfo: (f = msg.getIdentityInfo()) && identity_unauth_pb.IdentityKeyInfo.toObject(includeInstance, f), contentPrekey: (f = msg.getContentPrekey()) && identity_unauth_pb.Prekey.toObject(includeInstance, f), notifPrekey: (f = msg.getNotifPrekey()) && identity_unauth_pb.Prekey.toObject(includeInstance, f), oneTimeContentPrekey: jspb.Message.getFieldWithDefault(msg, 4, ""), oneTimeNotifPrekey: jspb.Message.getFieldWithDefault(msg, 5, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.OutboundKeyInfo} */ proto.identity.auth.OutboundKeyInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.OutboundKeyInfo; return proto.identity.auth.OutboundKeyInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.OutboundKeyInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.OutboundKeyInfo} */ proto.identity.auth.OutboundKeyInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new identity_unauth_pb.IdentityKeyInfo; reader.readMessage(value,identity_unauth_pb.IdentityKeyInfo.deserializeBinaryFromReader); msg.setIdentityInfo(value); break; case 2: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_pb.Prekey.deserializeBinaryFromReader); msg.setContentPrekey(value); break; case 3: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_pb.Prekey.deserializeBinaryFromReader); msg.setNotifPrekey(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.setOneTimeContentPrekey(value); break; case 5: var value = /** @type {string} */ (reader.readString()); msg.setOneTimeNotifPrekey(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.OutboundKeyInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.OutboundKeyInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.OutboundKeyInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.OutboundKeyInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getIdentityInfo(); if (f != null) { writer.writeMessage( 1, f, identity_unauth_pb.IdentityKeyInfo.serializeBinaryToWriter ); } f = message.getContentPrekey(); if (f != null) { writer.writeMessage( 2, f, identity_unauth_pb.Prekey.serializeBinaryToWriter ); } f = message.getNotifPrekey(); if (f != null) { writer.writeMessage( 3, f, identity_unauth_pb.Prekey.serializeBinaryToWriter ); } f = /** @type {string} */ (jspb.Message.getField(message, 4)); if (f != null) { writer.writeString( 4, f ); } f = /** @type {string} */ (jspb.Message.getField(message, 5)); if (f != null) { writer.writeString( 5, f ); } }; /** * optional identity.unauth.IdentityKeyInfo identity_info = 1; * @return {?proto.identity.unauth.IdentityKeyInfo} */ proto.identity.auth.OutboundKeyInfo.prototype.getIdentityInfo = function() { return /** @type{?proto.identity.unauth.IdentityKeyInfo} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.IdentityKeyInfo, 1)); }; /** * @param {?proto.identity.unauth.IdentityKeyInfo|undefined} value * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.setIdentityInfo = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.clearIdentityInfo = function() { return this.setIdentityInfo(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.OutboundKeyInfo.prototype.hasIdentityInfo = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional identity.unauth.Prekey content_prekey = 2; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.OutboundKeyInfo.prototype.getContentPrekey = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 2)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.setContentPrekey = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.clearContentPrekey = function() { return this.setContentPrekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.OutboundKeyInfo.prototype.hasContentPrekey = function() { return jspb.Message.getField(this, 2) != null; }; /** * optional identity.unauth.Prekey notif_prekey = 3; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.OutboundKeyInfo.prototype.getNotifPrekey = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 3)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.setNotifPrekey = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.clearNotifPrekey = function() { return this.setNotifPrekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.OutboundKeyInfo.prototype.hasNotifPrekey = function() { return jspb.Message.getField(this, 3) != null; }; /** * optional string one_time_content_prekey = 4; * @return {string} */ proto.identity.auth.OutboundKeyInfo.prototype.getOneTimeContentPrekey = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * @param {string} value * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.setOneTimeContentPrekey = function(value) { return jspb.Message.setField(this, 4, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.clearOneTimeContentPrekey = function() { return jspb.Message.setField(this, 4, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.OutboundKeyInfo.prototype.hasOneTimeContentPrekey = function() { return jspb.Message.getField(this, 4) != null; }; /** * optional string one_time_notif_prekey = 5; * @return {string} */ proto.identity.auth.OutboundKeyInfo.prototype.getOneTimeNotifPrekey = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** * @param {string} value * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.setOneTimeNotifPrekey = function(value) { return jspb.Message.setField(this, 5, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.auth.OutboundKeyInfo} returns this */ proto.identity.auth.OutboundKeyInfo.prototype.clearOneTimeNotifPrekey = function() { return jspb.Message.setField(this, 5, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.OutboundKeyInfo.prototype.hasOneTimeNotifPrekey = function() { return jspb.Message.getField(this, 5) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.KeyserverKeysResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.KeyserverKeysResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.KeyserverKeysResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.KeyserverKeysResponse.toObject = function(includeInstance, msg) { var f, obj = { keyserverInfo: (f = msg.getKeyserverInfo()) && proto.identity.auth.OutboundKeyInfo.toObject(includeInstance, f), identity: (f = msg.getIdentity()) && proto.identity.auth.Identity.toObject(includeInstance, f), primaryDeviceIdentityInfo: (f = msg.getPrimaryDeviceIdentityInfo()) && identity_unauth_pb.IdentityKeyInfo.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.KeyserverKeysResponse} */ proto.identity.auth.KeyserverKeysResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.KeyserverKeysResponse; return proto.identity.auth.KeyserverKeysResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.KeyserverKeysResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.KeyserverKeysResponse} */ proto.identity.auth.KeyserverKeysResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.identity.auth.OutboundKeyInfo; reader.readMessage(value,proto.identity.auth.OutboundKeyInfo.deserializeBinaryFromReader); msg.setKeyserverInfo(value); break; case 2: var value = new proto.identity.auth.Identity; reader.readMessage(value,proto.identity.auth.Identity.deserializeBinaryFromReader); msg.setIdentity(value); break; case 3: var value = new identity_unauth_pb.IdentityKeyInfo; reader.readMessage(value,identity_unauth_pb.IdentityKeyInfo.deserializeBinaryFromReader); msg.setPrimaryDeviceIdentityInfo(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.KeyserverKeysResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.KeyserverKeysResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.KeyserverKeysResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.KeyserverKeysResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getKeyserverInfo(); if (f != null) { writer.writeMessage( 1, f, proto.identity.auth.OutboundKeyInfo.serializeBinaryToWriter ); } f = message.getIdentity(); if (f != null) { writer.writeMessage( 2, f, proto.identity.auth.Identity.serializeBinaryToWriter ); } f = message.getPrimaryDeviceIdentityInfo(); if (f != null) { writer.writeMessage( 3, f, identity_unauth_pb.IdentityKeyInfo.serializeBinaryToWriter ); } }; /** * optional OutboundKeyInfo keyserver_info = 1; * @return {?proto.identity.auth.OutboundKeyInfo} */ proto.identity.auth.KeyserverKeysResponse.prototype.getKeyserverInfo = function() { return /** @type{?proto.identity.auth.OutboundKeyInfo} */ ( jspb.Message.getWrapperField(this, proto.identity.auth.OutboundKeyInfo, 1)); }; /** * @param {?proto.identity.auth.OutboundKeyInfo|undefined} value * @return {!proto.identity.auth.KeyserverKeysResponse} returns this */ proto.identity.auth.KeyserverKeysResponse.prototype.setKeyserverInfo = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.KeyserverKeysResponse} returns this */ proto.identity.auth.KeyserverKeysResponse.prototype.clearKeyserverInfo = function() { return this.setKeyserverInfo(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.KeyserverKeysResponse.prototype.hasKeyserverInfo = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional Identity identity = 2; * @return {?proto.identity.auth.Identity} */ proto.identity.auth.KeyserverKeysResponse.prototype.getIdentity = function() { return /** @type{?proto.identity.auth.Identity} */ ( jspb.Message.getWrapperField(this, proto.identity.auth.Identity, 2)); }; /** * @param {?proto.identity.auth.Identity|undefined} value * @return {!proto.identity.auth.KeyserverKeysResponse} returns this */ proto.identity.auth.KeyserverKeysResponse.prototype.setIdentity = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.KeyserverKeysResponse} returns this */ proto.identity.auth.KeyserverKeysResponse.prototype.clearIdentity = function() { return this.setIdentity(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.KeyserverKeysResponse.prototype.hasIdentity = function() { return jspb.Message.getField(this, 2) != null; }; /** * optional identity.unauth.IdentityKeyInfo primary_device_identity_info = 3; * @return {?proto.identity.unauth.IdentityKeyInfo} */ proto.identity.auth.KeyserverKeysResponse.prototype.getPrimaryDeviceIdentityInfo = function() { return /** @type{?proto.identity.unauth.IdentityKeyInfo} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.IdentityKeyInfo, 3)); }; /** * @param {?proto.identity.unauth.IdentityKeyInfo|undefined} value * @return {!proto.identity.auth.KeyserverKeysResponse} returns this */ proto.identity.auth.KeyserverKeysResponse.prototype.setPrimaryDeviceIdentityInfo = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.KeyserverKeysResponse} returns this */ proto.identity.auth.KeyserverKeysResponse.prototype.clearPrimaryDeviceIdentityInfo = function() { return this.setPrimaryDeviceIdentityInfo(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.KeyserverKeysResponse.prototype.hasPrimaryDeviceIdentityInfo = function() { return jspb.Message.getField(this, 3) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.OutboundKeysForUserResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.OutboundKeysForUserResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.OutboundKeysForUserResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.OutboundKeysForUserResponse.toObject = function(includeInstance, msg) { var f, obj = { devicesMap: (f = msg.getDevicesMap()) ? f.toObject(includeInstance, proto.identity.auth.OutboundKeyInfo.toObject) : [] }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.OutboundKeysForUserResponse} */ proto.identity.auth.OutboundKeysForUserResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.OutboundKeysForUserResponse; return proto.identity.auth.OutboundKeysForUserResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.OutboundKeysForUserResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.OutboundKeysForUserResponse} */ proto.identity.auth.OutboundKeysForUserResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = msg.getDevicesMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.identity.auth.OutboundKeyInfo.deserializeBinaryFromReader, "", new proto.identity.auth.OutboundKeyInfo()); }); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.OutboundKeysForUserResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.OutboundKeysForUserResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.OutboundKeysForUserResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.OutboundKeysForUserResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDevicesMap(true); if (f && f.getLength() > 0) { f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.identity.auth.OutboundKeyInfo.serializeBinaryToWriter); } }; /** * map devices = 1; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.identity.auth.OutboundKeysForUserResponse.prototype.getDevicesMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 1, opt_noLazyCreate, proto.identity.auth.OutboundKeyInfo)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.identity.auth.OutboundKeysForUserResponse} returns this */ proto.identity.auth.OutboundKeysForUserResponse.prototype.clearDevicesMap = function() { this.getDevicesMap().clear(); return this; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.OutboundKeysForUserRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.OutboundKeysForUserRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.OutboundKeysForUserRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.OutboundKeysForUserRequest.toObject = function(includeInstance, msg) { var f, obj = { userId: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.OutboundKeysForUserRequest} */ proto.identity.auth.OutboundKeysForUserRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.OutboundKeysForUserRequest; return proto.identity.auth.OutboundKeysForUserRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.OutboundKeysForUserRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.OutboundKeysForUserRequest} */ proto.identity.auth.OutboundKeysForUserRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setUserId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.OutboundKeysForUserRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.OutboundKeysForUserRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.OutboundKeysForUserRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.OutboundKeysForUserRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.auth.OutboundKeysForUserRequest.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.OutboundKeysForUserRequest} returns this */ proto.identity.auth.OutboundKeysForUserRequest.prototype.setUserId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.InboundKeyInfo.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.InboundKeyInfo.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.InboundKeyInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.InboundKeyInfo.toObject = function(includeInstance, msg) { var f, obj = { identityInfo: (f = msg.getIdentityInfo()) && identity_unauth_pb.IdentityKeyInfo.toObject(includeInstance, f), contentPrekey: (f = msg.getContentPrekey()) && identity_unauth_pb.Prekey.toObject(includeInstance, f), notifPrekey: (f = msg.getNotifPrekey()) && identity_unauth_pb.Prekey.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.InboundKeyInfo} */ proto.identity.auth.InboundKeyInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.InboundKeyInfo; return proto.identity.auth.InboundKeyInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.InboundKeyInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.InboundKeyInfo} */ proto.identity.auth.InboundKeyInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new identity_unauth_pb.IdentityKeyInfo; reader.readMessage(value,identity_unauth_pb.IdentityKeyInfo.deserializeBinaryFromReader); msg.setIdentityInfo(value); break; case 2: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_pb.Prekey.deserializeBinaryFromReader); msg.setContentPrekey(value); break; case 3: var value = new identity_unauth_pb.Prekey; reader.readMessage(value,identity_unauth_pb.Prekey.deserializeBinaryFromReader); msg.setNotifPrekey(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.InboundKeyInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.InboundKeyInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.InboundKeyInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.InboundKeyInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getIdentityInfo(); if (f != null) { writer.writeMessage( 1, f, identity_unauth_pb.IdentityKeyInfo.serializeBinaryToWriter ); } f = message.getContentPrekey(); if (f != null) { writer.writeMessage( 2, f, identity_unauth_pb.Prekey.serializeBinaryToWriter ); } f = message.getNotifPrekey(); if (f != null) { writer.writeMessage( 3, f, identity_unauth_pb.Prekey.serializeBinaryToWriter ); } }; /** * optional identity.unauth.IdentityKeyInfo identity_info = 1; * @return {?proto.identity.unauth.IdentityKeyInfo} */ proto.identity.auth.InboundKeyInfo.prototype.getIdentityInfo = function() { return /** @type{?proto.identity.unauth.IdentityKeyInfo} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.IdentityKeyInfo, 1)); }; /** * @param {?proto.identity.unauth.IdentityKeyInfo|undefined} value * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.setIdentityInfo = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.clearIdentityInfo = function() { return this.setIdentityInfo(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.InboundKeyInfo.prototype.hasIdentityInfo = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional identity.unauth.Prekey content_prekey = 2; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.InboundKeyInfo.prototype.getContentPrekey = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 2)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.setContentPrekey = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.clearContentPrekey = function() { return this.setContentPrekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.InboundKeyInfo.prototype.hasContentPrekey = function() { return jspb.Message.getField(this, 2) != null; }; /** * optional identity.unauth.Prekey notif_prekey = 3; * @return {?proto.identity.unauth.Prekey} */ proto.identity.auth.InboundKeyInfo.prototype.getNotifPrekey = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, identity_unauth_pb.Prekey, 3)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.setNotifPrekey = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.InboundKeyInfo} returns this */ proto.identity.auth.InboundKeyInfo.prototype.clearNotifPrekey = function() { return this.setNotifPrekey(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.InboundKeyInfo.prototype.hasNotifPrekey = function() { return jspb.Message.getField(this, 3) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.InboundKeysForUserResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.InboundKeysForUserResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.InboundKeysForUserResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.InboundKeysForUserResponse.toObject = function(includeInstance, msg) { var f, obj = { devicesMap: (f = msg.getDevicesMap()) ? f.toObject(includeInstance, proto.identity.auth.InboundKeyInfo.toObject) : [], identity: (f = msg.getIdentity()) && proto.identity.auth.Identity.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.InboundKeysForUserResponse} */ proto.identity.auth.InboundKeysForUserResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.InboundKeysForUserResponse; return proto.identity.auth.InboundKeysForUserResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.InboundKeysForUserResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.InboundKeysForUserResponse} */ proto.identity.auth.InboundKeysForUserResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = msg.getDevicesMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.identity.auth.InboundKeyInfo.deserializeBinaryFromReader, "", new proto.identity.auth.InboundKeyInfo()); }); break; case 2: var value = new proto.identity.auth.Identity; reader.readMessage(value,proto.identity.auth.Identity.deserializeBinaryFromReader); msg.setIdentity(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.InboundKeysForUserResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.InboundKeysForUserResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.InboundKeysForUserResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.InboundKeysForUserResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDevicesMap(true); if (f && f.getLength() > 0) { f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.identity.auth.InboundKeyInfo.serializeBinaryToWriter); } f = message.getIdentity(); if (f != null) { writer.writeMessage( 2, f, proto.identity.auth.Identity.serializeBinaryToWriter ); } }; /** * map devices = 1; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.identity.auth.InboundKeysForUserResponse.prototype.getDevicesMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 1, opt_noLazyCreate, proto.identity.auth.InboundKeyInfo)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.identity.auth.InboundKeysForUserResponse} returns this */ proto.identity.auth.InboundKeysForUserResponse.prototype.clearDevicesMap = function() { this.getDevicesMap().clear(); return this; }; /** * optional Identity identity = 2; * @return {?proto.identity.auth.Identity} */ proto.identity.auth.InboundKeysForUserResponse.prototype.getIdentity = function() { return /** @type{?proto.identity.auth.Identity} */ ( jspb.Message.getWrapperField(this, proto.identity.auth.Identity, 2)); }; /** * @param {?proto.identity.auth.Identity|undefined} value * @return {!proto.identity.auth.InboundKeysForUserResponse} returns this */ proto.identity.auth.InboundKeysForUserResponse.prototype.setIdentity = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.auth.InboundKeysForUserResponse} returns this */ proto.identity.auth.InboundKeysForUserResponse.prototype.clearIdentity = function() { return this.setIdentity(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.InboundKeysForUserResponse.prototype.hasIdentity = function() { return jspb.Message.getField(this, 2) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.InboundKeysForUserRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.InboundKeysForUserRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.InboundKeysForUserRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.InboundKeysForUserRequest.toObject = function(includeInstance, msg) { var f, obj = { userId: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.InboundKeysForUserRequest} */ proto.identity.auth.InboundKeysForUserRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.InboundKeysForUserRequest; return proto.identity.auth.InboundKeysForUserRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.InboundKeysForUserRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.InboundKeysForUserRequest} */ proto.identity.auth.InboundKeysForUserRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setUserId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.InboundKeysForUserRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.InboundKeysForUserRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.InboundKeysForUserRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.InboundKeysForUserRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.auth.InboundKeysForUserRequest.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.InboundKeysForUserRequest} returns this */ proto.identity.auth.InboundKeysForUserRequest.prototype.setUserId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.UpdateUserPasswordStartRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.UpdateUserPasswordStartRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.UpdateUserPasswordStartRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UpdateUserPasswordStartRequest.toObject = function(includeInstance, msg) { var f, obj = { - opaqueRegistrationRequest: msg.getOpaqueRegistrationRequest_asB64() + opaqueRegistrationRequest: msg.getOpaqueRegistrationRequest_asB64(), + opaqueLoginRequest: msg.getOpaqueLoginRequest_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.UpdateUserPasswordStartRequest} */ proto.identity.auth.UpdateUserPasswordStartRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UpdateUserPasswordStartRequest; return proto.identity.auth.UpdateUserPasswordStartRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UpdateUserPasswordStartRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UpdateUserPasswordStartRequest} */ proto.identity.auth.UpdateUserPasswordStartRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setOpaqueRegistrationRequest(value); break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOpaqueLoginRequest(value); + break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.UpdateUserPasswordStartRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.UpdateUserPasswordStartRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.UpdateUserPasswordStartRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UpdateUserPasswordStartRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getOpaqueRegistrationRequest_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } + f = message.getOpaqueLoginRequest_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } }; /** * optional bytes opaque_registration_request = 1; * @return {string} */ proto.identity.auth.UpdateUserPasswordStartRequest.prototype.getOpaqueRegistrationRequest = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * optional bytes opaque_registration_request = 1; * This is a type-conversion wrapper around `getOpaqueRegistrationRequest()` * @return {string} */ proto.identity.auth.UpdateUserPasswordStartRequest.prototype.getOpaqueRegistrationRequest_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueRegistrationRequest())); }; /** * optional bytes opaque_registration_request = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getOpaqueRegistrationRequest()` * @return {!Uint8Array} */ proto.identity.auth.UpdateUserPasswordStartRequest.prototype.getOpaqueRegistrationRequest_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueRegistrationRequest())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.auth.UpdateUserPasswordStartRequest} returns this */ proto.identity.auth.UpdateUserPasswordStartRequest.prototype.setOpaqueRegistrationRequest = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; +/** + * optional bytes opaque_login_request = 2; + * @return {string} + */ +proto.identity.auth.UpdateUserPasswordStartRequest.prototype.getOpaqueLoginRequest = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes opaque_login_request = 2; + * This is a type-conversion wrapper around `getOpaqueLoginRequest()` + * @return {string} + */ +proto.identity.auth.UpdateUserPasswordStartRequest.prototype.getOpaqueLoginRequest_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOpaqueLoginRequest())); +}; + + +/** + * optional bytes opaque_login_request = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOpaqueLoginRequest()` + * @return {!Uint8Array} + */ +proto.identity.auth.UpdateUserPasswordStartRequest.prototype.getOpaqueLoginRequest_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOpaqueLoginRequest())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.identity.auth.UpdateUserPasswordStartRequest} returns this + */ +proto.identity.auth.UpdateUserPasswordStartRequest.prototype.setOpaqueLoginRequest = function(value) { + return jspb.Message.setProto3BytesField(this, 2, value); +}; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.UpdateUserPasswordFinishRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.UpdateUserPasswordFinishRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UpdateUserPasswordFinishRequest.toObject = function(includeInstance, msg) { var f, obj = { sessionId: jspb.Message.getFieldWithDefault(msg, 1, ""), - opaqueRegistrationUpload: msg.getOpaqueRegistrationUpload_asB64() + opaqueRegistrationUpload: msg.getOpaqueRegistrationUpload_asB64(), + opaqueLoginUpload: msg.getOpaqueLoginUpload_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.UpdateUserPasswordFinishRequest} */ proto.identity.auth.UpdateUserPasswordFinishRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UpdateUserPasswordFinishRequest; return proto.identity.auth.UpdateUserPasswordFinishRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UpdateUserPasswordFinishRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UpdateUserPasswordFinishRequest} */ proto.identity.auth.UpdateUserPasswordFinishRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setSessionId(value); break; case 2: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setOpaqueRegistrationUpload(value); break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOpaqueLoginUpload(value); + break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.UpdateUserPasswordFinishRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.UpdateUserPasswordFinishRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UpdateUserPasswordFinishRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSessionId(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getOpaqueRegistrationUpload_asU8(); if (f.length > 0) { writer.writeBytes( 2, f ); } + f = message.getOpaqueLoginUpload_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } }; /** * optional string session_id = 1; * @return {string} */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.getSessionId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.UpdateUserPasswordFinishRequest} returns this */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.setSessionId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaque_registration_upload = 2; * @return {string} */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.getOpaqueRegistrationUpload = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * optional bytes opaque_registration_upload = 2; * This is a type-conversion wrapper around `getOpaqueRegistrationUpload()` * @return {string} */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.getOpaqueRegistrationUpload_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueRegistrationUpload())); }; /** * optional bytes opaque_registration_upload = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getOpaqueRegistrationUpload()` * @return {!Uint8Array} */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.getOpaqueRegistrationUpload_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueRegistrationUpload())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.auth.UpdateUserPasswordFinishRequest} returns this */ proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.setOpaqueRegistrationUpload = function(value) { return jspb.Message.setProto3BytesField(this, 2, value); }; +/** + * optional bytes opaque_login_upload = 3; + * @return {string} + */ +proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.getOpaqueLoginUpload = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes opaque_login_upload = 3; + * This is a type-conversion wrapper around `getOpaqueLoginUpload()` + * @return {string} + */ +proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.getOpaqueLoginUpload_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOpaqueLoginUpload())); +}; + + +/** + * optional bytes opaque_login_upload = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOpaqueLoginUpload()` + * @return {!Uint8Array} + */ +proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.getOpaqueLoginUpload_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOpaqueLoginUpload())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.identity.auth.UpdateUserPasswordFinishRequest} returns this + */ +proto.identity.auth.UpdateUserPasswordFinishRequest.prototype.setOpaqueLoginUpload = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.UpdateUserPasswordStartResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.UpdateUserPasswordStartResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UpdateUserPasswordStartResponse.toObject = function(includeInstance, msg) { var f, obj = { sessionId: jspb.Message.getFieldWithDefault(msg, 1, ""), - opaqueRegistrationResponse: msg.getOpaqueRegistrationResponse_asB64() + opaqueRegistrationResponse: msg.getOpaqueRegistrationResponse_asB64(), + opaqueLoginResponse: msg.getOpaqueLoginResponse_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.UpdateUserPasswordStartResponse} */ proto.identity.auth.UpdateUserPasswordStartResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UpdateUserPasswordStartResponse; return proto.identity.auth.UpdateUserPasswordStartResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UpdateUserPasswordStartResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UpdateUserPasswordStartResponse} */ proto.identity.auth.UpdateUserPasswordStartResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setSessionId(value); break; case 2: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setOpaqueRegistrationResponse(value); break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOpaqueLoginResponse(value); + break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.UpdateUserPasswordStartResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.UpdateUserPasswordStartResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UpdateUserPasswordStartResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSessionId(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getOpaqueRegistrationResponse_asU8(); if (f.length > 0) { writer.writeBytes( 2, f ); } + f = message.getOpaqueLoginResponse_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } }; /** * optional string session_id = 1; * @return {string} */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.getSessionId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.UpdateUserPasswordStartResponse} returns this */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.setSessionId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaque_registration_response = 2; * @return {string} */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.getOpaqueRegistrationResponse = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * optional bytes opaque_registration_response = 2; * This is a type-conversion wrapper around `getOpaqueRegistrationResponse()` * @return {string} */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.getOpaqueRegistrationResponse_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueRegistrationResponse())); }; /** * optional bytes opaque_registration_response = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getOpaqueRegistrationResponse()` * @return {!Uint8Array} */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.getOpaqueRegistrationResponse_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueRegistrationResponse())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.auth.UpdateUserPasswordStartResponse} returns this */ proto.identity.auth.UpdateUserPasswordStartResponse.prototype.setOpaqueRegistrationResponse = function(value) { return jspb.Message.setProto3BytesField(this, 2, value); }; +/** + * optional bytes opaque_login_response = 3; + * @return {string} + */ +proto.identity.auth.UpdateUserPasswordStartResponse.prototype.getOpaqueLoginResponse = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes opaque_login_response = 3; + * This is a type-conversion wrapper around `getOpaqueLoginResponse()` + * @return {string} + */ +proto.identity.auth.UpdateUserPasswordStartResponse.prototype.getOpaqueLoginResponse_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOpaqueLoginResponse())); +}; + + +/** + * optional bytes opaque_login_response = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOpaqueLoginResponse()` + * @return {!Uint8Array} + */ +proto.identity.auth.UpdateUserPasswordStartResponse.prototype.getOpaqueLoginResponse_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOpaqueLoginResponse())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.identity.auth.UpdateUserPasswordStartResponse} returns this + */ +proto.identity.auth.UpdateUserPasswordStartResponse.prototype.setOpaqueLoginResponse = function(value) { + return jspb.Message.setProto3BytesField(this, 3, value); +}; + + if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.DeletePasswordUserStartRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.DeletePasswordUserStartRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.DeletePasswordUserStartRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.DeletePasswordUserStartRequest.toObject = function(includeInstance, msg) { var f, obj = { opaqueLoginRequest: msg.getOpaqueLoginRequest_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.DeletePasswordUserStartRequest} */ proto.identity.auth.DeletePasswordUserStartRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.DeletePasswordUserStartRequest; return proto.identity.auth.DeletePasswordUserStartRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.DeletePasswordUserStartRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.DeletePasswordUserStartRequest} */ proto.identity.auth.DeletePasswordUserStartRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setOpaqueLoginRequest(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.DeletePasswordUserStartRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.DeletePasswordUserStartRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.DeletePasswordUserStartRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.DeletePasswordUserStartRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getOpaqueLoginRequest_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } }; /** * optional bytes opaque_login_request = 1; * @return {string} */ proto.identity.auth.DeletePasswordUserStartRequest.prototype.getOpaqueLoginRequest = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * optional bytes opaque_login_request = 1; * This is a type-conversion wrapper around `getOpaqueLoginRequest()` * @return {string} */ proto.identity.auth.DeletePasswordUserStartRequest.prototype.getOpaqueLoginRequest_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueLoginRequest())); }; /** * optional bytes opaque_login_request = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getOpaqueLoginRequest()` * @return {!Uint8Array} */ proto.identity.auth.DeletePasswordUserStartRequest.prototype.getOpaqueLoginRequest_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueLoginRequest())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.auth.DeletePasswordUserStartRequest} returns this */ proto.identity.auth.DeletePasswordUserStartRequest.prototype.setOpaqueLoginRequest = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.DeletePasswordUserFinishRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.DeletePasswordUserFinishRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.DeletePasswordUserFinishRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.DeletePasswordUserFinishRequest.toObject = function(includeInstance, msg) { var f, obj = { sessionId: jspb.Message.getFieldWithDefault(msg, 1, ""), opaqueLoginUpload: msg.getOpaqueLoginUpload_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.DeletePasswordUserFinishRequest} */ proto.identity.auth.DeletePasswordUserFinishRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.DeletePasswordUserFinishRequest; return proto.identity.auth.DeletePasswordUserFinishRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.DeletePasswordUserFinishRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.DeletePasswordUserFinishRequest} */ proto.identity.auth.DeletePasswordUserFinishRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setSessionId(value); break; case 2: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setOpaqueLoginUpload(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.DeletePasswordUserFinishRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.DeletePasswordUserFinishRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.DeletePasswordUserFinishRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.DeletePasswordUserFinishRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSessionId(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getOpaqueLoginUpload_asU8(); if (f.length > 0) { writer.writeBytes( 2, f ); } }; /** * optional string session_id = 1; * @return {string} */ proto.identity.auth.DeletePasswordUserFinishRequest.prototype.getSessionId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.DeletePasswordUserFinishRequest} returns this */ proto.identity.auth.DeletePasswordUserFinishRequest.prototype.setSessionId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaque_login_upload = 2; * @return {string} */ proto.identity.auth.DeletePasswordUserFinishRequest.prototype.getOpaqueLoginUpload = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * optional bytes opaque_login_upload = 2; * This is a type-conversion wrapper around `getOpaqueLoginUpload()` * @return {string} */ proto.identity.auth.DeletePasswordUserFinishRequest.prototype.getOpaqueLoginUpload_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueLoginUpload())); }; /** * optional bytes opaque_login_upload = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getOpaqueLoginUpload()` * @return {!Uint8Array} */ proto.identity.auth.DeletePasswordUserFinishRequest.prototype.getOpaqueLoginUpload_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueLoginUpload())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.auth.DeletePasswordUserFinishRequest} returns this */ proto.identity.auth.DeletePasswordUserFinishRequest.prototype.setOpaqueLoginUpload = function(value) { return jspb.Message.setProto3BytesField(this, 2, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.DeletePasswordUserStartResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.DeletePasswordUserStartResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.DeletePasswordUserStartResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.DeletePasswordUserStartResponse.toObject = function(includeInstance, msg) { var f, obj = { sessionId: jspb.Message.getFieldWithDefault(msg, 1, ""), opaqueLoginResponse: msg.getOpaqueLoginResponse_asB64() }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.DeletePasswordUserStartResponse} */ proto.identity.auth.DeletePasswordUserStartResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.DeletePasswordUserStartResponse; return proto.identity.auth.DeletePasswordUserStartResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.DeletePasswordUserStartResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.DeletePasswordUserStartResponse} */ proto.identity.auth.DeletePasswordUserStartResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setSessionId(value); break; case 2: var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setOpaqueLoginResponse(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.DeletePasswordUserStartResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.DeletePasswordUserStartResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.DeletePasswordUserStartResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.DeletePasswordUserStartResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSessionId(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getOpaqueLoginResponse_asU8(); if (f.length > 0) { writer.writeBytes( 2, f ); } }; /** * optional string session_id = 1; * @return {string} */ proto.identity.auth.DeletePasswordUserStartResponse.prototype.getSessionId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.DeletePasswordUserStartResponse} returns this */ proto.identity.auth.DeletePasswordUserStartResponse.prototype.setSessionId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaque_login_response = 2; * @return {string} */ proto.identity.auth.DeletePasswordUserStartResponse.prototype.getOpaqueLoginResponse = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * optional bytes opaque_login_response = 2; * This is a type-conversion wrapper around `getOpaqueLoginResponse()` * @return {string} */ proto.identity.auth.DeletePasswordUserStartResponse.prototype.getOpaqueLoginResponse_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getOpaqueLoginResponse())); }; /** * optional bytes opaque_login_response = 2; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getOpaqueLoginResponse()` * @return {!Uint8Array} */ proto.identity.auth.DeletePasswordUserStartResponse.prototype.getOpaqueLoginResponse_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueLoginResponse())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.auth.DeletePasswordUserStartResponse} returns this */ proto.identity.auth.DeletePasswordUserStartResponse.prototype.setOpaqueLoginResponse = function(value) { return jspb.Message.setProto3BytesField(this, 2, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.GetDeviceListRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.GetDeviceListRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.GetDeviceListRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.GetDeviceListRequest.toObject = function(includeInstance, msg) { var f, obj = { userId: jspb.Message.getFieldWithDefault(msg, 1, ""), sinceTimestamp: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.GetDeviceListRequest} */ proto.identity.auth.GetDeviceListRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.GetDeviceListRequest; return proto.identity.auth.GetDeviceListRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.GetDeviceListRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.GetDeviceListRequest} */ proto.identity.auth.GetDeviceListRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setUserId(value); break; case 2: var value = /** @type {number} */ (reader.readInt64()); msg.setSinceTimestamp(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.GetDeviceListRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.GetDeviceListRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.GetDeviceListRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.GetDeviceListRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } f = /** @type {number} */ (jspb.Message.getField(message, 2)); if (f != null) { writer.writeInt64( 2, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.auth.GetDeviceListRequest.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.GetDeviceListRequest} returns this */ proto.identity.auth.GetDeviceListRequest.prototype.setUserId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional int64 since_timestamp = 2; * @return {number} */ proto.identity.auth.GetDeviceListRequest.prototype.getSinceTimestamp = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value * @return {!proto.identity.auth.GetDeviceListRequest} returns this */ proto.identity.auth.GetDeviceListRequest.prototype.setSinceTimestamp = function(value) { return jspb.Message.setField(this, 2, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.auth.GetDeviceListRequest} returns this */ proto.identity.auth.GetDeviceListRequest.prototype.clearSinceTimestamp = function() { return jspb.Message.setField(this, 2, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.GetDeviceListRequest.prototype.hasSinceTimestamp = function() { return jspb.Message.getField(this, 2) != null; }; /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.identity.auth.GetDeviceListResponse.repeatedFields_ = [1]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.GetDeviceListResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.GetDeviceListResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.GetDeviceListResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.GetDeviceListResponse.toObject = function(includeInstance, msg) { var f, obj = { deviceListUpdatesList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.GetDeviceListResponse} */ proto.identity.auth.GetDeviceListResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.GetDeviceListResponse; return proto.identity.auth.GetDeviceListResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.GetDeviceListResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.GetDeviceListResponse} */ proto.identity.auth.GetDeviceListResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.addDeviceListUpdates(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.GetDeviceListResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.GetDeviceListResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.GetDeviceListResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.GetDeviceListResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDeviceListUpdatesList(); if (f.length > 0) { writer.writeRepeatedString( 1, f ); } }; /** * repeated string device_list_updates = 1; * @return {!Array} */ proto.identity.auth.GetDeviceListResponse.prototype.getDeviceListUpdatesList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** * @param {!Array} value * @return {!proto.identity.auth.GetDeviceListResponse} returns this */ proto.identity.auth.GetDeviceListResponse.prototype.setDeviceListUpdatesList = function(value) { return jspb.Message.setField(this, 1, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.auth.GetDeviceListResponse} returns this */ proto.identity.auth.GetDeviceListResponse.prototype.addDeviceListUpdates = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** * Clears the list making it empty but non-null. * @return {!proto.identity.auth.GetDeviceListResponse} returns this */ proto.identity.auth.GetDeviceListResponse.prototype.clearDeviceListUpdatesList = function() { return this.setDeviceListUpdatesList([]); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.PlatformDetails.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.PlatformDetails.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.PlatformDetails} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.PlatformDetails.toObject = function(includeInstance, msg) { var f, obj = { deviceType: jspb.Message.getFieldWithDefault(msg, 1, 0), codeVersion: jspb.Message.getFieldWithDefault(msg, 2, 0), stateVersion: jspb.Message.getFieldWithDefault(msg, 3, 0), majorDesktopVersion: jspb.Message.getFieldWithDefault(msg, 4, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.PlatformDetails} */ proto.identity.auth.PlatformDetails.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.PlatformDetails; return proto.identity.auth.PlatformDetails.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.PlatformDetails} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.PlatformDetails} */ proto.identity.auth.PlatformDetails.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {!proto.identity.unauth.DeviceType} */ (reader.readEnum()); msg.setDeviceType(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setCodeVersion(value); break; case 3: var value = /** @type {number} */ (reader.readUint64()); msg.setStateVersion(value); break; case 4: var value = /** @type {number} */ (reader.readUint64()); msg.setMajorDesktopVersion(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.PlatformDetails.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.PlatformDetails.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.PlatformDetails} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.PlatformDetails.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDeviceType(); if (f !== 0.0) { writer.writeEnum( 1, f ); } f = message.getCodeVersion(); if (f !== 0) { writer.writeUint64( 2, f ); } f = /** @type {number} */ (jspb.Message.getField(message, 3)); if (f != null) { writer.writeUint64( 3, f ); } f = /** @type {number} */ (jspb.Message.getField(message, 4)); if (f != null) { writer.writeUint64( 4, f ); } }; /** * optional identity.unauth.DeviceType device_type = 1; * @return {!proto.identity.unauth.DeviceType} */ proto.identity.auth.PlatformDetails.prototype.getDeviceType = function() { return /** @type {!proto.identity.unauth.DeviceType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** * @param {!proto.identity.unauth.DeviceType} value * @return {!proto.identity.auth.PlatformDetails} returns this */ proto.identity.auth.PlatformDetails.prototype.setDeviceType = function(value) { return jspb.Message.setProto3EnumField(this, 1, value); }; /** * optional uint64 code_version = 2; * @return {number} */ proto.identity.auth.PlatformDetails.prototype.getCodeVersion = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** * @param {number} value * @return {!proto.identity.auth.PlatformDetails} returns this */ proto.identity.auth.PlatformDetails.prototype.setCodeVersion = function(value) { return jspb.Message.setProto3IntField(this, 2, value); }; /** * optional uint64 state_version = 3; * @return {number} */ proto.identity.auth.PlatformDetails.prototype.getStateVersion = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** * @param {number} value * @return {!proto.identity.auth.PlatformDetails} returns this */ proto.identity.auth.PlatformDetails.prototype.setStateVersion = function(value) { return jspb.Message.setField(this, 3, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.auth.PlatformDetails} returns this */ proto.identity.auth.PlatformDetails.prototype.clearStateVersion = function() { return jspb.Message.setField(this, 3, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.PlatformDetails.prototype.hasStateVersion = function() { return jspb.Message.getField(this, 3) != null; }; /** * optional uint64 major_desktop_version = 4; * @return {number} */ proto.identity.auth.PlatformDetails.prototype.getMajorDesktopVersion = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** * @param {number} value * @return {!proto.identity.auth.PlatformDetails} returns this */ proto.identity.auth.PlatformDetails.prototype.setMajorDesktopVersion = function(value) { return jspb.Message.setField(this, 4, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.auth.PlatformDetails} returns this */ proto.identity.auth.PlatformDetails.prototype.clearMajorDesktopVersion = function() { return jspb.Message.setField(this, 4, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.auth.PlatformDetails.prototype.hasMajorDesktopVersion = function() { return jspb.Message.getField(this, 4) != null; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.UserDevicesPlatformDetails.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.UserDevicesPlatformDetails.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.UserDevicesPlatformDetails} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UserDevicesPlatformDetails.toObject = function(includeInstance, msg) { var f, obj = { devicesPlatformDetailsMap: (f = msg.getDevicesPlatformDetailsMap()) ? f.toObject(includeInstance, proto.identity.auth.PlatformDetails.toObject) : [] }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.UserDevicesPlatformDetails} */ proto.identity.auth.UserDevicesPlatformDetails.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UserDevicesPlatformDetails; return proto.identity.auth.UserDevicesPlatformDetails.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UserDevicesPlatformDetails} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UserDevicesPlatformDetails} */ proto.identity.auth.UserDevicesPlatformDetails.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = msg.getDevicesPlatformDetailsMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.identity.auth.PlatformDetails.deserializeBinaryFromReader, "", new proto.identity.auth.PlatformDetails()); }); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.UserDevicesPlatformDetails.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.UserDevicesPlatformDetails.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.UserDevicesPlatformDetails} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UserDevicesPlatformDetails.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDevicesPlatformDetailsMap(true); if (f && f.getLength() > 0) { f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.identity.auth.PlatformDetails.serializeBinaryToWriter); } }; /** * map devices_platform_details = 1; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.identity.auth.UserDevicesPlatformDetails.prototype.getDevicesPlatformDetailsMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 1, opt_noLazyCreate, proto.identity.auth.PlatformDetails)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.identity.auth.UserDevicesPlatformDetails} returns this */ proto.identity.auth.UserDevicesPlatformDetails.prototype.clearDevicesPlatformDetailsMap = function() { this.getDevicesPlatformDetailsMap().clear(); return this; }; /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.identity.auth.PeersDeviceListsRequest.repeatedFields_ = [1]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.PeersDeviceListsRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.PeersDeviceListsRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.PeersDeviceListsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.PeersDeviceListsRequest.toObject = function(includeInstance, msg) { var f, obj = { userIdsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.PeersDeviceListsRequest} */ proto.identity.auth.PeersDeviceListsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.PeersDeviceListsRequest; return proto.identity.auth.PeersDeviceListsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.PeersDeviceListsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.PeersDeviceListsRequest} */ proto.identity.auth.PeersDeviceListsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.addUserIds(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.PeersDeviceListsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.PeersDeviceListsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.PeersDeviceListsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.PeersDeviceListsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserIdsList(); if (f.length > 0) { writer.writeRepeatedString( 1, f ); } }; /** * repeated string user_ids = 1; * @return {!Array} */ proto.identity.auth.PeersDeviceListsRequest.prototype.getUserIdsList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** * @param {!Array} value * @return {!proto.identity.auth.PeersDeviceListsRequest} returns this */ proto.identity.auth.PeersDeviceListsRequest.prototype.setUserIdsList = function(value) { return jspb.Message.setField(this, 1, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.auth.PeersDeviceListsRequest} returns this */ proto.identity.auth.PeersDeviceListsRequest.prototype.addUserIds = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** * Clears the list making it empty but non-null. * @return {!proto.identity.auth.PeersDeviceListsRequest} returns this */ proto.identity.auth.PeersDeviceListsRequest.prototype.clearUserIdsList = function() { return this.setUserIdsList([]); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.PeersDeviceListsResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.PeersDeviceListsResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.PeersDeviceListsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.PeersDeviceListsResponse.toObject = function(includeInstance, msg) { var f, obj = { usersDeviceListsMap: (f = msg.getUsersDeviceListsMap()) ? f.toObject(includeInstance, undefined) : [], usersDevicesPlatformDetailsMap: (f = msg.getUsersDevicesPlatformDetailsMap()) ? f.toObject(includeInstance, proto.identity.auth.UserDevicesPlatformDetails.toObject) : [] }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.PeersDeviceListsResponse} */ proto.identity.auth.PeersDeviceListsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.PeersDeviceListsResponse; return proto.identity.auth.PeersDeviceListsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.PeersDeviceListsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.PeersDeviceListsResponse} */ proto.identity.auth.PeersDeviceListsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = msg.getUsersDeviceListsMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); }); break; case 2: var value = msg.getUsersDevicesPlatformDetailsMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.identity.auth.UserDevicesPlatformDetails.deserializeBinaryFromReader, "", new proto.identity.auth.UserDevicesPlatformDetails()); }); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.PeersDeviceListsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.PeersDeviceListsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.PeersDeviceListsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.PeersDeviceListsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUsersDeviceListsMap(true); if (f && f.getLength() > 0) { f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); } f = message.getUsersDevicesPlatformDetailsMap(true); if (f && f.getLength() > 0) { f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.identity.auth.UserDevicesPlatformDetails.serializeBinaryToWriter); } }; /** * map users_device_lists = 1; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.identity.auth.PeersDeviceListsResponse.prototype.getUsersDeviceListsMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 1, opt_noLazyCreate, null)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.identity.auth.PeersDeviceListsResponse} returns this */ proto.identity.auth.PeersDeviceListsResponse.prototype.clearUsersDeviceListsMap = function() { this.getUsersDeviceListsMap().clear(); return this; }; /** * map users_devices_platform_details = 2; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.identity.auth.PeersDeviceListsResponse.prototype.getUsersDevicesPlatformDetailsMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 2, opt_noLazyCreate, proto.identity.auth.UserDevicesPlatformDetails)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.identity.auth.PeersDeviceListsResponse} returns this */ proto.identity.auth.PeersDeviceListsResponse.prototype.clearUsersDevicesPlatformDetailsMap = function() { this.getUsersDevicesPlatformDetailsMap().clear(); return this; }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.UpdateDeviceListRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.UpdateDeviceListRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.UpdateDeviceListRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UpdateDeviceListRequest.toObject = function(includeInstance, msg) { var f, obj = { newDeviceList: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.UpdateDeviceListRequest} */ proto.identity.auth.UpdateDeviceListRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UpdateDeviceListRequest; return proto.identity.auth.UpdateDeviceListRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UpdateDeviceListRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UpdateDeviceListRequest} */ proto.identity.auth.UpdateDeviceListRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setNewDeviceList(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.UpdateDeviceListRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.UpdateDeviceListRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.UpdateDeviceListRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UpdateDeviceListRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNewDeviceList(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string new_device_list = 1; * @return {string} */ proto.identity.auth.UpdateDeviceListRequest.prototype.getNewDeviceList = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.UpdateDeviceListRequest} returns this */ proto.identity.auth.UpdateDeviceListRequest.prototype.setNewDeviceList = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.LinkFarcasterAccountRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.LinkFarcasterAccountRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.LinkFarcasterAccountRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.LinkFarcasterAccountRequest.toObject = function(includeInstance, msg) { var f, obj = { farcasterId: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.LinkFarcasterAccountRequest} */ proto.identity.auth.LinkFarcasterAccountRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.LinkFarcasterAccountRequest; return proto.identity.auth.LinkFarcasterAccountRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.LinkFarcasterAccountRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.LinkFarcasterAccountRequest} */ proto.identity.auth.LinkFarcasterAccountRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setFarcasterId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.LinkFarcasterAccountRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.LinkFarcasterAccountRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.LinkFarcasterAccountRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.LinkFarcasterAccountRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFarcasterId(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string farcaster_id = 1; * @return {string} */ proto.identity.auth.LinkFarcasterAccountRequest.prototype.getFarcasterId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.auth.LinkFarcasterAccountRequest} returns this */ proto.identity.auth.LinkFarcasterAccountRequest.prototype.setFarcasterId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.identity.auth.UserIdentitiesRequest.repeatedFields_ = [1]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.UserIdentitiesRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.UserIdentitiesRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.UserIdentitiesRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UserIdentitiesRequest.toObject = function(includeInstance, msg) { var f, obj = { userIdsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.UserIdentitiesRequest} */ proto.identity.auth.UserIdentitiesRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UserIdentitiesRequest; return proto.identity.auth.UserIdentitiesRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UserIdentitiesRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UserIdentitiesRequest} */ proto.identity.auth.UserIdentitiesRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.addUserIds(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.UserIdentitiesRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.UserIdentitiesRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.UserIdentitiesRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UserIdentitiesRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserIdsList(); if (f.length > 0) { writer.writeRepeatedString( 1, f ); } }; /** * repeated string user_ids = 1; * @return {!Array} */ proto.identity.auth.UserIdentitiesRequest.prototype.getUserIdsList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** * @param {!Array} value * @return {!proto.identity.auth.UserIdentitiesRequest} returns this */ proto.identity.auth.UserIdentitiesRequest.prototype.setUserIdsList = function(value) { return jspb.Message.setField(this, 1, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.auth.UserIdentitiesRequest} returns this */ proto.identity.auth.UserIdentitiesRequest.prototype.addUserIds = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; /** * Clears the list making it empty but non-null. * @return {!proto.identity.auth.UserIdentitiesRequest} returns this */ proto.identity.auth.UserIdentitiesRequest.prototype.clearUserIdsList = function() { return this.setUserIdsList([]); }; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. * Field names that are reserved in JavaScript and will be renamed to pb_name. * Optional fields that are not set will be set to undefined. * To access a reserved field use, foo.pb_, eg, foo.pb_default. * For the list of reserved names please see: * net/proto2/compiler/js/internal/generator.cc#kKeyword. * @param {boolean=} opt_includeInstance Deprecated. whether to include the * JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @return {!Object} */ proto.identity.auth.UserIdentitiesResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.auth.UserIdentitiesResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.identity.auth.UserIdentitiesResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UserIdentitiesResponse.toObject = function(includeInstance, msg) { var f, obj = { identitiesMap: (f = msg.getIdentitiesMap()) ? f.toObject(includeInstance, proto.identity.auth.Identity.toObject) : [] }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.identity.auth.UserIdentitiesResponse} */ proto.identity.auth.UserIdentitiesResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.auth.UserIdentitiesResponse; return proto.identity.auth.UserIdentitiesResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.auth.UserIdentitiesResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.auth.UserIdentitiesResponse} */ proto.identity.auth.UserIdentitiesResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = msg.getIdentitiesMap(); reader.readMessage(value, function(message, reader) { jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.identity.auth.Identity.deserializeBinaryFromReader, "", new proto.identity.auth.Identity()); }); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.auth.UserIdentitiesResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.auth.UserIdentitiesResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.identity.auth.UserIdentitiesResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.auth.UserIdentitiesResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getIdentitiesMap(true); if (f && f.getLength() > 0) { f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.identity.auth.Identity.serializeBinaryToWriter); } }; /** * map identities = 1; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ proto.identity.auth.UserIdentitiesResponse.prototype.getIdentitiesMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 1, opt_noLazyCreate, proto.identity.auth.Identity)); }; /** * Clears values from the map. The map will be non-null. * @return {!proto.identity.auth.UserIdentitiesResponse} returns this */ proto.identity.auth.UserIdentitiesResponse.prototype.clearIdentitiesMap = function() { this.getIdentitiesMap().clear(); return this; }; goog.object.extend(exports, proto.identity.auth); diff --git a/web/protobufs/identity-auth-structs.cjs.flow b/web/protobufs/identity-auth-structs.cjs.flow index cf47a1da8..220568288 100644 --- a/web/protobufs/identity-auth-structs.cjs.flow +++ b/web/protobufs/identity-auth-structs.cjs.flow @@ -1,600 +1,618 @@ // @flow import { Message, BinaryWriter, BinaryReader, Map as ProtoMap, } from 'google-protobuf'; import * as identityStructs from './identity-unauth-structs.cjs'; declare export class EthereumIdentity extends Message { getWalletAddress(): string; setWalletAddress(value: string): EthereumIdentity; getSiweMessage(): string; setSiweMessage(value: string): EthereumIdentity; getSiweSignature(): string; setSiweSignature(value: string): EthereumIdentity; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): EthereumIdentityObject; static toObject(includeInstance: boolean, msg: EthereumIdentity): EthereumIdentityObject; static serializeBinaryToWriter(message: EthereumIdentity, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): EthereumIdentity; static deserializeBinaryFromReader(message: EthereumIdentity, reader: BinaryReader): EthereumIdentity; } export type EthereumIdentityObject = { walletAddress: string, siweMessage: string, siweSignature: string, } declare export class Identity extends Message { getUsername(): string; setUsername(value: string): Identity; getEthIdentity(): EthereumIdentity | void; setEthIdentity(value?: EthereumIdentity): Identity; hasEthIdentity(): boolean; clearEthIdentity(): Identity; getFarcasterId(): string; setFarcasterId(value: string): Identity; hasFarcasterId(): boolean; clearFarcasterId(): Identity; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): IdentityObject; static toObject(includeInstance: boolean, msg: Identity): IdentityObject; static serializeBinaryToWriter(message: Identity, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): Identity; static deserializeBinaryFromReader(message: Identity, reader: BinaryReader): Identity; } export type IdentityObject = { username: string, ethIdentity: ?EthereumIdentityObject, farcasterId: ?string, } declare export class UploadOneTimeKeysRequest extends Message { getContentOneTimePrekeysList(): Array; setContentOneTimePrekeysList(value: Array): UploadOneTimeKeysRequest; clearContentOneTimePrekeysList(): UploadOneTimeKeysRequest; addContentOneTimePrekeys(value: string, index?: number): UploadOneTimeKeysRequest; getNotifOneTimePrekeysList(): Array; setNotifOneTimePrekeysList(value: Array): UploadOneTimeKeysRequest; clearNotifOneTimePrekeysList(): UploadOneTimeKeysRequest; addNotifOneTimePrekeys(value: string, index?: number): UploadOneTimeKeysRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UploadOneTimeKeysRequestObject; static toObject(includeInstance: boolean, msg: UploadOneTimeKeysRequest): UploadOneTimeKeysRequestObject; static serializeBinaryToWriter(message: UploadOneTimeKeysRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UploadOneTimeKeysRequest; static deserializeBinaryFromReader(message: UploadOneTimeKeysRequest, reader: BinaryReader): UploadOneTimeKeysRequest; } export type UploadOneTimeKeysRequestObject = { contentOneTimePrekeysList: Array, notifOneTimePrekeysList: Array, }; declare export class RefreshUserPrekeysRequest extends Message { getNewContentPrekey(): identityStructs.Prekey | void; setNewContentPrekey(value?: identityStructs.Prekey): RefreshUserPrekeysRequest; hasNewContentPrekey(): boolean; clearNewContentPrekey(): RefreshUserPrekeysRequest; getNewNotifPrekey(): identityStructs.Prekey | void; setNewNotifPrekey(value?: identityStructs.Prekey): RefreshUserPrekeysRequest; hasNewNotifPrekey(): boolean; clearNewNotifPrekey(): RefreshUserPrekeysRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): RefreshUserPrekeysRequestObject; static toObject(includeInstance: boolean, msg: RefreshUserPrekeysRequest): RefreshUserPrekeysRequestObject; static serializeBinaryToWriter(message: RefreshUserPrekeysRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): RefreshUserPrekeysRequest; static deserializeBinaryFromReader(message: RefreshUserPrekeysRequest, reader: BinaryReader): RefreshUserPrekeysRequest; } export type RefreshUserPrekeysRequestObject = { newContentPrekey?: identityStructs.PrekeyObject, newNotifPrekey?: identityStructs.PrekeyObject, } declare export class OutboundKeyInfo extends Message { getIdentityInfo(): identityStructs.IdentityKeyInfo | void; setIdentityInfo(value?: identityStructs.IdentityKeyInfo): OutboundKeyInfo; hasIdentityInfo(): boolean; clearIdentityInfo(): OutboundKeyInfo; getContentPrekey(): identityStructs.Prekey | void; setContentPrekey(value?: identityStructs.Prekey): OutboundKeyInfo; hasContentPrekey(): boolean; clearContentPrekey(): OutboundKeyInfo; getNotifPrekey(): identityStructs.Prekey | void; setNotifPrekey(value?: identityStructs.Prekey): OutboundKeyInfo; hasNotifPrekey(): boolean; clearNotifPrekey(): OutboundKeyInfo; getOneTimeContentPrekey(): string; setOneTimeContentPrekey(value: string): OutboundKeyInfo; hasOneTimeContentPrekey(): boolean; clearOneTimeContentPrekey(): OutboundKeyInfo; getOneTimeNotifPrekey(): string; setOneTimeNotifPrekey(value: string): OutboundKeyInfo; hasOneTimeNotifPrekey(): boolean; clearOneTimeNotifPrekey(): OutboundKeyInfo; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): OutboundKeyInfoObject; static toObject(includeInstance: boolean, msg: OutboundKeyInfo): OutboundKeyInfoObject; static serializeBinaryToWriter(message: OutboundKeyInfo, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): OutboundKeyInfo; static deserializeBinaryFromReader(message: OutboundKeyInfo, reader: BinaryReader): OutboundKeyInfo; } export type OutboundKeyInfoObject = { identityInfo?: identityStructs.IdentityKeyInfoObject, contentPrekey?: identityStructs.PrekeyObject, notifPrekey?: identityStructs.PrekeyObject, oneTimeContentPrekey?: string, oneTimeNotifPrekey?: string, }; declare export class KeyserverKeysResponse extends Message { getKeyserverInfo(): OutboundKeyInfo | void; setKeyserverInfo(value?: OutboundKeyInfo): KeyserverKeysResponse; hasKeyserverInfo(): boolean; clearKeyserverInfo(): KeyserverKeysResponse; getIdentity(): Identity | void; setIdentity(value?: Identity): KeyserverKeysResponse; hasIdentity(): boolean; clearIdentity(): KeyserverKeysResponse; getPrimaryDeviceIdentityInfo(): identityStructs.IdentityKeyInfo | void; setPrimaryDeviceIdentityInfo(value?: identityStructs.IdentityKeyInfo): KeyserverKeysResponse; hasPrimaryDeviceIdentityInfo(): boolean; clearPrimaryDeviceIdentityInfo(): KeyserverKeysResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): KeyserverKeysResponseObject; static toObject(includeInstance: boolean, msg: KeyserverKeysResponse): KeyserverKeysResponseObject; static serializeBinaryToWriter(message: KeyserverKeysResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): KeyserverKeysResponse; static deserializeBinaryFromReader(message: KeyserverKeysResponse, reader: BinaryReader): KeyserverKeysResponse; } export type KeyserverKeysResponseObject = { keyserverInfo: ?OutboundKeyInfoObject, identity: ?IdentityObject, primaryDeviceIdentityInfo: ?identityStructs.IdentityKeyInfoObject, }; declare export class OutboundKeysForUserResponse extends Message { getDevicesMap(): ProtoMap; clearDevicesMap(): OutboundKeysForUserResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): OutboundKeysForUserResponseObject; static toObject(includeInstance: boolean, msg: OutboundKeysForUserResponse): OutboundKeysForUserResponseObject; static serializeBinaryToWriter(message: OutboundKeysForUserResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): OutboundKeysForUserResponse; static deserializeBinaryFromReader(message: OutboundKeysForUserResponse, reader: BinaryReader): OutboundKeysForUserResponse; } export type OutboundKeysForUserResponseObject = { devicesMap: Array<[string, OutboundKeyInfoObject]>, }; declare export class OutboundKeysForUserRequest extends Message { getUserId(): string; setUserId(value: string): OutboundKeysForUserRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): OutboundKeysForUserRequestObject; static toObject(includeInstance: boolean, msg: OutboundKeysForUserRequest): OutboundKeysForUserRequestObject; static serializeBinaryToWriter(message: OutboundKeysForUserRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): OutboundKeysForUserRequest; static deserializeBinaryFromReader(message: OutboundKeysForUserRequest, reader: BinaryReader): OutboundKeysForUserRequest; } export type OutboundKeysForUserRequestObject = { userId: string, }; declare export class InboundKeyInfo extends Message { getIdentityInfo(): identityStructs.IdentityKeyInfo | void; setIdentityInfo(value?: identityStructs.IdentityKeyInfo): InboundKeyInfo; hasIdentityInfo(): boolean; clearIdentityInfo(): InboundKeyInfo; getContentPrekey(): identityStructs.Prekey | void; setContentPrekey(value?: identityStructs.Prekey): InboundKeyInfo; hasContentPrekey(): boolean; clearContentPrekey(): InboundKeyInfo; getNotifPrekey(): identityStructs.Prekey | void; setNotifPrekey(value?: identityStructs.Prekey): InboundKeyInfo; hasNotifPrekey(): boolean; clearNotifPrekey(): InboundKeyInfo; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): InboundKeyInfoObject; static toObject(includeInstance: boolean, msg: InboundKeyInfo): InboundKeyInfoObject; static serializeBinaryToWriter(message: InboundKeyInfo, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): InboundKeyInfo; static deserializeBinaryFromReader(message: InboundKeyInfo, reader: BinaryReader): InboundKeyInfo; } export type InboundKeyInfoObject = { identityInfo?: identityStructs.IdentityKeyInfoObject, contentPrekey?: identityStructs.PrekeyObject, notifPrekey?: identityStructs.PrekeyObject, }; declare export class InboundKeysForUserResponse extends Message { getDevicesMap(): ProtoMap; clearDevicesMap(): InboundKeysForUserResponse; getIdentity(): Identity | void; setIdentity(value?: Identity): InboundKeysForUserResponse; hasIdentity(): boolean; clearIdentity(): InboundKeysForUserResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): InboundKeysForUserResponseObject; static toObject(includeInstance: boolean, msg: InboundKeysForUserResponse): InboundKeysForUserResponseObject; static serializeBinaryToWriter(message: InboundKeysForUserResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): InboundKeysForUserResponse; static deserializeBinaryFromReader(message: InboundKeysForUserResponse, reader: BinaryReader): InboundKeysForUserResponse; } export type InboundKeysForUserResponseObject = { devicesMap: Array<[string, InboundKeyInfoObject]>, identity: ?IdentityObject, } declare export class InboundKeysForUserRequest extends Message { getUserId(): string; setUserId(value: string): InboundKeysForUserRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): InboundKeysForUserRequestObject; static toObject(includeInstance: boolean, msg: InboundKeysForUserRequest): InboundKeysForUserRequestObject; static serializeBinaryToWriter(message: InboundKeysForUserRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): InboundKeysForUserRequest; static deserializeBinaryFromReader(message: InboundKeysForUserRequest, reader: BinaryReader): InboundKeysForUserRequest; } export type InboundKeysForUserRequestObject = { userId: string, }; declare export class UpdateUserPasswordStartRequest extends Message { getOpaqueRegistrationRequest(): Uint8Array | string; getOpaqueRegistrationRequest_asU8(): Uint8Array; getOpaqueRegistrationRequest_asB64(): string; setOpaqueRegistrationRequest(value: Uint8Array | string): UpdateUserPasswordStartRequest; + getOpaqueLoginRequest(): Uint8Array | string; + getOpaqueLoginRequest_asU8(): Uint8Array; + getOpaqueLoginRequest_asB64(): string; + setOpaqueLoginRequest(value: Uint8Array | string): UpdateUserPasswordStartRequest; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UpdateUserPasswordStartRequestObject; static toObject(includeInstance: boolean, msg: UpdateUserPasswordStartRequest): UpdateUserPasswordStartRequestObject; static serializeBinaryToWriter(message: UpdateUserPasswordStartRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UpdateUserPasswordStartRequest; static deserializeBinaryFromReader(message: UpdateUserPasswordStartRequest, reader: BinaryReader): UpdateUserPasswordStartRequest; } export type UpdateUserPasswordStartRequestObject = { opaqueRegistrationRequest: Uint8Array | string, + opaqueLoginRequest: Uint8Array | string, }; declare export class UpdateUserPasswordFinishRequest extends Message { getSessionId(): string; setSessionId(value: string): UpdateUserPasswordFinishRequest; getOpaqueRegistrationUpload(): Uint8Array | string; getOpaqueRegistrationUpload_asU8(): Uint8Array; getOpaqueRegistrationUpload_asB64(): string; setOpaqueRegistrationUpload(value: Uint8Array | string): UpdateUserPasswordFinishRequest; + getOpaqueLoginUpload(): Uint8Array | string; + getOpaqueLoginUpload_asU8(): Uint8Array; + getOpaqueLoginUpload_asB64(): string; + setOpaqueLoginUpload(value: Uint8Array | string): UpdateUserPasswordFinishRequest; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UpdateUserPasswordFinishRequestObject; static toObject(includeInstance: boolean, msg: UpdateUserPasswordFinishRequest): UpdateUserPasswordFinishRequestObject; static serializeBinaryToWriter(message: UpdateUserPasswordFinishRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UpdateUserPasswordFinishRequest; static deserializeBinaryFromReader(message: UpdateUserPasswordFinishRequest, reader: BinaryReader): UpdateUserPasswordFinishRequest; } export type UpdateUserPasswordFinishRequestObject = { sessionId: string, opaqueRegistrationUpload: Uint8Array | string, + opaqueLoginUpload: Uint8Array | string, }; declare export class UpdateUserPasswordStartResponse extends Message { getSessionId(): string; setSessionId(value: string): UpdateUserPasswordStartResponse; getOpaqueRegistrationResponse(): Uint8Array | string; getOpaqueRegistrationResponse_asU8(): Uint8Array; getOpaqueRegistrationResponse_asB64(): string; setOpaqueRegistrationResponse(value: Uint8Array | string): UpdateUserPasswordStartResponse; + getOpaqueLoginResponse(): Uint8Array | string; + getOpaqueLoginResponse_asU8(): Uint8Array; + getOpaqueLoginResponse_asB64(): string; + setOpaqueLoginResponse(value: Uint8Array | string): UpdateUserPasswordStartResponse; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UpdateUserPasswordStartResponseObject; static toObject(includeInstance: boolean, msg: UpdateUserPasswordStartResponse): UpdateUserPasswordStartResponseObject; static serializeBinaryToWriter(message: UpdateUserPasswordStartResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UpdateUserPasswordStartResponse; static deserializeBinaryFromReader(message: UpdateUserPasswordStartResponse, reader: BinaryReader): UpdateUserPasswordStartResponse; } export type UpdateUserPasswordStartResponseObject = { sessionId: string, opaqueRegistrationResponse: Uint8Array | string, + opaqueLoginResponse: Uint8Array | string, }; declare export class DeletePasswordUserStartRequest extends Message { getOpaqueLoginRequest(): Uint8Array | string; getOpaqueLoginRequest_asU8(): Uint8Array; getOpaqueLoginRequest_asB64(): string; setOpaqueLoginRequest(value: Uint8Array | string): DeletePasswordUserStartRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): DeletePasswordUserStartRequestObject; static toObject(includeInstance: boolean, msg: DeletePasswordUserStartRequest): DeletePasswordUserStartRequestObject; static serializeBinaryToWriter(message: DeletePasswordUserStartRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): DeletePasswordUserStartRequest; static deserializeBinaryFromReader(message: DeletePasswordUserStartRequest, reader: BinaryReader): DeletePasswordUserStartRequest; } export type DeletePasswordUserStartRequestObject = { opaqueLoginRequest: Uint8Array | string, } declare export class DeletePasswordUserFinishRequest extends Message { getSessionId(): string; setSessionId(value: string): DeletePasswordUserFinishRequest; getOpaqueLoginUpload(): Uint8Array | string; getOpaqueLoginUpload_asU8(): Uint8Array; getOpaqueLoginUpload_asB64(): string; setOpaqueLoginUpload(value: Uint8Array | string): DeletePasswordUserFinishRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): DeletePasswordUserFinishRequestObject; static toObject(includeInstance: boolean, msg: DeletePasswordUserFinishRequest): DeletePasswordUserFinishRequestObject; static serializeBinaryToWriter(message: DeletePasswordUserFinishRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): DeletePasswordUserFinishRequest; static deserializeBinaryFromReader(message: DeletePasswordUserFinishRequest, reader: BinaryReader): DeletePasswordUserFinishRequest; } export type DeletePasswordUserFinishRequestObject = { sessionId: string, opaqueLoginUpload: Uint8Array | string, } declare export class DeletePasswordUserStartResponse extends Message { getSessionId(): string; setSessionId(value: string): DeletePasswordUserStartResponse; getOpaqueLoginResponse(): Uint8Array | string; getOpaqueLoginResponse_asU8(): Uint8Array; getOpaqueLoginResponse_asB64(): string; setOpaqueLoginResponse(value: Uint8Array | string): DeletePasswordUserStartResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): DeletePasswordUserStartResponseObject; static toObject(includeInstance: boolean, msg: DeletePasswordUserStartResponse): DeletePasswordUserStartResponseObject; static serializeBinaryToWriter(message: DeletePasswordUserStartResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): DeletePasswordUserStartResponse; static deserializeBinaryFromReader(message: DeletePasswordUserStartResponse, reader: BinaryReader): DeletePasswordUserStartResponse; } export type DeletePasswordUserStartResponseObject = { sessionId: string, opaqueLoginResponse: Uint8Array | string, } export type SinceTimestampCase = 0 | 2; declare export class GetDeviceListRequest extends Message { getUserId(): string; setUserId(value: string): GetDeviceListRequest; getSinceTimestamp(): number; setSinceTimestamp(value: number): GetDeviceListRequest; hasSinceTimestamp(): boolean; clearSinceTimestamp(): GetDeviceListRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): GetDeviceListRequestObject; static toObject(includeInstance: boolean, msg: GetDeviceListRequest): GetDeviceListRequestObject; static serializeBinaryToWriter(message: GetDeviceListRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): GetDeviceListRequest; static deserializeBinaryFromReader(message: GetDeviceListRequest, reader: BinaryReader): GetDeviceListRequest; } export type GetDeviceListRequestObject = { userId: string, sinceTimestamp?: number, } declare export class GetDeviceListResponse extends Message { getDeviceListUpdatesList(): Array; setDeviceListUpdatesList(value: Array): GetDeviceListResponse; clearDeviceListUpdatesList(): GetDeviceListResponse; addDeviceListUpdates(value: string, index?: number): GetDeviceListResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): GetDeviceListResponseObject; static toObject(includeInstance: boolean, msg: GetDeviceListResponse): GetDeviceListResponseObject; static serializeBinaryToWriter(message: GetDeviceListResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): GetDeviceListResponse; static deserializeBinaryFromReader(message: GetDeviceListResponse, reader: BinaryReader): GetDeviceListResponse; } export type GetDeviceListResponseObject = { deviceListUpdatesList: Array, } declare export class PlatformDetails extends Message { getDeviceType(): identityStructs.DeviceType; setDeviceType(value: identityStructs.DeviceType): PlatformDetails; getCodeVersion(): number; setCodeVersion(value: number): PlatformDetails; getStateVersion(): number; setStateVersion(value: number): PlatformDetails; hasStateVersion(): boolean; clearStateVersion(): PlatformDetails; getMajorDesktopVersion(): number; setMajorDesktopVersion(value: number): PlatformDetails; hasMajorDesktopVersion(): boolean; clearMajorDesktopVersion(): PlatformDetails; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): PlatformDetailsObject; static toObject(includeInstance: boolean, msg: PlatformDetails): PlatformDetailsObject; static serializeBinaryToWriter(message: PlatformDetails, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): PlatformDetails; static deserializeBinaryFromReader(message: PlatformDetails, reader: BinaryReader): PlatformDetails; } export type PlatformDetailsObject = { deviceType: identityStructs.DeviceType, codeVersion: number, stateVersion?: number, majorDesktopVersion?: number, } declare export class UserDevicesPlatformDetails extends Message { getDevicesPlatformDetailsMap(): ProtoMap; clearDevicesPlatformDetailsMap(): UserDevicesPlatformDetails; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UserDevicesPlatformDetailsObject; static toObject(includeInstance: boolean, msg: UserDevicesPlatformDetails): UserDevicesPlatformDetailsObject; static serializeBinaryToWriter(message: UserDevicesPlatformDetails, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UserDevicesPlatformDetails; static deserializeBinaryFromReader(message: UserDevicesPlatformDetails, reader: BinaryReader): UserDevicesPlatformDetails; } export type UserDevicesPlatformDetailsObject = { devicesPlatformDetailsMap: Array<[string, PlatformDetailsObject]>, } declare export class PeersDeviceListsRequest extends Message { getUserIdsList(): Array; setUserIdsList(value: Array): PeersDeviceListsRequest; clearUserIdsList(): PeersDeviceListsRequest; addUserIds(value: string, index?: number): PeersDeviceListsRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): PeersDeviceListsRequestObject; static toObject(includeInstance: boolean, msg: PeersDeviceListsRequest): PeersDeviceListsRequestObject; static serializeBinaryToWriter(message: PeersDeviceListsRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): PeersDeviceListsRequest; static deserializeBinaryFromReader(message: PeersDeviceListsRequest, reader: BinaryReader): PeersDeviceListsRequest; } export type PeersDeviceListsRequestObject = { userIdsList: Array, } declare export class PeersDeviceListsResponse extends Message { getUsersDeviceListsMap(): ProtoMap; clearUsersDeviceListsMap(): PeersDeviceListsResponse; getUsersDevicesPlatformDetailsMap(): ProtoMap; clearUsersDevicesPlatformDetailsMap(): PeersDeviceListsResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): PeersDeviceListsResponseObject; static toObject(includeInstance: boolean, msg: PeersDeviceListsResponse): PeersDeviceListsResponseObject; static serializeBinaryToWriter(message: PeersDeviceListsResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): PeersDeviceListsResponse; static deserializeBinaryFromReader(message: PeersDeviceListsResponse, reader: BinaryReader): PeersDeviceListsResponse; } export type PeersDeviceListsResponseObject = { usersDeviceListsMap: Array<[string, string]>, usersDevicesPlatformDetailsMap: Array<[string, UserDevicesPlatformDetailsObject]>, } declare export class UpdateDeviceListRequest extends Message { getNewDeviceList(): string; setNewDeviceList(value: string): UpdateDeviceListRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UpdateDeviceListRequestObject; static toObject(includeInstance: boolean, msg: UpdateDeviceListRequest): UpdateDeviceListRequestObject; static serializeBinaryToWriter(message: UpdateDeviceListRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UpdateDeviceListRequest; static deserializeBinaryFromReader(message: UpdateDeviceListRequest, reader: BinaryReader): UpdateDeviceListRequest; } export type UpdateDeviceListRequestObject = { newDeviceList: string, } declare export class LinkFarcasterAccountRequest extends Message { getFarcasterId(): string; setFarcasterId(value: string): LinkFarcasterAccountRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): LinkFarcasterAccountRequestObject; static toObject(includeInstance: boolean, msg: LinkFarcasterAccountRequest): LinkFarcasterAccountRequestObject; static serializeBinaryToWriter(message: LinkFarcasterAccountRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): LinkFarcasterAccountRequest; static deserializeBinaryFromReader(message: LinkFarcasterAccountRequest, reader: BinaryReader): LinkFarcasterAccountRequest; } export type LinkFarcasterAccountRequestObject = { farcasterId: string, } declare export class UserIdentitiesRequest extends Message { getUserIdsList(): Array; setUserIdsList(value: Array): UserIdentitiesRequest; clearUserIdsList(): UserIdentitiesRequest; addUserIds(value: string, index?: number): UserIdentitiesRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UserIdentitiesRequestObject; static toObject(includeInstance: boolean, msg: UserIdentitiesRequest): UserIdentitiesRequestObject; static serializeBinaryToWriter(message: UserIdentitiesRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UserIdentitiesRequest; static deserializeBinaryFromReader(message: UserIdentitiesRequest, reader: BinaryReader): UserIdentitiesRequest; } export type UserIdentitiesRequestObject = { userIdsList: Array, } declare export class UserIdentitiesResponse extends Message { getIdentitiesMap(): Map; clearIdentitiesMap(): UserIdentitiesResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): UserIdentitiesResponseObject; static toObject(includeInstance: boolean, msg: UserIdentitiesResponse): UserIdentitiesResponseObject; static serializeBinaryToWriter(message: UserIdentitiesResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): UserIdentitiesResponse; static deserializeBinaryFromReader(message: UserIdentitiesResponse, reader: BinaryReader): UserIdentitiesResponse; } export type UserIdentitiesResponseObject = { identitiesMap: Array<[string, IdentityObject]>, }