diff --git a/lib/types/identity-service-types.js b/lib/types/identity-service-types.js index 42f1fbe16..d5a37d7aa 100644 --- a/lib/types/identity-service-types.js +++ b/lib/types/identity-service-types.js @@ -1,368 +1,360 @@ // @flow import t, { type TInterface, type TList, type TDict, type TEnums } from 'tcomb'; import { identityKeysBlobValidator, type IdentityKeysBlob, signedPrekeysValidator, type SignedPrekeys, type OneTimeKeysResultValues, } from './crypto-types.js'; import { type OlmSessionInitializationInfo, olmSessionInitializationInfoValidator, } from './request-types.js'; import { currentUserInfoValidator, type CurrentUserInfo, } from './user-types.js'; import { values } from '../utils/objects.js'; import { tUserID, tShape } from '../utils/validation-utils.js'; export type UserAuthMetadata = { +userID: string, +accessToken: string, }; // This type should not be altered without also updating OutboundKeyInfoResponse // in native/native_rust_library/src/identity/x3dh.rs export type OutboundKeyInfoResponse = { +payload: string, +payloadSignature: string, +contentPrekey: string, +contentPrekeySignature: string, +notifPrekey: string, +notifPrekeySignature: string, +oneTimeContentPrekey: ?string, +oneTimeNotifPrekey: ?string, }; // This type should not be altered without also updating InboundKeyInfoResponse // in native/native_rust_library/src/identity/x3dh.rs export type InboundKeyInfoResponse = { +payload: string, +payloadSignature: string, +contentPrekey: string, +contentPrekeySignature: string, +notifPrekey: string, +notifPrekeySignature: string, +username?: ?string, +walletAddress?: ?string, }; export type DeviceOlmOutboundKeys = { +identityKeysBlob: IdentityKeysBlob, +contentInitializationInfo: OlmSessionInitializationInfo, +notifInitializationInfo: OlmSessionInitializationInfo, +payloadSignature: string, }; export const deviceOlmOutboundKeysValidator: TInterface = tShape({ identityKeysBlob: identityKeysBlobValidator, contentInitializationInfo: olmSessionInitializationInfoValidator, notifInitializationInfo: olmSessionInitializationInfoValidator, payloadSignature: t.String, }); export type UserDevicesOlmOutboundKeys = { +deviceID: string, +keys: ?DeviceOlmOutboundKeys, }; export type DeviceOlmInboundKeys = { +identityKeysBlob: IdentityKeysBlob, +signedPrekeys: SignedPrekeys, +payloadSignature: string, }; export const deviceOlmInboundKeysValidator: TInterface = tShape({ identityKeysBlob: identityKeysBlobValidator, signedPrekeys: signedPrekeysValidator, payloadSignature: t.String, }); export type UserDevicesOlmInboundKeys = { +keys: { +[deviceID: string]: ?DeviceOlmInboundKeys, }, +username?: ?string, +walletAddress?: ?string, }; // This type should not be altered without also updating FarcasterUser in // keyserver/addons/rust-node-addon/src/identity_client/get_farcaster_users.rs export type FarcasterUser = { +userID: string, +username: string, +farcasterID: string, }; export const farcasterUserValidator: TInterface = tShape({ userID: tUserID, username: t.String, farcasterID: t.String, }); export const farcasterUsersValidator: TList> = t.list( farcasterUserValidator, ); export const userDeviceOlmInboundKeysValidator: TInterface = tShape({ keys: t.dict(t.String, t.maybe(deviceOlmInboundKeysValidator)), username: t.maybe(t.String), walletAddress: t.maybe(t.String), }); export interface IdentityServiceClient { // Only a primary device can initiate account deletion, and web cannot be a // primary device +deleteWalletUser?: () => Promise; // Only a primary device can initiate account deletion, and web cannot be a // primary device +deletePasswordUser?: (password: string) => Promise; +logOut: () => Promise; +logOutSecondaryDevice: () => Promise; +getKeyserverKeys: string => Promise; // Users cannot register from web +registerPasswordUser?: ( username: string, password: string, fid: ?string, ) => Promise; // Users cannot register from web +registerReservedPasswordUser?: ( username: string, password: string, keyserverMessage: string, keyserverSignature: string, ) => Promise; +logInPasswordUser: ( username: string, password: string, ) => Promise; +getOutboundKeysForUser: ( userID: string, ) => Promise; +getInboundKeysForUser: ( userID: string, ) => Promise; +uploadOneTimeKeys: (oneTimeKeys: OneTimeKeysResultValues) => Promise; +generateNonce: () => Promise; // Users cannot register from web +registerWalletUser?: ( walletAddress: string, siweMessage: string, siweSignature: string, fid: ?string, ) => Promise; - // Users cannot register from web - +registerReservedWalletUser?: ( - walletAddress: string, - siweMessage: string, - siweSignature: string, - keyserverMessage: string, - keyserverSignature: string, - ) => Promise; +logInWalletUser: ( walletAddress: string, siweMessage: string, siweSignature: string, ) => Promise; // on native, publishing prekeys to Identity is called directly from C++, // there is no need to expose it to JS +publishWebPrekeys?: (prekeys: SignedPrekeys) => Promise; +getDeviceListHistoryForUser: ( userID: string, sinceTimestamp?: number, ) => Promise<$ReadOnlyArray>; +getDeviceListsForUsers: ( userIDs: $ReadOnlyArray, ) => Promise; // updating device list is possible only on Native // web cannot be a primary device, so there's no need to expose it to JS +updateDeviceList?: (newDeviceList: SignedDeviceList) => Promise; +syncPlatformDetails: () => Promise; +uploadKeysForRegisteredDeviceAndLogIn: ( userID: string, signedNonce: SignedNonce, ) => Promise; +getFarcasterUsers: ( farcasterIDs: $ReadOnlyArray, ) => Promise<$ReadOnlyArray>; +linkFarcasterAccount: (farcasterID: string) => Promise; +unlinkFarcasterAccount: () => Promise; +findUserIdentities: (userIDs: $ReadOnlyArray) => Promise; +versionSupported: () => Promise; +changePassword: (oldPassword: string, newPassword: string) => Promise; } export type IdentityServiceAuthLayer = { +userID: string, +deviceID: string, +commServicesAccessToken: string, }; export type IdentityAuthResult = { +userID: string, +accessToken: string, +username: string, +preRequestUserState?: ?CurrentUserInfo, }; export const identityAuthResultValidator: TInterface = tShape({ userID: tUserID, accessToken: t.String, username: t.String, preRequestUserState: t.maybe(currentUserInfoValidator), }); export type IdentityNewDeviceKeyUpload = { +keyPayload: string, +keyPayloadSignature: string, +contentPrekey: string, +contentPrekeySignature: string, +notifPrekey: string, +notifPrekeySignature: string, +contentOneTimeKeys: $ReadOnlyArray, +notifOneTimeKeys: $ReadOnlyArray, }; export type IdentityExistingDeviceKeyUpload = { +keyPayload: string, +keyPayloadSignature: string, +contentPrekey: string, +contentPrekeySignature: string, +notifPrekey: string, +notifPrekeySignature: string, }; // Device list types export type RawDeviceList = { +devices: $ReadOnlyArray, +timestamp: number, }; export const rawDeviceListValidator: TInterface = tShape({ devices: t.list(t.String), timestamp: t.Number, }); export type UsersRawDeviceLists = { +[userID: string]: RawDeviceList, }; // User Identity types export type EthereumIdentity = { walletAddress: string, siweMessage: string, siweSignature: string, }; export type Identity = { +username: string, +ethIdentity: ?EthereumIdentity, +farcasterID: ?string, }; export type Identities = { +[userID: string]: Identity, }; export const ethereumIdentityValidator: TInterface = tShape({ walletAddress: t.String, siweMessage: t.String, siweSignature: t.String, }); export const identityValidator: TInterface = tShape({ username: t.String, ethIdentity: t.maybe(ethereumIdentityValidator), farcasterID: t.maybe(t.String), }); export const identitiesValidator: TDict = t.dict( t.String, identityValidator, ); export type SignedDeviceList = { // JSON-stringified RawDeviceList +rawDeviceList: string, // Current primary device signature. Absent for Identity Service generated // device lists. +curPrimarySignature?: string, // Previous primary device signature. Present only if primary device // has changed since last update. +lastPrimarySignature?: string, }; export const signedDeviceListValidator: TInterface = tShape({ rawDeviceList: t.String, curPrimarySignature: t.maybe(t.String), lastPrimarySignature: t.maybe(t.String), }); export const signedDeviceListHistoryValidator: TList> = t.list(signedDeviceListValidator); export type UsersSignedDeviceLists = { +[userID: string]: SignedDeviceList, }; export const usersSignedDeviceListsValidator: TDict = t.dict(t.String, signedDeviceListValidator); export type SignedNonce = { +nonce: string, +nonceSignature: string, }; export const ONE_TIME_KEYS_NUMBER = 10; export const identityDeviceTypes = Object.freeze({ KEYSERVER: 0, WEB: 1, IOS: 2, ANDROID: 3, WINDOWS: 4, MAC_OS: 5, }); export type IdentityDeviceType = $Values; export const identityDeviceTypeValidator: TEnums = t.enums.of( values(identityDeviceTypes), ); export type IdentityPlatformDetails = { +deviceType: IdentityDeviceType, +codeVersion: number, +stateVersion?: number, +majorDesktopVersion?: number, }; export const identityPlatformDetailsValidator: TInterface = tShape({ deviceType: identityDeviceTypeValidator, codeVersion: t.Number, stateVersion: t.maybe(t.Number), majorDesktopVersion: t.maybe(t.Number), }); export type UserDevicesPlatformDetails = { +[deviceID: string]: IdentityPlatformDetails, }; export const userDevicesPlatformDetailsValidator: TDict = t.dict(t.String, identityPlatformDetailsValidator); export type UsersDevicesPlatformDetails = { +[userID: string]: UserDevicesPlatformDetails, }; export const usersDevicesPlatformDetailsValidator: TDict = t.dict(t.String, userDevicesPlatformDetailsValidator); export type PeersDeviceLists = { +usersSignedDeviceLists: UsersSignedDeviceLists, +usersDevicesPlatformDetails: UsersDevicesPlatformDetails, }; export const peersDeviceListsValidator: TInterface = tShape({ usersSignedDeviceLists: usersSignedDeviceListsValidator, usersDevicesPlatformDetails: usersDevicesPlatformDetailsValidator, }); diff --git a/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp b/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp index 4f6d85dea..def11c570 100644 --- a/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp +++ b/native/cpp/CommonCpp/NativeModules/CommRustModule.cpp @@ -1,1041 +1,979 @@ #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 oldPassword, jsi::String newPassword) { auto userIDRust = jsiStringToRustString(userID, rt); auto deviceIDRust = jsiStringToRustString(deviceID, rt); auto accessTokenRust = jsiStringToRustString(accessToken, 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, 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 b637eef2d..17065e210 100644 --- a/native/cpp/CommonCpp/NativeModules/CommRustModule.h +++ b/native/cpp/CommonCpp/NativeModules/CommRustModule.h @@ -1,219 +1,204 @@ #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 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 074ceb442..4c0f836ba 100644 --- a/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp +++ b/native/cpp/CommonCpp/_generated/rustJSI-generated.cpp @@ -1,138 +1,134 @@ /** * 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), 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 {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 e2f047708..1bba0798a 100644 --- a/native/cpp/CommonCpp/_generated/rustJSI.h +++ b/native/cpp/CommonCpp/_generated/rustJSI.h @@ -1,314 +1,305 @@ /** * 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 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 oldPassword, jsi::String newPassword) override { static_assert( 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(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/identity-service/identity-service-context-provider.react.js b/native/identity-service/identity-service-context-provider.react.js index 5390e5717..c5f8627f8 100644 --- a/native/identity-service/identity-service-context-provider.react.js +++ b/native/identity-service/identity-service-context-provider.react.js @@ -1,735 +1,693 @@ // @flow import * as React from 'react'; import { getOneTimeKeyValues } from 'lib/shared/crypto-utils.js'; import { createAndSignInitialDeviceList } from 'lib/shared/device-list-utils.js'; import { IdentityClientContext } from 'lib/shared/identity-client-context.js'; import { type IdentityKeysBlob, identityKeysBlobValidator, type OneTimeKeysResultValues, } from 'lib/types/crypto-types.js'; import { type DeviceOlmInboundKeys, deviceOlmInboundKeysValidator, type DeviceOlmOutboundKeys, deviceOlmOutboundKeysValidator, farcasterUsersValidator, identityAuthResultValidator, type IdentityServiceClient, ONE_TIME_KEYS_NUMBER, type SignedDeviceList, signedDeviceListHistoryValidator, type SignedNonce, type UserAuthMetadata, userDeviceOlmInboundKeysValidator, type UserDevicesOlmInboundKeys, type UserDevicesOlmOutboundKeys, type UsersSignedDeviceLists, identitiesValidator, type UsersDevicesPlatformDetails, peersDeviceListsValidator, } from 'lib/types/identity-service-types.js'; import { getContentSigningKey } from 'lib/utils/crypto-utils.js'; import { assertWithValidator } from 'lib/utils/validation-utils.js'; import { getCommServicesAuthMetadataEmitter } from '../event-emitters/csa-auth-metadata-emitter.js'; import { commCoreModule, commRustModule } from '../native-modules.js'; import { useSelector } from '../redux/redux-utils.js'; type Props = { +children: React.Node, }; function IdentityServiceContextProvider(props: Props): React.Node { const { children } = props; const userIDPromiseRef = React.useRef>(); if (!userIDPromiseRef.current) { userIDPromiseRef.current = (async () => { const { userID } = await commCoreModule.getCommServicesAuthMetadata(); return userID; })(); } React.useEffect(() => { const metadataEmitter = getCommServicesAuthMetadataEmitter(); const subscription = metadataEmitter.addListener( 'commServicesAuthMetadata', (authMetadata: UserAuthMetadata) => { userIDPromiseRef.current = Promise.resolve(authMetadata.userID); }, ); return () => subscription.remove(); }, []); const accessToken = useSelector(state => state.commServicesAccessToken); const getAuthMetadata = React.useCallback< () => Promise<{ +deviceID: string, +userID: string, +accessToken: string, }>, >(async () => { const deviceID = await getContentSigningKey(); const userID = await userIDPromiseRef.current; if (!deviceID || !userID || !accessToken) { throw new Error('Identity service client is not initialized'); } return { deviceID, userID, accessToken }; }, [accessToken]); const processAuthResult = async (authResult: string, deviceID: string) => { const { userID, accessToken: token, username } = JSON.parse(authResult); const identityAuthResult = { accessToken: token, userID, username, }; const validatedResult = assertWithValidator( identityAuthResult, identityAuthResultValidator, ); await commCoreModule.setCommServicesAuthMetadata( validatedResult.userID, deviceID, validatedResult.accessToken, ); return validatedResult; }; const client = React.useMemo( () => ({ deleteWalletUser: async () => { const { deviceID, userID, accessToken: token, } = await getAuthMetadata(); return commRustModule.deleteWalletUser(userID, deviceID, token); }, deletePasswordUser: async (password: string) => { const { deviceID, userID, accessToken: token, } = await getAuthMetadata(); return commRustModule.deletePasswordUser( userID, deviceID, token, password, ); }, logOut: async () => { const { deviceID, userID, accessToken: token, } = await getAuthMetadata(); return commRustModule.logOut(userID, deviceID, token); }, logOutSecondaryDevice: async () => { const { deviceID, userID, accessToken: token, } = await getAuthMetadata(); return commRustModule.logOutSecondaryDevice(userID, deviceID, token); }, getKeyserverKeys: async ( keyserverID: string, ): Promise => { const { deviceID, userID, accessToken: token, } = await getAuthMetadata(); const result = await commRustModule.getKeyserverKeys( userID, deviceID, token, keyserverID, ); const resultObject = JSON.parse(result); const payload = resultObject?.payload; const keyserverKeys = { identityKeysBlob: payload ? JSON.parse(payload) : null, contentInitializationInfo: { prekey: resultObject?.contentPrekey, prekeySignature: resultObject?.contentPrekeySignature, oneTimeKey: resultObject?.oneTimeContentPrekey, }, notifInitializationInfo: { prekey: resultObject?.notifPrekey, prekeySignature: resultObject?.notifPrekeySignature, oneTimeKey: resultObject?.oneTimeNotifPrekey, }, payloadSignature: resultObject?.payloadSignature, }; return assertWithValidator( keyserverKeys, deviceOlmOutboundKeysValidator, ); }, getOutboundKeysForUser: async ( targetUserID: string, ): Promise => { const { deviceID: authDeviceID, userID, accessToken: token, } = await getAuthMetadata(); const result = await commRustModule.getOutboundKeysForUser( userID, authDeviceID, token, targetUserID, ); const resultArray = JSON.parse(result); return resultArray .map(outboundKeysInfo => { try { const payload = outboundKeysInfo?.payload; const identityKeysBlob: IdentityKeysBlob = assertWithValidator( payload ? JSON.parse(payload) : null, identityKeysBlobValidator, ); const deviceID = identityKeysBlob.primaryIdentityPublicKeys.ed25519; const deviceKeys = { identityKeysBlob, contentInitializationInfo: { prekey: outboundKeysInfo?.contentPrekey, prekeySignature: outboundKeysInfo?.contentPrekeySignature, oneTimeKey: outboundKeysInfo?.oneTimeContentPrekey, }, notifInitializationInfo: { prekey: outboundKeysInfo?.notifPrekey, prekeySignature: outboundKeysInfo?.notifPrekeySignature, oneTimeKey: outboundKeysInfo?.oneTimeNotifPrekey, }, payloadSignature: outboundKeysInfo?.payloadSignature, }; try { const validatedKeys = assertWithValidator( deviceKeys, deviceOlmOutboundKeysValidator, ); return { deviceID, keys: validatedKeys, }; } catch (e) { console.log(e); return { deviceID, keys: null, }; } } catch (e) { console.log(e); return null; } }) .filter(Boolean); }, getInboundKeysForUser: async ( targetUserID: string, ): Promise => { const { deviceID: authDeviceID, userID, accessToken: token, } = await getAuthMetadata(); const result = await commRustModule.getInboundKeysForUser( userID, authDeviceID, token, targetUserID, ); const resultArray = JSON.parse(result); const devicesKeys: { [deviceID: string]: ?DeviceOlmInboundKeys, } = {}; resultArray.forEach(inboundKeysInfo => { try { const payload = inboundKeysInfo?.payload; const identityKeysBlob: IdentityKeysBlob = assertWithValidator( payload ? JSON.parse(payload) : null, identityKeysBlobValidator, ); const deviceID = identityKeysBlob.primaryIdentityPublicKeys.ed25519; const deviceKeys = { identityKeysBlob, signedPrekeys: { contentPrekey: inboundKeysInfo?.contentPrekey, contentPrekeySignature: inboundKeysInfo?.contentPrekeySignature, notifPrekey: inboundKeysInfo?.notifPrekey, notifPrekeySignature: inboundKeysInfo?.notifPrekeySignature, }, payloadSignature: inboundKeysInfo?.payloadSignature, }; try { devicesKeys[deviceID] = assertWithValidator( deviceKeys, deviceOlmInboundKeysValidator, ); } catch (e) { console.log(e); devicesKeys[deviceID] = null; } } catch (e) { console.log(e); } }); const device = resultArray?.[0]; const inboundUserKeys = { keys: devicesKeys, username: device?.username, walletAddress: device?.walletAddress, }; return assertWithValidator( inboundUserKeys, userDeviceOlmInboundKeysValidator, ); }, uploadOneTimeKeys: async (oneTimeKeys: OneTimeKeysResultValues) => { const { deviceID: authDeviceID, userID, accessToken: token, } = await getAuthMetadata(); await commRustModule.uploadOneTimeKeys( userID, authDeviceID, token, oneTimeKeys.contentOneTimeKeys, oneTimeKeys.notificationsOneTimeKeys, ); }, registerPasswordUser: async ( username: string, password: string, fid: ?string, ) => { await commCoreModule.initializeCryptoAccount(); const [ { blobPayload, signature, primaryIdentityPublicKeys }, { contentOneTimeKeys, notificationsOneTimeKeys }, prekeys, ] = await Promise.all([ commCoreModule.getUserPublicKey(), commCoreModule.getOneTimeKeys(ONE_TIME_KEYS_NUMBER), commCoreModule.validateAndGetPrekeys(), ]); const initialDeviceList = await createAndSignInitialDeviceList( primaryIdentityPublicKeys.ed25519, ); const registrationResult = await commRustModule.registerPasswordUser( username, password, blobPayload, signature, prekeys.contentPrekey, prekeys.contentPrekeySignature, prekeys.notifPrekey, prekeys.notifPrekeySignature, getOneTimeKeyValues(contentOneTimeKeys), getOneTimeKeyValues(notificationsOneTimeKeys), fid ?? '', JSON.stringify(initialDeviceList), ); return await processAuthResult( registrationResult, primaryIdentityPublicKeys.ed25519, ); }, registerReservedPasswordUser: async ( username: string, password: string, keyserverMessage: string, keyserverSignature: string, ) => { await commCoreModule.initializeCryptoAccount(); const [ { blobPayload, signature, primaryIdentityPublicKeys }, { contentOneTimeKeys, notificationsOneTimeKeys }, prekeys, ] = await Promise.all([ commCoreModule.getUserPublicKey(), commCoreModule.getOneTimeKeys(ONE_TIME_KEYS_NUMBER), commCoreModule.validateAndGetPrekeys(), ]); const initialDeviceList = await createAndSignInitialDeviceList( primaryIdentityPublicKeys.ed25519, ); const registrationResult = await commRustModule.registerReservedPasswordUser( username, password, blobPayload, signature, prekeys.contentPrekey, prekeys.contentPrekeySignature, prekeys.notifPrekey, prekeys.notifPrekeySignature, getOneTimeKeyValues(contentOneTimeKeys), getOneTimeKeyValues(notificationsOneTimeKeys), keyserverMessage, keyserverSignature, JSON.stringify(initialDeviceList), ); return await processAuthResult( registrationResult, primaryIdentityPublicKeys.ed25519, ); }, logInPasswordUser: async (username: string, password: string) => { await commCoreModule.initializeCryptoAccount(); const [{ blobPayload, signature, primaryIdentityPublicKeys }, prekeys] = await Promise.all([ commCoreModule.getUserPublicKey(), commCoreModule.validateAndGetPrekeys(), ]); const loginResult = await commRustModule.logInPasswordUser( username, password, blobPayload, signature, prekeys.contentPrekey, prekeys.contentPrekeySignature, prekeys.notifPrekey, prekeys.notifPrekeySignature, ); return await processAuthResult( loginResult, primaryIdentityPublicKeys.ed25519, ); }, registerWalletUser: async ( walletAddress: string, siweMessage: string, siweSignature: string, fid: ?string, ) => { await commCoreModule.initializeCryptoAccount(); const [ { blobPayload, signature, primaryIdentityPublicKeys }, { contentOneTimeKeys, notificationsOneTimeKeys }, prekeys, ] = await Promise.all([ commCoreModule.getUserPublicKey(), commCoreModule.getOneTimeKeys(ONE_TIME_KEYS_NUMBER), commCoreModule.validateAndGetPrekeys(), ]); const initialDeviceList = await createAndSignInitialDeviceList( primaryIdentityPublicKeys.ed25519, ); const registrationResult = await commRustModule.registerWalletUser( siweMessage, siweSignature, blobPayload, signature, prekeys.contentPrekey, prekeys.contentPrekeySignature, prekeys.notifPrekey, prekeys.notifPrekeySignature, getOneTimeKeyValues(contentOneTimeKeys), getOneTimeKeyValues(notificationsOneTimeKeys), fid ?? '', JSON.stringify(initialDeviceList), ); return await processAuthResult( registrationResult, primaryIdentityPublicKeys.ed25519, ); }, - registerReservedWalletUser: async ( - walletAddress: string, - siweMessage: string, - siweSignature: string, - keyserverMessage: string, - keyserverSignature: string, - ) => { - await commCoreModule.initializeCryptoAccount(); - const [ - { blobPayload, signature, primaryIdentityPublicKeys }, - { contentOneTimeKeys, notificationsOneTimeKeys }, - prekeys, - ] = await Promise.all([ - commCoreModule.getUserPublicKey(), - commCoreModule.getOneTimeKeys(ONE_TIME_KEYS_NUMBER), - commCoreModule.validateAndGetPrekeys(), - ]); - const initialDeviceList = await createAndSignInitialDeviceList( - primaryIdentityPublicKeys.ed25519, - ); - const registrationResult = - await commRustModule.registerReservedWalletUser( - siweMessage, - siweSignature, - blobPayload, - signature, - prekeys.contentPrekey, - prekeys.contentPrekeySignature, - prekeys.notifPrekey, - prekeys.notifPrekeySignature, - getOneTimeKeyValues(contentOneTimeKeys), - getOneTimeKeyValues(notificationsOneTimeKeys), - keyserverMessage, - keyserverSignature, - JSON.stringify(initialDeviceList), - ); - - return await processAuthResult( - registrationResult, - primaryIdentityPublicKeys.ed25519, - ); - }, logInWalletUser: async ( walletAddress: string, siweMessage: string, siweSignature: string, ) => { await commCoreModule.initializeCryptoAccount(); const [{ blobPayload, signature, primaryIdentityPublicKeys }, prekeys] = await Promise.all([ commCoreModule.getUserPublicKey(), commCoreModule.validateAndGetPrekeys(), ]); const loginResult = await commRustModule.logInWalletUser( siweMessage, siweSignature, blobPayload, signature, prekeys.contentPrekey, prekeys.contentPrekeySignature, prekeys.notifPrekey, prekeys.notifPrekeySignature, ); return await processAuthResult( loginResult, primaryIdentityPublicKeys.ed25519, ); }, uploadKeysForRegisteredDeviceAndLogIn: async ( userID: string, nonceChallengeResponse: SignedNonce, ) => { await commCoreModule.initializeCryptoAccount(); const [ { blobPayload, signature, primaryIdentityPublicKeys }, { contentOneTimeKeys, notificationsOneTimeKeys }, prekeys, ] = await Promise.all([ commCoreModule.getUserPublicKey(), commCoreModule.getOneTimeKeys(ONE_TIME_KEYS_NUMBER), commCoreModule.validateAndGetPrekeys(), ]); const { nonce, nonceSignature } = nonceChallengeResponse; const registrationResult = await commRustModule.uploadSecondaryDeviceKeysAndLogIn( userID, nonce, nonceSignature, blobPayload, signature, prekeys.contentPrekey, prekeys.contentPrekeySignature, prekeys.notifPrekey, prekeys.notifPrekeySignature, getOneTimeKeyValues(contentOneTimeKeys), getOneTimeKeyValues(notificationsOneTimeKeys), ); return await processAuthResult( registrationResult, primaryIdentityPublicKeys.ed25519, ); }, generateNonce: commRustModule.generateNonce, getDeviceListHistoryForUser: async ( userID: string, sinceTimestamp?: number, ) => { const { deviceID: authDeviceID, userID: authUserID, accessToken: token, } = await getAuthMetadata(); const result = await commRustModule.getDeviceListForUser( authUserID, authDeviceID, token, userID, sinceTimestamp, ); const rawPayloads: string[] = JSON.parse(result); const deviceLists: SignedDeviceList[] = rawPayloads.map(payload => JSON.parse(payload), ); return assertWithValidator( deviceLists, signedDeviceListHistoryValidator, ); }, getDeviceListsForUsers: async (userIDs: $ReadOnlyArray) => { const { deviceID: authDeviceID, userID: authUserID, accessToken: token, } = await getAuthMetadata(); const result = await commRustModule.getDeviceListsForUsers( authUserID, authDeviceID, token, userIDs, ); const rawPayloads: { +usersDeviceLists: { +[userID: string]: string }, +usersDevicesPlatformDetails: UsersDevicesPlatformDetails, } = JSON.parse(result); let usersDeviceLists: UsersSignedDeviceLists = {}; for (const userID in rawPayloads.usersDeviceLists) { usersDeviceLists = { ...usersDeviceLists, [userID]: JSON.parse(rawPayloads.usersDeviceLists[userID]), }; } const peersDeviceLists = { usersSignedDeviceLists: usersDeviceLists, usersDevicesPlatformDetails: rawPayloads.usersDevicesPlatformDetails, }; return assertWithValidator(peersDeviceLists, peersDeviceListsValidator); }, updateDeviceList: async (newDeviceList: SignedDeviceList) => { const { deviceID: authDeviceID, userID, accessToken: authAccessToken, } = await getAuthMetadata(); const payload = JSON.stringify(newDeviceList); await commRustModule.updateDeviceList( userID, authDeviceID, authAccessToken, payload, ); }, syncPlatformDetails: async () => { const { deviceID: authDeviceID, userID, accessToken: authAccessToken, } = await getAuthMetadata(); await commRustModule.syncPlatformDetails( userID, authDeviceID, authAccessToken, ); }, getFarcasterUsers: async (farcasterIDs: $ReadOnlyArray) => { const farcasterUsersJSONString = await commRustModule.getFarcasterUsers(farcasterIDs); const farcasterUsers = JSON.parse(farcasterUsersJSONString); return assertWithValidator(farcasterUsers, farcasterUsersValidator); }, linkFarcasterAccount: async (farcasterID: string) => { const { deviceID, userID, accessToken: token, } = await getAuthMetadata(); return commRustModule.linkFarcasterAccount( userID, deviceID, token, farcasterID, ); }, unlinkFarcasterAccount: async () => { const { deviceID, userID, accessToken: token, } = await getAuthMetadata(); return commRustModule.unlinkFarcasterAccount(userID, deviceID, token); }, findUserIdentities: async (userIDs: $ReadOnlyArray) => { const { deviceID, userID, accessToken: token, } = await getAuthMetadata(); const result = await commRustModule.findUserIdentities( userID, deviceID, token, userIDs, ); const identities = JSON.parse(result); return assertWithValidator(identities, identitiesValidator); }, versionSupported: () => { return commRustModule.versionSupported(); }, changePassword: async (oldPassword: string, newPassword: string) => { const { deviceID, userID, accessToken: token, } = await getAuthMetadata(); return commRustModule.updatePassword( userID, deviceID, token, oldPassword, newPassword, ); }, }), [getAuthMetadata], ); const value = React.useMemo( () => ({ identityClient: client, getAuthMetadata, }), [client, getAuthMetadata], ); return ( {children} ); } export default IdentityServiceContextProvider; diff --git a/native/native_rust_library/src/identity.rs b/native/native_rust_library/src/identity.rs index 00d4a376b..6d381ed87 100644 --- a/native/native_rust_library/src/identity.rs +++ b/native/native_rust_library/src/identity.rs @@ -1,212 +1,203 @@ use grpc_clients::identity::protos::unauth::{ AuthResponse, DeviceKeyUpload, Empty, IdentityKeyInfo, Prekey, }; use grpc_clients::identity::{get_unauthenticated_client, PlatformMetadata}; use lazy_static::lazy_static; use serde::Serialize; use crate::generated::STATE_VERSION; use crate::utils::jsi_callbacks::{ handle_bool_result_as_callback, handle_string_result_as_callback, }; use crate::{Error, RUNTIME}; use crate::{CODE_VERSION, DEVICE_TYPE, IDENTITY_SOCKET_ADDR}; pub mod account_actions; pub mod device_list; pub mod exact_user_search; pub mod farcaster; pub mod find_user_identities; pub mod login; pub mod registration; pub mod x3dh; lazy_static! { pub static ref PLATFORM_METADATA: PlatformMetadata = PlatformMetadata { device_type: DEVICE_TYPE.as_str_name().to_lowercase(), code_version: CODE_VERSION, state_version: Some(STATE_VERSION), major_desktop_version: None, }; } pub mod ffi { use super::*; pub use account_actions::ffi::*; pub use device_list::ffi::*; pub use exact_user_search::ffi::*; pub use farcaster::ffi::*; pub use find_user_identities::ffi::*; pub use login::ffi::*; pub use registration::ffi::*; pub use x3dh::ffi::*; pub fn generate_nonce(promise_id: u32) { RUNTIME.spawn(async move { let result = fetch_nonce().await; handle_string_result_as_callback(result, promise_id); }); } pub fn version_supported(promise_id: u32) { RUNTIME.spawn(async move { let result = version_supported_helper().await; handle_bool_result_as_callback(result, promise_id); }); } } // helper structs pub struct AuthInfo { pub user_id: String, pub device_id: String, pub access_token: String, } pub struct DeviceKeys { pub key_payload: String, pub key_payload_signature: String, pub content_prekey: String, pub content_prekey_signature: String, pub notif_prekey: String, pub notif_prekey_signature: String, pub content_one_time_keys: Vec, pub notif_one_time_keys: Vec, } impl From for DeviceKeyUpload { fn from(value: DeviceKeys) -> Self { let DeviceKeys { key_payload, key_payload_signature, content_prekey, content_prekey_signature, notif_prekey, notif_prekey_signature, content_one_time_keys, notif_one_time_keys, } = value; Self { device_key_info: Some(IdentityKeyInfo { payload: key_payload, payload_signature: key_payload_signature, }), content_upload: Some(Prekey { prekey: content_prekey, prekey_signature: content_prekey_signature, }), notif_upload: Some(Prekey { prekey: notif_prekey, prekey_signature: notif_prekey_signature, }), one_time_content_prekeys: content_one_time_keys, one_time_notif_prekeys: notif_one_time_keys, device_type: DEVICE_TYPE.into(), } } } pub struct LogInPasswordUserInfo { pub username: String, pub password: String, pub device_keys: DeviceKeys, } pub struct RegisterPasswordUserInfo { pub username: String, pub password: String, pub device_keys: DeviceKeys, pub farcaster_id: Option, pub initial_device_list: String, } pub struct RegisterReservedPasswordUserInfo { pub username: String, pub password: String, pub device_keys: DeviceKeys, pub keyserver_message: String, pub keyserver_signature: String, pub initial_device_list: String, } pub struct LogInWalletUserInfo { pub siwe_message: String, pub siwe_signature: String, pub device_keys: DeviceKeys, } pub struct RegisterWalletUserInfo { pub siwe_message: String, pub siwe_signature: String, pub device_keys: DeviceKeys, pub farcaster_id: Option, pub initial_device_list: String, } -pub struct RegisterReservedWalletUserInfo { - pub siwe_message: String, - pub siwe_signature: String, - pub device_keys: DeviceKeys, - pub keyserver_message: String, - pub keyserver_signature: String, - pub initial_device_list: String, -} - /// Counterpart of proto [`AuthResponse`] message /// that implements the `Serialize` trait. #[derive(Serialize)] #[serde(rename_all = "camelCase")] pub struct IdentityAuthResult { #[serde(rename = "userID")] user_id: String, access_token: String, username: String, } impl From for IdentityAuthResult { fn from(value: AuthResponse) -> Self { let AuthResponse { user_id, access_token, username, } = value; Self { user_id, access_token, username, } } } // API implementation helpers async fn fetch_nonce() -> Result { let mut identity_client = get_unauthenticated_client(IDENTITY_SOCKET_ADDR, PLATFORM_METADATA.clone()) .await?; let nonce = identity_client .generate_nonce(Empty {}) .await? .into_inner() .nonce; Ok(nonce) } async fn version_supported_helper() -> Result { let mut identity_client = get_unauthenticated_client(IDENTITY_SOCKET_ADDR, PLATFORM_METADATA.clone()) .await?; let response = identity_client.ping(Empty {}).await; match response { Ok(_) => Ok(true), Err(e) => { if grpc_clients::error::is_version_unsupported(&e) { Ok(false) } else { Err(e.into()) } } } } diff --git a/native/native_rust_library/src/identity/registration.rs b/native/native_rust_library/src/identity/registration.rs index 8eea5f668..e8f91602f 100644 --- a/native/native_rust_library/src/identity/registration.rs +++ b/native/native_rust_library/src/identity/registration.rs @@ -1,325 +1,259 @@ use crate::{ utils::jsi_callbacks::handle_string_result_as_callback, Error, IDENTITY_SOCKET_ADDR, RUNTIME, }; use comm_opaque2::client::Registration; use grpc_clients::identity::{ get_unauthenticated_client, protos::unauth::{ RegistrationFinishRequest, RegistrationStartRequest, - ReservedRegistrationStartRequest, ReservedWalletRegistrationRequest, - WalletAuthRequest, + ReservedRegistrationStartRequest, WalletAuthRequest, }, }; use tracing::instrument; use super::{ farcaster::farcaster_id_string_to_option, IdentityAuthResult, RegisterPasswordUserInfo, RegisterReservedPasswordUserInfo, - RegisterReservedWalletUserInfo, RegisterWalletUserInfo, PLATFORM_METADATA, + RegisterWalletUserInfo, PLATFORM_METADATA, }; #[allow(clippy::too_many_arguments)] pub mod ffi { use crate::identity::{ DeviceKeys, RegisterPasswordUserInfo, RegisterReservedPasswordUserInfo, RegisterWalletUserInfo, }; use super::*; #[instrument] pub 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, ) { RUNTIME.spawn(async move { let password_user_info = RegisterPasswordUserInfo { username, password, device_keys: DeviceKeys { key_payload, key_payload_signature, content_prekey, content_prekey_signature, notif_prekey, notif_prekey_signature, content_one_time_keys, notif_one_time_keys, }, farcaster_id: farcaster_id_string_to_option(&farcaster_id), initial_device_list, }; let result = register_password_user_helper(password_user_info).await; handle_string_result_as_callback(result, promise_id); }); } #[instrument] pub 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, ) { RUNTIME.spawn(async move { let password_user_info = RegisterReservedPasswordUserInfo { username, password, device_keys: DeviceKeys { key_payload, key_payload_signature, content_prekey, content_prekey_signature, notif_prekey, notif_prekey_signature, content_one_time_keys, notif_one_time_keys, }, keyserver_message, keyserver_signature, initial_device_list, }; let result = register_reserved_password_user_helper(password_user_info).await; handle_string_result_as_callback(result, promise_id); }); } #[instrument] pub 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, ) { RUNTIME.spawn(async move { let wallet_user_info = RegisterWalletUserInfo { siwe_message, siwe_signature, device_keys: DeviceKeys { key_payload, key_payload_signature, content_prekey, content_prekey_signature, notif_prekey, notif_prekey_signature, content_one_time_keys, notif_one_time_keys, }, farcaster_id: farcaster_id_string_to_option(&farcaster_id), initial_device_list, }; let result = register_wallet_user_helper(wallet_user_info).await; handle_string_result_as_callback(result, promise_id); }); } - - #[instrument] - pub 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, - ) { - RUNTIME.spawn(async move { - let wallet_user_info = RegisterReservedWalletUserInfo { - siwe_message, - siwe_signature, - device_keys: DeviceKeys { - key_payload, - key_payload_signature, - content_prekey, - content_prekey_signature, - notif_prekey, - notif_prekey_signature, - content_one_time_keys, - notif_one_time_keys, - }, - keyserver_message, - keyserver_signature, - initial_device_list, - }; - let result = register_reserved_wallet_user_helper(wallet_user_info).await; - handle_string_result_as_callback(result, promise_id); - }); - } } async fn register_password_user_helper( password_user_info: RegisterPasswordUserInfo, ) -> Result { let mut client_registration = Registration::new(); let opaque_registration_request = client_registration .start(&password_user_info.password) .map_err(crate::handle_error)?; let registration_start_request = RegistrationStartRequest { opaque_registration_request, username: password_user_info.username, device_key_upload: Some(password_user_info.device_keys.into()), farcaster_id: password_user_info.farcaster_id, initial_device_list: password_user_info.initial_device_list, }; let mut identity_client = get_unauthenticated_client(IDENTITY_SOCKET_ADDR, PLATFORM_METADATA.clone()) .await?; let response = identity_client .register_password_user_start(registration_start_request) .await?; let registration_start_response = response.into_inner(); let opaque_registration_upload = client_registration .finish( &password_user_info.password, ®istration_start_response.opaque_registration_response, ) .map_err(crate::handle_error)?; let registration_finish_request = RegistrationFinishRequest { session_id: registration_start_response.session_id, opaque_registration_upload, }; let registration_finish_response = identity_client .register_password_user_finish(registration_finish_request) .await? .into_inner(); let auth_result = IdentityAuthResult::from(registration_finish_response); Ok(serde_json::to_string(&auth_result)?) } async fn register_reserved_password_user_helper( password_user_info: RegisterReservedPasswordUserInfo, ) -> Result { let mut client_registration = Registration::new(); let opaque_registration_request = client_registration .start(&password_user_info.password) .map_err(crate::handle_error)?; let registration_start_request = ReservedRegistrationStartRequest { opaque_registration_request, username: password_user_info.username, device_key_upload: Some(password_user_info.device_keys.into()), keyserver_message: password_user_info.keyserver_message, keyserver_signature: password_user_info.keyserver_signature, initial_device_list: password_user_info.initial_device_list, }; let mut identity_client = get_unauthenticated_client(IDENTITY_SOCKET_ADDR, PLATFORM_METADATA.clone()) .await?; let response = identity_client .register_reserved_password_user_start(registration_start_request) .await?; let registration_start_response = response.into_inner(); let opaque_registration_upload = client_registration .finish( &password_user_info.password, ®istration_start_response.opaque_registration_response, ) .map_err(crate::handle_error)?; let registration_finish_request = RegistrationFinishRequest { session_id: registration_start_response.session_id, opaque_registration_upload, }; let registration_finish_response = identity_client .register_password_user_finish(registration_finish_request) .await? .into_inner(); let auth_result = IdentityAuthResult::from(registration_finish_response); Ok(serde_json::to_string(&auth_result)?) } async fn register_wallet_user_helper( wallet_user_info: RegisterWalletUserInfo, ) -> Result { let registration_request = WalletAuthRequest { siwe_message: wallet_user_info.siwe_message, siwe_signature: wallet_user_info.siwe_signature, device_key_upload: Some(wallet_user_info.device_keys.into()), farcaster_id: wallet_user_info.farcaster_id, initial_device_list: wallet_user_info.initial_device_list, }; let mut identity_client = get_unauthenticated_client(IDENTITY_SOCKET_ADDR, PLATFORM_METADATA.clone()) .await?; let registration_response = identity_client .register_wallet_user(registration_request) .await? .into_inner(); let auth_result = IdentityAuthResult::from(registration_response); Ok(serde_json::to_string(&auth_result)?) } - -async fn register_reserved_wallet_user_helper( - wallet_user_info: RegisterReservedWalletUserInfo, -) -> Result { - let registration_request = ReservedWalletRegistrationRequest { - siwe_message: wallet_user_info.siwe_message, - siwe_signature: wallet_user_info.siwe_signature, - device_key_upload: Some(wallet_user_info.device_keys.into()), - keyserver_message: wallet_user_info.keyserver_message, - keyserver_signature: wallet_user_info.keyserver_signature, - initial_device_list: wallet_user_info.initial_device_list, - }; - - let mut identity_client = - get_unauthenticated_client(IDENTITY_SOCKET_ADDR, PLATFORM_METADATA.clone()) - .await?; - - let registration_response = identity_client - .register_reserved_wallet_user(registration_request) - .await? - .into_inner(); - - let auth_result = IdentityAuthResult::from(registration_response); - Ok(serde_json::to_string(&auth_result)?) -} diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs index e086f8244..d52be0979 100644 --- a/native/native_rust_library/src/lib.rs +++ b/native/native_rust_library/src/lib.rs @@ -1,545 +1,527 @@ 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, 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 af4e5bf75..d53fed2eb 100644 --- a/native/schema/CommRustModuleSchema.js +++ b/native/schema/CommRustModuleSchema.js @@ -1,209 +1,194 @@ // @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, 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 38790971b..343e96d29 100644 --- a/services/identity/src/client_service.rs +++ b/services/identity/src/client_service.rs @@ -1,1305 +1,1224 @@ // 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, 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, + ReservedRegistrationStartRequest, 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(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 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 .get_user_id_from_reserved_usernames_table(&message.username) .await .map_err(handle_db_error)? .is_some(); 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 .get_user_id_from_reserved_usernames_table(&message.username) .await .map_err(handle_db_error)? .is_some(); 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 .get_user_id_from_reserved_usernames_table(&message.username) .await .map_err(handle_db_error)? .is_some(); 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(); let Some(WorkflowInProgress::Login(state)) = self .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)?; 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 login_time = chrono::Utc::now(); self .client .add_user_device( state.user_id.clone(), state.flattened_device_key_upload.clone(), platform_metadata, login_time, ) .await .map_err(handle_db_error)?; // 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, ); 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: 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 user_id = if let Some(user_id) = self .client .get_user_id_from_reserved_usernames_table(&wallet_address) .await .map_err(handle_db_error)? { // It's possible that the user attempting login is already registered // on Ashoat's keyserver. If they are, we should try to register them if // they're on a mobile device, otherwise we should send back a gRPC status // code instructing them to try logging in from a mobile device first. if platform_metadata.device_type.to_uppercase() != "ANDROID" && platform_metadata.device_type.to_uppercase() != "IOS" { return Err(tonic::Status::permission_denied( tonic_status_messages::RETRY_FROM_NATIVE, )); }; let social_proof = SocialProof::new(message.siwe_message, message.siwe_signature); self .check_device_id_taken(&flattened_device_key_upload, Some(&user_id)) .await?; 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, message.farcaster_id, None, ) .await .map_err(handle_db_error)?; user_id } else { let Some(user_id) = self .client .get_user_id_from_user_info(wallet_address.clone(), &AuthType::Wallet) .await .map_err(handle_db_error)? else { 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)?; user_id }; // 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, )?; 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 username_in_reserved_usernames_table = self .client .get_user_id_from_reserved_usernames_table(&wallet_address) .await .map_err(handle_db_error)? .is_some(); 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 maybe_user_id = self - .client - .get_user_id_from_reserved_usernames_table(&wallet_address) - .await - .map_err(handle_db_error)?; - let Some(user_id) = maybe_user_id else { - return Err(tonic::Status::permission_denied( - tonic_status_messages::WALLET_ADDRESS_NOT_RESERVED, - )); - }; - - 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 (get_user_id_from_reserved_usernames_table_result, user_id_result) = tokio::join!( self .client .get_user_id_from_reserved_usernames_table(&user_ident), self .client .get_user_id_from_user_info(user_ident.clone(), &auth_type), ); let is_reserved = get_user_id_from_reserved_usernames_table_result .map_err(handle_db_error)? .is_some(); 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/grpc_utils.rs b/services/identity/src/grpc_utils.rs index 940c05d51..8a85b9dbd 100644 --- a/services/identity/src/grpc_utils.rs +++ b/services/identity/src/grpc_utils.rs @@ -1,390 +1,378 @@ use base64::{engine::general_purpose, Engine as _}; use ed25519_dalek::{PublicKey, Signature, Verifier}; use serde::Deserialize; use tonic::Status; use tracing::warn; use crate::{ constants::tonic_status_messages, database::{DeviceListUpdate, DeviceRow, KeyPayload}, ddb_utils::{DBIdentity, Identifier as DBIdentifier}, device_list::SignedDeviceList, grpc_services::protos::{ auth::{EthereumIdentity, Identity, InboundKeyInfo, OutboundKeyInfo}, unauth::{ DeviceKeyUpload, ExistingDeviceLoginRequest, OpaqueLoginStartRequest, RegistrationStartRequest, ReservedRegistrationStartRequest, - ReservedWalletRegistrationRequest, SecondaryDeviceKeysUploadRequest, - WalletAuthRequest, + SecondaryDeviceKeysUploadRequest, WalletAuthRequest, }, }, }; #[derive(Deserialize)] pub struct SignedNonce { nonce: String, signature: String, } impl TryFrom<&SecondaryDeviceKeysUploadRequest> for SignedNonce { type Error = Status; fn try_from( value: &SecondaryDeviceKeysUploadRequest, ) -> Result { Ok(Self { nonce: value.nonce.to_string(), signature: value.nonce_signature.to_string(), }) } } impl TryFrom<&ExistingDeviceLoginRequest> for SignedNonce { type Error = Status; fn try_from(value: &ExistingDeviceLoginRequest) -> Result { Ok(Self { nonce: value.nonce.to_string(), signature: value.nonce_signature.to_string(), }) } } impl SignedNonce { pub fn verify_and_get_nonce( self, signing_public_key: &str, ) -> Result { ed25519_verify(signing_public_key, &self.nonce, &self.signature)?; Ok(self.nonce) } } /// Verifies ed25519-signed message. Returns Ok if the signature is valid. /// Public key and signature should be base64-encoded strings. pub fn ed25519_verify( signing_public_key: &str, message: &str, signature: &str, ) -> Result<(), Status> { let signature_bytes = general_purpose::STANDARD_NO_PAD .decode(signature) .map_err(|_| { Status::invalid_argument(tonic_status_messages::SIGNATURE_INVALID) })?; let signature = Signature::from_bytes(&signature_bytes).map_err(|_| { Status::invalid_argument(tonic_status_messages::SIGNATURE_INVALID) })?; let public_key_bytes = general_purpose::STANDARD_NO_PAD .decode(signing_public_key) .map_err(|_| { Status::failed_precondition(tonic_status_messages::MALFORMED_KEY) })?; let public_key: PublicKey = PublicKey::from_bytes(&public_key_bytes) .map_err(|_| { Status::failed_precondition(tonic_status_messages::MALFORMED_KEY) })?; public_key .verify(message.as_bytes(), &signature) .map_err(|_| { Status::permission_denied(tonic_status_messages::VERIFICATION_FAILED) })?; Ok(()) } pub struct DeviceKeysInfo { pub device_info: DeviceRow, pub content_one_time_key: Option, pub notif_one_time_key: Option, } impl From for DeviceKeysInfo { fn from(device_info: DeviceRow) -> Self { Self { device_info, content_one_time_key: None, notif_one_time_key: None, } } } impl From for InboundKeyInfo { fn from(info: DeviceKeysInfo) -> Self { let DeviceKeysInfo { device_info, .. } = info; InboundKeyInfo { identity_info: Some(device_info.device_key_info.into()), content_prekey: Some(device_info.content_prekey.into()), notif_prekey: Some(device_info.notif_prekey.into()), } } } impl From for OutboundKeyInfo { fn from(info: DeviceKeysInfo) -> Self { let DeviceKeysInfo { device_info, content_one_time_key, notif_one_time_key, } = info; OutboundKeyInfo { identity_info: Some(device_info.device_key_info.into()), content_prekey: Some(device_info.content_prekey.into()), notif_prekey: Some(device_info.notif_prekey.into()), one_time_content_prekey: content_one_time_key, one_time_notif_prekey: notif_one_time_key, } } } pub trait DeviceKeyUploadData { fn device_key_upload(&self) -> Option<&DeviceKeyUpload>; } impl DeviceKeyUploadData for RegistrationStartRequest { fn device_key_upload(&self) -> Option<&DeviceKeyUpload> { self.device_key_upload.as_ref() } } impl DeviceKeyUploadData for ReservedRegistrationStartRequest { fn device_key_upload(&self) -> Option<&DeviceKeyUpload> { self.device_key_upload.as_ref() } } impl DeviceKeyUploadData for OpaqueLoginStartRequest { fn device_key_upload(&self) -> Option<&DeviceKeyUpload> { self.device_key_upload.as_ref() } } impl DeviceKeyUploadData for WalletAuthRequest { fn device_key_upload(&self) -> Option<&DeviceKeyUpload> { self.device_key_upload.as_ref() } } -impl DeviceKeyUploadData for ReservedWalletRegistrationRequest { - fn device_key_upload(&self) -> Option<&DeviceKeyUpload> { - self.device_key_upload.as_ref() - } -} - impl DeviceKeyUploadData for SecondaryDeviceKeysUploadRequest { fn device_key_upload(&self) -> Option<&DeviceKeyUpload> { self.device_key_upload.as_ref() } } pub trait DeviceKeyUploadActions { fn payload(&self) -> Result; fn payload_signature(&self) -> Result; fn content_prekey(&self) -> Result; fn content_prekey_signature(&self) -> Result; fn notif_prekey(&self) -> Result; fn notif_prekey_signature(&self) -> Result; fn one_time_content_prekeys(&self) -> Result, Status>; fn one_time_notif_prekeys(&self) -> Result, Status>; fn device_type(&self) -> Result; } impl DeviceKeyUploadActions for T { fn payload(&self) -> Result { self .device_key_upload() .and_then(|upload| upload.device_key_info.as_ref()) .map(|info| info.payload.clone()) .ok_or_else(|| { Status::invalid_argument(tonic_status_messages::UNEXPECTED_MESSAGE_DATA) }) } fn payload_signature(&self) -> Result { self .device_key_upload() .and_then(|upload| upload.device_key_info.as_ref()) .map(|info| info.payload_signature.clone()) .ok_or_else(|| { Status::invalid_argument(tonic_status_messages::UNEXPECTED_MESSAGE_DATA) }) } fn content_prekey(&self) -> Result { self .device_key_upload() .and_then(|upload| upload.content_upload.as_ref()) .map(|prekey| prekey.prekey.clone()) .ok_or_else(|| { Status::invalid_argument(tonic_status_messages::UNEXPECTED_MESSAGE_DATA) }) } fn content_prekey_signature(&self) -> Result { self .device_key_upload() .and_then(|upload| upload.content_upload.as_ref()) .map(|prekey| prekey.prekey_signature.clone()) .ok_or_else(|| { Status::invalid_argument(tonic_status_messages::UNEXPECTED_MESSAGE_DATA) }) } fn notif_prekey(&self) -> Result { self .device_key_upload() .and_then(|upload| upload.notif_upload.as_ref()) .map(|prekey| prekey.prekey.clone()) .ok_or_else(|| { Status::invalid_argument(tonic_status_messages::UNEXPECTED_MESSAGE_DATA) }) } fn notif_prekey_signature(&self) -> Result { self .device_key_upload() .and_then(|upload| upload.notif_upload.as_ref()) .map(|prekey| prekey.prekey_signature.clone()) .ok_or_else(|| { Status::invalid_argument(tonic_status_messages::UNEXPECTED_MESSAGE_DATA) }) } fn one_time_content_prekeys(&self) -> Result, Status> { self .device_key_upload() .map(|upload| upload.one_time_content_prekeys.clone()) .ok_or_else(|| { Status::invalid_argument(tonic_status_messages::UNEXPECTED_MESSAGE_DATA) }) } fn one_time_notif_prekeys(&self) -> Result, Status> { self .device_key_upload() .map(|upload| upload.one_time_notif_prekeys.clone()) .ok_or_else(|| { Status::invalid_argument(tonic_status_messages::UNEXPECTED_MESSAGE_DATA) }) } fn device_type(&self) -> Result { self .device_key_upload() .map(|upload| upload.device_type) .ok_or_else(|| { Status::invalid_argument(tonic_status_messages::UNEXPECTED_MESSAGE_DATA) }) } } /// Common functionality for registration request messages trait RegistrationData { fn initial_device_list(&self) -> &str; } impl RegistrationData for RegistrationStartRequest { fn initial_device_list(&self) -> &str { &self.initial_device_list } } impl RegistrationData for ReservedRegistrationStartRequest { fn initial_device_list(&self) -> &str { &self.initial_device_list } } impl RegistrationData for WalletAuthRequest { fn initial_device_list(&self) -> &str { &self.initial_device_list } } -impl RegistrationData for ReservedWalletRegistrationRequest { - fn initial_device_list(&self) -> &str { - &self.initial_device_list - } -} /// Similar to `[DeviceKeyUploadActions]` but only for registration requests pub trait RegistrationActions { fn get_and_verify_initial_device_list( &self, ) -> Result, tonic::Status>; } impl RegistrationActions for T { fn get_and_verify_initial_device_list( &self, ) -> Result, tonic::Status> { let payload = self.initial_device_list(); if payload.is_empty() { return Ok(None); } let signed_list: SignedDeviceList = payload.parse().map_err(|err| { warn!("Failed to deserialize initial device list: {}", err); tonic::Status::invalid_argument( tonic_status_messages::INVALID_DEVICE_LIST_PAYLOAD, ) })?; let key_info = self.payload()?.parse::().map_err(|_| { tonic::Status::invalid_argument(tonic_status_messages::MALFORMED_PAYLOAD) })?; let primary_device_id = key_info.primary_identity_public_keys.ed25519; let update_payload = DeviceListUpdate::try_from(signed_list.clone())?; crate::device_list::verify_initial_device_list( &update_payload, &primary_device_id, )?; Ok(Some(signed_list)) } } impl From for Identity { fn from(value: DBIdentity) -> Self { match value.identifier { DBIdentifier::Username(username) => Identity { username, eth_identity: None, farcaster_id: value.farcaster_id, }, DBIdentifier::WalletAddress(eth_identity) => Identity { username: eth_identity.wallet_address.clone(), eth_identity: Some(EthereumIdentity { wallet_address: eth_identity.wallet_address, siwe_message: eth_identity.social_proof.message, siwe_signature: eth_identity.social_proof.signature, }), farcaster_id: value.farcaster_id, }, } } } #[cfg(test)] mod tests { use super::*; #[test] fn test_challenge_response_verification() { let expected_nonce = "hello"; let signing_key = "jnBariweGMSdfmJYvuObTu4IGT1fpaJTo/ovbkU0SAY"; let request = SecondaryDeviceKeysUploadRequest { nonce: expected_nonce.to_string(), nonce_signature: "LWlgCDND3bmgIS8liW/0eKJvuNs4Vcb4iMf43zD038/MnC0cSAYl2l3bO9dFc0fa2w6/2ABsUlPDMVr+isE0Aw".to_string(), user_id: "foo".to_string(), device_key_upload: None, }; let challenge_response = SignedNonce::try_from(&request) .expect("failed to parse challenge response"); let retrieved_nonce = challenge_response .verify_and_get_nonce(signing_key) .expect("verification failed"); assert_eq!(retrieved_nonce, expected_nonce); } } diff --git a/shared/protos/identity_unauth.proto b/shared/protos/identity_unauth.proto index fbe08829e..c7852df59 100644 --- a/shared/protos/identity_unauth.proto +++ b/shared/protos/identity_unauth.proto @@ -1,348 +1,322 @@ syntax = "proto3"; package identity.unauth; // RPCs from a client (iOS, Android, or web) to identity service service IdentityClientService { /* Account actions */ // Called by user to register with the Identity Service (PAKE only) // Due to limitations of grpc-web, the Opaque challenge+response // needs to be split up over two unary requests // Start/Finish is used here to align with opaque protocol rpc RegisterPasswordUserStart(RegistrationStartRequest) returns ( RegistrationStartResponse) {} rpc RegisterReservedPasswordUserStart(ReservedRegistrationStartRequest) returns (RegistrationStartResponse) {} rpc RegisterPasswordUserFinish(RegistrationFinishRequest) returns ( AuthResponse) {} // Called by user to register device and get an access token rpc LogInPasswordUserStart(OpaqueLoginStartRequest) returns (OpaqueLoginStartResponse) {} rpc LogInPasswordUserFinish(OpaqueLoginFinishRequest) returns (AuthResponse) {} rpc LogInWalletUser(WalletAuthRequest) returns (AuthResponse) {} rpc RegisterWalletUser(WalletAuthRequest) returns (AuthResponse) {} - rpc RegisterReservedWalletUser(ReservedWalletRegistrationRequest) returns - (AuthResponse) {} rpc UploadKeysForRegisteredDeviceAndLogIn(SecondaryDeviceKeysUploadRequest) returns (AuthResponse) {} rpc LogInExistingDevice(ExistingDeviceLoginRequest) returns (AuthResponse) {} /* Service actions */ // Called by other services to verify a user's access token rpc VerifyUserAccessToken(VerifyUserAccessTokenRequest) returns (VerifyUserAccessTokenResponse) {} /* Authoritative keyserver actions */ // Called by authoritative keyserver to add usernames // to the Identity service's reserved list rpc AddReservedUsernames(AddReservedUsernamesRequest) returns (Empty) {} // Called by authoritative keyserver to remove usernames from the Identity // service's reserved list rpc RemoveReservedUsername(RemoveReservedUsernameRequest) returns (Empty) {} /* Miscellaneous actions */ // Called by users periodically to check if their code version is supported rpc Ping(Empty) returns (Empty) {} // Returns userID for given username or wallet address rpc FindUserID(FindUserIDRequest) returns (FindUserIDResponse) {} // Called by clients to get a nonce for a Sign-In with Ethereum message // or RPCs requiring challenge-response actions rpc GenerateNonce(Empty) returns (GenerateNonceResponse) {} /* Farcaster actions */ rpc GetFarcasterUsers(GetFarcasterUsersRequest) returns (GetFarcasterUsersResponse) {} } // Helper types message Empty { } message Prekey { string prekey = 1; string prekey_signature = 2; } // Key information needed for starting a X3DH session message IdentityKeyInfo { // JSON payload containing Olm keys // Sessions for users will contain both ContentKeys and NotifKeys // For keyservers, this will only contain ContentKeys string payload = 1; // Payload signed with the signing ed25519 key string payload_signature = 2; } // RegisterUser // Ephemeral information provided so others can create initial message // to this device // // Prekeys are generally rotated periodically // One-time Prekeys are "consumed" after first use, so many need to // be provide to avoid exhausting them. enum DeviceType { KEYSERVER = 0; WEB = 1; // iOS doesn't leave a good option for title to camel case renaming IOS = 2; ANDROID = 3; WINDOWS = 4; MAC_OS = 5; } // Bundle of information needed for creating an initial message using X3DH message DeviceKeyUpload { IdentityKeyInfo device_key_info = 1; Prekey content_upload = 2; Prekey notif_upload = 3; repeated string one_time_content_prekeys = 4; repeated string one_time_notif_prekeys = 5; DeviceType device_type = 6; } // Request for registering a new user message RegistrationStartRequest { // Message sent to initiate PAKE registration (step 1) bytes opaque_registration_request = 1; string username = 2; // Information needed to open a new channel to current user's device DeviceKeyUpload device_key_upload = 3; optional string farcaster_id = 4; // A stringified JSON object of the following format: // { // "rawDeviceList": JSON.stringify({ // "devices": [] // "timestamp": , // }), // "curPrimarySignature": "base64-encoded primary device signature" // } // It's an empty string for older clients which don't sign device lists yet. string initial_device_list = 5; } message ReservedRegistrationStartRequest { // Message sent to initiate PAKE registration (step 1) bytes opaque_registration_request = 1; string username = 2; // Information needed to open a new channel to current user's device DeviceKeyUpload device_key_upload = 3; // Message from authoritative keyserver attesting that a given user // has ownership of a given username string keyserver_message = 4; // Above message signed with authoritative keyserver's signing ed25519 key string keyserver_signature = 5; // A stringified JSON object of the following format: // { // "rawDeviceList": JSON.stringify({ // "devices": [] // "timestamp": , // }), // "curPrimarySignature": "base64-encoded primary device signature" // } // It's an empty string for older clients which don't sign device lists yet. string initial_device_list = 6; } // Messages sent from a client to Identity Service message RegistrationFinishRequest { // Identifier to correlate RegisterStart session string session_id = 1; // Final message in PAKE registration bytes opaque_registration_upload = 2; } // Messages sent from Identity Service to client message RegistrationStartResponse { // Identifier used to correlate start request with finish request string session_id = 1; // sent to the user upon reception of the PAKE registration attempt // (step 2) bytes opaque_registration_response = 2; } message AuthResponse { // Unique identifier for user string user_id = 1; string access_token = 2; // This is wallet address for wallet users string username = 3; } // LoginUser message OpaqueLoginStartRequest { string username = 1; // Message sent to initiate PAKE login (step 1) bytes opaque_login_request = 2; // Information specific to a user's device needed to open a new channel of // communication with this user DeviceKeyUpload device_key_upload = 3; // If set to true, the user's existing keyserver will be deleted from the // identity service and replaced with this one. This field has no effect if // the device is not a keyserver optional bool force = 4; } message OpaqueLoginFinishRequest { // Identifier used to correlate start request with finish request string session_id = 1; // Message containing client's reponse to server challenge. // Used to verify that client holds password secret (Step 3) bytes opaque_login_upload = 2; } message OpaqueLoginStartResponse { // Identifier used to correlate start request with finish request string session_id = 1; // Opaque challenge sent from server to client attempting to login (Step 2) bytes opaque_login_response = 2; } message WalletAuthRequest { string siwe_message = 1; string siwe_signature = 2; // Information specific to a user's device needed to open a new channel of // communication with this user DeviceKeyUpload device_key_upload = 3; optional string farcaster_id = 4; // A stringified JSON object of the following format: // { // "rawDeviceList": JSON.stringify({ // "devices": [] // "timestamp": , // }), // "curPrimarySignature": "base64-encoded primary device signature" // } // It's an empty string when used outside `RegisterWalletUser` RPC // and for older clients which don't sign device lists yet. string initial_device_list = 5; } -message ReservedWalletRegistrationRequest { - string siwe_message = 1; - string siwe_signature = 2; - // Information specific to a user's device needed to open a new channel of - // communication with this user - DeviceKeyUpload device_key_upload = 3; - // Message from authoritative keyserver attesting that a given user - // has ownership of a given wallet address - string keyserver_message = 4; - // Above message signed with authoritative keyserver's signing ed25519 key - string keyserver_signature = 5; - // A stringified JSON object of the following format: - // { - // "rawDeviceList": JSON.stringify({ - // "devices": [] - // "timestamp": , - // }), - // "curPrimarySignature": "base64-encoded primary device signature" - // } - // It's an empty string when used for older clients - // which don't sign device lists yet. - string initial_device_list = 6; -} - // UploadKeysForRegisteredDeviceAndLogIn message SecondaryDeviceKeysUploadRequest { string user_id = 1; string nonce = 2; string nonce_signature = 3; // Information specific to a user's device needed to open a new channel of // communication with this user DeviceKeyUpload device_key_upload = 4; } // LogInExistingDevice message ExistingDeviceLoginRequest { string user_id = 1; string device_id = 2; string nonce = 3; string nonce_signature = 4; } // GenerateNonce message GenerateNonceResponse{ string nonce = 1; } // VerifyUserAccessToken message VerifyUserAccessTokenRequest { string user_id = 1; // signing ed25519 key for the given user's device string device_id = 2; string access_token = 3; } message VerifyUserAccessTokenResponse { bool token_valid = 1; } // AddReservedUsernames message AddReservedUsernamesRequest { // Message from authoritative keyserver containing the username to be added string message = 1; // Above message signed with authoritative keyserver's signing ed25519 key string signature = 2; } // RemoveReservedUsername message RemoveReservedUsernameRequest { // Message from authoritative keyserver containing the username to be removed string message = 1; // Above message signed with authoritative keyserver's signing ed25519 key string signature = 2; } // FindUserID message FindUserIDRequest { oneof identifier { string username = 1; string wallet_address = 2; } } message FindUserIDResponse { // userID if the user is registered with Identity Service, null otherwise optional string user_id = 1; // true if the identifier (username or wallet address) exists in the // reserved usernames list, false otherwise. It doesn't take into account // whether the user is registered with Identity Service (userID != null). bool is_reserved = 2; } // GetFarcasterUsers message GetFarcasterUsersRequest { repeated string farcaster_ids = 1; } message GetFarcasterUsersResponse { repeated FarcasterUser farcaster_users = 1; } message FarcasterUser { string user_id = 1; string farcaster_id = 2; string username = 3; } diff --git a/web/protobufs/identity-unauth-structs.cjs b/web/protobufs/identity-unauth-structs.cjs index af7112e2d..1f13ed3d6 100644 --- a/web/protobufs/identity-unauth-structs.cjs +++ b/web/protobufs/identity-unauth-structs.cjs @@ -1,5994 +1,5671 @@ // source: identity_unauth.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')(); goog.exportSymbol('proto.identity.unauth.AddReservedUsernamesRequest', null, global); goog.exportSymbol('proto.identity.unauth.AuthResponse', null, global); goog.exportSymbol('proto.identity.unauth.DeviceKeyUpload', null, global); goog.exportSymbol('proto.identity.unauth.DeviceType', null, global); goog.exportSymbol('proto.identity.unauth.Empty', null, global); goog.exportSymbol('proto.identity.unauth.ExistingDeviceLoginRequest', null, global); goog.exportSymbol('proto.identity.unauth.FarcasterUser', null, global); goog.exportSymbol('proto.identity.unauth.FindUserIDRequest', null, global); goog.exportSymbol('proto.identity.unauth.FindUserIDRequest.IdentifierCase', null, global); goog.exportSymbol('proto.identity.unauth.FindUserIDResponse', null, global); goog.exportSymbol('proto.identity.unauth.GenerateNonceResponse', null, global); goog.exportSymbol('proto.identity.unauth.GetFarcasterUsersRequest', null, global); goog.exportSymbol('proto.identity.unauth.GetFarcasterUsersResponse', null, global); goog.exportSymbol('proto.identity.unauth.IdentityKeyInfo', null, global); goog.exportSymbol('proto.identity.unauth.OpaqueLoginFinishRequest', null, global); goog.exportSymbol('proto.identity.unauth.OpaqueLoginStartRequest', null, global); goog.exportSymbol('proto.identity.unauth.OpaqueLoginStartResponse', null, global); goog.exportSymbol('proto.identity.unauth.Prekey', null, global); goog.exportSymbol('proto.identity.unauth.RegistrationFinishRequest', null, global); goog.exportSymbol('proto.identity.unauth.RegistrationStartRequest', null, global); goog.exportSymbol('proto.identity.unauth.RegistrationStartResponse', null, global); goog.exportSymbol('proto.identity.unauth.RemoveReservedUsernameRequest', null, global); goog.exportSymbol('proto.identity.unauth.ReservedRegistrationStartRequest', null, global); -goog.exportSymbol('proto.identity.unauth.ReservedWalletRegistrationRequest', null, global); goog.exportSymbol('proto.identity.unauth.SecondaryDeviceKeysUploadRequest', null, global); goog.exportSymbol('proto.identity.unauth.VerifyUserAccessTokenRequest', null, global); goog.exportSymbol('proto.identity.unauth.VerifyUserAccessTokenResponse', null, global); goog.exportSymbol('proto.identity.unauth.WalletAuthRequest', 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.unauth.Empty = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.Empty, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.Empty.displayName = 'proto.identity.unauth.Empty'; } /** * 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.unauth.Prekey = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.Prekey, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.Prekey.displayName = 'proto.identity.unauth.Prekey'; } /** * 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.unauth.IdentityKeyInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.IdentityKeyInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.IdentityKeyInfo.displayName = 'proto.identity.unauth.IdentityKeyInfo'; } /** * 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.unauth.DeviceKeyUpload = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.identity.unauth.DeviceKeyUpload.repeatedFields_, null); }; goog.inherits(proto.identity.unauth.DeviceKeyUpload, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.DeviceKeyUpload.displayName = 'proto.identity.unauth.DeviceKeyUpload'; } /** * 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.unauth.RegistrationStartRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.RegistrationStartRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.RegistrationStartRequest.displayName = 'proto.identity.unauth.RegistrationStartRequest'; } /** * 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.unauth.ReservedRegistrationStartRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.ReservedRegistrationStartRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.ReservedRegistrationStartRequest.displayName = 'proto.identity.unauth.ReservedRegistrationStartRequest'; } /** * 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.unauth.RegistrationFinishRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.RegistrationFinishRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.RegistrationFinishRequest.displayName = 'proto.identity.unauth.RegistrationFinishRequest'; } /** * 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.unauth.RegistrationStartResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.RegistrationStartResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.RegistrationStartResponse.displayName = 'proto.identity.unauth.RegistrationStartResponse'; } /** * 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.unauth.AuthResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.AuthResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.AuthResponse.displayName = 'proto.identity.unauth.AuthResponse'; } /** * 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.unauth.OpaqueLoginStartRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.OpaqueLoginStartRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.OpaqueLoginStartRequest.displayName = 'proto.identity.unauth.OpaqueLoginStartRequest'; } /** * 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.unauth.OpaqueLoginFinishRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.OpaqueLoginFinishRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.OpaqueLoginFinishRequest.displayName = 'proto.identity.unauth.OpaqueLoginFinishRequest'; } /** * 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.unauth.OpaqueLoginStartResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.OpaqueLoginStartResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.OpaqueLoginStartResponse.displayName = 'proto.identity.unauth.OpaqueLoginStartResponse'; } /** * 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.unauth.WalletAuthRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.WalletAuthRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.WalletAuthRequest.displayName = 'proto.identity.unauth.WalletAuthRequest'; } -/** - * 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.unauth.ReservedWalletRegistrationRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.identity.unauth.ReservedWalletRegistrationRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.identity.unauth.ReservedWalletRegistrationRequest.displayName = 'proto.identity.unauth.ReservedWalletRegistrationRequest'; -} /** * 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.unauth.SecondaryDeviceKeysUploadRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.SecondaryDeviceKeysUploadRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.displayName = 'proto.identity.unauth.SecondaryDeviceKeysUploadRequest'; } /** * 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.unauth.ExistingDeviceLoginRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.ExistingDeviceLoginRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.ExistingDeviceLoginRequest.displayName = 'proto.identity.unauth.ExistingDeviceLoginRequest'; } /** * 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.unauth.GenerateNonceResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.GenerateNonceResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.GenerateNonceResponse.displayName = 'proto.identity.unauth.GenerateNonceResponse'; } /** * 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.unauth.VerifyUserAccessTokenRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.VerifyUserAccessTokenRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.VerifyUserAccessTokenRequest.displayName = 'proto.identity.unauth.VerifyUserAccessTokenRequest'; } /** * 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.unauth.VerifyUserAccessTokenResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.VerifyUserAccessTokenResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.VerifyUserAccessTokenResponse.displayName = 'proto.identity.unauth.VerifyUserAccessTokenResponse'; } /** * 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.unauth.AddReservedUsernamesRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.AddReservedUsernamesRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.AddReservedUsernamesRequest.displayName = 'proto.identity.unauth.AddReservedUsernamesRequest'; } /** * 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.unauth.RemoveReservedUsernameRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.RemoveReservedUsernameRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.RemoveReservedUsernameRequest.displayName = 'proto.identity.unauth.RemoveReservedUsernameRequest'; } /** * 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.unauth.FindUserIDRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, proto.identity.unauth.FindUserIDRequest.oneofGroups_); }; goog.inherits(proto.identity.unauth.FindUserIDRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.FindUserIDRequest.displayName = 'proto.identity.unauth.FindUserIDRequest'; } /** * 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.unauth.FindUserIDResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.FindUserIDResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.FindUserIDResponse.displayName = 'proto.identity.unauth.FindUserIDResponse'; } /** * 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.unauth.GetFarcasterUsersRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.identity.unauth.GetFarcasterUsersRequest.repeatedFields_, null); }; goog.inherits(proto.identity.unauth.GetFarcasterUsersRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.GetFarcasterUsersRequest.displayName = 'proto.identity.unauth.GetFarcasterUsersRequest'; } /** * 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.unauth.GetFarcasterUsersResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.identity.unauth.GetFarcasterUsersResponse.repeatedFields_, null); }; goog.inherits(proto.identity.unauth.GetFarcasterUsersResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.GetFarcasterUsersResponse.displayName = 'proto.identity.unauth.GetFarcasterUsersResponse'; } /** * 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.unauth.FarcasterUser = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.identity.unauth.FarcasterUser, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ proto.identity.unauth.FarcasterUser.displayName = 'proto.identity.unauth.FarcasterUser'; } 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.unauth.Empty.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.Empty.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.unauth.Empty} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.Empty.toObject = function(includeInstance, msg) { var f, obj = { }; 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.unauth.Empty} */ proto.identity.unauth.Empty.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.Empty; return proto.identity.unauth.Empty.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.Empty} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.Empty} */ proto.identity.unauth.Empty.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.Empty.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.Empty.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.unauth.Empty} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.Empty.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; 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.unauth.Prekey.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.Prekey.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.unauth.Prekey} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.Prekey.toObject = function(includeInstance, msg) { var f, obj = { prekey: jspb.Message.getFieldWithDefault(msg, 1, ""), prekeySignature: jspb.Message.getFieldWithDefault(msg, 2, "") }; 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.unauth.Prekey} */ proto.identity.unauth.Prekey.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.Prekey; return proto.identity.unauth.Prekey.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.Prekey} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.Prekey} */ proto.identity.unauth.Prekey.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.setPrekey(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setPrekeySignature(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.Prekey.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.Prekey.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.unauth.Prekey} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.Prekey.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getPrekey(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getPrekeySignature(); if (f.length > 0) { writer.writeString( 2, f ); } }; /** * optional string prekey = 1; * @return {string} */ proto.identity.unauth.Prekey.prototype.getPrekey = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.Prekey} returns this */ proto.identity.unauth.Prekey.prototype.setPrekey = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string prekey_signature = 2; * @return {string} */ proto.identity.unauth.Prekey.prototype.getPrekeySignature = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.Prekey} returns this */ proto.identity.unauth.Prekey.prototype.setPrekeySignature = function(value) { return jspb.Message.setProto3StringField(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.unauth.IdentityKeyInfo.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.IdentityKeyInfo.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.unauth.IdentityKeyInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.IdentityKeyInfo.toObject = function(includeInstance, msg) { var f, obj = { payload: jspb.Message.getFieldWithDefault(msg, 1, ""), payloadSignature: jspb.Message.getFieldWithDefault(msg, 2, "") }; 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.unauth.IdentityKeyInfo} */ proto.identity.unauth.IdentityKeyInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.IdentityKeyInfo; return proto.identity.unauth.IdentityKeyInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.IdentityKeyInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.IdentityKeyInfo} */ proto.identity.unauth.IdentityKeyInfo.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.setPayload(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setPayloadSignature(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.IdentityKeyInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.IdentityKeyInfo.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.unauth.IdentityKeyInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.IdentityKeyInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getPayload(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getPayloadSignature(); if (f.length > 0) { writer.writeString( 2, f ); } }; /** * optional string payload = 1; * @return {string} */ proto.identity.unauth.IdentityKeyInfo.prototype.getPayload = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.IdentityKeyInfo} returns this */ proto.identity.unauth.IdentityKeyInfo.prototype.setPayload = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string payload_signature = 2; * @return {string} */ proto.identity.unauth.IdentityKeyInfo.prototype.getPayloadSignature = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.IdentityKeyInfo} returns this */ proto.identity.unauth.IdentityKeyInfo.prototype.setPayloadSignature = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.identity.unauth.DeviceKeyUpload.repeatedFields_ = [4,5]; 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.unauth.DeviceKeyUpload.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.DeviceKeyUpload.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.unauth.DeviceKeyUpload} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.DeviceKeyUpload.toObject = function(includeInstance, msg) { var f, obj = { deviceKeyInfo: (f = msg.getDeviceKeyInfo()) && proto.identity.unauth.IdentityKeyInfo.toObject(includeInstance, f), contentUpload: (f = msg.getContentUpload()) && proto.identity.unauth.Prekey.toObject(includeInstance, f), notifUpload: (f = msg.getNotifUpload()) && proto.identity.unauth.Prekey.toObject(includeInstance, f), oneTimeContentPrekeysList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f, oneTimeNotifPrekeysList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f, deviceType: jspb.Message.getFieldWithDefault(msg, 6, 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.unauth.DeviceKeyUpload} */ proto.identity.unauth.DeviceKeyUpload.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.DeviceKeyUpload; return proto.identity.unauth.DeviceKeyUpload.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.DeviceKeyUpload} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.DeviceKeyUpload} */ proto.identity.unauth.DeviceKeyUpload.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.identity.unauth.IdentityKeyInfo; reader.readMessage(value,proto.identity.unauth.IdentityKeyInfo.deserializeBinaryFromReader); msg.setDeviceKeyInfo(value); break; case 2: var value = new proto.identity.unauth.Prekey; reader.readMessage(value,proto.identity.unauth.Prekey.deserializeBinaryFromReader); msg.setContentUpload(value); break; case 3: var value = new proto.identity.unauth.Prekey; reader.readMessage(value,proto.identity.unauth.Prekey.deserializeBinaryFromReader); msg.setNotifUpload(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.addOneTimeContentPrekeys(value); break; case 5: var value = /** @type {string} */ (reader.readString()); msg.addOneTimeNotifPrekeys(value); break; case 6: var value = /** @type {!proto.identity.unauth.DeviceType} */ (reader.readEnum()); msg.setDeviceType(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.DeviceKeyUpload.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.DeviceKeyUpload.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.unauth.DeviceKeyUpload} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.DeviceKeyUpload.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDeviceKeyInfo(); if (f != null) { writer.writeMessage( 1, f, proto.identity.unauth.IdentityKeyInfo.serializeBinaryToWriter ); } f = message.getContentUpload(); if (f != null) { writer.writeMessage( 2, f, proto.identity.unauth.Prekey.serializeBinaryToWriter ); } f = message.getNotifUpload(); if (f != null) { writer.writeMessage( 3, f, proto.identity.unauth.Prekey.serializeBinaryToWriter ); } f = message.getOneTimeContentPrekeysList(); if (f.length > 0) { writer.writeRepeatedString( 4, f ); } f = message.getOneTimeNotifPrekeysList(); if (f.length > 0) { writer.writeRepeatedString( 5, f ); } f = message.getDeviceType(); if (f !== 0.0) { writer.writeEnum( 6, f ); } }; /** * optional IdentityKeyInfo device_key_info = 1; * @return {?proto.identity.unauth.IdentityKeyInfo} */ proto.identity.unauth.DeviceKeyUpload.prototype.getDeviceKeyInfo = function() { return /** @type{?proto.identity.unauth.IdentityKeyInfo} */ ( jspb.Message.getWrapperField(this, proto.identity.unauth.IdentityKeyInfo, 1)); }; /** * @param {?proto.identity.unauth.IdentityKeyInfo|undefined} value * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.setDeviceKeyInfo = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.clearDeviceKeyInfo = function() { return this.setDeviceKeyInfo(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.DeviceKeyUpload.prototype.hasDeviceKeyInfo = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional Prekey content_upload = 2; * @return {?proto.identity.unauth.Prekey} */ proto.identity.unauth.DeviceKeyUpload.prototype.getContentUpload = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, proto.identity.unauth.Prekey, 2)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.setContentUpload = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.clearContentUpload = function() { return this.setContentUpload(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.DeviceKeyUpload.prototype.hasContentUpload = function() { return jspb.Message.getField(this, 2) != null; }; /** * optional Prekey notif_upload = 3; * @return {?proto.identity.unauth.Prekey} */ proto.identity.unauth.DeviceKeyUpload.prototype.getNotifUpload = function() { return /** @type{?proto.identity.unauth.Prekey} */ ( jspb.Message.getWrapperField(this, proto.identity.unauth.Prekey, 3)); }; /** * @param {?proto.identity.unauth.Prekey|undefined} value * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.setNotifUpload = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.clearNotifUpload = function() { return this.setNotifUpload(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.DeviceKeyUpload.prototype.hasNotifUpload = function() { return jspb.Message.getField(this, 3) != null; }; /** * repeated string one_time_content_prekeys = 4; * @return {!Array} */ proto.identity.unauth.DeviceKeyUpload.prototype.getOneTimeContentPrekeysList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); }; /** * @param {!Array} value * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.setOneTimeContentPrekeysList = function(value) { return jspb.Message.setField(this, 4, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.addOneTimeContentPrekeys = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 4, value, opt_index); }; /** * Clears the list making it empty but non-null. * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.clearOneTimeContentPrekeysList = function() { return this.setOneTimeContentPrekeysList([]); }; /** * repeated string one_time_notif_prekeys = 5; * @return {!Array} */ proto.identity.unauth.DeviceKeyUpload.prototype.getOneTimeNotifPrekeysList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); }; /** * @param {!Array} value * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.setOneTimeNotifPrekeysList = function(value) { return jspb.Message.setField(this, 5, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.addOneTimeNotifPrekeys = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 5, value, opt_index); }; /** * Clears the list making it empty but non-null. * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.clearOneTimeNotifPrekeysList = function() { return this.setOneTimeNotifPrekeysList([]); }; /** * optional DeviceType device_type = 6; * @return {!proto.identity.unauth.DeviceType} */ proto.identity.unauth.DeviceKeyUpload.prototype.getDeviceType = function() { return /** @type {!proto.identity.unauth.DeviceType} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** * @param {!proto.identity.unauth.DeviceType} value * @return {!proto.identity.unauth.DeviceKeyUpload} returns this */ proto.identity.unauth.DeviceKeyUpload.prototype.setDeviceType = function(value) { return jspb.Message.setProto3EnumField(this, 6, 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.unauth.RegistrationStartRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.RegistrationStartRequest.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.unauth.RegistrationStartRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.RegistrationStartRequest.toObject = function(includeInstance, msg) { var f, obj = { opaqueRegistrationRequest: msg.getOpaqueRegistrationRequest_asB64(), username: jspb.Message.getFieldWithDefault(msg, 2, ""), deviceKeyUpload: (f = msg.getDeviceKeyUpload()) && proto.identity.unauth.DeviceKeyUpload.toObject(includeInstance, f), farcasterId: jspb.Message.getFieldWithDefault(msg, 4, ""), initialDeviceList: 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.unauth.RegistrationStartRequest} */ proto.identity.unauth.RegistrationStartRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.RegistrationStartRequest; return proto.identity.unauth.RegistrationStartRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.RegistrationStartRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.RegistrationStartRequest} */ proto.identity.unauth.RegistrationStartRequest.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 {string} */ (reader.readString()); msg.setUsername(value); break; case 3: var value = new proto.identity.unauth.DeviceKeyUpload; reader.readMessage(value,proto.identity.unauth.DeviceKeyUpload.deserializeBinaryFromReader); msg.setDeviceKeyUpload(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.setFarcasterId(value); break; case 5: var value = /** @type {string} */ (reader.readString()); msg.setInitialDeviceList(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.RegistrationStartRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.RegistrationStartRequest.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.unauth.RegistrationStartRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.RegistrationStartRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getOpaqueRegistrationRequest_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } f = message.getUsername(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getDeviceKeyUpload(); if (f != null) { writer.writeMessage( 3, f, proto.identity.unauth.DeviceKeyUpload.serializeBinaryToWriter ); } f = /** @type {string} */ (jspb.Message.getField(message, 4)); if (f != null) { writer.writeString( 4, f ); } f = message.getInitialDeviceList(); if (f.length > 0) { writer.writeString( 5, f ); } }; /** * optional bytes opaque_registration_request = 1; * @return {string} */ proto.identity.unauth.RegistrationStartRequest.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.unauth.RegistrationStartRequest.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.unauth.RegistrationStartRequest.prototype.getOpaqueRegistrationRequest_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueRegistrationRequest())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.unauth.RegistrationStartRequest} returns this */ proto.identity.unauth.RegistrationStartRequest.prototype.setOpaqueRegistrationRequest = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; /** * optional string username = 2; * @return {string} */ proto.identity.unauth.RegistrationStartRequest.prototype.getUsername = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.RegistrationStartRequest} returns this */ proto.identity.unauth.RegistrationStartRequest.prototype.setUsername = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * optional DeviceKeyUpload device_key_upload = 3; * @return {?proto.identity.unauth.DeviceKeyUpload} */ proto.identity.unauth.RegistrationStartRequest.prototype.getDeviceKeyUpload = function() { return /** @type{?proto.identity.unauth.DeviceKeyUpload} */ ( jspb.Message.getWrapperField(this, proto.identity.unauth.DeviceKeyUpload, 3)); }; /** * @param {?proto.identity.unauth.DeviceKeyUpload|undefined} value * @return {!proto.identity.unauth.RegistrationStartRequest} returns this */ proto.identity.unauth.RegistrationStartRequest.prototype.setDeviceKeyUpload = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.unauth.RegistrationStartRequest} returns this */ proto.identity.unauth.RegistrationStartRequest.prototype.clearDeviceKeyUpload = function() { return this.setDeviceKeyUpload(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.RegistrationStartRequest.prototype.hasDeviceKeyUpload = function() { return jspb.Message.getField(this, 3) != null; }; /** * optional string farcaster_id = 4; * @return {string} */ proto.identity.unauth.RegistrationStartRequest.prototype.getFarcasterId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.RegistrationStartRequest} returns this */ proto.identity.unauth.RegistrationStartRequest.prototype.setFarcasterId = function(value) { return jspb.Message.setField(this, 4, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.unauth.RegistrationStartRequest} returns this */ proto.identity.unauth.RegistrationStartRequest.prototype.clearFarcasterId = function() { return jspb.Message.setField(this, 4, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.RegistrationStartRequest.prototype.hasFarcasterId = function() { return jspb.Message.getField(this, 4) != null; }; /** * optional string initial_device_list = 5; * @return {string} */ proto.identity.unauth.RegistrationStartRequest.prototype.getInitialDeviceList = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.RegistrationStartRequest} returns this */ proto.identity.unauth.RegistrationStartRequest.prototype.setInitialDeviceList = function(value) { return jspb.Message.setProto3StringField(this, 5, 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.unauth.ReservedRegistrationStartRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.ReservedRegistrationStartRequest.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.unauth.ReservedRegistrationStartRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.ReservedRegistrationStartRequest.toObject = function(includeInstance, msg) { var f, obj = { opaqueRegistrationRequest: msg.getOpaqueRegistrationRequest_asB64(), username: jspb.Message.getFieldWithDefault(msg, 2, ""), deviceKeyUpload: (f = msg.getDeviceKeyUpload()) && proto.identity.unauth.DeviceKeyUpload.toObject(includeInstance, f), keyserverMessage: jspb.Message.getFieldWithDefault(msg, 4, ""), keyserverSignature: jspb.Message.getFieldWithDefault(msg, 5, ""), initialDeviceList: jspb.Message.getFieldWithDefault(msg, 6, "") }; 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.unauth.ReservedRegistrationStartRequest} */ proto.identity.unauth.ReservedRegistrationStartRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.ReservedRegistrationStartRequest; return proto.identity.unauth.ReservedRegistrationStartRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.ReservedRegistrationStartRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.ReservedRegistrationStartRequest} */ proto.identity.unauth.ReservedRegistrationStartRequest.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 {string} */ (reader.readString()); msg.setUsername(value); break; case 3: var value = new proto.identity.unauth.DeviceKeyUpload; reader.readMessage(value,proto.identity.unauth.DeviceKeyUpload.deserializeBinaryFromReader); msg.setDeviceKeyUpload(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.setKeyserverMessage(value); break; case 5: var value = /** @type {string} */ (reader.readString()); msg.setKeyserverSignature(value); break; case 6: var value = /** @type {string} */ (reader.readString()); msg.setInitialDeviceList(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.ReservedRegistrationStartRequest.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.unauth.ReservedRegistrationStartRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.ReservedRegistrationStartRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getOpaqueRegistrationRequest_asU8(); if (f.length > 0) { writer.writeBytes( 1, f ); } f = message.getUsername(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getDeviceKeyUpload(); if (f != null) { writer.writeMessage( 3, f, proto.identity.unauth.DeviceKeyUpload.serializeBinaryToWriter ); } f = message.getKeyserverMessage(); if (f.length > 0) { writer.writeString( 4, f ); } f = message.getKeyserverSignature(); if (f.length > 0) { writer.writeString( 5, f ); } f = message.getInitialDeviceList(); if (f.length > 0) { writer.writeString( 6, f ); } }; /** * optional bytes opaque_registration_request = 1; * @return {string} */ proto.identity.unauth.ReservedRegistrationStartRequest.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.unauth.ReservedRegistrationStartRequest.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.unauth.ReservedRegistrationStartRequest.prototype.getOpaqueRegistrationRequest_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueRegistrationRequest())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.unauth.ReservedRegistrationStartRequest} returns this */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.setOpaqueRegistrationRequest = function(value) { return jspb.Message.setProto3BytesField(this, 1, value); }; /** * optional string username = 2; * @return {string} */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.getUsername = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.ReservedRegistrationStartRequest} returns this */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.setUsername = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * optional DeviceKeyUpload device_key_upload = 3; * @return {?proto.identity.unauth.DeviceKeyUpload} */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.getDeviceKeyUpload = function() { return /** @type{?proto.identity.unauth.DeviceKeyUpload} */ ( jspb.Message.getWrapperField(this, proto.identity.unauth.DeviceKeyUpload, 3)); }; /** * @param {?proto.identity.unauth.DeviceKeyUpload|undefined} value * @return {!proto.identity.unauth.ReservedRegistrationStartRequest} returns this */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.setDeviceKeyUpload = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.unauth.ReservedRegistrationStartRequest} returns this */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.clearDeviceKeyUpload = function() { return this.setDeviceKeyUpload(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.hasDeviceKeyUpload = function() { return jspb.Message.getField(this, 3) != null; }; /** * optional string keyserver_message = 4; * @return {string} */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.getKeyserverMessage = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.ReservedRegistrationStartRequest} returns this */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.setKeyserverMessage = function(value) { return jspb.Message.setProto3StringField(this, 4, value); }; /** * optional string keyserver_signature = 5; * @return {string} */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.getKeyserverSignature = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.ReservedRegistrationStartRequest} returns this */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.setKeyserverSignature = function(value) { return jspb.Message.setProto3StringField(this, 5, value); }; /** * optional string initial_device_list = 6; * @return {string} */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.getInitialDeviceList = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.ReservedRegistrationStartRequest} returns this */ proto.identity.unauth.ReservedRegistrationStartRequest.prototype.setInitialDeviceList = function(value) { return jspb.Message.setProto3StringField(this, 6, 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.unauth.RegistrationFinishRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.RegistrationFinishRequest.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.unauth.RegistrationFinishRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.RegistrationFinishRequest.toObject = function(includeInstance, msg) { var f, obj = { sessionId: jspb.Message.getFieldWithDefault(msg, 1, ""), opaqueRegistrationUpload: msg.getOpaqueRegistrationUpload_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.unauth.RegistrationFinishRequest} */ proto.identity.unauth.RegistrationFinishRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.RegistrationFinishRequest; return proto.identity.unauth.RegistrationFinishRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.RegistrationFinishRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.RegistrationFinishRequest} */ proto.identity.unauth.RegistrationFinishRequest.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; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.RegistrationFinishRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.RegistrationFinishRequest.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.unauth.RegistrationFinishRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.RegistrationFinishRequest.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 ); } }; /** * optional string session_id = 1; * @return {string} */ proto.identity.unauth.RegistrationFinishRequest.prototype.getSessionId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.RegistrationFinishRequest} returns this */ proto.identity.unauth.RegistrationFinishRequest.prototype.setSessionId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaque_registration_upload = 2; * @return {string} */ proto.identity.unauth.RegistrationFinishRequest.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.unauth.RegistrationFinishRequest.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.unauth.RegistrationFinishRequest.prototype.getOpaqueRegistrationUpload_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueRegistrationUpload())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.unauth.RegistrationFinishRequest} returns this */ proto.identity.unauth.RegistrationFinishRequest.prototype.setOpaqueRegistrationUpload = 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.unauth.RegistrationStartResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.RegistrationStartResponse.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.unauth.RegistrationStartResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.RegistrationStartResponse.toObject = function(includeInstance, msg) { var f, obj = { sessionId: jspb.Message.getFieldWithDefault(msg, 1, ""), opaqueRegistrationResponse: msg.getOpaqueRegistrationResponse_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.unauth.RegistrationStartResponse} */ proto.identity.unauth.RegistrationStartResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.RegistrationStartResponse; return proto.identity.unauth.RegistrationStartResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.RegistrationStartResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.RegistrationStartResponse} */ proto.identity.unauth.RegistrationStartResponse.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; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.RegistrationStartResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.RegistrationStartResponse.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.unauth.RegistrationStartResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.RegistrationStartResponse.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 ); } }; /** * optional string session_id = 1; * @return {string} */ proto.identity.unauth.RegistrationStartResponse.prototype.getSessionId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.RegistrationStartResponse} returns this */ proto.identity.unauth.RegistrationStartResponse.prototype.setSessionId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaque_registration_response = 2; * @return {string} */ proto.identity.unauth.RegistrationStartResponse.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.unauth.RegistrationStartResponse.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.unauth.RegistrationStartResponse.prototype.getOpaqueRegistrationResponse_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueRegistrationResponse())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.unauth.RegistrationStartResponse} returns this */ proto.identity.unauth.RegistrationStartResponse.prototype.setOpaqueRegistrationResponse = 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.unauth.AuthResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.AuthResponse.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.unauth.AuthResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.AuthResponse.toObject = function(includeInstance, msg) { var f, obj = { userId: jspb.Message.getFieldWithDefault(msg, 1, ""), accessToken: jspb.Message.getFieldWithDefault(msg, 2, ""), username: 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.unauth.AuthResponse} */ proto.identity.unauth.AuthResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.AuthResponse; return proto.identity.unauth.AuthResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.AuthResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.AuthResponse} */ proto.identity.unauth.AuthResponse.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 {string} */ (reader.readString()); msg.setAccessToken(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setUsername(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.AuthResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.AuthResponse.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.unauth.AuthResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.AuthResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getAccessToken(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getUsername(); if (f.length > 0) { writer.writeString( 3, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.unauth.AuthResponse.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.AuthResponse} returns this */ proto.identity.unauth.AuthResponse.prototype.setUserId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string access_token = 2; * @return {string} */ proto.identity.unauth.AuthResponse.prototype.getAccessToken = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.AuthResponse} returns this */ proto.identity.unauth.AuthResponse.prototype.setAccessToken = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string username = 3; * @return {string} */ proto.identity.unauth.AuthResponse.prototype.getUsername = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.AuthResponse} returns this */ proto.identity.unauth.AuthResponse.prototype.setUsername = 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.unauth.OpaqueLoginStartRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.OpaqueLoginStartRequest.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.unauth.OpaqueLoginStartRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.OpaqueLoginStartRequest.toObject = function(includeInstance, msg) { var f, obj = { username: jspb.Message.getFieldWithDefault(msg, 1, ""), opaqueLoginRequest: msg.getOpaqueLoginRequest_asB64(), deviceKeyUpload: (f = msg.getDeviceKeyUpload()) && proto.identity.unauth.DeviceKeyUpload.toObject(includeInstance, f), force: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) }; 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.unauth.OpaqueLoginStartRequest} */ proto.identity.unauth.OpaqueLoginStartRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.OpaqueLoginStartRequest; return proto.identity.unauth.OpaqueLoginStartRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.OpaqueLoginStartRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.OpaqueLoginStartRequest} */ proto.identity.unauth.OpaqueLoginStartRequest.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 = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setOpaqueLoginRequest(value); break; case 3: var value = new proto.identity.unauth.DeviceKeyUpload; reader.readMessage(value,proto.identity.unauth.DeviceKeyUpload.deserializeBinaryFromReader); msg.setDeviceKeyUpload(value); break; case 4: var value = /** @type {boolean} */ (reader.readBool()); msg.setForce(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.OpaqueLoginStartRequest.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.unauth.OpaqueLoginStartRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.OpaqueLoginStartRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUsername(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getOpaqueLoginRequest_asU8(); if (f.length > 0) { writer.writeBytes( 2, f ); } f = message.getDeviceKeyUpload(); if (f != null) { writer.writeMessage( 3, f, proto.identity.unauth.DeviceKeyUpload.serializeBinaryToWriter ); } f = /** @type {boolean} */ (jspb.Message.getField(message, 4)); if (f != null) { writer.writeBool( 4, f ); } }; /** * optional string username = 1; * @return {string} */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.getUsername = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.OpaqueLoginStartRequest} returns this */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.setUsername = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaque_login_request = 2; * @return {string} */ proto.identity.unauth.OpaqueLoginStartRequest.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.unauth.OpaqueLoginStartRequest.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.unauth.OpaqueLoginStartRequest.prototype.getOpaqueLoginRequest_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueLoginRequest())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.unauth.OpaqueLoginStartRequest} returns this */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.setOpaqueLoginRequest = function(value) { return jspb.Message.setProto3BytesField(this, 2, value); }; /** * optional DeviceKeyUpload device_key_upload = 3; * @return {?proto.identity.unauth.DeviceKeyUpload} */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.getDeviceKeyUpload = function() { return /** @type{?proto.identity.unauth.DeviceKeyUpload} */ ( jspb.Message.getWrapperField(this, proto.identity.unauth.DeviceKeyUpload, 3)); }; /** * @param {?proto.identity.unauth.DeviceKeyUpload|undefined} value * @return {!proto.identity.unauth.OpaqueLoginStartRequest} returns this */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.setDeviceKeyUpload = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.unauth.OpaqueLoginStartRequest} returns this */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.clearDeviceKeyUpload = function() { return this.setDeviceKeyUpload(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.hasDeviceKeyUpload = function() { return jspb.Message.getField(this, 3) != null; }; /** * optional bool force = 4; * @return {boolean} */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.getForce = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); }; /** * @param {boolean} value * @return {!proto.identity.unauth.OpaqueLoginStartRequest} returns this */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.setForce = function(value) { return jspb.Message.setField(this, 4, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.unauth.OpaqueLoginStartRequest} returns this */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.clearForce = function() { return jspb.Message.setField(this, 4, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.OpaqueLoginStartRequest.prototype.hasForce = 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.unauth.OpaqueLoginFinishRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.OpaqueLoginFinishRequest.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.unauth.OpaqueLoginFinishRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.OpaqueLoginFinishRequest.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.unauth.OpaqueLoginFinishRequest} */ proto.identity.unauth.OpaqueLoginFinishRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.OpaqueLoginFinishRequest; return proto.identity.unauth.OpaqueLoginFinishRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.OpaqueLoginFinishRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.OpaqueLoginFinishRequest} */ proto.identity.unauth.OpaqueLoginFinishRequest.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.unauth.OpaqueLoginFinishRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.OpaqueLoginFinishRequest.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.unauth.OpaqueLoginFinishRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.OpaqueLoginFinishRequest.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.unauth.OpaqueLoginFinishRequest.prototype.getSessionId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.OpaqueLoginFinishRequest} returns this */ proto.identity.unauth.OpaqueLoginFinishRequest.prototype.setSessionId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaque_login_upload = 2; * @return {string} */ proto.identity.unauth.OpaqueLoginFinishRequest.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.unauth.OpaqueLoginFinishRequest.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.unauth.OpaqueLoginFinishRequest.prototype.getOpaqueLoginUpload_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueLoginUpload())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.unauth.OpaqueLoginFinishRequest} returns this */ proto.identity.unauth.OpaqueLoginFinishRequest.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.unauth.OpaqueLoginStartResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.OpaqueLoginStartResponse.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.unauth.OpaqueLoginStartResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.OpaqueLoginStartResponse.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.unauth.OpaqueLoginStartResponse} */ proto.identity.unauth.OpaqueLoginStartResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.OpaqueLoginStartResponse; return proto.identity.unauth.OpaqueLoginStartResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.OpaqueLoginStartResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.OpaqueLoginStartResponse} */ proto.identity.unauth.OpaqueLoginStartResponse.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.unauth.OpaqueLoginStartResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.OpaqueLoginStartResponse.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.unauth.OpaqueLoginStartResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.OpaqueLoginStartResponse.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.unauth.OpaqueLoginStartResponse.prototype.getSessionId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.OpaqueLoginStartResponse} returns this */ proto.identity.unauth.OpaqueLoginStartResponse.prototype.setSessionId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional bytes opaque_login_response = 2; * @return {string} */ proto.identity.unauth.OpaqueLoginStartResponse.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.unauth.OpaqueLoginStartResponse.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.unauth.OpaqueLoginStartResponse.prototype.getOpaqueLoginResponse_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getOpaqueLoginResponse())); }; /** * @param {!(string|Uint8Array)} value * @return {!proto.identity.unauth.OpaqueLoginStartResponse} returns this */ proto.identity.unauth.OpaqueLoginStartResponse.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.unauth.WalletAuthRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.WalletAuthRequest.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.unauth.WalletAuthRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.WalletAuthRequest.toObject = function(includeInstance, msg) { var f, obj = { siweMessage: jspb.Message.getFieldWithDefault(msg, 1, ""), siweSignature: jspb.Message.getFieldWithDefault(msg, 2, ""), deviceKeyUpload: (f = msg.getDeviceKeyUpload()) && proto.identity.unauth.DeviceKeyUpload.toObject(includeInstance, f), farcasterId: jspb.Message.getFieldWithDefault(msg, 4, ""), initialDeviceList: 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.unauth.WalletAuthRequest} */ proto.identity.unauth.WalletAuthRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.WalletAuthRequest; return proto.identity.unauth.WalletAuthRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.WalletAuthRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.WalletAuthRequest} */ proto.identity.unauth.WalletAuthRequest.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.setSiweMessage(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setSiweSignature(value); break; case 3: var value = new proto.identity.unauth.DeviceKeyUpload; reader.readMessage(value,proto.identity.unauth.DeviceKeyUpload.deserializeBinaryFromReader); msg.setDeviceKeyUpload(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.setFarcasterId(value); break; case 5: var value = /** @type {string} */ (reader.readString()); msg.setInitialDeviceList(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.WalletAuthRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.WalletAuthRequest.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.unauth.WalletAuthRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.WalletAuthRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSiweMessage(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getSiweSignature(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getDeviceKeyUpload(); if (f != null) { writer.writeMessage( 3, f, proto.identity.unauth.DeviceKeyUpload.serializeBinaryToWriter ); } f = /** @type {string} */ (jspb.Message.getField(message, 4)); if (f != null) { writer.writeString( 4, f ); } f = message.getInitialDeviceList(); if (f.length > 0) { writer.writeString( 5, f ); } }; /** * optional string siwe_message = 1; * @return {string} */ proto.identity.unauth.WalletAuthRequest.prototype.getSiweMessage = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.WalletAuthRequest} returns this */ proto.identity.unauth.WalletAuthRequest.prototype.setSiweMessage = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string siwe_signature = 2; * @return {string} */ proto.identity.unauth.WalletAuthRequest.prototype.getSiweSignature = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.WalletAuthRequest} returns this */ proto.identity.unauth.WalletAuthRequest.prototype.setSiweSignature = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * optional DeviceKeyUpload device_key_upload = 3; * @return {?proto.identity.unauth.DeviceKeyUpload} */ proto.identity.unauth.WalletAuthRequest.prototype.getDeviceKeyUpload = function() { return /** @type{?proto.identity.unauth.DeviceKeyUpload} */ ( jspb.Message.getWrapperField(this, proto.identity.unauth.DeviceKeyUpload, 3)); }; /** * @param {?proto.identity.unauth.DeviceKeyUpload|undefined} value * @return {!proto.identity.unauth.WalletAuthRequest} returns this */ proto.identity.unauth.WalletAuthRequest.prototype.setDeviceKeyUpload = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.unauth.WalletAuthRequest} returns this */ proto.identity.unauth.WalletAuthRequest.prototype.clearDeviceKeyUpload = function() { return this.setDeviceKeyUpload(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.WalletAuthRequest.prototype.hasDeviceKeyUpload = function() { return jspb.Message.getField(this, 3) != null; }; /** * optional string farcaster_id = 4; * @return {string} */ proto.identity.unauth.WalletAuthRequest.prototype.getFarcasterId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.WalletAuthRequest} returns this */ proto.identity.unauth.WalletAuthRequest.prototype.setFarcasterId = function(value) { return jspb.Message.setField(this, 4, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.unauth.WalletAuthRequest} returns this */ proto.identity.unauth.WalletAuthRequest.prototype.clearFarcasterId = function() { return jspb.Message.setField(this, 4, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.WalletAuthRequest.prototype.hasFarcasterId = function() { return jspb.Message.getField(this, 4) != null; }; /** * optional string initial_device_list = 5; * @return {string} */ proto.identity.unauth.WalletAuthRequest.prototype.getInitialDeviceList = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.WalletAuthRequest} returns this */ proto.identity.unauth.WalletAuthRequest.prototype.setInitialDeviceList = function(value) { return jspb.Message.setProto3StringField(this, 5, 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.unauth.ReservedWalletRegistrationRequest.prototype.toObject = function(opt_includeInstance) { - return proto.identity.unauth.ReservedWalletRegistrationRequest.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.unauth.ReservedWalletRegistrationRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.toObject = function(includeInstance, msg) { - var f, obj = { - siweMessage: jspb.Message.getFieldWithDefault(msg, 1, ""), - siweSignature: jspb.Message.getFieldWithDefault(msg, 2, ""), - deviceKeyUpload: (f = msg.getDeviceKeyUpload()) && proto.identity.unauth.DeviceKeyUpload.toObject(includeInstance, f), - keyserverMessage: jspb.Message.getFieldWithDefault(msg, 4, ""), - keyserverSignature: jspb.Message.getFieldWithDefault(msg, 5, ""), - initialDeviceList: jspb.Message.getFieldWithDefault(msg, 6, "") - }; - - 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.unauth.ReservedWalletRegistrationRequest} - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.identity.unauth.ReservedWalletRegistrationRequest; - return proto.identity.unauth.ReservedWalletRegistrationRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.identity.unauth.ReservedWalletRegistrationRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.identity.unauth.ReservedWalletRegistrationRequest} - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.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.setSiweMessage(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setSiweSignature(value); - break; - case 3: - var value = new proto.identity.unauth.DeviceKeyUpload; - reader.readMessage(value,proto.identity.unauth.DeviceKeyUpload.deserializeBinaryFromReader); - msg.setDeviceKeyUpload(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setKeyserverMessage(value); - break; - case 5: - var value = /** @type {string} */ (reader.readString()); - msg.setKeyserverSignature(value); - break; - case 6: - var value = /** @type {string} */ (reader.readString()); - msg.setInitialDeviceList(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.identity.unauth.ReservedWalletRegistrationRequest.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.unauth.ReservedWalletRegistrationRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getSiweMessage(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getSiweSignature(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getDeviceKeyUpload(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.identity.unauth.DeviceKeyUpload.serializeBinaryToWriter - ); - } - f = message.getKeyserverMessage(); - if (f.length > 0) { - writer.writeString( - 4, - f - ); - } - f = message.getKeyserverSignature(); - if (f.length > 0) { - writer.writeString( - 5, - f - ); - } - f = message.getInitialDeviceList(); - if (f.length > 0) { - writer.writeString( - 6, - f - ); - } -}; - - -/** - * optional string siwe_message = 1; - * @return {string} - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.getSiweMessage = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.identity.unauth.ReservedWalletRegistrationRequest} returns this - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.setSiweMessage = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string siwe_signature = 2; - * @return {string} - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.getSiweSignature = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.identity.unauth.ReservedWalletRegistrationRequest} returns this - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.setSiweSignature = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional DeviceKeyUpload device_key_upload = 3; - * @return {?proto.identity.unauth.DeviceKeyUpload} - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.getDeviceKeyUpload = function() { - return /** @type{?proto.identity.unauth.DeviceKeyUpload} */ ( - jspb.Message.getWrapperField(this, proto.identity.unauth.DeviceKeyUpload, 3)); -}; - - -/** - * @param {?proto.identity.unauth.DeviceKeyUpload|undefined} value - * @return {!proto.identity.unauth.ReservedWalletRegistrationRequest} returns this -*/ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.setDeviceKeyUpload = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.identity.unauth.ReservedWalletRegistrationRequest} returns this - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.clearDeviceKeyUpload = function() { - return this.setDeviceKeyUpload(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.hasDeviceKeyUpload = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional string keyserver_message = 4; - * @return {string} - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.getKeyserverMessage = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); -}; - - -/** - * @param {string} value - * @return {!proto.identity.unauth.ReservedWalletRegistrationRequest} returns this - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.setKeyserverMessage = function(value) { - return jspb.Message.setProto3StringField(this, 4, value); -}; - - -/** - * optional string keyserver_signature = 5; - * @return {string} - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.getKeyserverSignature = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); -}; - - -/** - * @param {string} value - * @return {!proto.identity.unauth.ReservedWalletRegistrationRequest} returns this - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.setKeyserverSignature = function(value) { - return jspb.Message.setProto3StringField(this, 5, value); -}; - - -/** - * optional string initial_device_list = 6; - * @return {string} - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.getInitialDeviceList = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); -}; - - -/** - * @param {string} value - * @return {!proto.identity.unauth.ReservedWalletRegistrationRequest} returns this - */ -proto.identity.unauth.ReservedWalletRegistrationRequest.prototype.setInitialDeviceList = function(value) { - return jspb.Message.setProto3StringField(this, 6, 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.unauth.SecondaryDeviceKeysUploadRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.SecondaryDeviceKeysUploadRequest.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.unauth.SecondaryDeviceKeysUploadRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.toObject = function(includeInstance, msg) { var f, obj = { userId: jspb.Message.getFieldWithDefault(msg, 1, ""), nonce: jspb.Message.getFieldWithDefault(msg, 2, ""), nonceSignature: jspb.Message.getFieldWithDefault(msg, 3, ""), deviceKeyUpload: (f = msg.getDeviceKeyUpload()) && proto.identity.unauth.DeviceKeyUpload.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.unauth.SecondaryDeviceKeysUploadRequest} */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.SecondaryDeviceKeysUploadRequest; return proto.identity.unauth.SecondaryDeviceKeysUploadRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.SecondaryDeviceKeysUploadRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.SecondaryDeviceKeysUploadRequest} */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.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 {string} */ (reader.readString()); msg.setNonce(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setNonceSignature(value); break; case 4: var value = new proto.identity.unauth.DeviceKeyUpload; reader.readMessage(value,proto.identity.unauth.DeviceKeyUpload.deserializeBinaryFromReader); msg.setDeviceKeyUpload(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.SecondaryDeviceKeysUploadRequest.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.unauth.SecondaryDeviceKeysUploadRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getNonce(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getNonceSignature(); if (f.length > 0) { writer.writeString( 3, f ); } f = message.getDeviceKeyUpload(); if (f != null) { writer.writeMessage( 4, f, proto.identity.unauth.DeviceKeyUpload.serializeBinaryToWriter ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.SecondaryDeviceKeysUploadRequest} returns this */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.prototype.setUserId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string nonce = 2; * @return {string} */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.prototype.getNonce = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.SecondaryDeviceKeysUploadRequest} returns this */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.prototype.setNonce = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string nonce_signature = 3; * @return {string} */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.prototype.getNonceSignature = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.SecondaryDeviceKeysUploadRequest} returns this */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.prototype.setNonceSignature = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; /** * optional DeviceKeyUpload device_key_upload = 4; * @return {?proto.identity.unauth.DeviceKeyUpload} */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.prototype.getDeviceKeyUpload = function() { return /** @type{?proto.identity.unauth.DeviceKeyUpload} */ ( jspb.Message.getWrapperField(this, proto.identity.unauth.DeviceKeyUpload, 4)); }; /** * @param {?proto.identity.unauth.DeviceKeyUpload|undefined} value * @return {!proto.identity.unauth.SecondaryDeviceKeysUploadRequest} returns this */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.prototype.setDeviceKeyUpload = function(value) { return jspb.Message.setWrapperField(this, 4, value); }; /** * Clears the message field making it undefined. * @return {!proto.identity.unauth.SecondaryDeviceKeysUploadRequest} returns this */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.prototype.clearDeviceKeyUpload = function() { return this.setDeviceKeyUpload(undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.SecondaryDeviceKeysUploadRequest.prototype.hasDeviceKeyUpload = 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.unauth.ExistingDeviceLoginRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.ExistingDeviceLoginRequest.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.unauth.ExistingDeviceLoginRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.ExistingDeviceLoginRequest.toObject = function(includeInstance, msg) { var f, obj = { userId: jspb.Message.getFieldWithDefault(msg, 1, ""), deviceId: jspb.Message.getFieldWithDefault(msg, 2, ""), nonce: jspb.Message.getFieldWithDefault(msg, 3, ""), nonceSignature: jspb.Message.getFieldWithDefault(msg, 4, "") }; 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.unauth.ExistingDeviceLoginRequest} */ proto.identity.unauth.ExistingDeviceLoginRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.ExistingDeviceLoginRequest; return proto.identity.unauth.ExistingDeviceLoginRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.ExistingDeviceLoginRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.ExistingDeviceLoginRequest} */ proto.identity.unauth.ExistingDeviceLoginRequest.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 {string} */ (reader.readString()); msg.setDeviceId(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setNonce(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.setNonceSignature(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.ExistingDeviceLoginRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.ExistingDeviceLoginRequest.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.unauth.ExistingDeviceLoginRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.ExistingDeviceLoginRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getDeviceId(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getNonce(); if (f.length > 0) { writer.writeString( 3, f ); } f = message.getNonceSignature(); if (f.length > 0) { writer.writeString( 4, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.unauth.ExistingDeviceLoginRequest.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.ExistingDeviceLoginRequest} returns this */ proto.identity.unauth.ExistingDeviceLoginRequest.prototype.setUserId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string device_id = 2; * @return {string} */ proto.identity.unauth.ExistingDeviceLoginRequest.prototype.getDeviceId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.ExistingDeviceLoginRequest} returns this */ proto.identity.unauth.ExistingDeviceLoginRequest.prototype.setDeviceId = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string nonce = 3; * @return {string} */ proto.identity.unauth.ExistingDeviceLoginRequest.prototype.getNonce = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.ExistingDeviceLoginRequest} returns this */ proto.identity.unauth.ExistingDeviceLoginRequest.prototype.setNonce = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; /** * optional string nonce_signature = 4; * @return {string} */ proto.identity.unauth.ExistingDeviceLoginRequest.prototype.getNonceSignature = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.ExistingDeviceLoginRequest} returns this */ proto.identity.unauth.ExistingDeviceLoginRequest.prototype.setNonceSignature = function(value) { return jspb.Message.setProto3StringField(this, 4, 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.unauth.GenerateNonceResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.GenerateNonceResponse.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.unauth.GenerateNonceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.GenerateNonceResponse.toObject = function(includeInstance, msg) { var f, obj = { nonce: 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.unauth.GenerateNonceResponse} */ proto.identity.unauth.GenerateNonceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.GenerateNonceResponse; return proto.identity.unauth.GenerateNonceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.GenerateNonceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.GenerateNonceResponse} */ proto.identity.unauth.GenerateNonceResponse.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.setNonce(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.GenerateNonceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.GenerateNonceResponse.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.unauth.GenerateNonceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.GenerateNonceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNonce(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string nonce = 1; * @return {string} */ proto.identity.unauth.GenerateNonceResponse.prototype.getNonce = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.GenerateNonceResponse} returns this */ proto.identity.unauth.GenerateNonceResponse.prototype.setNonce = 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.unauth.VerifyUserAccessTokenRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.VerifyUserAccessTokenRequest.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.unauth.VerifyUserAccessTokenRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.VerifyUserAccessTokenRequest.toObject = function(includeInstance, msg) { var f, obj = { userId: jspb.Message.getFieldWithDefault(msg, 1, ""), deviceId: jspb.Message.getFieldWithDefault(msg, 2, ""), accessToken: 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.unauth.VerifyUserAccessTokenRequest} */ proto.identity.unauth.VerifyUserAccessTokenRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.VerifyUserAccessTokenRequest; return proto.identity.unauth.VerifyUserAccessTokenRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.VerifyUserAccessTokenRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.VerifyUserAccessTokenRequest} */ proto.identity.unauth.VerifyUserAccessTokenRequest.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 {string} */ (reader.readString()); msg.setDeviceId(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setAccessToken(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.VerifyUserAccessTokenRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.VerifyUserAccessTokenRequest.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.unauth.VerifyUserAccessTokenRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.VerifyUserAccessTokenRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getDeviceId(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getAccessToken(); if (f.length > 0) { writer.writeString( 3, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.unauth.VerifyUserAccessTokenRequest.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.VerifyUserAccessTokenRequest} returns this */ proto.identity.unauth.VerifyUserAccessTokenRequest.prototype.setUserId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string device_id = 2; * @return {string} */ proto.identity.unauth.VerifyUserAccessTokenRequest.prototype.getDeviceId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.VerifyUserAccessTokenRequest} returns this */ proto.identity.unauth.VerifyUserAccessTokenRequest.prototype.setDeviceId = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string access_token = 3; * @return {string} */ proto.identity.unauth.VerifyUserAccessTokenRequest.prototype.getAccessToken = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.VerifyUserAccessTokenRequest} returns this */ proto.identity.unauth.VerifyUserAccessTokenRequest.prototype.setAccessToken = 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.unauth.VerifyUserAccessTokenResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.VerifyUserAccessTokenResponse.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.unauth.VerifyUserAccessTokenResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.VerifyUserAccessTokenResponse.toObject = function(includeInstance, msg) { var f, obj = { tokenValid: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) }; 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.unauth.VerifyUserAccessTokenResponse} */ proto.identity.unauth.VerifyUserAccessTokenResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.VerifyUserAccessTokenResponse; return proto.identity.unauth.VerifyUserAccessTokenResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.VerifyUserAccessTokenResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.VerifyUserAccessTokenResponse} */ proto.identity.unauth.VerifyUserAccessTokenResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {boolean} */ (reader.readBool()); msg.setTokenValid(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.VerifyUserAccessTokenResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.VerifyUserAccessTokenResponse.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.unauth.VerifyUserAccessTokenResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.VerifyUserAccessTokenResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getTokenValid(); if (f) { writer.writeBool( 1, f ); } }; /** * optional bool token_valid = 1; * @return {boolean} */ proto.identity.unauth.VerifyUserAccessTokenResponse.prototype.getTokenValid = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); }; /** * @param {boolean} value * @return {!proto.identity.unauth.VerifyUserAccessTokenResponse} returns this */ proto.identity.unauth.VerifyUserAccessTokenResponse.prototype.setTokenValid = function(value) { return jspb.Message.setProto3BooleanField(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.unauth.AddReservedUsernamesRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.AddReservedUsernamesRequest.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.unauth.AddReservedUsernamesRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.AddReservedUsernamesRequest.toObject = function(includeInstance, msg) { var f, obj = { message: jspb.Message.getFieldWithDefault(msg, 1, ""), signature: jspb.Message.getFieldWithDefault(msg, 2, "") }; 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.unauth.AddReservedUsernamesRequest} */ proto.identity.unauth.AddReservedUsernamesRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.AddReservedUsernamesRequest; return proto.identity.unauth.AddReservedUsernamesRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.AddReservedUsernamesRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.AddReservedUsernamesRequest} */ proto.identity.unauth.AddReservedUsernamesRequest.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.setMessage(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setSignature(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.AddReservedUsernamesRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.AddReservedUsernamesRequest.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.unauth.AddReservedUsernamesRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.AddReservedUsernamesRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getMessage(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getSignature(); if (f.length > 0) { writer.writeString( 2, f ); } }; /** * optional string message = 1; * @return {string} */ proto.identity.unauth.AddReservedUsernamesRequest.prototype.getMessage = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.AddReservedUsernamesRequest} returns this */ proto.identity.unauth.AddReservedUsernamesRequest.prototype.setMessage = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string signature = 2; * @return {string} */ proto.identity.unauth.AddReservedUsernamesRequest.prototype.getSignature = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.AddReservedUsernamesRequest} returns this */ proto.identity.unauth.AddReservedUsernamesRequest.prototype.setSignature = function(value) { return jspb.Message.setProto3StringField(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.unauth.RemoveReservedUsernameRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.RemoveReservedUsernameRequest.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.unauth.RemoveReservedUsernameRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.RemoveReservedUsernameRequest.toObject = function(includeInstance, msg) { var f, obj = { message: jspb.Message.getFieldWithDefault(msg, 1, ""), signature: jspb.Message.getFieldWithDefault(msg, 2, "") }; 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.unauth.RemoveReservedUsernameRequest} */ proto.identity.unauth.RemoveReservedUsernameRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.RemoveReservedUsernameRequest; return proto.identity.unauth.RemoveReservedUsernameRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.RemoveReservedUsernameRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.RemoveReservedUsernameRequest} */ proto.identity.unauth.RemoveReservedUsernameRequest.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.setMessage(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setSignature(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.RemoveReservedUsernameRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.RemoveReservedUsernameRequest.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.unauth.RemoveReservedUsernameRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.RemoveReservedUsernameRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getMessage(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getSignature(); if (f.length > 0) { writer.writeString( 2, f ); } }; /** * optional string message = 1; * @return {string} */ proto.identity.unauth.RemoveReservedUsernameRequest.prototype.getMessage = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.RemoveReservedUsernameRequest} returns this */ proto.identity.unauth.RemoveReservedUsernameRequest.prototype.setMessage = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string signature = 2; * @return {string} */ proto.identity.unauth.RemoveReservedUsernameRequest.prototype.getSignature = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.RemoveReservedUsernameRequest} returns this */ proto.identity.unauth.RemoveReservedUsernameRequest.prototype.setSignature = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * Oneof group definitions for this message. Each group defines the field * numbers belonging to that group. When of these fields' value is set, all * other fields in the group are cleared. During deserialization, if multiple * fields are encountered for a group, only the last value seen will be kept. * @private {!Array>} * @const */ proto.identity.unauth.FindUserIDRequest.oneofGroups_ = [[1,2]]; /** * @enum {number} */ proto.identity.unauth.FindUserIDRequest.IdentifierCase = { IDENTIFIER_NOT_SET: 0, USERNAME: 1, WALLET_ADDRESS: 2 }; /** * @return {proto.identity.unauth.FindUserIDRequest.IdentifierCase} */ proto.identity.unauth.FindUserIDRequest.prototype.getIdentifierCase = function() { return /** @type {proto.identity.unauth.FindUserIDRequest.IdentifierCase} */(jspb.Message.computeOneofCase(this, proto.identity.unauth.FindUserIDRequest.oneofGroups_[0])); }; 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.unauth.FindUserIDRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.FindUserIDRequest.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.unauth.FindUserIDRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.FindUserIDRequest.toObject = function(includeInstance, msg) { var f, obj = { username: jspb.Message.getFieldWithDefault(msg, 1, ""), walletAddress: jspb.Message.getFieldWithDefault(msg, 2, "") }; 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.unauth.FindUserIDRequest} */ proto.identity.unauth.FindUserIDRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.FindUserIDRequest; return proto.identity.unauth.FindUserIDRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.FindUserIDRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.FindUserIDRequest} */ proto.identity.unauth.FindUserIDRequest.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 = /** @type {string} */ (reader.readString()); msg.setWalletAddress(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.FindUserIDRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.FindUserIDRequest.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.unauth.FindUserIDRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.FindUserIDRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { writer.writeString( 1, f ); } f = /** @type {string} */ (jspb.Message.getField(message, 2)); if (f != null) { writer.writeString( 2, f ); } }; /** * optional string username = 1; * @return {string} */ proto.identity.unauth.FindUserIDRequest.prototype.getUsername = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.FindUserIDRequest} returns this */ proto.identity.unauth.FindUserIDRequest.prototype.setUsername = function(value) { return jspb.Message.setOneofField(this, 1, proto.identity.unauth.FindUserIDRequest.oneofGroups_[0], value); }; /** * Clears the field making it undefined. * @return {!proto.identity.unauth.FindUserIDRequest} returns this */ proto.identity.unauth.FindUserIDRequest.prototype.clearUsername = function() { return jspb.Message.setOneofField(this, 1, proto.identity.unauth.FindUserIDRequest.oneofGroups_[0], undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.FindUserIDRequest.prototype.hasUsername = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional string wallet_address = 2; * @return {string} */ proto.identity.unauth.FindUserIDRequest.prototype.getWalletAddress = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.FindUserIDRequest} returns this */ proto.identity.unauth.FindUserIDRequest.prototype.setWalletAddress = function(value) { return jspb.Message.setOneofField(this, 2, proto.identity.unauth.FindUserIDRequest.oneofGroups_[0], value); }; /** * Clears the field making it undefined. * @return {!proto.identity.unauth.FindUserIDRequest} returns this */ proto.identity.unauth.FindUserIDRequest.prototype.clearWalletAddress = function() { return jspb.Message.setOneofField(this, 2, proto.identity.unauth.FindUserIDRequest.oneofGroups_[0], undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.FindUserIDRequest.prototype.hasWalletAddress = 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.unauth.FindUserIDResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.FindUserIDResponse.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.unauth.FindUserIDResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.FindUserIDResponse.toObject = function(includeInstance, msg) { var f, obj = { userId: jspb.Message.getFieldWithDefault(msg, 1, ""), isReserved: jspb.Message.getBooleanFieldWithDefault(msg, 2, false) }; 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.unauth.FindUserIDResponse} */ proto.identity.unauth.FindUserIDResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.FindUserIDResponse; return proto.identity.unauth.FindUserIDResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.FindUserIDResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.FindUserIDResponse} */ proto.identity.unauth.FindUserIDResponse.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 {boolean} */ (reader.readBool()); msg.setIsReserved(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.FindUserIDResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.FindUserIDResponse.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.unauth.FindUserIDResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.FindUserIDResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { writer.writeString( 1, f ); } f = message.getIsReserved(); if (f) { writer.writeBool( 2, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.unauth.FindUserIDResponse.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.FindUserIDResponse} returns this */ proto.identity.unauth.FindUserIDResponse.prototype.setUserId = function(value) { return jspb.Message.setField(this, 1, value); }; /** * Clears the field making it undefined. * @return {!proto.identity.unauth.FindUserIDResponse} returns this */ proto.identity.unauth.FindUserIDResponse.prototype.clearUserId = function() { return jspb.Message.setField(this, 1, undefined); }; /** * Returns whether this field is set. * @return {boolean} */ proto.identity.unauth.FindUserIDResponse.prototype.hasUserId = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional bool is_reserved = 2; * @return {boolean} */ proto.identity.unauth.FindUserIDResponse.prototype.getIsReserved = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; /** * @param {boolean} value * @return {!proto.identity.unauth.FindUserIDResponse} returns this */ proto.identity.unauth.FindUserIDResponse.prototype.setIsReserved = function(value) { return jspb.Message.setProto3BooleanField(this, 2, value); }; /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.identity.unauth.GetFarcasterUsersRequest.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.unauth.GetFarcasterUsersRequest.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.GetFarcasterUsersRequest.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.unauth.GetFarcasterUsersRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.GetFarcasterUsersRequest.toObject = function(includeInstance, msg) { var f, obj = { farcasterIdsList: (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.unauth.GetFarcasterUsersRequest} */ proto.identity.unauth.GetFarcasterUsersRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.GetFarcasterUsersRequest; return proto.identity.unauth.GetFarcasterUsersRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.GetFarcasterUsersRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.GetFarcasterUsersRequest} */ proto.identity.unauth.GetFarcasterUsersRequest.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.addFarcasterIds(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.GetFarcasterUsersRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.GetFarcasterUsersRequest.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.unauth.GetFarcasterUsersRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.GetFarcasterUsersRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFarcasterIdsList(); if (f.length > 0) { writer.writeRepeatedString( 1, f ); } }; /** * repeated string farcaster_ids = 1; * @return {!Array} */ proto.identity.unauth.GetFarcasterUsersRequest.prototype.getFarcasterIdsList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; /** * @param {!Array} value * @return {!proto.identity.unauth.GetFarcasterUsersRequest} returns this */ proto.identity.unauth.GetFarcasterUsersRequest.prototype.setFarcasterIdsList = function(value) { return jspb.Message.setField(this, 1, value || []); }; /** * @param {string} value * @param {number=} opt_index * @return {!proto.identity.unauth.GetFarcasterUsersRequest} returns this */ proto.identity.unauth.GetFarcasterUsersRequest.prototype.addFarcasterIds = 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.unauth.GetFarcasterUsersRequest} returns this */ proto.identity.unauth.GetFarcasterUsersRequest.prototype.clearFarcasterIdsList = function() { return this.setFarcasterIdsList([]); }; /** * List of repeated fields within this message type. * @private {!Array} * @const */ proto.identity.unauth.GetFarcasterUsersResponse.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.unauth.GetFarcasterUsersResponse.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.GetFarcasterUsersResponse.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.unauth.GetFarcasterUsersResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.GetFarcasterUsersResponse.toObject = function(includeInstance, msg) { var f, obj = { farcasterUsersList: jspb.Message.toObjectList(msg.getFarcasterUsersList(), proto.identity.unauth.FarcasterUser.toObject, includeInstance) }; 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.unauth.GetFarcasterUsersResponse} */ proto.identity.unauth.GetFarcasterUsersResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.GetFarcasterUsersResponse; return proto.identity.unauth.GetFarcasterUsersResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.GetFarcasterUsersResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.GetFarcasterUsersResponse} */ proto.identity.unauth.GetFarcasterUsersResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.identity.unauth.FarcasterUser; reader.readMessage(value,proto.identity.unauth.FarcasterUser.deserializeBinaryFromReader); msg.addFarcasterUsers(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.GetFarcasterUsersResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.GetFarcasterUsersResponse.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.unauth.GetFarcasterUsersResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.GetFarcasterUsersResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFarcasterUsersList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, proto.identity.unauth.FarcasterUser.serializeBinaryToWriter ); } }; /** * repeated FarcasterUser farcaster_users = 1; * @return {!Array} */ proto.identity.unauth.GetFarcasterUsersResponse.prototype.getFarcasterUsersList = function() { return /** @type{!Array} */ ( jspb.Message.getRepeatedWrapperField(this, proto.identity.unauth.FarcasterUser, 1)); }; /** * @param {!Array} value * @return {!proto.identity.unauth.GetFarcasterUsersResponse} returns this */ proto.identity.unauth.GetFarcasterUsersResponse.prototype.setFarcasterUsersList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** * @param {!proto.identity.unauth.FarcasterUser=} opt_value * @param {number=} opt_index * @return {!proto.identity.unauth.FarcasterUser} */ proto.identity.unauth.GetFarcasterUsersResponse.prototype.addFarcasterUsers = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.identity.unauth.FarcasterUser, opt_index); }; /** * Clears the list making it empty but non-null. * @return {!proto.identity.unauth.GetFarcasterUsersResponse} returns this */ proto.identity.unauth.GetFarcasterUsersResponse.prototype.clearFarcasterUsersList = function() { return this.setFarcasterUsersList([]); }; 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.unauth.FarcasterUser.prototype.toObject = function(opt_includeInstance) { return proto.identity.unauth.FarcasterUser.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.unauth.FarcasterUser} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.FarcasterUser.toObject = function(includeInstance, msg) { var f, obj = { userId: jspb.Message.getFieldWithDefault(msg, 1, ""), farcasterId: jspb.Message.getFieldWithDefault(msg, 2, ""), username: 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.unauth.FarcasterUser} */ proto.identity.unauth.FarcasterUser.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.identity.unauth.FarcasterUser; return proto.identity.unauth.FarcasterUser.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.identity.unauth.FarcasterUser} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.identity.unauth.FarcasterUser} */ proto.identity.unauth.FarcasterUser.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 {string} */ (reader.readString()); msg.setFarcasterId(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setUsername(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.identity.unauth.FarcasterUser.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.identity.unauth.FarcasterUser.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.unauth.FarcasterUser} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.identity.unauth.FarcasterUser.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getFarcasterId(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getUsername(); if (f.length > 0) { writer.writeString( 3, f ); } }; /** * optional string user_id = 1; * @return {string} */ proto.identity.unauth.FarcasterUser.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.FarcasterUser} returns this */ proto.identity.unauth.FarcasterUser.prototype.setUserId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string farcaster_id = 2; * @return {string} */ proto.identity.unauth.FarcasterUser.prototype.getFarcasterId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.FarcasterUser} returns this */ proto.identity.unauth.FarcasterUser.prototype.setFarcasterId = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string username = 3; * @return {string} */ proto.identity.unauth.FarcasterUser.prototype.getUsername = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** * @param {string} value * @return {!proto.identity.unauth.FarcasterUser} returns this */ proto.identity.unauth.FarcasterUser.prototype.setUsername = function(value) { return jspb.Message.setProto3StringField(this, 3, value); }; /** * @enum {number} */ proto.identity.unauth.DeviceType = { KEYSERVER: 0, WEB: 1, IOS: 2, ANDROID: 3, WINDOWS: 4, MAC_OS: 5 }; goog.object.extend(exports, proto.identity.unauth); diff --git a/web/protobufs/identity-unauth-structs.cjs.flow b/web/protobufs/identity-unauth-structs.cjs.flow index f5e9256cc..62f2306d0 100644 --- a/web/protobufs/identity-unauth-structs.cjs.flow +++ b/web/protobufs/identity-unauth-structs.cjs.flow @@ -1,663 +1,625 @@ // @flow import { Message, BinaryWriter, BinaryReader, Map as ProtoMap, } from 'google-protobuf'; declare export class Empty extends Message { serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): {}; static toObject(includeInstance: boolean, msg: Empty): {}; static serializeBinaryToWriter(message: Empty, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): Empty; static deserializeBinaryFromReader(message: Empty, reader: BinaryReader): Empty; } export type PrekeyObject = { prekey: string, prekeySignature: string, } declare export class Prekey extends Message { getPrekey(): string; setPrekey(value: string): Prekey; getPrekeySignature(): string; setPrekeySignature(value: string): Prekey; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): PrekeyObject; static toObject(includeInstance: boolean, msg: Prekey): PrekeyObject; static serializeBinaryToWriter(message: Prekey, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): Prekey; static deserializeBinaryFromReader(message: Prekey, reader: BinaryReader): Prekey; } export type IdentityKeyInfoObject = { payload: string, payloadSignature: string, }; declare export class IdentityKeyInfo extends Message { getPayload(): string; setPayload(value: string): IdentityKeyInfo; getPayloadSignature(): string; setPayloadSignature(value: string): IdentityKeyInfo; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): IdentityKeyInfoObject; static toObject(includeInstance: boolean, msg: IdentityKeyInfo): IdentityKeyInfoObject; static serializeBinaryToWriter(message: IdentityKeyInfo, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): IdentityKeyInfo; static deserializeBinaryFromReader(message: IdentityKeyInfo, reader: BinaryReader): IdentityKeyInfo; } declare export class DeviceKeyUpload extends Message { getDeviceKeyInfo(): IdentityKeyInfo | void; setDeviceKeyInfo(value?: IdentityKeyInfo): DeviceKeyUpload; hasDeviceKeyInfo(): boolean; clearDeviceKeyInfo(): DeviceKeyUpload; getContentUpload(): Prekey | void; setContentUpload(value?: Prekey): DeviceKeyUpload; hasContentUpload(): boolean; clearContentUpload(): DeviceKeyUpload; getNotifUpload(): Prekey | void; setNotifUpload(value?: Prekey): DeviceKeyUpload; hasNotifUpload(): boolean; clearNotifUpload(): DeviceKeyUpload; getOneTimeContentPrekeysList(): Array; setOneTimeContentPrekeysList(value: Array): DeviceKeyUpload; clearOneTimeContentPrekeysList(): DeviceKeyUpload; addOneTimeContentPrekeys(value: string, index?: number): DeviceKeyUpload; getOneTimeNotifPrekeysList(): Array; setOneTimeNotifPrekeysList(value: Array): DeviceKeyUpload; clearOneTimeNotifPrekeysList(): DeviceKeyUpload; addOneTimeNotifPrekeys(value: string, index?: number): DeviceKeyUpload; getDeviceType(): DeviceType; setDeviceType(value: DeviceType): DeviceKeyUpload; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): DeviceKeyUploadObject; static toObject(includeInstance: boolean, msg: DeviceKeyUpload): DeviceKeyUploadObject; static serializeBinaryToWriter(message: DeviceKeyUpload, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): DeviceKeyUpload; static deserializeBinaryFromReader(message: DeviceKeyUpload, reader: BinaryReader): DeviceKeyUpload; } export type DeviceKeyUploadObject = { deviceKeyInfo?: IdentityKeyInfoObject, contentUpload?: PrekeyObject, notifUpload?: PrekeyObject, oneTimeContentPrekeysList: Array, oneTimeNotifPrekeysList: Array, deviceType: DeviceType, }; declare export class RegistrationStartRequest extends Message { getOpaqueRegistrationRequest(): Uint8Array | string; getOpaqueRegistrationRequest_asU8(): Uint8Array; getOpaqueRegistrationRequest_asB64(): string; setOpaqueRegistrationRequest(value: Uint8Array | string): RegistrationStartRequest; getUsername(): string; setUsername(value: string): RegistrationStartRequest; getDeviceKeyUpload(): DeviceKeyUpload | void; setDeviceKeyUpload(value?: DeviceKeyUpload): RegistrationStartRequest; hasDeviceKeyUpload(): boolean; clearDeviceKeyUpload(): RegistrationStartRequest; getFarcasterId(): string; setFarcasterId(value: string): RegistrationStartRequest; hasFarcasterId(): boolean; clearFarcasterId(): RegistrationStartRequest; getInitialDeviceList(): string; setInitialDeviceList(value: string): RegistrationStartRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): RegistrationStartRequestObject; static toObject(includeInstance: boolean, msg: RegistrationStartRequest): RegistrationStartRequestObject; static serializeBinaryToWriter(message: RegistrationStartRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): RegistrationStartRequest; static deserializeBinaryFromReader(message: RegistrationStartRequest, reader: BinaryReader): RegistrationStartRequest; } export type RegistrationStartRequestObject = { opaqueRegistrationRequest: Uint8Array | string, username: string, deviceKeyUpload?: DeviceKeyUploadObject, farcasterId?: string, initialDeviceList: string, }; declare export class ReservedRegistrationStartRequest extends Message { getOpaqueRegistrationRequest(): Uint8Array | string; getOpaqueRegistrationRequest_asU8(): Uint8Array; getOpaqueRegistrationRequest_asB64(): string; setOpaqueRegistrationRequest(value: Uint8Array | string): ReservedRegistrationStartRequest; getUsername(): string; setUsername(value: string): ReservedRegistrationStartRequest; getDeviceKeyUpload(): DeviceKeyUpload | void; setDeviceKeyUpload(value?: DeviceKeyUpload): ReservedRegistrationStartRequest; hasDeviceKeyUpload(): boolean; clearDeviceKeyUpload(): ReservedRegistrationStartRequest; getKeyserverMessage(): string; setKeyserverMessage(value: string): ReservedRegistrationStartRequest; getKeyserverSignature(): string; setKeyserverSignature(value: string): ReservedRegistrationStartRequest; getInitialDeviceList(): string; setInitialDeviceList(value: string): ReservedRegistrationStartRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): ReservedRegistrationStartRequestObject; static toObject(includeInstance: boolean, msg: ReservedRegistrationStartRequest): ReservedRegistrationStartRequestObject; static serializeBinaryToWriter(message: ReservedRegistrationStartRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): ReservedRegistrationStartRequest; static deserializeBinaryFromReader(message: ReservedRegistrationStartRequest, reader: BinaryReader): ReservedRegistrationStartRequest; } export type ReservedRegistrationStartRequestObject = { opaqueRegistrationRequest: Uint8Array | string, username: string, deviceKeyUpload?: DeviceKeyUploadObject, keyserverMessage: string, keyserverSignature: string, initialDeviceList: string, }; declare export class RegistrationFinishRequest extends Message { getSessionid(): string; setSessionid(value: string): RegistrationFinishRequest; getOpaqueregistrationupload(): Uint8Array | string; getOpaqueregistrationupload_asU8(): Uint8Array; getOpaqueregistrationupload_asB64(): string; setOpaqueregistrationupload(value: Uint8Array | string): RegistrationFinishRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): RegistrationFinishRequestObject; static toObject(includeInstance: boolean, msg: RegistrationFinishRequest): RegistrationFinishRequestObject; static serializeBinaryToWriter(message: RegistrationFinishRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): RegistrationFinishRequest; static deserializeBinaryFromReader(message: RegistrationFinishRequest, reader: BinaryReader): RegistrationFinishRequest; } export type RegistrationFinishRequestObject = { sessionid: string, opaqueregistrationupload: Uint8Array | string, }; declare export class RegistrationStartResponse extends Message { getSessionId(): string; setSessionId(value: string): RegistrationStartResponse; getOpaqueRegistrationResponse(): Uint8Array | string; getOpaqueRegistrationResponse_asU8(): Uint8Array; getOpaqueRegistrationResponse_asB64(): string; setOpaqueRegistrationResponse(value: Uint8Array | string): RegistrationStartResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): RegistrationStartResponseObject; static toObject(includeInstance: boolean, msg: RegistrationStartResponse): RegistrationStartResponseObject; static serializeBinaryToWriter(message: RegistrationStartResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): RegistrationStartResponse; static deserializeBinaryFromReader(message: RegistrationStartResponse, reader: BinaryReader): RegistrationStartResponse; } export type RegistrationStartResponseObject = { sessionId: string, opaqueRegistrationResponse: Uint8Array | string, }; declare export class AuthResponse extends Message { getUserId(): string; setUserId(value: string): AuthResponse; getAccessToken(): string; setAccessToken(value: string): AuthResponse; getUsername(): string; setUsername(value: string): AuthResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): AuthResponseObject; static toObject(includeInstance: boolean, msg: AuthResponse): AuthResponseObject; static serializeBinaryToWriter(message: AuthResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): AuthResponse; static deserializeBinaryFromReader(message: AuthResponse, reader: BinaryReader): AuthResponse; } export type AuthResponseObject = { userId: string, accessToken: string, username: string, }; declare export class OpaqueLoginStartRequest extends Message { getUsername(): string; setUsername(value: string): OpaqueLoginStartRequest; getOpaqueLoginRequest(): Uint8Array | string; getOpaqueLoginRequest_asU8(): Uint8Array; getOpaqueLoginRequest_asB64(): string; setOpaqueLoginRequest(value: Uint8Array | string): OpaqueLoginStartRequest; getDeviceKeyUpload(): DeviceKeyUpload | void; setDeviceKeyUpload(value?: DeviceKeyUpload): OpaqueLoginStartRequest; hasDeviceKeyUpload(): boolean; clearDeviceKeyUpload(): OpaqueLoginStartRequest; getForce(): boolean; setForce(value: boolean): OpaqueLoginStartRequest; hasForce(): boolean; clearForce(): OpaqueLoginStartRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): OpaqueLoginStartRequestObject; static toObject(includeInstance: boolean, msg: OpaqueLoginStartRequest): OpaqueLoginStartRequestObject; static serializeBinaryToWriter(message: OpaqueLoginStartRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): OpaqueLoginStartRequest; static deserializeBinaryFromReader(message: OpaqueLoginStartRequest, reader: BinaryReader): OpaqueLoginStartRequest; } export type OpaqueLoginStartRequestObject = { username: string, opaqueLoginRequest: Uint8Array | string, deviceKeyUpload?: DeviceKeyUploadObject, force?: boolean, }; declare export class OpaqueLoginFinishRequest extends Message { getSessionId(): string; setSessionId(value: string): OpaqueLoginFinishRequest; getOpaqueLoginUpload(): Uint8Array | string; getOpaqueLoginUpload_asU8(): Uint8Array; getOpaqueLoginUpload_asB64(): string; setOpaqueLoginUpload(value: Uint8Array | string): OpaqueLoginFinishRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): OpaqueLoginFinishRequestObject; static toObject(includeInstance: boolean, msg: OpaqueLoginFinishRequest): OpaqueLoginFinishRequestObject; static serializeBinaryToWriter(message: OpaqueLoginFinishRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): OpaqueLoginFinishRequest; static deserializeBinaryFromReader(message: OpaqueLoginFinishRequest, reader: BinaryReader): OpaqueLoginFinishRequest; } export type OpaqueLoginFinishRequestObject = { sessionId: string, opaqueLoginUpload: Uint8Array | string, }; declare export class OpaqueLoginStartResponse extends Message { getSessionId(): string; setSessionId(value: string): OpaqueLoginStartResponse; getOpaqueLoginResponse(): Uint8Array | string; getOpaqueLoginResponse_asU8(): Uint8Array; getOpaqueLoginResponse_asB64(): string; setOpaqueLoginResponse(value: Uint8Array | string): OpaqueLoginStartResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): OpaqueLoginStartResponseObject; static toObject(includeInstance: boolean, msg: OpaqueLoginStartResponse): OpaqueLoginStartResponseObject; static serializeBinaryToWriter(message: OpaqueLoginStartResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): OpaqueLoginStartResponse; static deserializeBinaryFromReader(message: OpaqueLoginStartResponse, reader: BinaryReader): OpaqueLoginStartResponse; } export type OpaqueLoginStartResponseObject = { sessionId: string, opaqueLoginResponse: Uint8Array | string, }; declare export class WalletAuthRequest extends Message { getSiweMessage(): string; setSiweMessage(value: string): WalletAuthRequest; getSiweSignature(): string; setSiweSignature(value: string): WalletAuthRequest; getDeviceKeyUpload(): DeviceKeyUpload | void; setDeviceKeyUpload(value?: DeviceKeyUpload): WalletAuthRequest; hasDeviceKeyUpload(): boolean; clearDeviceKeyUpload(): WalletAuthRequest; getFarcasterId(): string; setFarcasterId(value: string): WalletAuthRequest; hasFarcasterId(): boolean; clearFarcasterId(): WalletAuthRequest; getInitialDeviceList(): string; setInitialDeviceList(value: string): WalletAuthRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): WalletAuthRequestObject; static toObject(includeInstance: boolean, msg: WalletAuthRequest): WalletAuthRequestObject; static serializeBinaryToWriter(message: WalletAuthRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): WalletAuthRequest; static deserializeBinaryFromReader(message: WalletAuthRequest, reader: BinaryReader): WalletAuthRequest; } export type WalletAuthRequestObject = { siweMessage: string, siweSignature: string, deviceKeyUpload?: DeviceKeyUploadObject, farcasterId?: string, initialDeviceList: string, }; -declare export class ReservedWalletRegistrationRequest extends Message { - getSiweMessage(): string; - setSiweMessage(value: string): ReservedWalletRegistrationRequest; - - getSiweSignature(): string; - setSiweSignature(value: string): ReservedWalletRegistrationRequest; - - getDeviceKeyUpload(): DeviceKeyUpload | void; - setDeviceKeyUpload(value?: DeviceKeyUpload): ReservedWalletRegistrationRequest; - hasDeviceKeyUpload(): boolean; - clearDeviceKeyUpload(): ReservedWalletRegistrationRequest; - - getKeyserverMessage(): string; - setKeyserverMessage(value: string): ReservedWalletRegistrationRequest; - - getKeyserverSignature(): string; - setKeyserverSignature(value: string): ReservedWalletRegistrationRequest; - - getInitialDeviceList(): string; - setInitialDeviceList(value: string): ReservedWalletRegistrationRequest; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ReservedWalletRegistrationRequestObject; - static toObject(includeInstance: boolean, msg: ReservedWalletRegistrationRequest): ReservedWalletRegistrationRequestObject; - static serializeBinaryToWriter(message: ReservedWalletRegistrationRequest, writer: BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ReservedWalletRegistrationRequest; - static deserializeBinaryFromReader(message: ReservedWalletRegistrationRequest, reader: BinaryReader): ReservedWalletRegistrationRequest; -} - -export type ReservedWalletRegistrationRequestObject = { - siweMessage: string, - siweSignature: string, - deviceKeyUpload?: DeviceKeyUploadObject, - keyserverMessage: string, - keyserverSignature: string, - initialDeviceList: string, -}; - declare export class SecondaryDeviceKeysUploadRequest extends Message { getUserId(): string; setUserId(value: string): SecondaryDeviceKeysUploadRequest; getNonce(): string; setNonce(value: string): SecondaryDeviceKeysUploadRequest; getNonceSignature(): string; setNonceSignature(value: string): SecondaryDeviceKeysUploadRequest; getDeviceKeyUpload(): DeviceKeyUpload | void; setDeviceKeyUpload(value?: DeviceKeyUpload): SecondaryDeviceKeysUploadRequest; hasDeviceKeyUpload(): boolean; clearDeviceKeyUpload(): SecondaryDeviceKeysUploadRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): SecondaryDeviceKeysUploadRequestObject; static toObject(includeInstance: boolean, msg: SecondaryDeviceKeysUploadRequest): SecondaryDeviceKeysUploadRequestObject; static serializeBinaryToWriter(message: SecondaryDeviceKeysUploadRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): SecondaryDeviceKeysUploadRequest; static deserializeBinaryFromReader(message: SecondaryDeviceKeysUploadRequest, reader: BinaryReader): SecondaryDeviceKeysUploadRequest; } export type SecondaryDeviceKeysUploadRequestObject = { userId: string, nonce: string, nonceSignature: string, deviceKeyUpload?: DeviceKeyUploadObject, } declare export class ExistingDeviceLoginRequest extends Message { getUserId(): string; setUserId(value: string): ExistingDeviceLoginRequest; getDeviceId(): string; setDeviceId(value: string): ExistingDeviceLoginRequest; getNonce(): string; setNonce(value: string): ExistingDeviceLoginRequest; getNonceSignature(): string; setNonceSignature(value: string): ExistingDeviceLoginRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): ExistingDeviceLoginRequestObject; static toObject(includeInstance: boolean, msg: ExistingDeviceLoginRequest): ExistingDeviceLoginRequestObject; static serializeBinaryToWriter(message: ExistingDeviceLoginRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): ExistingDeviceLoginRequest; static deserializeBinaryFromReader(message: ExistingDeviceLoginRequest, reader: BinaryReader): ExistingDeviceLoginRequest; } export type ExistingDeviceLoginRequestObject = { userId: string, deviceId: string, nonce: string, nonceSignature: string, } declare export class GenerateNonceResponse extends Message { getNonce(): string; setNonce(value: string): GenerateNonceResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): GenerateNonceResponseObject; static toObject(includeInstance: boolean, msg: GenerateNonceResponse): GenerateNonceResponseObject; static serializeBinaryToWriter(message: GenerateNonceResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): GenerateNonceResponse; static deserializeBinaryFromReader(message: GenerateNonceResponse, reader: BinaryReader): GenerateNonceResponse; } export type GenerateNonceResponseObject = { nonce: string, }; declare export class VerifyUserAccessTokenRequest extends Message { getUserId(): string; setUserId(value: string): VerifyUserAccessTokenRequest; getDeviceId(): string; setDeviceId(value: string): VerifyUserAccessTokenRequest; getAccessToken(): string; setAccessToken(value: string): VerifyUserAccessTokenRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): VerifyUserAccessTokenRequestObject; static toObject(includeInstance: boolean, msg: VerifyUserAccessTokenRequest): VerifyUserAccessTokenRequestObject; static serializeBinaryToWriter(message: VerifyUserAccessTokenRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): VerifyUserAccessTokenRequest; static deserializeBinaryFromReader(message: VerifyUserAccessTokenRequest, reader: BinaryReader): VerifyUserAccessTokenRequest; } export type VerifyUserAccessTokenRequestObject = { userId: string, deviceId: string, accessToken: string, }; declare export class VerifyUserAccessTokenResponse extends Message { getTokenValid(): boolean; setTokenValid(value: boolean): VerifyUserAccessTokenResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): VerifyUserAccessTokenResponseObject; static toObject(includeInstance: boolean, msg: VerifyUserAccessTokenResponse): VerifyUserAccessTokenResponseObject; static serializeBinaryToWriter(message: VerifyUserAccessTokenResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): VerifyUserAccessTokenResponse; static deserializeBinaryFromReader(message: VerifyUserAccessTokenResponse, reader: BinaryReader): VerifyUserAccessTokenResponse; } export type VerifyUserAccessTokenResponseObject = { tokenValid: boolean, }; declare export class AddReservedUsernamesRequest extends Message { getMessage(): string; setMessage(value: string): AddReservedUsernamesRequest; getSignature(): string; setSignature(value: string): AddReservedUsernamesRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): AddReservedUsernamesRequestObject; static toObject(includeInstance: boolean, msg: AddReservedUsernamesRequest): AddReservedUsernamesRequestObject; static serializeBinaryToWriter(message: AddReservedUsernamesRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): AddReservedUsernamesRequest; static deserializeBinaryFromReader(message: AddReservedUsernamesRequest, reader: BinaryReader): AddReservedUsernamesRequest; } export type AddReservedUsernamesRequestObject = { message: string, signature: string, }; declare export class RemoveReservedUsernameRequest extends Message { getMessage(): string; setMessage(value: string): RemoveReservedUsernameRequest; getSignature(): string; setSignature(value: string): RemoveReservedUsernameRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): RemoveReservedUsernameRequestObject; static toObject(includeInstance: boolean, msg: RemoveReservedUsernameRequest): RemoveReservedUsernameRequestObject; static serializeBinaryToWriter(message: RemoveReservedUsernameRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): RemoveReservedUsernameRequest; static deserializeBinaryFromReader(message: RemoveReservedUsernameRequest, reader: BinaryReader): RemoveReservedUsernameRequest; } export type RemoveReservedUsernameRequestObject = { message: string, signature: string, }; export type IdentifierCase = 0 | 1 | 2; declare export class FindUserIDRequest extends Message { getUsername(): string; setUsername(value: string): FindUserIDRequest; getWalletAddress(): string; setWalletAddress(value: string): FindUserIDRequest; getIdentifierCase(): IdentifierCase; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): FindUserIDRequestObject; static toObject(includeInstance: boolean, msg: FindUserIDRequest): FindUserIDRequestObject; static serializeBinaryToWriter(message: FindUserIDRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): FindUserIDRequest; static deserializeBinaryFromReader(message: FindUserIDRequest, reader: BinaryReader): FindUserIDRequest; } export type FindUserIDRequestObject = { username: string, walletAddress: string, } declare export class FindUserIDResponse extends Message { getUserId(): string; setUserId(value: string): FindUserIDResponse; hasUserId(): boolean; clearUserId(): FindUserIDResponse; getIsReserved(): boolean; setIsReserved(value: boolean): FindUserIDResponse; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): FindUserIDResponseObject; static toObject(includeInstance: boolean, msg: FindUserIDResponse): FindUserIDResponseObject; static serializeBinaryToWriter(message: FindUserIDResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): FindUserIDResponse; static deserializeBinaryFromReader(message: FindUserIDResponse, reader: BinaryReader): FindUserIDResponse; } export type FindUserIDResponseObject = { userId?: string, isReserved: boolean, } declare export class GetFarcasterUsersRequest extends Message { getFarcasterIdsList(): Array; setFarcasterIdsList(value: Array): GetFarcasterUsersRequest; clearFarcasterIdsList(): GetFarcasterUsersRequest; addFarcasterIds(value: string, index?: number): GetFarcasterUsersRequest; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): GetFarcasterUsersRequestObject; static toObject(includeInstance: boolean, msg: GetFarcasterUsersRequest): GetFarcasterUsersRequestObject; static serializeBinaryToWriter(message: GetFarcasterUsersRequest, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): GetFarcasterUsersRequest; static deserializeBinaryFromReader(message: GetFarcasterUsersRequest, reader: BinaryReader): GetFarcasterUsersRequest; } export type GetFarcasterUsersRequestObject = { farcasterIdsList: Array, } declare export class GetFarcasterUsersResponse extends Message { getFarcasterUsersList(): Array; setFarcasterUsersList(value: Array): GetFarcasterUsersResponse; clearFarcasterUsersList(): GetFarcasterUsersResponse; addFarcasterUsers(value?: FarcasterUser, index?: number): FarcasterUser; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): GetFarcasterUsersResponseObject; static toObject(includeInstance: boolean, msg: GetFarcasterUsersResponse): GetFarcasterUsersResponseObject; static serializeBinaryToWriter(message: GetFarcasterUsersResponse, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): GetFarcasterUsersResponse; static deserializeBinaryFromReader(message: GetFarcasterUsersResponse, reader: BinaryReader): GetFarcasterUsersResponse; } export type GetFarcasterUsersResponseObject = { farcasterUsersList: Array, } declare export class FarcasterUser extends Message { getUserId(): string; setUserId(value: string): FarcasterUser; getFarcasterId(): string; setFarcasterId(value: string): FarcasterUser; getUsername(): string; setUsername(value: string): FarcasterUser; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): FarcasterUserObject; static toObject(includeInstance: boolean, msg: FarcasterUser): FarcasterUserObject; static serializeBinaryToWriter(message: FarcasterUser, writer: BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): FarcasterUser; static deserializeBinaryFromReader(message: FarcasterUser, reader: BinaryReader): FarcasterUser; } export type FarcasterUserObject = { userId: string, farcasterId: string, username: string, } export type DeviceType = 0 | 1 | 2 | 3 | 4 | 5; diff --git a/web/protobufs/identity-unauth.cjs b/web/protobufs/identity-unauth.cjs index 1097c0e8d..db55d1d2a 100644 --- a/web/protobufs/identity-unauth.cjs +++ b/web/protobufs/identity-unauth.cjs @@ -1,1116 +1,1055 @@ /** * @fileoverview gRPC-Web generated client stub for identity.unauth * @enhanceable * @public * @generated */ // Code generated by protoc-gen-grpc-web. DO NOT EDIT. // versions: // protoc-gen-grpc-web v1.4.2 // protoc v3.21.12 // source: identity_unauth.proto /* eslint-disable */ // @ts-nocheck const grpc = {}; grpc.web = require('grpc-web'); const proto = {}; proto.identity = {}; proto.identity.unauth = require('./identity-unauth-structs.cjs'); /** * @param {string} hostname * @param {?Object} credentials * @param {?grpc.web.ClientOptions} options * @constructor * @struct * @final */ proto.identity.unauth.IdentityClientServiceClient = function(hostname, credentials, options) { if (!options) options = {}; options.format = 'text'; /** * @private @const {!grpc.web.GrpcWebClientBase} The client */ this.client_ = new grpc.web.GrpcWebClientBase(options); /** * @private @const {string} The hostname */ this.hostname_ = hostname.replace(/\/+$/, ''); }; /** * @param {string} hostname * @param {?Object} credentials * @param {?grpc.web.ClientOptions} options * @constructor * @struct * @final */ proto.identity.unauth.IdentityClientServicePromiseClient = function(hostname, credentials, options) { if (!options) options = {}; options.format = 'text'; /** * @private @const {!grpc.web.GrpcWebClientBase} The client */ this.client_ = new grpc.web.GrpcWebClientBase(options); /** * @private @const {string} The hostname */ this.hostname_ = hostname.replace(/\/+$/, ''); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.RegistrationStartRequest, * !proto.identity.unauth.RegistrationStartResponse>} */ const methodDescriptor_IdentityClientService_RegisterPasswordUserStart = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/RegisterPasswordUserStart', grpc.web.MethodType.UNARY, proto.identity.unauth.RegistrationStartRequest, proto.identity.unauth.RegistrationStartResponse, /** * @param {!proto.identity.unauth.RegistrationStartRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.RegistrationStartResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.RegistrationStartRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.RegistrationStartResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.registerPasswordUserStart = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/RegisterPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterPasswordUserStart, callback); }; /** * @param {!proto.identity.unauth.RegistrationStartRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.registerPasswordUserStart = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/RegisterPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterPasswordUserStart); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.ReservedRegistrationStartRequest, * !proto.identity.unauth.RegistrationStartResponse>} */ const methodDescriptor_IdentityClientService_RegisterReservedPasswordUserStart = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/RegisterReservedPasswordUserStart', grpc.web.MethodType.UNARY, proto.identity.unauth.ReservedRegistrationStartRequest, proto.identity.unauth.RegistrationStartResponse, /** * @param {!proto.identity.unauth.ReservedRegistrationStartRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.RegistrationStartResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.ReservedRegistrationStartRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.RegistrationStartResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.registerReservedPasswordUserStart = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/RegisterReservedPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterReservedPasswordUserStart, callback); }; /** * @param {!proto.identity.unauth.ReservedRegistrationStartRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.registerReservedPasswordUserStart = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/RegisterReservedPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterReservedPasswordUserStart); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.RegistrationFinishRequest, * !proto.identity.unauth.AuthResponse>} */ const methodDescriptor_IdentityClientService_RegisterPasswordUserFinish = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/RegisterPasswordUserFinish', grpc.web.MethodType.UNARY, proto.identity.unauth.RegistrationFinishRequest, proto.identity.unauth.AuthResponse, /** * @param {!proto.identity.unauth.RegistrationFinishRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.AuthResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.RegistrationFinishRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.AuthResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.registerPasswordUserFinish = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/RegisterPasswordUserFinish', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterPasswordUserFinish, callback); }; /** * @param {!proto.identity.unauth.RegistrationFinishRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.registerPasswordUserFinish = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/RegisterPasswordUserFinish', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterPasswordUserFinish); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.OpaqueLoginStartRequest, * !proto.identity.unauth.OpaqueLoginStartResponse>} */ const methodDescriptor_IdentityClientService_LogInPasswordUserStart = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/LogInPasswordUserStart', grpc.web.MethodType.UNARY, proto.identity.unauth.OpaqueLoginStartRequest, proto.identity.unauth.OpaqueLoginStartResponse, /** * @param {!proto.identity.unauth.OpaqueLoginStartRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.OpaqueLoginStartResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.OpaqueLoginStartRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.OpaqueLoginStartResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.logInPasswordUserStart = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/LogInPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_LogInPasswordUserStart, callback); }; /** * @param {!proto.identity.unauth.OpaqueLoginStartRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.logInPasswordUserStart = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/LogInPasswordUserStart', request, metadata || {}, methodDescriptor_IdentityClientService_LogInPasswordUserStart); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.OpaqueLoginFinishRequest, * !proto.identity.unauth.AuthResponse>} */ const methodDescriptor_IdentityClientService_LogInPasswordUserFinish = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/LogInPasswordUserFinish', grpc.web.MethodType.UNARY, proto.identity.unauth.OpaqueLoginFinishRequest, proto.identity.unauth.AuthResponse, /** * @param {!proto.identity.unauth.OpaqueLoginFinishRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.AuthResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.OpaqueLoginFinishRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.AuthResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.logInPasswordUserFinish = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/LogInPasswordUserFinish', request, metadata || {}, methodDescriptor_IdentityClientService_LogInPasswordUserFinish, callback); }; /** * @param {!proto.identity.unauth.OpaqueLoginFinishRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.logInPasswordUserFinish = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/LogInPasswordUserFinish', request, metadata || {}, methodDescriptor_IdentityClientService_LogInPasswordUserFinish); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.WalletAuthRequest, * !proto.identity.unauth.AuthResponse>} */ const methodDescriptor_IdentityClientService_LogInWalletUser = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/LogInWalletUser', grpc.web.MethodType.UNARY, proto.identity.unauth.WalletAuthRequest, proto.identity.unauth.AuthResponse, /** * @param {!proto.identity.unauth.WalletAuthRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.AuthResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.WalletAuthRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.AuthResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.logInWalletUser = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/LogInWalletUser', request, metadata || {}, methodDescriptor_IdentityClientService_LogInWalletUser, callback); }; /** * @param {!proto.identity.unauth.WalletAuthRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.logInWalletUser = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/LogInWalletUser', request, metadata || {}, methodDescriptor_IdentityClientService_LogInWalletUser); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.WalletAuthRequest, * !proto.identity.unauth.AuthResponse>} */ const methodDescriptor_IdentityClientService_RegisterWalletUser = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/RegisterWalletUser', grpc.web.MethodType.UNARY, proto.identity.unauth.WalletAuthRequest, proto.identity.unauth.AuthResponse, /** * @param {!proto.identity.unauth.WalletAuthRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.AuthResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.WalletAuthRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.AuthResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.registerWalletUser = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/RegisterWalletUser', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterWalletUser, callback); }; /** * @param {!proto.identity.unauth.WalletAuthRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.registerWalletUser = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/RegisterWalletUser', request, metadata || {}, methodDescriptor_IdentityClientService_RegisterWalletUser); }; -/** - * @const - * @type {!grpc.web.MethodDescriptor< - * !proto.identity.unauth.ReservedWalletRegistrationRequest, - * !proto.identity.unauth.AuthResponse>} - */ -const methodDescriptor_IdentityClientService_RegisterReservedWalletUser = new grpc.web.MethodDescriptor( - '/identity.unauth.IdentityClientService/RegisterReservedWalletUser', - grpc.web.MethodType.UNARY, - proto.identity.unauth.ReservedWalletRegistrationRequest, - proto.identity.unauth.AuthResponse, - /** - * @param {!proto.identity.unauth.ReservedWalletRegistrationRequest} request - * @return {!Uint8Array} - */ - function(request) { - return request.serializeBinary(); - }, - proto.identity.unauth.AuthResponse.deserializeBinary -); - - -/** - * @param {!proto.identity.unauth.ReservedWalletRegistrationRequest} request The - * request proto - * @param {?Object} metadata User defined - * call metadata - * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.AuthResponse)} - * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} - * The XHR Node Readable Stream - */ -proto.identity.unauth.IdentityClientServiceClient.prototype.registerReservedWalletUser = - function(request, metadata, callback) { - return this.client_.rpcCall(this.hostname_ + - '/identity.unauth.IdentityClientService/RegisterReservedWalletUser', - request, - metadata || {}, - methodDescriptor_IdentityClientService_RegisterReservedWalletUser, - callback); -}; - - -/** - * @param {!proto.identity.unauth.ReservedWalletRegistrationRequest} request The - * request proto - * @param {?Object=} metadata User defined - * call metadata - * @return {!Promise} - * Promise that resolves to the response - */ -proto.identity.unauth.IdentityClientServicePromiseClient.prototype.registerReservedWalletUser = - function(request, metadata) { - return this.client_.unaryCall(this.hostname_ + - '/identity.unauth.IdentityClientService/RegisterReservedWalletUser', - request, - metadata || {}, - methodDescriptor_IdentityClientService_RegisterReservedWalletUser); -}; - - /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.SecondaryDeviceKeysUploadRequest, * !proto.identity.unauth.AuthResponse>} */ const methodDescriptor_IdentityClientService_UploadKeysForRegisteredDeviceAndLogIn = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/UploadKeysForRegisteredDeviceAndLogIn', grpc.web.MethodType.UNARY, proto.identity.unauth.SecondaryDeviceKeysUploadRequest, proto.identity.unauth.AuthResponse, /** * @param {!proto.identity.unauth.SecondaryDeviceKeysUploadRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.AuthResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.SecondaryDeviceKeysUploadRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.AuthResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.uploadKeysForRegisteredDeviceAndLogIn = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/UploadKeysForRegisteredDeviceAndLogIn', request, metadata || {}, methodDescriptor_IdentityClientService_UploadKeysForRegisteredDeviceAndLogIn, callback); }; /** * @param {!proto.identity.unauth.SecondaryDeviceKeysUploadRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.uploadKeysForRegisteredDeviceAndLogIn = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/UploadKeysForRegisteredDeviceAndLogIn', request, metadata || {}, methodDescriptor_IdentityClientService_UploadKeysForRegisteredDeviceAndLogIn); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.ExistingDeviceLoginRequest, * !proto.identity.unauth.AuthResponse>} */ const methodDescriptor_IdentityClientService_LogInExistingDevice = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/LogInExistingDevice', grpc.web.MethodType.UNARY, proto.identity.unauth.ExistingDeviceLoginRequest, proto.identity.unauth.AuthResponse, /** * @param {!proto.identity.unauth.ExistingDeviceLoginRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.AuthResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.ExistingDeviceLoginRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.AuthResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.logInExistingDevice = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/LogInExistingDevice', request, metadata || {}, methodDescriptor_IdentityClientService_LogInExistingDevice, callback); }; /** * @param {!proto.identity.unauth.ExistingDeviceLoginRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.logInExistingDevice = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/LogInExistingDevice', request, metadata || {}, methodDescriptor_IdentityClientService_LogInExistingDevice); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.VerifyUserAccessTokenRequest, * !proto.identity.unauth.VerifyUserAccessTokenResponse>} */ const methodDescriptor_IdentityClientService_VerifyUserAccessToken = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/VerifyUserAccessToken', grpc.web.MethodType.UNARY, proto.identity.unauth.VerifyUserAccessTokenRequest, proto.identity.unauth.VerifyUserAccessTokenResponse, /** * @param {!proto.identity.unauth.VerifyUserAccessTokenRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.VerifyUserAccessTokenResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.VerifyUserAccessTokenRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.VerifyUserAccessTokenResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.verifyUserAccessToken = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/VerifyUserAccessToken', request, metadata || {}, methodDescriptor_IdentityClientService_VerifyUserAccessToken, callback); }; /** * @param {!proto.identity.unauth.VerifyUserAccessTokenRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.verifyUserAccessToken = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/VerifyUserAccessToken', request, metadata || {}, methodDescriptor_IdentityClientService_VerifyUserAccessToken); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.AddReservedUsernamesRequest, * !proto.identity.unauth.Empty>} */ const methodDescriptor_IdentityClientService_AddReservedUsernames = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/AddReservedUsernames', grpc.web.MethodType.UNARY, proto.identity.unauth.AddReservedUsernamesRequest, proto.identity.unauth.Empty, /** * @param {!proto.identity.unauth.AddReservedUsernamesRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.Empty.deserializeBinary ); /** * @param {!proto.identity.unauth.AddReservedUsernamesRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.Empty)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.addReservedUsernames = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/AddReservedUsernames', request, metadata || {}, methodDescriptor_IdentityClientService_AddReservedUsernames, callback); }; /** * @param {!proto.identity.unauth.AddReservedUsernamesRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.addReservedUsernames = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/AddReservedUsernames', request, metadata || {}, methodDescriptor_IdentityClientService_AddReservedUsernames); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.RemoveReservedUsernameRequest, * !proto.identity.unauth.Empty>} */ const methodDescriptor_IdentityClientService_RemoveReservedUsername = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/RemoveReservedUsername', grpc.web.MethodType.UNARY, proto.identity.unauth.RemoveReservedUsernameRequest, proto.identity.unauth.Empty, /** * @param {!proto.identity.unauth.RemoveReservedUsernameRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.Empty.deserializeBinary ); /** * @param {!proto.identity.unauth.RemoveReservedUsernameRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.Empty)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.removeReservedUsername = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/RemoveReservedUsername', request, metadata || {}, methodDescriptor_IdentityClientService_RemoveReservedUsername, callback); }; /** * @param {!proto.identity.unauth.RemoveReservedUsernameRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.removeReservedUsername = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/RemoveReservedUsername', request, metadata || {}, methodDescriptor_IdentityClientService_RemoveReservedUsername); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.Empty, * !proto.identity.unauth.Empty>} */ const methodDescriptor_IdentityClientService_Ping = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/Ping', grpc.web.MethodType.UNARY, proto.identity.unauth.Empty, proto.identity.unauth.Empty, /** * @param {!proto.identity.unauth.Empty} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.Empty.deserializeBinary ); /** * @param {!proto.identity.unauth.Empty} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.Empty)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.ping = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/Ping', request, metadata || {}, methodDescriptor_IdentityClientService_Ping, callback); }; /** * @param {!proto.identity.unauth.Empty} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.ping = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/Ping', request, metadata || {}, methodDescriptor_IdentityClientService_Ping); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.FindUserIDRequest, * !proto.identity.unauth.FindUserIDResponse>} */ const methodDescriptor_IdentityClientService_FindUserID = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/FindUserID', grpc.web.MethodType.UNARY, proto.identity.unauth.FindUserIDRequest, proto.identity.unauth.FindUserIDResponse, /** * @param {!proto.identity.unauth.FindUserIDRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.FindUserIDResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.FindUserIDRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.FindUserIDResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.findUserID = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/FindUserID', request, metadata || {}, methodDescriptor_IdentityClientService_FindUserID, callback); }; /** * @param {!proto.identity.unauth.FindUserIDRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.findUserID = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/FindUserID', request, metadata || {}, methodDescriptor_IdentityClientService_FindUserID); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.Empty, * !proto.identity.unauth.GenerateNonceResponse>} */ const methodDescriptor_IdentityClientService_GenerateNonce = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/GenerateNonce', grpc.web.MethodType.UNARY, proto.identity.unauth.Empty, proto.identity.unauth.GenerateNonceResponse, /** * @param {!proto.identity.unauth.Empty} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.GenerateNonceResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.Empty} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.GenerateNonceResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.generateNonce = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/GenerateNonce', request, metadata || {}, methodDescriptor_IdentityClientService_GenerateNonce, callback); }; /** * @param {!proto.identity.unauth.Empty} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.generateNonce = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/GenerateNonce', request, metadata || {}, methodDescriptor_IdentityClientService_GenerateNonce); }; /** * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.GetFarcasterUsersRequest, * !proto.identity.unauth.GetFarcasterUsersResponse>} */ const methodDescriptor_IdentityClientService_GetFarcasterUsers = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/GetFarcasterUsers', grpc.web.MethodType.UNARY, proto.identity.unauth.GetFarcasterUsersRequest, proto.identity.unauth.GetFarcasterUsersResponse, /** * @param {!proto.identity.unauth.GetFarcasterUsersRequest} request * @return {!Uint8Array} */ function(request) { return request.serializeBinary(); }, proto.identity.unauth.GetFarcasterUsersResponse.deserializeBinary ); /** * @param {!proto.identity.unauth.GetFarcasterUsersRequest} request The * request proto * @param {?Object} metadata User defined * call metadata * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.GetFarcasterUsersResponse)} * callback The callback function(error, response) * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.getFarcasterUsers = function(request, metadata, callback) { return this.client_.rpcCall(this.hostname_ + '/identity.unauth.IdentityClientService/GetFarcasterUsers', request, metadata || {}, methodDescriptor_IdentityClientService_GetFarcasterUsers, callback); }; /** * @param {!proto.identity.unauth.GetFarcasterUsersRequest} request The * request proto * @param {?Object=} metadata User defined * call metadata * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.getFarcasterUsers = function(request, metadata) { return this.client_.unaryCall(this.hostname_ + '/identity.unauth.IdentityClientService/GetFarcasterUsers', request, metadata || {}, methodDescriptor_IdentityClientService_GetFarcasterUsers); }; module.exports = proto.identity.unauth; diff --git a/web/protobufs/identity-unauth.cjs.flow b/web/protobufs/identity-unauth.cjs.flow index 8c93f1782..7556bd14b 100644 --- a/web/protobufs/identity-unauth.cjs.flow +++ b/web/protobufs/identity-unauth.cjs.flow @@ -1,222 +1,210 @@ // @flow import * as grpcWeb from 'grpc-web'; import * as identityStructs from './identity-unauth-structs.cjs'; declare export class IdentityClientServiceClient { constructor (hostname: string, credentials?: null | { +[index: string]: string }, options?: null | { +[index: string]: any }): void; registerPasswordUserStart( request: identityStructs.RegistrationStartRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.RegistrationStartResponse) => void ): grpcWeb.ClientReadableStream; registerReservedPasswordUserStart( request: identityStructs.ReservedRegistrationStartRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.RegistrationStartResponse) => void ): grpcWeb.ClientReadableStream; registerPasswordUserFinish( request: identityStructs.RegistrationFinishRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.AuthResponse) => void ): grpcWeb.ClientReadableStream; logInPasswordUserStart( request: identityStructs.OpaqueLoginStartRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.OpaqueLoginStartResponse) => void ): grpcWeb.ClientReadableStream; logInPasswordUserFinish( request: identityStructs.OpaqueLoginFinishRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.AuthResponse) => void ): grpcWeb.ClientReadableStream; logInWalletUser( request: identityStructs.WalletAuthRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.AuthResponse) => void ): grpcWeb.ClientReadableStream; registerWalletUser( request: identityStructs.WalletAuthRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.AuthResponse) => void ): grpcWeb.ClientReadableStream; - registerReservedWalletUser( - request: identityStructs.ReservedWalletRegistrationRequest, - metadata: grpcWeb.Metadata | void, - callback: (err: grpcWeb.RpcError, - response: identityStructs.AuthResponse) => void - ): grpcWeb.ClientReadableStream; - uploadKeysForRegisteredDeviceAndLogIn( request: identityStructs.SecondaryDeviceKeysUploadRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.AuthResponse) => void ): grpcWeb.ClientReadableStream; logInExistingDevice( request: identityStructs.ExistingDeviceLoginRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.AuthResponse) => void ): grpcWeb.ClientReadableStream; verifyUserAccessToken( request: identityStructs.VerifyUserAccessTokenRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.VerifyUserAccessTokenResponse) => void ): grpcWeb.ClientReadableStream; addReservedUsernames( request: identityStructs.AddReservedUsernamesRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.Empty) => void ): grpcWeb.ClientReadableStream; removeReservedUsername( request: identityStructs.RemoveReservedUsernameRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.Empty) => void ): grpcWeb.ClientReadableStream; ping( request: identityStructs.Empty, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.Empty) => void ): grpcWeb.ClientReadableStream; findUserID( request: identityStructs.FindUserIDRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.FindUserIDResponse) => void ): grpcWeb.ClientReadableStream; generateNonce( request: identityStructs.Empty, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.GenerateNonceResponse) => void ): grpcWeb.ClientReadableStream; getFarcasterUsers( request: identityStructs.GetFarcasterUsersRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, response: identityStructs.GetFarcasterUsersResponse) => void ): grpcWeb.ClientReadableStream; } declare export class IdentityClientServicePromiseClient { constructor (hostname: string, credentials?: null | { +[index: string]: string }, options?: null | { +[index: string]: any }): void; registerPasswordUserStart( request: identityStructs.RegistrationStartRequest, metadata?: grpcWeb.Metadata ): Promise; registerReservedPasswordUserStart( request: identityStructs.ReservedRegistrationStartRequest, metadata?: grpcWeb.Metadata ): Promise; registerPasswordUserFinish( request: identityStructs.RegistrationFinishRequest, metadata?: grpcWeb.Metadata ): Promise; logInPasswordUserStart( request: identityStructs.OpaqueLoginStartRequest, metadata?: grpcWeb.Metadata ): Promise; logInPasswordUserFinish( request: identityStructs.OpaqueLoginFinishRequest, metadata?: grpcWeb.Metadata ): Promise; logInWalletUser( request: identityStructs.WalletAuthRequest, metadata?: grpcWeb.Metadata ): Promise; registerWalletUser( request: identityStructs.WalletAuthRequest, metadata?: grpcWeb.Metadata ): Promise; - registerReservedWalletUser( - request: identityStructs.ReservedWalletRegistrationRequest, - metadata?: grpcWeb.Metadata - ): Promise; - uploadKeysForRegisteredDeviceAndLogIn( request: identityStructs.SecondaryDeviceKeysUploadRequest, metadata?: grpcWeb.Metadata ): Promise; logInExistingDevice( request: identityStructs.ExistingDeviceLoginRequest, metadata?: grpcWeb.Metadata ): Promise; verifyUserAccessToken( request: identityStructs.VerifyUserAccessTokenRequest, metadata?: grpcWeb.Metadata ): Promise; addReservedUsernames( request: identityStructs.AddReservedUsernamesRequest, metadata?: grpcWeb.Metadata ): Promise; removeReservedUsername( request: identityStructs.RemoveReservedUsernameRequest, metadata?: grpcWeb.Metadata ): Promise; ping( request: identityStructs.Empty, metadata?: grpcWeb.Metadata ): Promise; findUserID( request: identityStructs.FindUserIDRequest, metadata?: grpcWeb.Metadata ): Promise; generateNonce( request: identityStructs.Empty, metadata?: grpcWeb.Metadata ): Promise; getFarcasterUsers( request: identityStructs.GetFarcasterUsersRequest, metadata?: grpcWeb.Metadata ): Promise; }