diff --git a/lib/actions/siwe-actions.js b/lib/actions/siwe-actions.js --- a/lib/actions/siwe-actions.js +++ b/lib/actions/siwe-actions.js @@ -29,15 +29,15 @@ return response.nonce; }; -const siweAuthActionTypes = Object.freeze({ - started: 'SIWE_AUTH_STARTED', - success: 'SIWE_AUTH_SUCCESS', - failed: 'SIWE_AUTH_FAILED', +const legacySiweAuthActionTypes = Object.freeze({ + started: 'LEGACY_SIWE_AUTH_STARTED', + success: 'LEGACY_SIWE_AUTH_SUCCESS', + failed: 'LEGACY_SIWE_AUTH_FAILED', }); -const siweAuthCallSingleKeyserverEndpointOptions = { +const legacySiweAuthCallSingleKeyserverEndpointOptions = { timeout: permissionsAndAuthRelatedRequestTimeout, }; -const siweAuth = +const legacySiweAuth = ( callSingleKeyserverEndpoint: CallSingleKeyserverEndpoint, ): (( @@ -59,7 +59,7 @@ platformDetails: getConfig().platformDetails, }, { - ...siweAuthCallSingleKeyserverEndpointOptions, + ...legacySiweAuthCallSingleKeyserverEndpointOptions, ...options, }, ); @@ -88,4 +88,9 @@ }; }; -export { getSIWENonceActionTypes, getSIWENonce, siweAuthActionTypes, siweAuth }; +export { + getSIWENonceActionTypes, + getSIWENonce, + legacySiweAuthActionTypes, + legacySiweAuth, +}; diff --git a/lib/reducers/calendar-filters-reducer.js b/lib/reducers/calendar-filters-reducer.js --- a/lib/reducers/calendar-filters-reducer.js +++ b/lib/reducers/calendar-filters-reducer.js @@ -4,7 +4,7 @@ updateCalendarCommunityFilter, clearCalendarCommunityFilter, } from '../actions/community-actions.js'; -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { newThreadActionTypes, joinThreadActionTypes, @@ -53,7 +53,7 @@ ): $ReadOnlyArray { if ( action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success || + action.type === legacySiweAuthActionTypes.success || action.type === keyserverRegisterActionTypes.success ) { return defaultCalendarFilters; diff --git a/lib/reducers/entry-reducer.js b/lib/reducers/entry-reducer.js --- a/lib/reducers/entry-reducer.js +++ b/lib/reducers/entry-reducer.js @@ -24,7 +24,7 @@ fetchRevisionsForEntryActionTypes, restoreEntryActionTypes, } from '../actions/entry-actions.js'; -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { deleteThreadActionTypes, leaveThreadActionTypes, @@ -481,7 +481,7 @@ ]; } else if ( action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success || + action.type === legacySiweAuthActionTypes.success || action.type === keyserverAuthActionTypes.success ) { const { calendarResult } = action.payload; diff --git a/lib/reducers/integrity-reducer.js b/lib/reducers/integrity-reducer.js --- a/lib/reducers/integrity-reducer.js +++ b/lib/reducers/integrity-reducer.js @@ -2,7 +2,7 @@ import { setClientDBStoreActionType } from '../actions/client-db-store-actions.js'; import { updateIntegrityStoreActionType } from '../actions/integrity-actions.js'; -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { keyserverAuthActionTypes, legacyLogInActionTypes, @@ -81,7 +81,7 @@ }; } else if ( action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success || + action.type === legacySiweAuthActionTypes.success || action.type === keyserverRegisterActionTypes.success || (action.type === setClientDBStoreActionType && !!action.payload.threadStore && diff --git a/lib/reducers/keyserver-reducer.js b/lib/reducers/keyserver-reducer.js --- a/lib/reducers/keyserver-reducer.js +++ b/lib/reducers/keyserver-reducer.js @@ -13,7 +13,7 @@ addKeyserverActionType, removeKeyserverActionType, } from '../actions/keyserver-actions.js'; -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { identityLogInActionTypes, identityRegisterActionTypes, @@ -190,7 +190,7 @@ }; } else if ( action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success || + action.type === legacySiweAuthActionTypes.success || action.type === keyserverAuthActionTypes.success ) { const { updatesCurrentAsOf } = action.payload; diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js --- a/lib/reducers/master-reducer.js +++ b/lib/reducers/master-reducer.js @@ -25,7 +25,7 @@ import { reduceThreadInfos } from './thread-reducer.js'; import { reduceCurrentUserInfo, reduceUserInfos } from './user-reducer.js'; import { addKeyserverActionType } from '../actions/keyserver-actions.js'; -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { keyserverRegisterActionTypes, legacyLogInActionTypes, @@ -94,7 +94,7 @@ action.type !== fullStateSyncActionType && action.type !== keyserverRegisterActionTypes.success && action.type !== legacyLogInActionTypes.success && - action.type !== siweAuthActionTypes.success && + action.type !== legacySiweAuthActionTypes.success && action.type !== keyserverAuthActionTypes.success && action.type !== addKeyserverActionType ) { diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js --- a/lib/reducers/message-reducer.js +++ b/lib/reducers/message-reducer.js @@ -35,7 +35,7 @@ fetchSingleMostRecentMessagesFromThreadsActionTypes, } from '../actions/message-actions.js'; import { sendMessageReportActionTypes } from '../actions/message-report-actions.js'; -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { changeThreadSettingsActionTypes, deleteThreadActionTypes, @@ -728,7 +728,7 @@ ): ReduceMessageStoreResult { if ( action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success + action.type === legacySiweAuthActionTypes.success ) { const { messagesResult } = action.payload; let { messageInfos } = messagesResult; diff --git a/lib/reducers/nav-reducer.js b/lib/reducers/nav-reducer.js --- a/lib/reducers/nav-reducer.js +++ b/lib/reducers/nav-reducer.js @@ -1,7 +1,7 @@ // @flow import { updateCalendarQueryActionTypes } from '../actions/entry-actions.js'; -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { identityRegisterActionTypes, legacyLogInActionTypes, @@ -25,7 +25,7 @@ ): T { if ( action.type === legacyLogInActionTypes.started || - action.type === siweAuthActionTypes.started || + action.type === legacySiweAuthActionTypes.started || action.type === keyserverRegisterActionTypes.started || action.type === fullStateSyncActionType || action.type === incrementalStateSyncActionType diff --git a/lib/reducers/policies-reducer.js b/lib/reducers/policies-reducer.js --- a/lib/reducers/policies-reducer.js +++ b/lib/reducers/policies-reducer.js @@ -1,6 +1,6 @@ // @flow -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { legacyLogInActionTypes, logOutActionTypes, @@ -21,7 +21,7 @@ if ( action.type === forcePolicyAcknowledgmentActionType || action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success || + action.type === legacySiweAuthActionTypes.success || action.type === keyserverAuthActionTypes.success ) { const { notAcknowledgedPolicies } = action.payload; diff --git a/lib/reducers/report-store-reducer.js b/lib/reducers/report-store-reducer.js --- a/lib/reducers/report-store-reducer.js +++ b/lib/reducers/report-store-reducer.js @@ -6,7 +6,7 @@ sendReportsActionTypes, queueReportsActionType, } from '../actions/report-actions.js'; -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { logOutActionTypes, deleteAccountActionTypes, @@ -105,7 +105,7 @@ }; } else if ( action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success + action.type === legacySiweAuthActionTypes.success ) { return { reportStore: { diff --git a/lib/reducers/theme-reducer.js b/lib/reducers/theme-reducer.js --- a/lib/reducers/theme-reducer.js +++ b/lib/reducers/theme-reducer.js @@ -1,6 +1,6 @@ // @flow -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { updateThemeInfoActionType } from '../actions/theme-actions.js'; import { legacyLogInActionTypes, @@ -21,7 +21,7 @@ ): GlobalThemeInfo { if ( action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success || + action.type === legacySiweAuthActionTypes.success || action.type === keyserverRegisterActionTypes.success ) { return defaultGlobalThemeInfo; diff --git a/lib/reducers/thread-reducer.js b/lib/reducers/thread-reducer.js --- a/lib/reducers/thread-reducer.js +++ b/lib/reducers/thread-reducer.js @@ -6,7 +6,7 @@ } from '../actions/activity-actions.js'; import { setClientDBStoreActionType } from '../actions/client-db-store-actions.js'; import { saveMessagesActionType } from '../actions/message-actions.js'; -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { changeThreadSettingsActionTypes, deleteThreadActionTypes, @@ -108,7 +108,7 @@ }; } else if ( action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success || + action.type === legacySiweAuthActionTypes.success || action.type === keyserverRegisterActionTypes.success ) { const newThreadInfos = action.payload.threadInfos; diff --git a/lib/reducers/user-reducer.js b/lib/reducers/user-reducer.js --- a/lib/reducers/user-reducer.js +++ b/lib/reducers/user-reducer.js @@ -4,7 +4,7 @@ import _keyBy from 'lodash/fp/keyBy.js'; import { setClientDBStoreActionType } from '../actions/client-db-store-actions.js'; -import { siweAuthActionTypes } from '../actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from '../actions/siwe-actions.js'; import { joinThreadActionTypes, newThreadActionTypes, @@ -66,7 +66,7 @@ } } else if ( action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success || + action.type === legacySiweAuthActionTypes.success || action.type === keyserverRegisterActionTypes.success || action.type === logOutActionTypes.success || action.type === deleteAccountActionTypes.success @@ -272,7 +272,7 @@ } } else if ( action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success || + action.type === legacySiweAuthActionTypes.success || action.type === keyserverRegisterActionTypes.success ) { const newUserInfos = _keyBy(userInfo => userInfo.id)( diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js --- a/lib/types/redux-types.js +++ b/lib/types/redux-types.js @@ -1083,17 +1083,17 @@ +loadingInfo: LoadingInfo, } | { - +type: 'SIWE_AUTH_STARTED', + +type: 'LEGACY_SIWE_AUTH_STARTED', +payload: LogInStartingPayload, +loadingInfo: LoadingInfo, } | { - +type: 'SIWE_AUTH_SUCCESS', + +type: 'LEGACY_SIWE_AUTH_SUCCESS', +payload: LogInResult, +loadingInfo: LoadingInfo, } | { - +type: 'SIWE_AUTH_FAILED', + +type: 'LEGACY_SIWE_AUTH_FAILED', +error: true, +payload: Error, +loadingInfo: LoadingInfo, 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 @@ -4,7 +4,7 @@ import { Text, View } from 'react-native'; import { setDataLoadedActionType } from 'lib/actions/client-db-store-actions.js'; -import { siweAuthActionTypes } from 'lib/actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from 'lib/actions/siwe-actions.js'; import { useENSName } from 'lib/hooks/ens-cache.js'; import { useWalletLogIn } from 'lib/hooks/login-hooks.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; @@ -24,8 +24,9 @@ import Alert from '../../utils/alert.js'; import { useLegacySIWEServerCall } from '../siwe-hooks.js'; -const siweAuthLoadingStatusSelector = - createLoadingStatusSelector(siweAuthActionTypes); +const legacySiweAuthLoadingStatusSelector = createLoadingStatusSelector( + legacySiweAuthActionTypes, +); export type ExistingEthereumAccountParams = SIWEResult; @@ -77,8 +78,8 @@ } }, [legacySiweServerCall, walletLogIn, params, dispatch]); - const siweAuthCallLoading = useSelector( - state => siweAuthLoadingStatusSelector(state) === 'loading', + const legacySiweAuthCallLoading = useSelector( + state => legacySiweAuthLoadingStatusSelector(state) === 'loading', ); const { address } = params; @@ -111,7 +112,7 @@ Promise { - const siweAuthCall = useLegacyAshoatKeyserverCall(siweAuth); + const legacySiweAuthCall = useLegacyAshoatKeyserverCall(legacySiweAuth); const callSIWE = React.useCallback( ( @@ -40,7 +43,7 @@ extraInfo: $ReadOnly<{ ...LogInExtraInfo, +doNotRegister?: boolean }>, callSingleKeyserverEndpointOptions: ?CallSingleKeyserverEndpointOptions, ) => - siweAuthCall( + legacySiweAuthCall( { message, signature, @@ -48,7 +51,7 @@ }, callSingleKeyserverEndpointOptions, ), - [siweAuthCall], + [legacySiweAuthCall], ); const logInExtraInfo = useSelector(nativeLogInExtraInfoSelector); @@ -80,7 +83,7 @@ ); void dispatchActionPromise( - siweAuthActionTypes, + legacySiweAuthActionTypes, siwePromise, undefined, ({ calendarQuery: extraInfo.calendarQuery }: LogInStartingPayload), 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 @@ -8,7 +8,7 @@ import { getSIWENonce, getSIWENonceActionTypes, - siweAuthActionTypes, + legacySiweAuthActionTypes, } from 'lib/actions/siwe-actions.js'; import { identityGenerateNonceActionTypes, @@ -42,8 +42,9 @@ const identityGenerateNonceLoadingStatusSelector = createLoadingStatusSelector( identityGenerateNonceActionTypes, ); -const legacySiweAuthLoadingStatusSelector = - createLoadingStatusSelector(siweAuthActionTypes); +const legacySiweAuthLoadingStatusSelector = createLoadingStatusSelector( + legacySiweAuthActionTypes, +); type Props = { +onClosed: () => mixed, diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js --- a/native/redux/redux-setup.js +++ b/native/redux/redux-setup.js @@ -6,7 +6,7 @@ import thunk from 'redux-thunk'; import { setClientDBStoreActionType } from 'lib/actions/client-db-store-actions.js'; -import { siweAuthActionTypes } from 'lib/actions/siwe-actions.js'; +import { legacySiweAuthActionTypes } from 'lib/actions/siwe-actions.js'; import { logOutActionTypes, deleteAccountActionTypes, @@ -183,7 +183,7 @@ action.payload.authActionSource, )) || ((action.type === legacyLogInActionTypes.success || - action.type === siweAuthActionTypes.success) && + action.type === legacySiweAuthActionTypes.success) && invalidSessionRecovery( state, action.payload.preRequestUserInfo, diff --git a/web/account/siwe-login-form.react.js b/web/account/siwe-login-form.react.js --- a/web/account/siwe-login-form.react.js +++ b/web/account/siwe-login-form.react.js @@ -10,8 +10,8 @@ import { getSIWENonce, getSIWENonceActionTypes, - siweAuth, - siweAuthActionTypes, + legacySiweAuth, + legacySiweAuthActionTypes, } from 'lib/actions/siwe-actions.js'; import { identityGenerateNonceActionTypes, @@ -59,8 +59,9 @@ const identityGenerateNonceLoadingStatusSelector = createLoadingStatusSelector( identityGenerateNonceActionTypes, ); -const legacySiweAuthLoadingStatusSelector = - createLoadingStatusSelector(siweAuthActionTypes); +const legacySiweAuthLoadingStatusSelector = createLoadingStatusSelector( + legacySiweAuthActionTypes, +); function SIWELoginForm(props: SIWELoginFormProps): React.Node { const { address } = useAccount(); const { data: signer } = useWalletClient(); @@ -76,7 +77,7 @@ const siweAuthLoadingStatus = useSelector( legacySiweAuthLoadingStatusSelector, ); - const legacySiweAuthCall = useLegacyAshoatKeyserverCall(siweAuth); + const legacySiweAuthCall = useLegacyAshoatKeyserverCall(legacySiweAuth); const logInExtraInfo = useSelector(logInExtraInfoSelector); const walletLogIn = useWalletLogIn(); @@ -147,7 +148,7 @@ const attemptLegacySIWEAuth = React.useCallback( (message: string, signature: string) => { return dispatchActionPromise( - siweAuthActionTypes, + legacySiweAuthActionTypes, callLegacySIWEAuthEndpoint(message, signature, logInExtraInfo), undefined, ({ calendarQuery: logInExtraInfo.calendarQuery }: LogInStartingPayload),