diff --git a/lib/keyserver-conn/call-single-keyserver-endpoint.js b/lib/keyserver-conn/call-single-keyserver-endpoint.js --- a/lib/keyserver-conn/call-single-keyserver-endpoint.js +++ b/lib/keyserver-conn/call-single-keyserver-endpoint.js @@ -1,5 +1,6 @@ // @flow +import invariant from 'invariant'; import _isEqual from 'lodash/fp/isEqual.js'; import { @@ -77,6 +78,13 @@ platformDetails?: PlatformDetails, }; +let jsonUserInfoHandler = null; +export const registerJsonUserInfoHandler = ( + handler: (CallSingleKeyserverEndpointResponse, Endpoint) => void, +) => { + jsonUserInfoHandler = handler; +}; + async function callSingleKeyserverEndpoint( cookie: ?string, setNewSession: (sessionChange: ClientSessionChange, error: ?string) => void, @@ -201,6 +209,8 @@ json = await Promise.race([callEndpointPromise, rejectPromise]); } } + invariant(jsonUserInfoHandler, 'jsonUserInfoHandler should be registered'); + jsonUserInfoHandler(json, endpoint); const { cookieChange, error, payload, currentUserInfo } = json; const sessionChange: ?ServerSessionChange = cookieChange; diff --git a/native/root.react.js b/native/root.react.js --- a/native/root.react.js +++ b/native/root.react.js @@ -33,8 +33,10 @@ import PrekeysHandler from 'lib/components/prekeys-handler.react.js'; import { StaffContextProvider } from 'lib/components/staff-provider.react.js'; import { DBOpsHandler } from 'lib/handlers/db-ops-handler.react.js'; +import { httpMessageUserInfosHandler } from 'lib/handlers/http-message-user-infos-handler.js'; import { IdentitySearchProvider } from 'lib/identity-search/identity-search-context.js'; import { CallKeyserverEndpointProvider } from 'lib/keyserver-conn/call-keyserver-endpoint-provider.react.js'; +import { registerJsonUserInfoHandler } from 'lib/keyserver-conn/call-single-keyserver-endpoint.js'; import KeyserverConnectionsHandler from 'lib/keyserver-conn/keyserver-connections-handler.js'; import { TunnelbrokerProvider } from 'lib/tunnelbroker/tunnelbroker-context.js'; import { actionLogger } from 'lib/utils/action-logger.js'; @@ -95,6 +97,8 @@ SplashScreen.preventAutoHideAsync().catch(console.log); +registerJsonUserInfoHandler(httpMessageUserInfosHandler); + function Root() { const navStateRef = React.useRef(); const navDispatchRef = diff --git a/web/root.js b/web/root.js --- a/web/root.js +++ b/web/root.js @@ -14,7 +14,9 @@ import IntegrityHandler from 'lib/components/integrity-handler.react.js'; import PrekeysHandler from 'lib/components/prekeys-handler.react.js'; import ReportHandler from 'lib/components/report-handler.react.js'; +import { httpMessageUserInfosHandler } from 'lib/handlers/http-message-user-infos-handler.js'; import { CallKeyserverEndpointProvider } from 'lib/keyserver-conn/call-keyserver-endpoint-provider.react.js'; +import { registerJsonUserInfoHandler } from 'lib/keyserver-conn/call-single-keyserver-endpoint.js'; import KeyserverConnectionsHandler from 'lib/keyserver-conn/keyserver-connections-handler.js'; import { reduxLoggerMiddleware } from 'lib/utils/action-logger.js'; import { getWagmiConfig } from 'lib/utils/wagmi-utils.js'; @@ -37,6 +39,8 @@ localforage.config(localforageConfig); +registerJsonUserInfoHandler(httpMessageUserInfosHandler); + const persistedReducer = persistReducer(persistConfig, reducer); const store: Store = createStore( persistedReducer,