diff --git a/preload.js b/preload.js index bf4471ec0..9bb88c0eb 100644 --- a/preload.js +++ b/preload.js @@ -456,6 +456,7 @@ window.lokiFeatureFlags = { enableSenderKeys: false, onionRequestHops: 3, debugMessageLogs: process.env.ENABLE_MESSAGE_LOGS, + useMultiDevice: false, }; // eslint-disable-next-line no-extend-native,func-names @@ -492,6 +493,7 @@ if (config.environment.includes('test-integration')) { useFileOnionRequests: false, debugMessageLogs: true, enableSenderKeys: true, + useMultiDevice: false, }; } diff --git a/ts/receiver/multidevice.ts b/ts/receiver/multidevice.ts index 6dd9142b6..d0caa6c42 100644 --- a/ts/receiver/multidevice.ts +++ b/ts/receiver/multidevice.ts @@ -87,6 +87,11 @@ export async function handlePairingAuthorisationMessage( pairingAuthorisation: SignalService.IPairingAuthorisationMessage, dataMessage: SignalService.IDataMessage | undefined | null ): Promise { + if (!window.lokiFeatureFlags.useMultiDevice) { + await removeFromCache(envelope); + return; + } + const { secondaryDevicePubKey, grantSignature } = pairingAuthorisation; const isGrant = grantSignature && diff --git a/ts/session/protocols/MultiDeviceProtocol.ts b/ts/session/protocols/MultiDeviceProtocol.ts index 2ae330040..3e3a2320a 100644 --- a/ts/session/protocols/MultiDeviceProtocol.ts +++ b/ts/session/protocols/MultiDeviceProtocol.ts @@ -28,6 +28,11 @@ export class MultiDeviceProtocol { public static async fetchPairingAuthorisationsIfNeeded( device: PubKey ): Promise { + // Disable fetching if we don't want to use multi device + if (!window.lokiFeatureFlags.useMultiDevice) { + return; + } + // This return here stops an infinite loop when we get all our other devices const ourKey = await UserUtil.getCurrentDevicePubKey(); if (!ourKey || device.key === ourKey) { diff --git a/ts/window.d.ts b/ts/window.d.ts index f6d15c2d6..41031dde8 100644 --- a/ts/window.d.ts +++ b/ts/window.d.ts @@ -51,7 +51,17 @@ declare global { libloki: Libloki; libsignal: LibsignalProtocol; log: any; - lokiFeatureFlags: any; + lokiFeatureFlags: { + multiDeviceUnpairing: boolean, + privateGroupChats: boolean, + useSnodeProxy: boolean, + useOnionRequests: boolean, + useFileOnionRequests: boolean, + enableSenderKeys: boolean, + onionRequestHops: number, + debugMessageLogs: boolean, + useMultiDevice: boolean, + }; lokiFileServerAPI: LokiFileServerInstance; lokiMessageAPI: LokiMessageInterface; lokiPublicChatAPI: LokiPublicChatFactoryInterface;