diff --git a/src/components/structures/auth/SetupEncryptionBody.tsx b/src/components/structures/auth/SetupEncryptionBody.tsx index 7afa4f321b..1de7cc7d83 100644 --- a/src/components/structures/auth/SetupEncryptionBody.tsx +++ b/src/components/structures/auth/SetupEncryptionBody.tsx @@ -89,7 +89,7 @@ export default class SetupEncryptionBody extends React.Component private onVerifyClick = (): void => { const cli = MatrixClientPeg.safeGet(); const userId = cli.getSafeUserId(); - const requestPromise = cli.requestVerification(userId); + const requestPromise = cli.getCrypto()!.requestOwnUserVerification(); // We need to call onFinished now to close this dialog, and // again later to signal that the verification is complete. diff --git a/src/components/views/settings/devices/useOwnDevices.ts b/src/components/views/settings/devices/useOwnDevices.ts index 3422720077..b7eff43f0c 100644 --- a/src/components/views/settings/devices/useOwnDevices.ts +++ b/src/components/views/settings/devices/useOwnDevices.ts @@ -177,7 +177,7 @@ export const useOwnDevices = (): DevicesState => { const requestDeviceVerification = isCurrentDeviceVerified && userId ? async (deviceId: ExtendedDevice["device_id"]): Promise => { - return await matrixClient.requestVerification(userId, [deviceId]); + return await matrixClient.getCrypto()!.requestDeviceVerification(userId, deviceId); } : undefined; diff --git a/src/stores/SetupEncryptionStore.ts b/src/stores/SetupEncryptionStore.ts index 3c47d6b266..2c1e64353b 100644 --- a/src/stores/SetupEncryptionStore.ts +++ b/src/stores/SetupEncryptionStore.ts @@ -66,7 +66,7 @@ export class SetupEncryptionStore extends EventEmitter { cli.on(CryptoEvent.VerificationRequest, this.onVerificationRequest); cli.on(CryptoEvent.UserTrustStatusChanged, this.onUserTrustStatusChanged); - const requestsInProgress = cli.getVerificationRequestsToDeviceInProgress(cli.getUserId()!); + const requestsInProgress = cli.getCrypto()!.getVerificationRequestsToDeviceInProgress(cli.getUserId()!); if (requestsInProgress.length) { // If there are multiple, we take the most recent. Equally if the user sends another request from // another device after this screen has been shown, we'll switch to the new one, so this diff --git a/src/verification.ts b/src/verification.ts index 4736b4693b..aa20740b21 100644 --- a/src/verification.ts +++ b/src/verification.ts @@ -120,6 +120,6 @@ export function pendingVerificationRequestForUser( ): VerificationRequest | undefined { const dmRoom = findDMForUser(matrixClient, user.userId); if (dmRoom) { - return matrixClient.findVerificationRequestDMInProgress(dmRoom.roomId); + return matrixClient.getCrypto()!.findVerificationRequestDMInProgress(dmRoom.roomId); } } diff --git a/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx b/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx index e9c6641b39..f2e34d37e6 100644 --- a/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx +++ b/test/components/views/settings/tabs/user/SessionManagerTab-test.tsx @@ -18,7 +18,7 @@ import React from "react"; import { act, fireEvent, render, RenderResult } from "@testing-library/react"; import { DeviceInfo } from "matrix-js-sdk/src/crypto/deviceinfo"; import { logger } from "matrix-js-sdk/src/logger"; -import { VerificationRequest } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest"; +import { VerificationRequest } from "matrix-js-sdk/src/crypto-api"; import { defer, sleep } from "matrix-js-sdk/src/utils"; import { ClientEvent, @@ -88,6 +88,7 @@ describe("", () => { const mockCrypto = mocked({ getDeviceVerificationStatus: jest.fn(), + requestDeviceVerification: jest.fn().mockResolvedValue(mockVerificationRequest), } as unknown as CryptoApi); const mockClient = getMockClientWithEventEmitter({ @@ -96,7 +97,6 @@ describe("", () => { getDevices: jest.fn(), getStoredDevice: jest.fn(), getDeviceId: jest.fn().mockReturnValue(deviceId), - requestVerification: jest.fn().mockResolvedValue(mockVerificationRequest), deleteMultipleDevices: jest.fn(), generateClientSecret: jest.fn(), setDeviceDetails: jest.fn(), @@ -531,7 +531,7 @@ describe("", () => { // click verify button from current session section fireEvent.click(getByTestId(`verification-status-button-${alicesMobileDevice.device_id}`)); - expect(mockClient.requestVerification).toHaveBeenCalledWith(aliceId, [alicesMobileDevice.device_id]); + expect(mockCrypto.requestDeviceVerification).toHaveBeenCalledWith(aliceId, alicesMobileDevice.device_id); expect(modalSpy).toHaveBeenCalled(); });