diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js --- a/lib/actions/user-actions.js +++ b/lib/actions/user-actions.js @@ -3,6 +3,7 @@ import invariant from 'invariant'; import * as React from 'react'; +import { usePeerOlmSessionsCreatorContext } from '../components/peer-olm-session-creator-provider.react.js'; import { useBroadcastDeviceListUpdates } from '../hooks/peer-list-hooks.js'; import type { CallSingleKeyserverEndpoint, @@ -87,7 +88,6 @@ } from '../types/user-types.js'; import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js'; import { getConfig } from '../utils/config.js'; -import { createOlmSessionWithPeer } from '../utils/crypto-utils.js'; import { getMessageForException } from '../utils/errors.js'; import { useSelector } from '../utils/redux-utils.js'; import { usingCommServicesAccessToken } from '../utils/services-utils.js'; @@ -270,6 +270,7 @@ const foreignPeerDevices = useSelector(getForeignPeerDevices); const logOut = useLogOut(primaryDeviceLogOutOptions); + const { createOlmSessionsWithPeer } = usePeerOlmSessionsCreatorContext(); return React.useCallback(async () => { const { identityClient, getAuthMetadata } = identityContext; const authMetadata = await getAuthMetadata(); @@ -307,13 +308,7 @@ }); } catch { try { - await createOlmSessionWithPeer( - authMetadata, - identityClient, - sendMessage, - userID, - deviceID, - ); + await createOlmSessionsWithPeer(userID, deviceID); const encryptedData = await olmAPI.encrypt( JSON.stringify(messageContents), deviceID, @@ -346,6 +341,7 @@ await broadcastDeviceListUpdates(foreignPeerDevices); return logOutResult; }, [ + createOlmSessionsWithPeer, broadcastDeviceListUpdates, foreignPeerDevices, identityContext, @@ -366,6 +362,7 @@ if (!identityContext) { throw new Error('Identity service client is not initialized'); } + const { createOlmSessionsWithPeer } = usePeerOlmSessionsCreatorContext(); return React.useCallback(async () => { const { identityClient, getAuthMetadata } = identityContext; @@ -404,13 +401,7 @@ }); } catch { try { - await createOlmSessionWithPeer( - authMetadata, - identityClient, - sendMessage, - userID, - primaryDeviceID, - ); + await createOlmSessionsWithPeer(userID, primaryDeviceID); const encryptedData = await olmAPI.encrypt( JSON.stringify(messageContents), primaryDeviceID, @@ -431,7 +422,7 @@ // log out of identity service, keyserver and visually return logOut(); - }, [identityContext, sendMessage, logOut]); + }, [createOlmSessionsWithPeer, identityContext, sendMessage, logOut]); } const claimUsernameActionTypes = Object.freeze({ diff --git a/lib/components/peer-olm-session-creator-provider.react.js b/lib/components/peer-olm-session-creator-provider.react.js new file mode 100644 --- /dev/null +++ b/lib/components/peer-olm-session-creator-provider.react.js @@ -0,0 +1,87 @@ +// @flow + +import invariant from 'invariant'; +import * as React from 'react'; + +import { IdentityClientContext } from '../shared/identity-client-context.js'; +import { useTunnelbroker } from '../tunnelbroker/tunnelbroker-context.js'; +import { createOlmSessionWithPeer } from '../utils/crypto-utils.js'; + +export type PeerOlmSessionCreatorContextType = { + +createOlmSessionsWithPeer: ( + userID: string, + deviceID: string, + ) => Promise, +}; + +const PeerOlmSessionCreatorContext: React.Context = + React.createContext(); + +type Props = { + +children: React.Node, +}; +function PeerOlmSessionCreatorProvider(props: Props): React.Node { + const identityContext = React.useContext(IdentityClientContext); + invariant(identityContext, 'Identity context should be set'); + const { identityClient, getAuthMetadata } = identityContext; + + const { sendMessage } = useTunnelbroker(); + + const runningPromises = React.useRef<{ + [userID: string]: { [deviceID: string]: ?Promise }, + }>({}); + + const createOlmSessionsWithPeer = React.useCallback( + (userID: string, deviceID: string) => { + if ( + runningPromises.current[userID] && + runningPromises.current[userID][deviceID] + ) { + return runningPromises.current[userID][deviceID]; + } + + const promise = (async () => { + const authMetadata = await getAuthMetadata(); + await createOlmSessionWithPeer( + authMetadata, + identityClient, + sendMessage, + userID, + deviceID, + ); + + runningPromises.current[userID][deviceID] = null; + })(); + + if (!runningPromises.current[userID]) { + runningPromises.current[userID] = {}; + } + + runningPromises.current[userID][deviceID] = promise; + return promise; + }, + [identityClient, sendMessage, getAuthMetadata], + ); + + const peerOlmSessionCreatorContextValue: PeerOlmSessionCreatorContextType = + React.useMemo( + () => ({ createOlmSessionsWithPeer }), + [createOlmSessionsWithPeer], + ); + + return ( + + {props.children} + + ); +} + +function usePeerOlmSessionsCreatorContext(): PeerOlmSessionCreatorContextType { + const context = React.useContext(PeerOlmSessionCreatorContext); + invariant(context, 'PeerOlmSessionsCreatorContext should be set'); + return context; +} + +export { PeerOlmSessionCreatorProvider, usePeerOlmSessionsCreatorContext }; diff --git a/lib/push/send-hooks.react.js b/lib/push/send-hooks.react.js --- a/lib/push/send-hooks.react.js +++ b/lib/push/send-hooks.react.js @@ -8,6 +8,7 @@ } from './send-utils.js'; import { ENSCacheContext } from '../components/ens-cache-provider.react.js'; import { NeynarClientContext } from '../components/neynar-client-provider.react.js'; +import { usePeerOlmSessionsCreatorContext } from '../components/peer-olm-session-creator-provider.react.js'; import { thickRawThreadInfosSelector } from '../selectors/thread-selectors.js'; import type { MessageData } from '../types/message-types.js'; import type { @@ -29,6 +30,9 @@ const { getENSNames } = React.useContext(ENSCacheContext); const getFCNames = React.useContext(NeynarClientContext)?.getFCNames; + const { createOlmSessionsWithPeer: olmSessionCreator } = + usePeerOlmSessionsCreatorContext(); + return React.useCallback( ( encryptedNotifUtilsAPI: EncryptedNotifUtilsAPI, @@ -38,6 +42,7 @@ return preparePushNotifs({ encryptedNotifUtilsAPI, senderDeviceDescriptor, + olmSessionCreator, messageInfos: rawMessageInfos, thickRawThreadInfos, auxUserInfos, @@ -48,6 +53,7 @@ }); }, [ + olmSessionCreator, rawMessageInfos, thickRawThreadInfos, auxUserInfos, diff --git a/lib/push/send-utils.js b/lib/push/send-utils.js --- a/lib/push/send-utils.js +++ b/lib/push/send-utils.js @@ -654,6 +654,7 @@ type PreparePushNotifsInputData = { +encryptedNotifUtilsAPI: EncryptedNotifUtilsAPI, +senderDeviceDescriptor: SenderDeviceDescriptor, + +olmSessionCreator: (userID: string, deviceID: string) => Promise, +messageInfos: { +[id: string]: RawMessageInfo }, +thickRawThreadInfos: ThickRawThreadInfos, +auxUserInfos: AuxUserInfos, @@ -669,6 +670,7 @@ const { encryptedNotifUtilsAPI, senderDeviceDescriptor, + olmSessionCreator, messageDatas, messageInfos, auxUserInfos, @@ -689,6 +691,24 @@ return null; } + const olmSessionCreationPromises = []; + for (const userID in pushInfos) { + for (const device of pushInfos[userID].devices) { + olmSessionCreationPromises.push( + olmSessionCreator(userID, device.cryptoID), + ); + } + } + + try { + await Promise.all(olmSessionCreationPromises); + } catch (e) { + // session creation may fail for some devices + // but we should still pursue notification + // delivery for others + console.log(e); + } + return await buildNotifsFromPushInfo({ encryptedNotifUtilsAPI, senderDeviceDescriptor, diff --git a/lib/tunnelbroker/peer-to-peer-context.js b/lib/tunnelbroker/peer-to-peer-context.js --- a/lib/tunnelbroker/peer-to-peer-context.js +++ b/lib/tunnelbroker/peer-to-peer-context.js @@ -7,6 +7,7 @@ type TunnelbrokerClientMessageToDevice, useTunnelbroker, } from './tunnelbroker-context.js'; +import { usePeerOlmSessionsCreatorContext } from '../components/peer-olm-session-creator-provider.react.js'; import { IdentityClientContext, type IdentityClientContextType, @@ -20,7 +21,6 @@ peerToPeerMessageTypes, } from '../types/tunnelbroker/peer-to-peer-message-types.js'; import { getConfig } from '../utils/config.js'; -import { createOlmSessionWithPeer } from '../utils/crypto-utils.js'; import { getMessageForException } from '../utils/errors.js'; type PeerToPeerContextType = { @@ -40,6 +40,7 @@ messageID: ?string, ) => Promise, identityContext: IdentityClientContextType, + peerOlmSessionsCreator: (userID: string, deviceID: string) => Promise, messageIDs: ?$ReadOnlyArray, ): Promise { const authMetadata = await identityContext.getAuthMetadata(); @@ -114,13 +115,7 @@ await sendMessageToPeer(encryptedMessage); } catch (e) { try { - await createOlmSessionWithPeer( - authMetadata, - identityContext.identityClient, - sendMessage, - message.userID, - peerDeviceID, - ); + await peerOlmSessionsCreator(message.userID, peerDeviceID); const result = await olmAPI.encryptAndPersist( message.plaintext, message.deviceID, @@ -156,6 +151,8 @@ const identityContext = React.useContext(IdentityClientContext); invariant(identityContext, 'Identity context should be set'); + const { createOlmSessionsWithPeer: peerOlmSessionsCreator } = + usePeerOlmSessionsCreatorContext(); const processOutboundMessages = React.useCallback( (messageIDs?: $ReadOnlyArray) => { processingQueue.current.push(messageIDs); @@ -168,6 +165,7 @@ await processOutboundP2PMessages( sendMessage, identityContext, + peerOlmSessionsCreator, nextMessageIDs, ); } catch (e) { @@ -182,7 +180,7 @@ })(); } }, - [identityContext, sendMessage], + [peerOlmSessionsCreator, identityContext, sendMessage], ); React.useEffect(() => { diff --git a/lib/types/crypto-types.js b/lib/types/crypto-types.js --- a/lib/types/crypto-types.js +++ b/lib/types/crypto-types.js @@ -183,7 +183,7 @@ notificationsIdentityKeys: OLMIdentityKeys, notificationsInitializationInfo: OlmSessionInitializationInfo, ) => Promise, - +isPeerNotificationsSessionInitialized: ( + +isDeviceNotificationsSessionInitialized: ( deviceID: string, ) => Promise, +reassignNotificationsSession?: ( diff --git a/lib/utils/__mocks__/config.js b/lib/utils/__mocks__/config.js --- a/lib/utils/__mocks__/config.js +++ b/lib/utils/__mocks__/config.js @@ -25,7 +25,7 @@ keyserverNotificationsSessionCreator: jest.fn(), notificationsOutboundSessionCreator: jest.fn(), isContentSessionInitialized: jest.fn(), - isPeerNotificationsSessionInitialized: jest.fn(), + isDeviceNotificationsSessionInitialized: jest.fn(), getOneTimeKeys: jest.fn(), validateAndUploadPrekeys: jest.fn(), signMessage: jest.fn(), diff --git a/lib/utils/crypto-utils.js b/lib/utils/crypto-utils.js --- a/lib/utils/crypto-utils.js +++ b/lib/utils/crypto-utils.js @@ -11,8 +11,9 @@ import type { IdentityKeysBlob, OLMIdentityKeys, + OutboundSessionCreationResult, SignedIdentityKeysBlob, -} from '../types/crypto-types'; +} from '../types/crypto-types.js'; import type { IdentityServiceClient } from '../types/identity-service-types'; import { type OutboundSessionCreation, @@ -115,6 +116,14 @@ ): Promise { const { olmAPI } = getConfig(); await olmAPI.initializeCryptoAccount(); + const [hasContentSession, hasNotifsSession] = await Promise.all([ + olmAPI.isContentSessionInitialized(deviceID), + olmAPI.isDeviceNotificationsSessionInitialized(deviceID), + ]); + + if (hasContentSession && hasNotifsSession) { + return; + } const { userID: authUserID, @@ -134,14 +143,40 @@ } const { keys } = deviceKeysResponse; - const { primaryIdentityPublicKeys } = keys.identityKeysBlob; + const { primaryIdentityPublicKeys, notificationIdentityPublicKeys } = + keys.identityKeysBlob; const recipientDeviceID = primaryIdentityPublicKeys.ed25519; - const { sessionVersion, encryptedData } = - await olmAPI.contentOutboundSessionCreator( + if (hasContentSession) { + await olmAPI.notificationsOutboundSessionCreator( + recipientDeviceID, + notificationIdentityPublicKeys, + keys.notifInitializationInfo, + ); + return; + } + + let outboundSessionCreationResult: OutboundSessionCreationResult; + if (hasNotifsSession) { + outboundSessionCreationResult = await olmAPI.contentOutboundSessionCreator( primaryIdentityPublicKeys, keys.contentInitializationInfo, ); + } else { + [outboundSessionCreationResult] = await Promise.all([ + await olmAPI.contentOutboundSessionCreator( + primaryIdentityPublicKeys, + keys.contentInitializationInfo, + ), + olmAPI.notificationsOutboundSessionCreator( + recipientDeviceID, + notificationIdentityPublicKeys, + keys.notifInitializationInfo, + ), + ]); + } + + const { sessionVersion, encryptedData } = outboundSessionCreationResult; const sessionCreationMessage: OutboundSessionCreation = { type: peerToPeerMessageTypes.OUTBOUND_SESSION_CREATION, diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h --- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h +++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h @@ -110,7 +110,7 @@ jsi::String keyserverID) override; virtual jsi::Value isNotificationsSessionInitialized(jsi::Runtime &rt) override; - virtual jsi::Value isPeerNotificationsSessionInitialized( + virtual jsi::Value isDeviceNotificationsSessionInitialized( jsi::Runtime &rt, jsi::String deviceID) override; virtual jsi::Value updateKeyserverDataInNotifStorage( diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp --- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp +++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp @@ -1207,7 +1207,7 @@ }); } -jsi::Value CommCoreModule::isPeerNotificationsSessionInitialized( +jsi::Value CommCoreModule::isDeviceNotificationsSessionInitialized( jsi::Runtime &rt, jsi::String deviceID) { auto deviceIDCpp{deviceID.utf8(rt)}; @@ -1218,7 +1218,7 @@ bool result; try { result = NotificationsCryptoModule:: - isPeerNotificationsSessionInitialized(deviceIDCpp); + isDeviceNotificationsSessionInitialized(deviceIDCpp); } catch (const std::exception &e) { error = e.what(); } diff --git a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp --- a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp +++ b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp @@ -69,8 +69,8 @@ static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_isNotificationsSessionInitialized(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->isNotificationsSessionInitialized(rt); } -static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_isPeerNotificationsSessionInitialized(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { - return static_cast(&turboModule)->isPeerNotificationsSessionInitialized(rt, args[0].asString(rt)); +static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_isDeviceNotificationsSessionInitialized(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { + return static_cast(&turboModule)->isDeviceNotificationsSessionInitialized(rt, args[0].asString(rt)); } static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_updateKeyserverDataInNotifStorage(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { return static_cast(&turboModule)->updateKeyserverDataInNotifStorage(rt, args[0].asObject(rt).asArray(rt)); @@ -250,7 +250,7 @@ methodMap_["validateAndUploadPrekeys"] = MethodMetadata {3, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_validateAndUploadPrekeys}; methodMap_["initializeNotificationsSession"] = MethodMetadata {5, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_initializeNotificationsSession}; methodMap_["isNotificationsSessionInitialized"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_isNotificationsSessionInitialized}; - methodMap_["isPeerNotificationsSessionInitialized"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_isPeerNotificationsSessionInitialized}; + methodMap_["isDeviceNotificationsSessionInitialized"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_isDeviceNotificationsSessionInitialized}; methodMap_["updateKeyserverDataInNotifStorage"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_updateKeyserverDataInNotifStorage}; methodMap_["removeKeyserverDataFromNotifStorage"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_removeKeyserverDataFromNotifStorage}; methodMap_["getKeyserverDataFromNotifStorage"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getKeyserverDataFromNotifStorage}; diff --git a/native/cpp/CommonCpp/_generated/commJSI.h b/native/cpp/CommonCpp/_generated/commJSI.h --- a/native/cpp/CommonCpp/_generated/commJSI.h +++ b/native/cpp/CommonCpp/_generated/commJSI.h @@ -38,7 +38,7 @@ virtual jsi::Value validateAndUploadPrekeys(jsi::Runtime &rt, jsi::String authUserID, jsi::String authDeviceID, jsi::String authAccessToken) = 0; virtual jsi::Value initializeNotificationsSession(jsi::Runtime &rt, jsi::String identityKeys, jsi::String prekey, jsi::String prekeySignature, std::optional oneTimeKey, jsi::String keyserverID) = 0; virtual jsi::Value isNotificationsSessionInitialized(jsi::Runtime &rt) = 0; - virtual jsi::Value isPeerNotificationsSessionInitialized(jsi::Runtime &rt, jsi::String deviceID) = 0; + virtual jsi::Value isDeviceNotificationsSessionInitialized(jsi::Runtime &rt, jsi::String deviceID) = 0; virtual jsi::Value updateKeyserverDataInNotifStorage(jsi::Runtime &rt, jsi::Array keyserversData) = 0; virtual jsi::Value removeKeyserverDataFromNotifStorage(jsi::Runtime &rt, jsi::Array keyserverIDsToDelete) = 0; virtual jsi::Value getKeyserverDataFromNotifStorage(jsi::Runtime &rt, jsi::Array keyserverIDs) = 0; @@ -255,13 +255,13 @@ return bridging::callFromJs( rt, &T::isNotificationsSessionInitialized, jsInvoker_, instance_); } - jsi::Value isPeerNotificationsSessionInitialized(jsi::Runtime &rt, jsi::String deviceID) override { + jsi::Value isDeviceNotificationsSessionInitialized(jsi::Runtime &rt, jsi::String deviceID) override { static_assert( - bridging::getParameterCount(&T::isPeerNotificationsSessionInitialized) == 2, - "Expected isPeerNotificationsSessionInitialized(...) to have 2 parameters"); + bridging::getParameterCount(&T::isDeviceNotificationsSessionInitialized) == 2, + "Expected isDeviceNotificationsSessionInitialized(...) to have 2 parameters"); return bridging::callFromJs( - rt, &T::isPeerNotificationsSessionInitialized, jsInvoker_, instance_, std::move(deviceID)); + rt, &T::isDeviceNotificationsSessionInitialized, jsInvoker_, instance_, std::move(deviceID)); } jsi::Value updateKeyserverDataInNotifStorage(jsi::Runtime &rt, jsi::Array keyserversData) override { static_assert( diff --git a/native/crypto/olm-api.js b/native/crypto/olm-api.js --- a/native/crypto/olm-api.js +++ b/native/crypto/olm-api.js @@ -96,8 +96,8 @@ deviceID, ); }, - isPeerNotificationsSessionInitialized: - commCoreModule.isPeerNotificationsSessionInitialized, + isDeviceNotificationsSessionInitialized: + commCoreModule.isDeviceNotificationsSessionInitialized, async getOneTimeKeys(numberOfKeys: number): Promise { const { contentOneTimeKeys, notificationsOneTimeKeys } = await commCoreModule.getOneTimeKeys(numberOfKeys); diff --git a/native/root.react.js b/native/root.react.js --- a/native/root.react.js +++ b/native/root.react.js @@ -30,6 +30,7 @@ import IntegrityHandler from 'lib/components/integrity-handler.react.js'; import { MediaCacheProvider } from 'lib/components/media-cache-provider.react.js'; import { NeynarClientProvider } from 'lib/components/neynar-client-provider.react.js'; +import { PeerOlmSessionCreatorProvider } from 'lib/components/peer-olm-session-creator-provider.react.js'; import PlatformDetailsSynchronizer from 'lib/components/platform-details-synchronizer.react.js'; import PrekeysHandler from 'lib/components/prekeys-handler.react.js'; import { QRAuthProvider } from 'lib/components/qr-auth-provider.react.js'; @@ -322,76 +323,80 @@ - - - - - - - - - - - - - - - - - - - - - - {gated} - - - - - - - - - - - {navigation} - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + {gated} + + + + + + + + + + + {navigation} + + + + + + + + + + + + + + + + + + + diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js --- a/native/schema/CommCoreModuleSchema.js +++ b/native/schema/CommCoreModuleSchema.js @@ -68,7 +68,7 @@ keyserverID: string, ) => Promise; +isNotificationsSessionInitialized: () => Promise; - +isPeerNotificationsSessionInitialized: ( + +isDeviceNotificationsSessionInitialized: ( deviceID: string, ) => Promise; +updateKeyserverDataInNotifStorage: ( diff --git a/web/app.react.js b/web/app.react.js --- a/web/app.react.js +++ b/web/app.react.js @@ -21,6 +21,7 @@ useModalContext, } from 'lib/components/modal-provider.react.js'; import { NeynarClientProvider } from 'lib/components/neynar-client-provider.react.js'; +import { PeerOlmSessionCreatorProvider } from 'lib/components/peer-olm-session-creator-provider.react.js'; import PlatformDetailsSynchronizer from 'lib/components/platform-details-synchronizer.react.js'; import { QRAuthProvider } from 'lib/components/qr-auth-provider.react.js'; import { StaffContextProvider } from 'lib/components/staff-provider.react.js'; @@ -559,27 +560,29 @@ onClose={releaseLockOrAbortRequest} secondaryTunnelbrokerConnection={secondaryTunnelbrokerConnection} > - - - - - - + + + + + + + + ); diff --git a/web/crypto/olm-api.js b/web/crypto/olm-api.js --- a/web/crypto/olm-api.js +++ b/web/crypto/olm-api.js @@ -52,8 +52,8 @@ contentInboundSessionCreator: proxyToWorker('contentInboundSessionCreator'), contentOutboundSessionCreator: proxyToWorker('contentOutboundSessionCreator'), isContentSessionInitialized: proxyToWorker('isContentSessionInitialized'), - isPeerNotificationsSessionInitialized: proxyToWorker( - 'isPeerNotificationsSessionInitialized', + isDeviceNotificationsSessionInitialized: proxyToWorker( + 'isDeviceNotificationsSessionInitialized', ), keyserverNotificationsSessionCreator: proxyToWorker( 'keyserverNotificationsSessionCreator', diff --git a/web/shared-worker/worker/worker-crypto.js b/web/shared-worker/worker/worker-crypto.js --- a/web/shared-worker/worker/worker-crypto.js +++ b/web/shared-worker/worker/worker-crypto.js @@ -753,7 +753,7 @@ dataEncryptionKeyDBLabel, ); }, - async isPeerNotificationsSessionInitialized(deviceID: string) { + async isDeviceNotificationsSessionInitialized(deviceID: string) { const dataPersistenceKey = getOlmDataKeyForDeviceID(deviceID); const dataEncryptionKeyDBLabel = getOlmEncryptionKeyDBLabelForDeviceID(deviceID);