{
? `${categoryTitlePrefix.slice(0, -1)} Settings`
: `${categoryTitlePrefix} Settings`;
const showSearch = false;
- const showAddDevice = false;
- /* FIXME enable back to allow linking of device
- const showAddDevice =
+ const showAddDevice =
category === SessionSettingCategory.Devices &&
this.props.showLinkDeviceButton;
- */
return (
diff --git a/ts/receiver/multidevice.ts b/ts/receiver/multidevice.ts
index 6dd9142b6..c1c69261d 100644
--- a/ts/receiver/multidevice.ts
+++ b/ts/receiver/multidevice.ts
@@ -87,6 +87,14 @@ export async function handlePairingAuthorisationMessage(
pairingAuthorisation: SignalService.IPairingAuthorisationMessage,
dataMessage: SignalService.IDataMessage | undefined | null
): Promise {
+ if (!window.lokiFeatureFlags.useMultiDevice) {
+ window.log.info(
+ `Received a pairing authorisation message from ${envelope.source} while multi device is disabled.`
+ );
+ 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/test/session/protocols/MultiDeviceProtocol_test.ts b/ts/test/session/protocols/MultiDeviceProtocol_test.ts
index e1d248121..1a5dd8220 100644
--- a/ts/test/session/protocols/MultiDeviceProtocol_test.ts
+++ b/ts/test/session/protocols/MultiDeviceProtocol_test.ts
@@ -25,6 +25,13 @@ function generateFakeAuthorisations(
describe('MultiDeviceProtocol', () => {
const sandbox = sinon.createSandbox();
+ beforeEach(() => {
+ // Enable multidevice for tests
+ TestUtils.stubWindow('lokiFeatureFlags', {
+ useMultiDevice: true,
+ });
+ });
+
afterEach(() => {
TestUtils.restoreStubs();
sandbox.restore();
diff --git a/ts/window.d.ts b/ts/window.d.ts
index f6d15c2d6..d6b245677 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;