diff --git a/lib/utils/config.js b/lib/utils/config.js --- a/lib/utils/config.js +++ b/lib/utils/config.js @@ -26,6 +26,7 @@ +setSessionIDOnRequest: boolean, +calendarRangeInactivityLimit: ?number, +platformDetails: PlatformDetails, + +authoritativeKeyserverID: string, }; let registeredConfig: ?Config = null; diff --git a/native/authoritative-keyserver-id.js b/native/authoritative-keyserver-id.js new file mode 100644 --- /dev/null +++ b/native/authoritative-keyserver-id.js @@ -0,0 +1,12 @@ +// @flow + +let authoritativeKeyserverID: string; +try { + const { + authoritativeKeyserverID: keyserverID, + // $FlowExpectedError: file might not exist + } = require('./facts/authoritative_keyserver.json'); + authoritativeKeyserverID = keyserverID; +} catch {} + +export { authoritativeKeyserverID }; diff --git a/native/config.js b/native/config.js --- a/native/config.js +++ b/native/config.js @@ -3,8 +3,10 @@ import { Platform } from 'react-native'; import { registerConfig } from 'lib/utils/config.js'; +import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import { resolveKeyserverSessionInvalidationUsingNativeCredentials } from './account/legacy-recover-keyserver-session.js'; +import { authoritativeKeyserverID } from './authoritative-keyserver-id.js'; import { persistConfig, codeVersion } from './redux/persist.js'; registerConfig({ @@ -16,4 +18,5 @@ codeVersion, stateVersion: persistConfig.version, }, + authoritativeKeyserverID: authoritativeKeyserverID ?? ashoatKeyserverID, }); diff --git a/web/app.react.js b/web/app.react.js --- a/web/app.react.js +++ b/web/app.react.js @@ -34,6 +34,7 @@ import { getConfig, registerConfig } from 'lib/utils/config.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; import { infoFromURL } from 'lib/utils/url-utils.js'; +import { ashoatKeyserverID } from 'lib/utils/validation-utils.js'; import { AlchemyENSCacheProvider, wagmiConfig } from 'lib/utils/wagmi-utils.js'; import QrCodeLogin from './account/qr-code-login.react.js'; @@ -102,6 +103,8 @@ stateVersion: persistConfig.version, ...desktopDetails, }, + authoritativeKeyserverID: + process.env.AUTHORITATIVE_KEYSERVER_ID ?? ashoatKeyserverID, }); const versionBroadcast = new BroadcastChannel('comm_version'); diff --git a/web/webpack.config.cjs b/web/webpack.config.cjs --- a/web/webpack.config.cjs +++ b/web/webpack.config.cjs @@ -13,7 +13,7 @@ async function getConfig(configName) { const { getCommConfig } = await import( - '../keyserver/dist/lib/utils/comm-config.js' + 'keyserver/dist/lib/utils/comm-config.js' ); return await getCommConfig(configName); } @@ -194,7 +194,18 @@ const identitySocketAddr = JSON.stringify( identityServiceConfig?.identitySocketAddr, ); - const envVars = { IDENTITY_SOCKET_ADDR: identitySocketAddr }; + const authoritativeKeyserverIDConfig = await getConfig({ + folder: 'facts', + name: 'authoritative_keyserver', + }); + const authoritativeKeyserverID = JSON.stringify( + authoritativeKeyserverIDConfig?.authoritativeKeyserverID, + ); + + const envVars = { + IDENTITY_SOCKET_ADDR: identitySocketAddr, + AUTHORITATIVE_KEYSERVER_ID: authoritativeKeyserverID, + }; const browserConfigPromise = env.prod ? createProdBrowserConfig(baseProdBrowserConfig, babelConfig, envVars) : createDevBrowserConfig(baseDevBrowserConfig, babelConfig, envVars);