diff --git a/lib/shared/crypto-utils.js b/lib/shared/crypto-utils.js --- a/lib/shared/crypto-utils.js +++ b/lib/shared/crypto-utils.js @@ -20,7 +20,7 @@ CallServerEndpointOptions, CallServerEndpoint, } from '../utils/call-server-endpoint.js'; -import { values } from '../utils/objects.js'; +import { values, entries } from '../utils/objects.js'; export type InitialNotifMessageOptions = { +callServerEndpoint?: ?CallServerEndpoint, @@ -98,6 +98,14 @@ return getPrekeyValue(prekey); } +function getOneTimeKeyArray( + oneTimeKeys: OLMOneTimeKeys, +): $ReadOnlyArray { + return entries(oneTimeKeys.curve25519).map(([key, value]: [string, string]) => + JSON.stringify({ curve25519: { [key]: value } }), + ); +} + export { getOneTimeKeyValues, getPrekeyValue, @@ -105,4 +113,5 @@ getPrekeyValueFromBlob, initialEncryptedMessageContent, useInitialNotificationsEncryptedMessage, + getOneTimeKeyArray, };