Skip to content

Commit ff2546b

Browse files
committed
Remove call of MatrixClient.setDeviceVerified
1 parent 95175ca commit ff2546b

File tree

4 files changed

+4
-270
lines changed

4 files changed

+4
-270
lines changed

src/SlashCommands.tsx

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import VoipUserMapper from "./VoipUserMapper";
4949
import { htmlSerializeFromMdIfNeeded } from "./editor/serialize";
5050
import { leaveRoomBehaviour } from "./utils/leave-behaviour";
5151
import { MatrixClientPeg } from "./MatrixClientPeg";
52-
import { getDeviceCryptoInfo } from "./utils/crypto/deviceInfo";
5352
import { isCurrentLocalRoom, reject, singleMxcUpload, success, successSync } from "./slash-commands/utils";
5453
import { deop, op } from "./slash-commands/op";
5554
import { CommandCategories } from "./slash-commands/interface";
@@ -658,69 +657,6 @@ export const Commands = [
658657
category: CommandCategories.admin,
659658
renderingTypes: [TimelineRenderingType.Room],
660659
}),
661-
new Command({
662-
command: "verify",
663-
args: "<user-id> <device-id> <device-signing-key>",
664-
description: _td("slash_command|verify"),
665-
runFn: function (cli, roomId, threadId, args) {
666-
if (args) {
667-
const matches = args.match(/^(\S+) +(\S+) +(\S+)$/);
668-
if (matches) {
669-
const userId = matches[1];
670-
const deviceId = matches[2];
671-
const fingerprint = matches[3];
672-
673-
return success(
674-
(async (): Promise<void> => {
675-
const device = await getDeviceCryptoInfo(cli, userId, deviceId);
676-
if (!device) {
677-
throw new UserFriendlyError("slash_command|verify_unknown_pair", {
678-
userId,
679-
deviceId,
680-
cause: undefined,
681-
});
682-
}
683-
const deviceTrust = await cli.getCrypto()?.getDeviceVerificationStatus(userId, deviceId);
684-
685-
if (deviceTrust?.isVerified()) {
686-
if (device.getFingerprint() === fingerprint) {
687-
throw new UserFriendlyError("slash_command|verify_nop");
688-
} else {
689-
throw new UserFriendlyError("slash_command|verify_nop_warning_mismatch");
690-
}
691-
}
692-
693-
if (device.getFingerprint() !== fingerprint) {
694-
const fprint = device.getFingerprint();
695-
throw new UserFriendlyError("slash_command|verify_mismatch", {
696-
fprint,
697-
userId,
698-
deviceId,
699-
fingerprint,
700-
cause: undefined,
701-
});
702-
}
703-
704-
await cli.setDeviceVerified(userId, deviceId, true);
705-
706-
// Tell the user we verified everything
707-
Modal.createDialog(InfoDialog, {
708-
title: _t("slash_command|verify_success_title"),
709-
description: (
710-
<div>
711-
<p>{_t("slash_command|verify_success_description", { userId, deviceId })}</p>
712-
</div>
713-
),
714-
});
715-
})(),
716-
);
717-
}
718-
}
719-
return reject(this.getUsage());
720-
},
721-
category: CommandCategories.advanced,
722-
renderingTypes: [TimelineRenderingType.Room],
723-
}),
724660
new Command({
725661
command: "discardsession",
726662
description: _td("slash_command|discardsession"),

src/components/views/dialogs/ManualDeviceKeyVerificationDialog.tsx

Lines changed: 0 additions & 90 deletions
This file was deleted.

src/verification.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { RightPanelPhases } from "./stores/right-panel/RightPanelStorePhases";
1515
import { accessSecretStorage } from "./SecurityManager";
1616
import UntrustedDeviceDialog from "./components/views/dialogs/UntrustedDeviceDialog";
1717
import { IDevice } from "./components/views/right_panel/UserInfo";
18-
import { ManualDeviceKeyVerificationDialog } from "./components/views/dialogs/ManualDeviceKeyVerificationDialog";
1918
import RightPanelStore from "./stores/right-panel/RightPanelStore";
2019
import { IRightPanelCardState } from "./stores/right-panel/RightPanelStoreIPanelState";
2120
import { findDMForUser } from "./utils/dm/findDMForUser";
@@ -48,17 +47,10 @@ export async function verifyDevice(matrixClient: MatrixClient, user: User, devic
4847
user,
4948
device,
5049
onFinished: async (action): Promise<void> => {
51-
if (action === "sas") {
52-
const verificationRequestPromise = matrixClient
53-
.getCrypto()
54-
?.requestDeviceVerification(user.userId, device.deviceId);
55-
setRightPanel({ member: user, verificationRequestPromise });
56-
} else if (action === "legacy") {
57-
Modal.createDialog(ManualDeviceKeyVerificationDialog, {
58-
userId: user.userId,
59-
device,
60-
});
61-
}
50+
const verificationRequestPromise = matrixClient
51+
.getCrypto()
52+
?.requestDeviceVerification(user.userId, device.deviceId);
53+
setRightPanel({ member: user, verificationRequestPromise });
6254
},
6355
});
6456
}

test/unit-tests/components/views/dialogs/ManualDeviceKeyVerificationDialog-test.tsx

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)