diff --git a/.eslintrc.js b/.eslintrc.js index 74318ab70e..14afc41c07 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -119,11 +119,6 @@ module.exports = { "!matrix-js-sdk/src/crypto/CrossSigning", "!matrix-js-sdk/src/crypto/recoverykey", "!matrix-js-sdk/src/crypto/dehydration", - "!matrix-js-sdk/src/crypto/verification", - "!matrix-js-sdk/src/crypto/verification/SAS", - "!matrix-js-sdk/src/crypto/verification/QRCode", - "!matrix-js-sdk/src/crypto/verification/request", - "!matrix-js-sdk/src/crypto/verification/request/VerificationRequest", "!matrix-js-sdk/src/oidc", "!matrix-js-sdk/src/oidc/discovery", "!matrix-js-sdk/src/oidc/authorize", diff --git a/playwright/e2e/crypto/utils.ts b/playwright/e2e/crypto/utils.ts index 51e0709343..d43e4c7f94 100644 --- a/playwright/e2e/crypto/utils.ts +++ b/playwright/e2e/crypto/utils.ts @@ -17,8 +17,13 @@ limitations under the License. import { type Page, expect, JSHandle } from "@playwright/test"; import type { CryptoEvent, ICreateRoomOpts, MatrixClient } from "matrix-js-sdk/src/matrix"; -import type { VerificationRequest, Verifier, EmojiMapping, VerifierEvent } from "matrix-js-sdk/src/crypto-api"; -import type { ISasEvent } from "matrix-js-sdk/src/crypto/verification/SAS"; +import type { + VerificationRequest, + Verifier, + EmojiMapping, + VerifierEvent, + ShowSasCallbacks, +} from "matrix-js-sdk/src/crypto-api"; import { Credentials, HomeserverInstance } from "../../plugins/homeserver"; import { Client } from "../../pages/client"; import { ElementAppPage } from "../../pages/ElementAppPage"; @@ -58,7 +63,7 @@ export function handleSasVerification(verifier: JSHandle): Promise((resolve) => { - const onShowSas = (event: ISasEvent) => { + const onShowSas = (event: ShowSasCallbacks) => { verifier.off("show_sas" as VerifierEvent, onShowSas); event.confirm(); resolve(event.sas.emoji); diff --git a/src/MatrixClientPeg.ts b/src/MatrixClientPeg.ts index 4758517390..a42903f46f 100644 --- a/src/MatrixClientPeg.ts +++ b/src/MatrixClientPeg.ts @@ -29,9 +29,8 @@ import { RoomNameType, TokenRefreshFunction, } from "matrix-js-sdk/src/matrix"; +import { VerificationMethod } from "matrix-js-sdk/src/types"; import * as utils from "matrix-js-sdk/src/utils"; -import { verificationMethods } from "matrix-js-sdk/src/crypto"; -import { SHOW_QR_CODE_METHOD } from "matrix-js-sdk/src/crypto/verification/QRCode"; import { logger } from "matrix-js-sdk/src/logger"; import createMatrixClient from "./utils/createMatrixClient"; @@ -433,9 +432,9 @@ class MatrixClientPegClass implements IMatrixClientPeg { // the call arrives. iceCandidatePoolSize: 20, verificationMethods: [ - verificationMethods.SAS, - SHOW_QR_CODE_METHOD, - verificationMethods.RECIPROCATE_QR_CODE, + VerificationMethod.Sas, + VerificationMethod.ShowQrCode, + VerificationMethod.Reciprocate, ], identityServer: new IdentityAuthClient(), // These are always installed regardless of the labs flag so that cross-signing features diff --git a/src/components/views/right_panel/VerificationPanel.tsx b/src/components/views/right_panel/VerificationPanel.tsx index 2cc93fcb1a..5e9a17a8c5 100644 --- a/src/components/views/right_panel/VerificationPanel.tsx +++ b/src/components/views/right_panel/VerificationPanel.tsx @@ -15,18 +15,17 @@ limitations under the License. */ import React from "react"; -import { verificationMethods } from "matrix-js-sdk/src/crypto"; -import { SCAN_QR_CODE_METHOD } from "matrix-js-sdk/src/crypto/verification/QRCode"; import { + ShowQrCodeCallbacks, + ShowSasCallbacks, VerificationPhase as Phase, VerificationRequest, VerificationRequestEvent, - ShowQrCodeCallbacks, - ShowSasCallbacks, VerifierEvent, } from "matrix-js-sdk/src/crypto-api"; -import { RoomMember, Device, User } from "matrix-js-sdk/src/matrix"; +import { Device, RoomMember, User } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; +import { VerificationMethod } from "matrix-js-sdk/src/types"; import { MatrixClientPeg } from "../../../MatrixClientPeg"; import VerificationQRCode from "../elements/crypto/VerificationQRCode"; @@ -87,8 +86,8 @@ export default class VerificationPanel extends React.PureComponent => { this.setState({ emojiButtonClicked: true }); - await this.props.request.startVerification(verificationMethods.SAS); + await this.props.request.startVerification(VerificationMethod.Sas); }; private onSasMatchesClick = (): void => { diff --git a/src/verification.ts b/src/verification.ts index 3b1938c5ca..64a9cf2618 100644 --- a/src/verification.ts +++ b/src/verification.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { User, MatrixClient, RoomMember } from "matrix-js-sdk/src/matrix"; -import { verificationMethods as VerificationMethods } from "matrix-js-sdk/src/crypto"; +import { VerificationMethod } from "matrix-js-sdk/src/types"; import { CrossSigningKey, VerificationRequest } from "matrix-js-sdk/src/crypto-api"; import dis from "./dispatcher/dispatcher"; @@ -61,7 +61,7 @@ export async function verifyDevice(matrixClient: MatrixClient, user: User, devic const verificationRequestPromise = matrixClient.legacyDeviceVerification( user.userId, device.deviceId, - VerificationMethods.SAS, + VerificationMethod.Sas, ); setRightPanel({ member: user, verificationRequestPromise }); } else if (action === "legacy") { diff --git a/test/components/views/right_panel/UserInfo-test.tsx b/test/components/views/right_panel/UserInfo-test.tsx index 5130a2bcdd..b40146e609 100644 --- a/test/components/views/right_panel/UserInfo-test.tsx +++ b/test/components/views/right_panel/UserInfo-test.tsx @@ -30,14 +30,14 @@ import { Device, } from "matrix-js-sdk/src/matrix"; import { KnownMembership } from "matrix-js-sdk/src/types"; -import { - Phase, - VerificationRequest, - VerificationRequestEvent, -} from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest"; import { defer } from "matrix-js-sdk/src/utils"; import { EventEmitter } from "events"; -import { UserVerificationStatus } from "matrix-js-sdk/src/crypto-api"; +import { + UserVerificationStatus, + VerificationRequest, + VerificationPhase as Phase, + VerificationRequestEvent, +} from "matrix-js-sdk/src/crypto-api"; import { TooltipProvider } from "@vector-im/compound-web"; import UserInfo, { diff --git a/test/components/views/toasts/VerificationRequestToast-test.tsx b/test/components/views/toasts/VerificationRequestToast-test.tsx index fe3f7886bd..deb3e564a3 100644 --- a/test/components/views/toasts/VerificationRequestToast-test.tsx +++ b/test/components/views/toasts/VerificationRequestToast-test.tsx @@ -17,11 +17,8 @@ limitations under the License. import React, { ComponentProps } from "react"; import { mocked, Mocked } from "jest-mock"; import { act, render, RenderResult } from "@testing-library/react"; -import { - VerificationRequest, - VerificationRequestEvent, -} from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest"; import { TypedEventEmitter, IMyDevice, MatrixClient, Device } from "matrix-js-sdk/src/matrix"; +import { VerificationRequest, VerificationRequestEvent } from "matrix-js-sdk/src/crypto-api"; import VerificationRequestToast from "../../../../src/components/views/toasts/VerificationRequestToast"; import {