Skip to content

Commit a13ec69

Browse files
committed
[keyserver] Remove extraneous verifyClientSupported calls
Summary: In the past, we had calls to `validateInput` in each responder, which in turn calls `verifyClientSupported`. When the input did not need validation because there was no input, we would instead add direct calls to `verifyClientSupported`. However, now `validateInput` is called implicitly before each responder. As such, `verifyClientSupported` is also called implicitly, and we don't need any explicit calls to it in responders. Test Plan: Careful reading of the code. I think this change is relatively safe since I'm just removing a call that already occurs elsewhere Reviewers: michal, marcin Reviewed By: marcin Subscribers: tomek, wyilio Differential Revision: https://phab.comm.dev/D9581
1 parent 10bd397 commit a13ec69

2 files changed

Lines changed: 1 addition & 13 deletions

File tree

keyserver/src/responders/keys-responders.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { ServerError } from 'lib/utils/errors.js';
1616
import { tShape, tNull } from 'lib/utils/validation-utils.js';
1717

1818
import { fetchSessionPublicKeys } from '../fetchers/key-fetchers.js';
19-
import { verifyClientSupported } from '../session/version.js';
2019
import type { Viewer } from '../session/viewer.js';
2120
import { fetchCallUpdateOlmAccount } from '../updaters/olm-account-updater.js';
2221

@@ -63,11 +62,7 @@ function retrieveSessionInitializationKeysSet(
6362
return { identityKeys, oneTimeKey, prekey, prekeySignature };
6463
}
6564

66-
async function getOlmSessionInitializationDataResponder(
67-
viewer: Viewer,
68-
): Promise<GetOlmSessionInitializationDataResponse> {
69-
await verifyClientSupported(viewer);
70-
65+
async function getOlmSessionInitializationDataResponder(): Promise<GetOlmSessionInitializationDataResponse> {
7166
const {
7267
identityKeys: notificationsIdentityKeys,
7368
prekey: notificationsPrekey,

keyserver/src/responders/user-responders.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ import {
120120
createNewUserCookie,
121121
setNewSession,
122122
} from '../session/cookies.js';
123-
import { verifyClientSupported } from '../session/version.js';
124123
import type { Viewer } from '../session/viewer.js';
125124
import {
126125
accountUpdater,
@@ -176,9 +175,6 @@ async function passwordUpdateResponder(
176175
}
177176

178177
async function sendVerificationEmailResponder(viewer: Viewer): Promise<void> {
179-
if (!viewer.isSocket) {
180-
await verifyClientSupported(viewer, viewer.platformDetails);
181-
}
182178
await checkAndSendVerificationEmail(viewer);
183179
}
184180

@@ -200,9 +196,6 @@ export const logOutResponseValidator: TInterface<LogOutResponse> =
200196
});
201197

202198
async function logOutResponder(viewer: Viewer): Promise<LogOutResponse> {
203-
if (!viewer.isSocket) {
204-
await verifyClientSupported(viewer, viewer.platformDetails);
205-
}
206199
if (viewer.loggedIn) {
207200
const [anonymousViewerData] = await Promise.all([
208201
createNewAnonymousCookie({

0 commit comments

Comments
 (0)