diff --git a/keyserver/src/utils/fc-cache.js b/keyserver/src/utils/fc-cache.js index 6c32e215c..2a3c22ebc 100644 --- a/keyserver/src/utils/fc-cache.js +++ b/keyserver/src/utils/fc-cache.js @@ -1,35 +1,28 @@ // @flow -import { getCommConfig } from 'lib/utils/comm-config.js'; import { getFCNames as baseGetFCNames, type GetFCNames, type BaseFCNamesInfo, } from 'lib/utils/farcaster-helpers.js'; import { FCCache } from 'lib/utils/fc-cache.js'; import { NeynarClient } from 'lib/utils/neynar-client.js'; -type NeynarConfig = { - +key: string, - +signerUUID?: string, - +neynarWebhookSecret?: string, -}; +import { getNeynarConfig } from './neynar-utils.js'; let getFCNames: ?GetFCNames; let neynarClient: ?NeynarClient; async function initFCCache() { - const neynarSecret = await getCommConfig({ - folder: 'secrets', - name: 'neynar', - }); + const neynarSecret = await getNeynarConfig(); + const neynarKey = neynarSecret?.key; if (!neynarKey) { return; } neynarClient = new NeynarClient(neynarKey); const fcCache = new FCCache(neynarClient); getFCNames = (users: $ReadOnlyArray): Promise => baseGetFCNames(fcCache, users); } export { initFCCache, getFCNames, neynarClient }; diff --git a/keyserver/src/utils/neynar-utils.js b/keyserver/src/utils/neynar-utils.js new file mode 100644 index 000000000..6258a19ba --- /dev/null +++ b/keyserver/src/utils/neynar-utils.js @@ -0,0 +1,18 @@ +// @flow + +import { getCommConfig } from 'lib/utils/comm-config.js'; + +type NeynarConfig = { + +key: string, + +signerUUID?: string, + +neynarWebhookSecret?: string, +}; + +function getNeynarConfig(): Promise { + return getCommConfig({ + folder: 'secrets', + name: 'neynar', + }); +} + +export { getNeynarConfig };