diff --git a/native/account/fullscreen-siwe-panel.react.js b/native/account/fullscreen-siwe-panel.react.js --- a/native/account/fullscreen-siwe-panel.react.js +++ b/native/account/fullscreen-siwe-panel.react.js @@ -5,16 +5,12 @@ import * as React from 'react'; import { ActivityIndicator, View } from 'react-native'; -import { setDataLoadedActionType } from 'lib/actions/client-db-store-actions.js'; import { useWalletLogIn } from 'lib/hooks/login-hooks.js'; import { type SIWEResult, SIWEMessageTypes } from 'lib/types/siwe-types.js'; -import { ServerError, getMessageForException } from 'lib/utils/errors.js'; -import { useDispatch } from 'lib/utils/redux-utils.js'; -import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; +import { getMessageForException } from 'lib/utils/errors.js'; import { useGetEthereumAccountFromSIWEResult } from './registration/ethereum-utils.js'; import { RegistrationContext } from './registration/registration-context.js'; -import { useLegacySIWEServerCall } from './siwe-hooks.js'; import SIWEPanel from './siwe-panel.react.js'; import { commRustModule } from '../native-modules.js'; import { @@ -84,103 +80,50 @@ [goBackToPrompt], ); - const legacySiweServerCall = useLegacySIWEServerCall(); const walletLogIn = useWalletLogIn(); const successRef = React.useRef(false); - const dispatch = useDispatch(); const onSuccess = React.useCallback( async (result: SIWEResult) => { successRef.current = true; - if (usingCommServicesAccessToken) { - try { - const findUserIDResponseString = - await commRustModule.findUserIDForWalletAddress(result.address); - const findUserIDResponse = JSON.parse(findUserIDResponseString); - if (findUserIDResponse.userID || findUserIDResponse.isReserved) { - try { - await walletLogIn( - result.address, - result.message, - result.signature, + try { + const findUserIDResponseString = + await commRustModule.findUserIDForWalletAddress(result.address); + const findUserIDResponse = JSON.parse(findUserIDResponseString); + if (findUserIDResponse.userID || findUserIDResponse.isReserved) { + try { + await walletLogIn(result.address, result.message, result.signature); + } catch (e) { + const messageForException = getMessageForException(e); + if (messageForException === 'nonce_expired') { + onNonceExpired('login'); + } else if ( + messageForException === 'unsupported_version' || + messageForException === 'client_version_unsupported' || + messageForException === 'use_new_flow' + ) { + Alert.alert( + appOutOfDateAlertDetails.title, + appOutOfDateAlertDetails.message, + [{ text: 'OK', onPress: goBackToPrompt }], + { cancelable: false }, ); - } catch (e) { - const messageForException = getMessageForException(e); - if (messageForException === 'nonce_expired') { - onNonceExpired('login'); - } else if ( - messageForException === 'unsupported_version' || - messageForException === 'client_version_unsupported' || - messageForException === 'use_new_flow' - ) { - Alert.alert( - appOutOfDateAlertDetails.title, - appOutOfDateAlertDetails.message, - [{ text: 'OK', onPress: goBackToPrompt }], - { cancelable: false }, - ); - } else { - throw e; - } + } else { + throw e; } - } else { - await onAccountDoesNotExist(result); } - } catch (e) { - Alert.alert( - unknownErrorAlertDetails.title, - unknownErrorAlertDetails.message, - [{ text: 'OK', onPress: goBackToPrompt }], - { cancelable: false }, - ); + } else { + await onAccountDoesNotExist(result); } - } else { - try { - await legacySiweServerCall({ - ...result, - doNotRegister: true, - }); - } catch (e) { - if ( - e instanceof ServerError && - e.message === 'account_does_not_exist' - ) { - await onAccountDoesNotExist(result); - } else if ( - e instanceof ServerError && - e.message === 'client_version_unsupported' - ) { - Alert.alert( - appOutOfDateAlertDetails.title, - appOutOfDateAlertDetails.message, - [{ text: 'OK', onPress: goBackToPrompt }], - { cancelable: false }, - ); - } else { - Alert.alert( - unknownErrorAlertDetails.title, - unknownErrorAlertDetails.message, - [{ text: 'OK', onPress: goBackToPrompt }], - { cancelable: false }, - ); - } - return; - } - dispatch({ - type: setDataLoadedActionType, - payload: { - dataLoaded: true, - }, - }); + } catch (e) { + Alert.alert( + unknownErrorAlertDetails.title, + unknownErrorAlertDetails.message, + [{ text: 'OK', onPress: goBackToPrompt }], + { cancelable: false }, + ); } }, - [ - walletLogIn, - goBackToPrompt, - dispatch, - legacySiweServerCall, - onAccountDoesNotExist, - onNonceExpired, - ], + [walletLogIn, goBackToPrompt, onAccountDoesNotExist, onNonceExpired], ); const ifBeforeSuccessGoBackToPrompt = React.useCallback(() => { diff --git a/native/account/log-in-panel.react.js b/native/account/log-in-panel.react.js --- a/native/account/log-in-panel.react.js +++ b/native/account/log-in-panel.react.js @@ -2,50 +2,28 @@ import invariant from 'invariant'; import * as React from 'react'; -import { View, StyleSheet, Keyboard, Platform } from 'react-native'; +import { Keyboard, Platform, StyleSheet, View } from 'react-native'; -import { - legacyLogInActionTypes, - useLegacyLogIn, - getOlmSessionInitializationDataActionTypes, -} from 'lib/actions/user-actions.js'; +import { getOlmSessionInitializationDataActionTypes } from 'lib/actions/user-actions.js'; import { usePasswordLogIn } from 'lib/hooks/login-hooks.js'; +import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { - createLoadingStatusSelector, - combineLoadingStatuses, -} from 'lib/selectors/loading-selectors.js'; -import { - validEmailRegex, oldValidUsernameRegex, + validEmailRegex, } from 'lib/shared/account-utils.js'; -import { useInitialNotificationsEncryptedMessage } from 'lib/shared/crypto-utils.js'; -import { - type LegacyLogInInfo, - type LegacyLogInExtraInfo, - type LegacyLogInResult, - type LegacyLogInStartingPayload, - logInActionSources, -} from 'lib/types/account-types.js'; import type { IdentityAuthResult } from 'lib/types/identity-service-types.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; import { getMessageForException } from 'lib/utils/errors.js'; -import { - useDispatchActionPromise, - type DispatchActionPromise, -} from 'lib/utils/redux-promise-utils.js'; -import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; import { TextInput } from './modal-components.react.js'; import { fetchNativeCredentials, setNativeCredentials, } from './native-credentials.js'; -import { PanelButton, Panel } from './panel-components.react.js'; +import { Panel, PanelButton } from './panel-components.react.js'; import PasswordInput from './password-input.react.js'; -import { authoritativeKeyserverID } from '../authoritative-keyserver.js'; import SWMansionIcon from '../components/swmansion-icon.react.js'; import { useSelector } from '../redux/redux-utils.js'; -import { nativeLegacyLogInExtraInfoSelector } from '../selectors/account-selectors.js'; import type { KeyPressEvent } from '../types/react-native.js'; import type { ViewStyle } from '../types/styles.js'; import { @@ -68,14 +46,10 @@ type Props = { ...BaseProps, +loadingStatus: LoadingStatus, - +legacyLogInExtraInfo: () => Promise, - +dispatchActionPromise: DispatchActionPromise, - +legacyLogIn: (logInInfo: LegacyLogInInfo) => Promise, +identityPasswordLogIn: ( username: string, password: string, ) => Promise, - +getInitialNotificationsEncryptedMessage: () => Promise, }; type State = { +logInPending: boolean, @@ -262,69 +236,9 @@ } Keyboard.dismiss(); - if (usingCommServicesAccessToken) { - await this.identityPasswordLogIn(); - return; - } - - const extraInfo = await this.props.legacyLogInExtraInfo(); - const initialNotificationsEncryptedMessage = - await this.props.getInitialNotificationsEncryptedMessage(); - - void this.props.dispatchActionPromise( - legacyLogInActionTypes, - this.legacyLogInAction({ - ...extraInfo, - initialNotificationsEncryptedMessage, - }), - undefined, - ({ calendarQuery: extraInfo.calendarQuery }: LegacyLogInStartingPayload), - ); + await this.identityPasswordLogIn(); }; - async legacyLogInAction( - extraInfo: LegacyLogInExtraInfo, - ): Promise { - try { - const result = await this.props.legacyLogIn({ - ...extraInfo, - username: this.usernameInputText, - password: this.passwordInputText, - authActionSource: logInActionSources.logInFromNativeForm, - }); - this.props.setActiveAlert(false); - await setNativeCredentials({ - username: result.currentUserInfo.username, - password: this.passwordInputText, - }); - return result; - } catch (e) { - if (e.message === 'invalid_credentials') { - Alert.alert( - userNotFoundAlertDetails.title, - userNotFoundAlertDetails.message, - [{ text: 'OK', onPress: this.onUnsuccessfulLoginAlertAckowledged }], - { cancelable: false }, - ); - } else if (e.message === 'client_version_unsupported') { - Alert.alert( - appOutOfDateAlertDetails.title, - appOutOfDateAlertDetails.message, - [{ text: 'OK', onPress: this.onOtherErrorAlertAcknowledged }], - { cancelable: false }, - ); - } else { - Alert.alert( - unknownErrorAlertDetails.title, - unknownErrorAlertDetails.message, - [{ text: 'OK', onPress: this.onOtherErrorAlertAcknowledged }], - { cancelable: false }, - ); - } - throw e; - } - } - async identityPasswordLogIn(): Promise { if (this.state.logInPending) { return; @@ -413,8 +327,6 @@ }; } -export type InnerLogInPanel = LogInPanel; - const styles = StyleSheet.create({ footer: { flexDirection: 'row', @@ -433,44 +345,22 @@ }, }); -const logInLoadingStatusSelector = createLoadingStatusSelector( - legacyLogInActionTypes, -); const olmSessionInitializationDataLoadingStatusSelector = createLoadingStatusSelector(getOlmSessionInitializationDataActionTypes); const ConnectedLogInPanel: React.ComponentType = React.memo(function ConnectedLogInPanel(props: BaseProps) { - const logInLoadingStatus = useSelector(logInLoadingStatusSelector); - const olmSessionInitializationDataLoadingStatus = useSelector( + const loadingStatus = useSelector( olmSessionInitializationDataLoadingStatusSelector, ); - const loadingStatus = combineLoadingStatuses( - logInLoadingStatus, - olmSessionInitializationDataLoadingStatus, - ); - - const legacyLogInExtraInfo = useSelector( - nativeLegacyLogInExtraInfoSelector, - ); - const dispatchActionPromise = useDispatchActionPromise(); - const callLegacyLogIn = useLegacyLogIn(); const callIdentityPasswordLogIn = usePasswordLogIn(); - const getInitialNotificationsEncryptedMessage = - useInitialNotificationsEncryptedMessage(authoritativeKeyserverID); return ( ); }); diff --git a/native/account/logged-out-modal.react.js b/native/account/logged-out-modal.react.js --- a/native/account/logged-out-modal.react.js +++ b/native/account/logged-out-modal.react.js @@ -23,16 +23,11 @@ import { SafeAreaView } from 'react-native-safe-area-context'; import { useIsLoggedInToAuthoritativeKeyserver } from 'lib/hooks/account-hooks.js'; -import { setActiveSessionRecoveryActionType } from 'lib/keyserver-conn/keyserver-conn-types.js'; import { usePersistedStateLoaded } from 'lib/selectors/app-state-selectors.js'; import { isLoggedIn } from 'lib/selectors/user-selectors.js'; import { useTunnelbroker } from 'lib/tunnelbroker/tunnelbroker-context.js'; -import { recoveryFromReduxActionSources } from 'lib/types/account-types.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; -import { - usingCommServicesAccessToken, - useIsRestoreFlowEnabled, -} from 'lib/utils/services-utils.js'; +import { useIsRestoreFlowEnabled } from 'lib/utils/services-utils.js'; import { splashBackgroundURI } from './background-info.js'; import FullscreenSIWEPanel from './fullscreen-siwe-panel.react.js'; @@ -40,7 +35,6 @@ import type { LogInState } from './log-in-panel.react.js'; import LoggedOutStaffInfo from './logged-out-staff-info.react.js'; import PromptButton from './prompt-button.react.js'; -import { authoritativeKeyserverID } from '../authoritative-keyserver.js'; import KeyboardAvoidingView from '../components/keyboard-avoiding-view.react.js'; import ConnectedStatusBar from '../connected-status-bar.react.js'; import { useRatchetingKeyboardHeight } from '../keyboard/animated-keyboard.js'; @@ -373,25 +367,6 @@ return; } initialAppLoad = false; - - if (usingCommServicesAccessToken || __DEV__) { - return; - } - - if (loggedIn === isLoggedInToAuthKeyserver) { - return; - } - - const actionSource = loggedIn - ? recoveryFromReduxActionSources.appStartReduxLoggedInButInvalidCookie - : recoveryFromReduxActionSources.appStartCookieLoggedInButInvalidRedux; - dispatch({ - type: setActiveSessionRecoveryActionType, - payload: { - activeSessionRecovery: actionSource, - keyserverID: authoritativeKeyserverID, - }, - }); }, [rehydrateConcluded, loggedIn, isLoggedInToAuthKeyserver, dispatch]); const onPressSIWE = React.useCallback(() => { diff --git a/native/account/registration/connect-ethereum.react.js b/native/account/registration/connect-ethereum.react.js --- a/native/account/registration/connect-ethereum.react.js +++ b/native/account/registration/connect-ethereum.react.js @@ -4,15 +4,9 @@ import * as React from 'react'; import { Text, View } from 'react-native'; -import { - exactSearchUser, - exactSearchUserActionTypes, -} from 'lib/actions/user-actions.js'; -import { useLegacyAshoatKeyserverCall } from 'lib/keyserver-conn/legacy-keyserver-call.js'; +import { exactSearchUserActionTypes } from 'lib/actions/user-actions.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import { type SIWEResult, SIWEMessageTypes } from 'lib/types/siwe-types.js'; -import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; -import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; import type { AuthNavigationProp } from './auth-navigator.react.js'; import { @@ -131,31 +125,17 @@ [keyserverURL], ); - const exactSearchUserCall = useLegacyAshoatKeyserverCall( - exactSearchUser, - serverCallParamOverride, - ); - const dispatchActionPromise = useDispatchActionPromise(); - const getEthereumAccountFromSIWEResult = useGetEthereumAccountFromSIWEResult(); const { retrieveLatestBackupInfo } = useClientBackup(); const onSuccessfulWalletSignature = React.useCallback( async (result: SIWEResult) => { - let userAlreadyExists; - if (usingCommServicesAccessToken) { - const findUserIDResponseString = - await commRustModule.findUserIDForWalletAddress(result.address); - const findUserIDResponse = JSON.parse(findUserIDResponseString); - userAlreadyExists = - !!findUserIDResponse.userID || findUserIDResponse.isReserved; - } else { - const searchPromise = exactSearchUserCall(result.address); - void dispatchActionPromise(exactSearchUserActionTypes, searchPromise); - const { userInfo } = await searchPromise; - userAlreadyExists = !!userInfo; - } + const findUserIDResponseString = + await commRustModule.findUserIDForWalletAddress(result.address); + const findUserIDResponse = JSON.parse(findUserIDResponseString); + const userAlreadyExists = + !!findUserIDResponse.userID || findUserIDResponse.isReserved; if (userAlreadyExists) { const backupInfo = await retrieveLatestBackupInfo(result.address); @@ -182,8 +162,6 @@ }, [ userSelections, - exactSearchUserCall, - dispatchActionPromise, navigate, getEthereumAccountFromSIWEResult, retrieveLatestBackupInfo, diff --git a/native/account/registration/ethereum-utils.js b/native/account/registration/ethereum-utils.js --- a/native/account/registration/ethereum-utils.js +++ b/native/account/registration/ethereum-utils.js @@ -5,11 +5,9 @@ import { ENSCacheContext } from 'lib/components/ens-cache-provider.react.js'; import { - type SIWEResult, identitySIWENonceLifetime, - legacyKeyserverSIWENonceLifetime, + type SIWEResult, } from 'lib/types/siwe-types.js'; -import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; import { RegistrationContext } from './registration-context.js'; import { @@ -63,10 +61,7 @@ } function siweNonceExpired(nonceTimestamp: number): boolean { - const nonceLifetime = usingCommServicesAccessToken - ? identitySIWENonceLifetime - : legacyKeyserverSIWENonceLifetime; - return Date.now() > nonceTimestamp + nonceLifetime; + return Date.now() > nonceTimestamp + identitySIWENonceLifetime; } export { useGetEthereumAccountFromSIWEResult, siweNonceExpired }; diff --git a/native/account/registration/existing-ethereum-account.react.js b/native/account/registration/existing-ethereum-account.react.js --- a/native/account/registration/existing-ethereum-account.react.js +++ b/native/account/registration/existing-ethereum-account.react.js @@ -9,17 +9,12 @@ import * as React from 'react'; import { Text, View } from 'react-native'; -import { setDataLoadedActionType } from 'lib/actions/client-db-store-actions.js'; import { useENSName } from 'lib/hooks/ens-cache.js'; import { useWalletLogIn } from 'lib/hooks/login-hooks.js'; import type { SIWEBackupData } from 'lib/types/backup-types.js'; import type { SIWEResult } from 'lib/types/siwe-types.js'; import { getMessageForException } from 'lib/utils/errors.js'; -import { useDispatch } from 'lib/utils/redux-utils.js'; -import { - usingCommServicesAccessToken, - useIsRestoreFlowEnabled, -} from 'lib/utils/services-utils.js'; +import { useIsRestoreFlowEnabled } from 'lib/utils/services-utils.js'; import type { AuthNavigationProp } from './auth-navigator.react.js'; import { RegistrationContext } from './registration-context.js'; @@ -41,7 +36,6 @@ import AuthButtonContainer from '../auth-components/auth-button-container.react.js'; import AuthContainer from '../auth-components/auth-container.react.js'; import AuthContentContainer from '../auth-components/auth-content-container.react.js'; -import { useLegacySIWEServerCall } from '../siwe-hooks.js'; export type ExistingEthereumAccountParams = $ReadOnly<{ ...SIWEResult, @@ -53,7 +47,6 @@ +route: NavigationRoute<'ExistingEthereumAccount'>, }; function ExistingEthereumAccount(props: Props): React.Node { - const legacySiweServerCall = useLegacySIWEServerCall(); const walletLogIn = useWalletLogIn(); const [logInPending, setLogInPending] = React.useState(false); @@ -64,7 +57,6 @@ const { params } = props.route; const { address, message, signature, backupData } = params; - const dispatch = useDispatch(); const { navigation } = props; const goBackToHome = navigation.getParent< ScreenParamList, @@ -81,17 +73,7 @@ } setLogInPending(true); try { - if (usingCommServicesAccessToken) { - await walletLogIn(params.address, params.message, params.signature); - } else { - await legacySiweServerCall({ ...params, doNotRegister: true }); - dispatch({ - type: setDataLoadedActionType, - payload: { - dataLoaded: true, - }, - }); - } + await walletLogIn(params.address, params.message, params.signature); } catch (e) { const messageForException = getMessageForException(e); if (messageForException === 'nonce_expired') { @@ -133,13 +115,13 @@ setLogInPending(false); } }, [ - logInPending, - legacySiweServerCall, - walletLogIn, - params, - dispatch, goBackToHome, + logInPending, + params.address, + params.message, + params.signature, setCachedSelections, + walletLogIn, ]); const usingRestoreFlow = useIsRestoreFlowEnabled(); diff --git a/native/account/registration/registration-server-call.js b/native/account/registration/registration-server-call.js --- a/native/account/registration/registration-server-call.js +++ b/native/account/registration/registration-server-call.js @@ -5,8 +5,6 @@ import { setDataLoadedActionType } from 'lib/actions/client-db-store-actions.js'; import { setSyncedMetadataEntryActionType } from 'lib/actions/synced-metadata-actions.js'; import { - legacyKeyserverRegisterActionTypes, - legacyKeyserverRegister, useIdentityPasswordRegister, identityRegisterActionTypes, deleteAccountActionTypes, @@ -14,10 +12,8 @@ } from 'lib/actions/user-actions.js'; import { useIsLoggedInToAuthoritativeKeyserver } from 'lib/hooks/account-hooks.js'; import { useKeyserverAuthWithRetry } from 'lib/keyserver-conn/keyserver-auth.js'; -import { useLegacyAshoatKeyserverCall } from 'lib/keyserver-conn/legacy-keyserver-call.js'; import { usePreRequestUserState } from 'lib/selectors/account-selectors.js'; import { - type LegacyLogInStartingPayload, logInActionSources, type LogOutResult, } from 'lib/types/account-types.js'; @@ -26,7 +22,6 @@ import { useSetLocalFID } from 'lib/utils/farcaster-utils.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; -import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; import { setURLPrefix } from 'lib/utils/url-utils.js'; import { waitUntilDatabaseDeleted } from 'lib/utils/wait-until-db-deleted.js'; @@ -44,7 +39,6 @@ import { commCoreModule } from '../../native-modules.js'; import { persistConfig } from '../../redux/persist.js'; import { useSelector } from '../../redux/redux-utils.js'; -import { nativeLegacyLogInExtraInfoSelector } from '../../selectors/account-selectors.js'; import { appOutOfDateAlertDetails, usernameReservedAlertDetails, @@ -52,12 +46,8 @@ unknownErrorAlertDetails, } from '../../utils/alert-messages.js'; import Alert from '../../utils/alert.js'; -import { defaultURLPrefix } from '../../utils/url-utils.js'; import { setNativeCredentials } from '../native-credentials.js'; -import { - useLegacySIWEServerCall, - useIdentityWalletRegisterCall, -} from '../siwe-hooks.js'; +import { useIdentityWalletRegisterCall } from '../siwe-hooks.js'; // We can't just do everything in one async callback, since the server calls // would get bound to Redux state from before the registration. The registration @@ -97,12 +87,7 @@ // STEP 1: ACCOUNT REGISTRATION - const legacyLogInExtraInfo = useSelector(nativeLegacyLogInExtraInfoSelector); - const dispatchActionPromise = useDispatchActionPromise(); - const callLegacyKeyserverRegister = useLegacyAshoatKeyserverCall( - legacyKeyserverRegister, - ); const callIdentityPasswordRegister = useIdentityPasswordRegister(); const identityRegisterUsernameAccount = React.useCallback( @@ -161,106 +146,6 @@ [callIdentityPasswordRegister, dispatchActionPromise], ); - const legacyKeyserverRegisterUsernameAccount = React.useCallback( - async ( - accountSelection: UsernameAccountSelection, - keyserverURL: string, - onAlertAcknowledged: ?() => mixed, - ) => { - const extraInfo = await legacyLogInExtraInfo(); - const legacyKeyserverRegisterPromise = (async () => { - try { - return await callLegacyKeyserverRegister( - { - ...extraInfo, - username: accountSelection.username, - password: accountSelection.password, - }, - { - urlPrefixOverride: keyserverURL, - }, - ); - } catch (e) { - const messageForException = getMessageForException(e); - if (messageForException === 'username_reserved') { - Alert.alert( - usernameReservedAlertDetails.title, - usernameReservedAlertDetails.message, - [{ text: 'OK', onPress: onAlertAcknowledged }], - { cancelable: !onAlertAcknowledged }, - ); - } else if (messageForException === 'username_taken') { - Alert.alert( - usernameTakenAlertDetails.title, - usernameTakenAlertDetails.message, - [{ text: 'OK', onPress: onAlertAcknowledged }], - { cancelable: !onAlertAcknowledged }, - ); - } else if (messageForException === 'client_version_unsupported') { - Alert.alert( - appOutOfDateAlertDetails.title, - appOutOfDateAlertDetails.message, - [{ text: 'OK', onPress: onAlertAcknowledged }], - { cancelable: !onAlertAcknowledged }, - ); - } else { - Alert.alert( - unknownErrorAlertDetails.title, - unknownErrorAlertDetails.message, - [{ text: 'OK', onPress: onAlertAcknowledged }], - { cancelable: !onAlertAcknowledged }, - ); - } - throw e; - } - })(); - void dispatchActionPromise( - legacyKeyserverRegisterActionTypes, - legacyKeyserverRegisterPromise, - undefined, - ({ - calendarQuery: extraInfo.calendarQuery, - }: LegacyLogInStartingPayload), - ); - await legacyKeyserverRegisterPromise; - }, - [legacyLogInExtraInfo, callLegacyKeyserverRegister, dispatchActionPromise], - ); - - const legacySiweServerCall = useLegacySIWEServerCall(); - const legacyKeyserverRegisterEthereumAccount = React.useCallback( - async ( - accountSelection: EthereumAccountSelection, - keyserverURL: string, - onAlertAcknowledged: ?() => mixed, - ) => { - try { - await legacySiweServerCall(accountSelection, { - urlPrefixOverride: keyserverURL, - }); - } catch (e) { - const messageForException = getMessageForException(e); - if (messageForException === 'client_version_unsupported') { - Alert.alert( - appOutOfDateAlertDetails.title, - appOutOfDateAlertDetails.message, - [{ text: 'OK', onPress: onAlertAcknowledged }], - { cancelable: !onAlertAcknowledged }, - ); - } else { - Alert.alert( - unknownErrorAlertDetails.title, - unknownErrorAlertDetails.message, - [{ text: 'OK', onPress: onAlertAcknowledged }], - { cancelable: !onAlertAcknowledged }, - ); - } - throw e; - } - }, - [legacySiweServerCall], - ); - const identityWalletRegisterCall = useIdentityWalletRegisterCall(); const identityRegisterEthereumAccount = React.useCallback( async ( @@ -322,28 +207,12 @@ onNonceExpired, onAlertAcknowledged, } = input; - const keyserverURL = passedKeyserverURL ?? defaultURLPrefix; - if ( - accountSelection.accountType === 'username' && - !usingCommServicesAccessToken - ) { - await legacyKeyserverRegisterUsernameAccount( - accountSelection, - keyserverURL, - onAlertAcknowledged, - ); - } else if (accountSelection.accountType === 'username') { + if (accountSelection.accountType === 'username') { await identityRegisterUsernameAccount( accountSelection, farcasterID, onAlertAcknowledged, ); - } else if (!usingCommServicesAccessToken) { - await legacyKeyserverRegisterEthereumAccount( - accountSelection, - keyserverURL, - onAlertAcknowledged, - ); } else { await identityRegisterEthereumAccount( accountSelection, @@ -369,38 +238,25 @@ password: accountSelection.password, } : null; - if (usingCommServicesAccessToken) { - setCurrentStep({ - step: 'identity_registration_dispatched', - avatarData, - clearCachedSelections, - onAlertAcknowledged, - credentialsToSave, - resolve, - reject, - }); - } else { - setCurrentStep({ - step: 'authoritative_keyserver_registration_dispatched', - avatarData, - clearCachedSelections, - credentialsToSave, - resolve, - reject, - }); - } + setCurrentStep({ + step: 'identity_registration_dispatched', + avatarData, + clearCachedSelections, + onAlertAcknowledged, + credentialsToSave, + resolve, + reject, + }); } catch (e) { reject(e); } }, ), [ - currentStep, - legacyKeyserverRegisterUsernameAccount, - identityRegisterUsernameAccount, - legacyKeyserverRegisterEthereumAccount, - identityRegisterEthereumAccount, + currentStep.step, dispatch, + identityRegisterEthereumAccount, + identityRegisterUsernameAccount, setLocalFID, ], ); diff --git a/native/account/registration/username-selection.react.js b/native/account/registration/username-selection.react.js --- a/native/account/registration/username-selection.react.js +++ b/native/account/registration/username-selection.react.js @@ -4,14 +4,7 @@ import * as React from 'react'; import { View, Text } from 'react-native'; -import { - exactSearchUser, - exactSearchUserActionTypes, -} from 'lib/actions/user-actions.js'; -import { useLegacyAshoatKeyserverCall } from 'lib/keyserver-conn/legacy-keyserver-call.js'; import { validUsernameRegex } from 'lib/shared/account-utils.js'; -import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; -import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; import { isValidEthereumAddress } from 'lib/utils/siwe-utils.js'; import type { AuthNavigationProp } from './auth-navigator.react.js'; @@ -67,22 +60,10 @@ }, [validUsername]); const { userSelections } = props.route.params; - const { keyserverURL } = userSelections; - const serverCallParamOverride = React.useMemo(() => { - if (keyserverURL) { - return { urlPrefix: keyserverURL }; - } - return undefined; - }, [keyserverURL]); const [usernameSearchLoading, setUsernameSearchLoading] = React.useState(false); - const exactSearchUserCall = useLegacyAshoatKeyserverCall( - exactSearchUser, - serverCallParamOverride, - ); - const dispatchActionPromise = useDispatchActionPromise(); const { navigate } = props.navigation; const onProceed = React.useCallback(async () => { if (!checkUsernameValidity()) { @@ -93,18 +74,11 @@ let userAlreadyExists; try { - if (usingCommServicesAccessToken) { - const findUserIDResponseString = - await commRustModule.findUserIDForUsername(username); - const findUserIDResponse = JSON.parse(findUserIDResponseString); - userAlreadyExists = - !!findUserIDResponse.userID || findUserIDResponse.isReserved; - } else { - const searchPromise = exactSearchUserCall(username); - void dispatchActionPromise(exactSearchUserActionTypes, searchPromise); - const { userInfo } = await searchPromise; - userAlreadyExists = !!userInfo; - } + const findUserIDResponseString = + await commRustModule.findUserIDForUsername(username); + const findUserIDResponse = JSON.parse(findUserIDResponseString); + userAlreadyExists = + !!findUserIDResponse.userID || findUserIDResponse.isReserved; } finally { setUsernameSearchLoading(false); } @@ -130,12 +104,10 @@ }); }, [ checkUsernameValidity, - username, - exactSearchUserCall, - dispatchActionPromise, - setCachedSelections, navigate, + setCachedSelections, userSelections, + username, ]); let buttonVariant = 'disabled'; diff --git a/native/account/siwe-hooks.js b/native/account/siwe-hooks.js --- a/native/account/siwe-hooks.js +++ b/native/account/siwe-hooks.js @@ -2,109 +2,13 @@ import * as React from 'react'; -import { - legacySiweAuth, - legacySiweAuthActionTypes, -} from 'lib/actions/siwe-actions.js'; import { identityRegisterActionTypes, useIdentityWalletRegister, } from 'lib/actions/user-actions.js'; -import type { CallSingleKeyserverEndpointOptions } from 'lib/keyserver-conn/call-single-keyserver-endpoint.js'; -import { useLegacyAshoatKeyserverCall } from 'lib/keyserver-conn/legacy-keyserver-call.js'; -import { useInitialNotificationsEncryptedMessage } from 'lib/shared/crypto-utils.js'; -import type { - LegacyLogInStartingPayload, - LegacyLogInExtraInfo, -} from 'lib/types/account-types.js'; import type { IdentityWalletRegisterInput } from 'lib/types/siwe-types.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; -import { authoritativeKeyserverID } from '../authoritative-keyserver.js'; -import { useSelector } from '../redux/redux-utils.js'; -import { nativeLegacyLogInExtraInfoSelector } from '../selectors/account-selectors.js'; - -type SIWEServerCallParams = { - +message: string, - +signature: string, - +doNotRegister?: boolean, - ... -}; -function useLegacySIWEServerCall(): ( - SIWEServerCallParams, - ?CallSingleKeyserverEndpointOptions, -) => Promise { - const legacySiweAuthCall = useLegacyAshoatKeyserverCall(legacySiweAuth); - - const callSIWE = React.useCallback( - ( - message: string, - signature: string, - extraInfo: $ReadOnly<{ - ...LegacyLogInExtraInfo, - +doNotRegister?: boolean, - }>, - callSingleKeyserverEndpointOptions: ?CallSingleKeyserverEndpointOptions, - ) => - legacySiweAuthCall( - { - message, - signature, - ...extraInfo, - }, - callSingleKeyserverEndpointOptions, - ), - [legacySiweAuthCall], - ); - - const legacyLogInExtraInfo = useSelector(nativeLegacyLogInExtraInfoSelector); - - const getInitialNotificationsEncryptedMessage = - useInitialNotificationsEncryptedMessage(authoritativeKeyserverID); - - const dispatchActionPromise = useDispatchActionPromise(); - return React.useCallback( - async ( - { message, signature, doNotRegister }, - callSingleKeyserverEndpointOptions, - ) => { - const extraInfo = await legacyLogInExtraInfo(); - const initialNotificationsEncryptedMessage = - await getInitialNotificationsEncryptedMessage({ - callSingleKeyserverEndpointOptions, - }); - - const siwePromise = callSIWE( - message, - signature, - { - ...extraInfo, - initialNotificationsEncryptedMessage, - doNotRegister, - }, - callSingleKeyserverEndpointOptions, - ); - - void dispatchActionPromise( - legacySiweAuthActionTypes, - siwePromise, - undefined, - ({ - calendarQuery: extraInfo.calendarQuery, - }: LegacyLogInStartingPayload), - ); - - await siwePromise; - }, - [ - legacyLogInExtraInfo, - dispatchActionPromise, - callSIWE, - getInitialNotificationsEncryptedMessage, - ], - ); -} - function useIdentityWalletRegisterCall(): IdentityWalletRegisterInput => Promise { const identityWalletRegister = useIdentityWalletRegister(); const dispatchActionPromise = useDispatchActionPromise(); @@ -168,8 +72,4 @@ ); } -export { - useLegacySIWEServerCall, - useIdentityWalletRegisterCall, - useSIWEPanelState, -}; +export { useIdentityWalletRegisterCall, useSIWEPanelState }; diff --git a/native/account/siwe-panel.react.js b/native/account/siwe-panel.react.js --- a/native/account/siwe-panel.react.js +++ b/native/account/siwe-panel.react.js @@ -24,7 +24,6 @@ } from 'lib/types/siwe-types.js'; import { getContentSigningKey } from 'lib/utils/crypto-utils.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; -import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; import { getPublicKeyFromSIWEStatement } from 'lib/utils/siwe-utils.js'; import { useKeyboardHeight } from '../keyboard/keyboard-hooks.js'; @@ -145,17 +144,10 @@ }; void (async () => { - if (usingCommServicesAccessToken) { - void dispatchActionPromise( - identityGenerateNonceActionTypes, - generateNonce(identityGenerateNonce), - ); - } else { - void dispatchActionPromise( - getSIWENonceActionTypes, - generateNonce(getSIWENonceCall), - ); - } + void dispatchActionPromise( + identityGenerateNonceActionTypes, + generateNonce(identityGenerateNonce), + ); const ed25519 = await getContentSigningKey(); setPrimaryIdentityPublicKey(ed25519); diff --git a/native/components/background-identity-login-handler.react.js b/native/components/background-identity-login-handler.react.js --- a/native/components/background-identity-login-handler.react.js +++ b/native/components/background-identity-login-handler.react.js @@ -13,7 +13,6 @@ import { securityUpdateLogoutText } from 'lib/types/alert-types.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import { useSelector } from 'lib/utils/redux-utils.js'; -import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; import { fetchNativeKeychainCredentials } from '../account/native-credentials.js'; import { useIsAppLoggedIn } from '../navigation/nav-selectors.js'; @@ -49,7 +48,6 @@ if ( hasAccessToken || !readyToTryIdentityLogin || - !usingCommServicesAccessToken || loginAttemptedRef.current ) { return; diff --git a/native/media/encryption-utils.js b/native/media/encryption-utils.js --- a/native/media/encryption-utils.js +++ b/native/media/encryption-utils.js @@ -25,7 +25,6 @@ import { pad, unpad, calculatePaddedLength } from 'lib/utils/pkcs7-padding.js'; import { createDefaultHTTPRequestHeaders, - usingCommServicesAccessToken, httpResponseIsInvalidCSAT, } from 'lib/utils/services-utils.js'; @@ -424,12 +423,10 @@ return React.useCallback( async (blobURI, encryptionKey, options) => { let authMetadata; - if (usingCommServicesAccessToken) { - try { - authMetadata = await getAuthMetadata(); - } catch (err) { - console.warn('Failed to get auth metadata:', err); - } + try { + authMetadata = await getAuthMetadata(); + } catch (err) { + console.warn('Failed to get auth metadata:', err); } const output = await fetchAndDecryptMedia( blobURI, diff --git a/native/navigation/deep-links-context-provider.react.js b/native/navigation/deep-links-context-provider.react.js --- a/native/navigation/deep-links-context-provider.react.js +++ b/native/navigation/deep-links-context-provider.react.js @@ -26,7 +26,6 @@ import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import { errorMessageIsInvalidCSAT, - usingCommServicesAccessToken, useIsRestoreFlowEnabled, } from 'lib/utils/services-utils.js'; @@ -130,10 +129,7 @@ } if (parsedData.type === 'invite-link') { - let authMetadata; - if (usingCommServicesAccessToken) { - authMetadata = await getAuthMetadata(); - } + const authMetadata = await getAuthMetadata(); const { secret } = parsedData.data; inviteLinkSecret.current = secret; diff --git a/native/profile/delete-account.react.js b/native/profile/delete-account.react.js --- a/native/profile/delete-account.react.js +++ b/native/profile/delete-account.react.js @@ -17,7 +17,6 @@ import { accountHasPassword } from 'lib/shared/account-utils.js'; import { getMessageForException } from 'lib/utils/errors.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; -import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; import type { ProfileNavigationProp } from './profile.react.js'; import { deleteNativeCredentialsFor } from '../account/native-credentials.js'; @@ -97,7 +96,7 @@ }, [callDeleteAccount, onErrorAlertAcknowledged, password]); const onDelete = React.useCallback(() => { - if (!password && isAccountWithPassword && usingCommServicesAccessToken) { + if (!password && isAccountWithPassword) { Alert.alert('Password required', 'Please enter your password.', [ { text: 'OK', onPress: onErrorAlertAcknowledged }, ]); @@ -116,7 +115,7 @@ ]); let inputPasswordPrompt; - if (isAccountWithPassword && usingCommServicesAccessToken) { + if (isAccountWithPassword) { inputPasswordPrompt = ( <> PASSWORD diff --git a/native/profile/edit-password.react.js b/native/profile/edit-password.react.js --- a/native/profile/edit-password.react.js +++ b/native/profile/edit-password.react.js @@ -12,21 +12,16 @@ import { ScrollView } from 'react-native-gesture-handler'; import { - changeKeyserverUserPasswordActionTypes, - changeKeyserverUserPassword, useChangeIdentityUserPassword, changeIdentityUserPasswordActionTypes, } from 'lib/actions/user-actions.js'; -import { useLegacyAshoatKeyserverCall } from 'lib/keyserver-conn/legacy-keyserver-call.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; -import type { PasswordUpdate } from 'lib/types/user-types.js'; import { getMessageForException } from 'lib/utils/errors.js'; import { useDispatchActionPromise, type DispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; -import { usingCommServicesAccessToken } from 'lib/utils/services-utils.js'; import type { ProfileNavigationProp } from './profile.react.js'; import { setNativeCredentials } from '../account/native-credentials.js'; @@ -108,9 +103,6 @@ // Redux dispatch functions +dispatchActionPromise: DispatchActionPromise, // async functions that hit server APIs - +changeKeyserverUserPassword: ( - passwordUpdate: PasswordUpdate, - ) => Promise, +changeIdentityUserPassword: ( oldPassword: string, newPassword: string, @@ -287,14 +279,9 @@ ); } else if (this.state.newPassword === this.state.currentPassword) { this.goBackOnce(); - } else if (usingCommServicesAccessToken) { - void this.props.dispatchActionPromise( - changeIdentityUserPasswordActionTypes, - this.savePassword(), - ); } else { void this.props.dispatchActionPromise( - changeKeyserverUserPasswordActionTypes, + changeIdentityUserPasswordActionTypes, this.savePassword(), ); } @@ -306,19 +293,10 @@ return; } try { - if (usingCommServicesAccessToken) { - await this.props.changeIdentityUserPassword( - this.state.currentPassword, - this.state.newPassword, - ); - } else { - await this.props.changeKeyserverUserPassword({ - updatedFields: { - password: this.state.newPassword, - }, - currentPassword: this.state.currentPassword, - }); - } + await this.props.changeIdentityUserPassword( + this.state.currentPassword, + this.state.newPassword, + ); await setNativeCredentials({ username, password: this.state.newPassword, @@ -366,9 +344,9 @@ }; } -const loadingStatusSelector = usingCommServicesAccessToken - ? createLoadingStatusSelector(changeIdentityUserPasswordActionTypes) - : createLoadingStatusSelector(changeKeyserverUserPasswordActionTypes); +const loadingStatusSelector = createLoadingStatusSelector( + changeIdentityUserPasswordActionTypes, +); const ConnectedEditPassword: React.ComponentType = React.memo(function ConnectedEditPassword(props: BaseProps) { @@ -383,9 +361,6 @@ const styles = useStyles(unboundStyles); const dispatchActionPromise = useDispatchActionPromise(); - const callChangeKeyserverUserPassword = useLegacyAshoatKeyserverCall( - changeKeyserverUserPassword, - ); const callChangeIdentityUserPassword = useChangeIdentityUserPassword(); return ( @@ -396,7 +371,6 @@ colors={colors} styles={styles} dispatchActionPromise={dispatchActionPromise} - changeKeyserverUserPassword={callChangeKeyserverUserPassword} changeIdentityUserPassword={callChangeIdentityUserPassword} /> ); diff --git a/native/profile/profile-screen.react.js b/native/profile/profile-screen.react.js --- a/native/profile/profile-screen.react.js +++ b/native/profile/profile-screen.react.js @@ -29,10 +29,7 @@ useDispatchActionPromise, type DispatchActionPromise, } from 'lib/utils/redux-promise-utils.js'; -import { - usingCommServicesAccessToken, - useIsRestoreFlowEnabled, -} from 'lib/utils/services-utils.js'; +import { useIsRestoreFlowEnabled } from 'lib/utils/services-utils.js'; import type { ProfileNavigationProp } from './profile.react.js'; import { deleteNativeCredentialsFor } from '../account/native-credentials.js'; @@ -271,15 +268,12 @@ ); } - let farcasterAccountSettings; - if (usingCommServicesAccessToken || __DEV__) { - farcasterAccountSettings = ( - - ); - } + const farcasterAccountSettings = ( + + ); let dmActions; if (staffCanSee) {