diff --git a/keyserver/src/user/login.js b/keyserver/src/user/login.js --- a/keyserver/src/user/login.js +++ b/keyserver/src/user/login.js @@ -3,7 +3,6 @@ import type { Account as OlmAccount } from '@commapp/olm'; import { getRustAPI } from 'rust-node-addon'; -import type { OLMOneTimeKeys } from 'lib/types/crypto-types'; import { getCommConfig } from 'lib/utils/comm-config.js'; import { ServerError } from 'lib/utils/errors.js'; import { values } from 'lib/utils/objects.js'; @@ -12,7 +11,10 @@ import type { IdentityInfo } from './identity.js'; import { getMessageForException } from '../responders/utils.js'; import { fetchCallUpdateOlmAccount } from '../updaters/olm-account-updater.js'; -import { validateAccountPrekey } from '../utils/olm-utils.js'; +import { + getOneTimeKeyValues, + validateAccountPrekey, +} from '../utils/olm-utils.js'; type UserCredentials = { +username: string, +password: string }; @@ -23,12 +25,6 @@ +oneTimeKey: $ReadOnlyArray, }; -function getOneTimeKeyValues(keyBlob: string): $ReadOnlyArray { - const content: OLMOneTimeKeys = JSON.parse(keyBlob); - const keys: $ReadOnlyArray = values(content.curve25519); - return keys; -} - function retrieveAccountKeysSet(account: OlmAccount): AccountKeysSet { const identityKeys = account.identity_keys(); diff --git a/keyserver/src/utils/olm-utils.js b/keyserver/src/utils/olm-utils.js --- a/keyserver/src/utils/olm-utils.js +++ b/keyserver/src/utils/olm-utils.js @@ -81,6 +81,12 @@ return cachedOLMUtility; } +function getOneTimeKeyValues(keyBlob: string): $ReadOnlyArray { + const content: OLMOneTimeKeys = JSON.parse(keyBlob); + const keys: $ReadOnlyArray = values(content.curve25519); + return keys; +} + function shouldRotatePrekey(account: OlmAccount): boolean { const currentDate = new Date(); const lastPrekeyPublishDate = new Date(account.last_prekey_publish_time()); @@ -184,6 +190,7 @@ createPickledOlmAccount, createPickledOlmSession, getOlmUtility, + getOneTimeKeyValues, unpickleOlmAccount, unpickleOlmSession, validateAccountPrekey,