diff --git a/lib/utils/action-utils.js b/lib/utils/action-utils.js --- a/lib/utils/action-utils.js +++ b/lib/utils/action-utils.js @@ -199,8 +199,9 @@ keyserverID: string, getInitialNotificationsEncryptedMessage?: () => Promise, ): Promise { - const resolveInvalidatedCookie = getConfig().resolveInvalidatedCookie; - if (!resolveInvalidatedCookie) { + const { resolveKeyserverSessionInvalidationUsingNativeCredentials } = + getConfig(); + if (!resolveKeyserverSessionInvalidationUsingNativeCredentials) { return null; } let newSessionChange = null; @@ -287,7 +288,7 @@ ); return new Promise(r => (callServerEndpointCallback = r)); }; - await resolveInvalidatedCookie( + await resolveKeyserverSessionInvalidationUsingNativeCredentials( boundCallServerEndpoint, boundCallKeyserverEndpoint, dispatchRecoveryAttempt, @@ -329,13 +330,16 @@ undefined, keyserverID, ); + const { resolveKeyserverSessionInvalidationUsingNativeCredentials } = + getConfig(); // This function gets called before callServerEndpoint sends a request, // to make sure that we're not in the middle of trying to recover // an invalidated cookie const waitIfCookieInvalidated = () => { - if (!getConfig().resolveInvalidatedCookie) { - // If there is no resolveInvalidatedCookie function, just let the caller - // callServerEndpoint instance continue + if (!resolveKeyserverSessionInvalidationUsingNativeCredentials) { + // If there is no + // resolveKeyserverSessionInvalidationUsingNativeCredentials function, + // just let the caller callServerEndpoint instance continue return Promise.resolve(null); } if (!currentlyWaitingForNewCookie) { @@ -381,9 +385,10 @@ // its cookie, and is wondering if it should just like... give up? // Or if there's a chance at redemption const cookieInvalidationRecovery = (sessionChange: ClientSessionChange) => { - if (!getConfig().resolveInvalidatedCookie) { - // If there is no resolveInvalidatedCookie function, just let the caller - // callServerEndpoint instance continue + if (!resolveKeyserverSessionInvalidationUsingNativeCredentials) { + // If there is no + // resolveKeyserverSessionInvalidationUsingNativeCredentials function, + // just let the caller callServerEndpoint instance continue return Promise.resolve(null); } if (!loggedIn) { diff --git a/lib/utils/config.js b/lib/utils/config.js --- a/lib/utils/config.js +++ b/lib/utils/config.js @@ -9,7 +9,7 @@ import type { PlatformDetails } from '../types/device-types.js'; export type Config = { - +resolveInvalidatedCookie: ?( + +resolveKeyserverSessionInvalidationUsingNativeCredentials: ?( callServerEndpoint: CallServerEndpoint, callKeyserverEndpoint: CallKeyserverEndpoint, dispatchRecoveryAttempt: DispatchRecoveryAttempt, diff --git a/native/account/resolve-invalidated-cookie.js b/native/account/resolve-invalidated-cookie.js --- a/native/account/resolve-invalidated-cookie.js +++ b/native/account/resolve-invalidated-cookie.js @@ -12,7 +12,7 @@ import { store } from '../redux/redux-setup.js'; import { nativeLogInExtraInfoSelector } from '../selectors/account-selectors.js'; -async function resolveInvalidatedCookie( +async function resolveKeyserverSessionInvalidationUsingNativeCredentials( callServerEndpoint: CallServerEndpoint, callKeyserverEndpoint: CallKeyserverEndpoint, dispatchRecoveryAttempt: DispatchRecoveryAttempt, @@ -50,4 +50,4 @@ ); } -export { resolveInvalidatedCookie }; +export { resolveKeyserverSessionInvalidationUsingNativeCredentials }; diff --git a/native/config.js b/native/config.js --- a/native/config.js +++ b/native/config.js @@ -4,11 +4,11 @@ import { registerConfig } from 'lib/utils/config.js'; -import { resolveInvalidatedCookie } from './account/resolve-invalidated-cookie.js'; +import { resolveKeyserverSessionInvalidationUsingNativeCredentials } from './account/resolve-invalidated-cookie.js'; import { persistConfig, codeVersion } from './redux/persist.js'; registerConfig({ - resolveInvalidatedCookie, + resolveKeyserverSessionInvalidationUsingNativeCredentials, setSessionIDOnRequest: false, calendarRangeInactivityLimit: 15 * 60 * 1000, platformDetails: { diff --git a/web/app.react.js b/web/app.react.js --- a/web/app.react.js +++ b/web/app.react.js @@ -88,9 +88,8 @@ : null; registerConfig({ - // We can't securely cache credentials on web, so we have no way to recover - // from a cookie invalidation - resolveInvalidatedCookie: null, + // We can't securely cache credentials on web + resolveKeyserverSessionInvalidationUsingNativeCredentials: null, setSessionIDOnRequest: true, // Never reset the calendar range calendarRangeInactivityLimit: null,