Skip to content

Commit

Permalink
[keyserver] rename retrieveAccountKeysSet -> `retrieveSessionInitia…
Browse files Browse the repository at this point in the history
…lizationKeysSet`

Summary:
Addresses: https://phab.comm.dev/D9422#276975

We get to the point where there are two functions with the same name, but doing different things. This should make it more consistent to avoid confusion.

Depends on D9427

Test Plan: Flow

Reviewers: marcin

Reviewed By: marcin

Subscribers: ashoat, tomek, wyilio

Differential Revision: https://phab.comm.dev/D9450
  • Loading branch information
xsanm committed Oct 16, 2023
1 parent 3f2145c commit 38818ef
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions keyserver/src/responders/keys-responders.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { verifyClientSupported } from '../session/version.js';
import type { Viewer } from '../session/viewer.js';
import { fetchCallUpdateOlmAccount } from '../updaters/olm-account-updater.js';

type AccountKeysSet = {
type SessionInitializationKeysSet = {
+identityKeys: string,
...OlmSessionInitializationInfo,
};
Expand All @@ -44,16 +44,16 @@ async function getSessionPublicKeysResponder(
return await fetchSessionPublicKeys(request.session);
}

async function retrieveAccountKeysSet(
function retrieveSessionInitializationKeysSet(
account: OlmAccount,
): Promise<AccountKeysSet> {
): SessionInitializationKeysSet {
const identityKeys = account.identity_keys();

const prekey = account.prekey();
const prekeySignature = account.prekey_signature();

if (!prekeySignature) {
throw new ServerError('prekey_validation_failure');
throw new ServerError('invalid_prekey');
}

account.generate_one_time_keys(1);
Expand All @@ -73,15 +73,18 @@ async function getOlmSessionInitializationDataResponder(
prekey: notificationsPrekey,
prekeySignature: notificationsPrekeySignature,
oneTimeKey: notificationsOneTimeKey,
} = await fetchCallUpdateOlmAccount('notifications', retrieveAccountKeysSet);
} = await fetchCallUpdateOlmAccount(
'notifications',
retrieveSessionInitializationKeysSet,
);

const contentAccountCallback = async (account: OlmAccount) => {
const {
identityKeys: contentIdentityKeys,
oneTimeKey,
prekey,
prekeySignature,
} = await retrieveAccountKeysSet(account);
} = await retrieveSessionInitializationKeysSet(account);

const identityKeysBlob = {
primaryIdentityPublicKeys: JSON.parse(contentIdentityKeys),
Expand Down

0 comments on commit 38818ef

Please sign in to comment.