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'; @@ -15,7 +14,10 @@ } 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 }; @@ -26,12 +28,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 @@ -8,7 +8,11 @@ } from '@commapp/olm'; import uuid from 'uuid'; -import { olmEncryptedMessageTypes } from 'lib/types/crypto-types.js'; +import { + olmEncryptedMessageTypes, + type OLMOneTimeKeys, +} from 'lib/types/crypto-types.js'; +import { values } from 'lib/utils/objects.js'; type PickledOlmAccount = { +picklingKey: string, @@ -99,6 +103,12 @@ } } +function getOneTimeKeyValues(keyBlob: string): $ReadOnlyArray { + const content: OLMOneTimeKeys = JSON.parse(keyBlob); + const keys: $ReadOnlyArray = values(content.curve25519); + return keys; +} + export { createPickledOlmAccount, createPickledOlmSession, @@ -106,4 +116,5 @@ unpickleOlmAccount, unpickleOlmSession, validateAccountPrekey, + getOneTimeKeyValues, };