diff --git a/keyserver/src/fetchers/user-fetchers.js b/keyserver/src/fetchers/user-fetchers.js --- a/keyserver/src/fetchers/user-fetchers.js +++ b/keyserver/src/fetchers/user-fetchers.js @@ -374,6 +374,15 @@ return row.username; } +async function fetchUsernames(): Promise { + const query = SQL`SELECT username FROM users`; + const result = await dbQuery(query); + if (result.length === 0) { + return []; + } + return result.map(row => row.username); +} + async function fetchKeyserverAdminID(): Promise { const changeRoleExtractString = `$.${threadPermissions.CHANGE_ROLE}`; const query = SQL` @@ -415,6 +424,7 @@ fetchCurrentUserInfo, fetchAllUserIDs, fetchUsername, + fetchUsernames, fetchKnownUserInfos, fetchKeyserverAdminID, fetchUserIDForEthereumAddress,