Remove references to matrix-js-sdk/src/crypto/verification (#12365)

All this stuff is deprecated and has better alternatives now.
This commit is contained in:
Richard van der Hoff 2024-03-25 17:44:45 +00:00 committed by GitHub
parent ef2bd7ae04
commit 157ca48dff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 30 additions and 35 deletions

View file

@ -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",

View file

@ -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<Verifier>): Promise<Emo
if (event) return event.sas.emoji;
return new Promise<EmojiMapping[]>((resolve) => {
const onShowSas = (event: ISasEvent) => {
const onShowSas = (event: ShowSasCallbacks) => {
verifier.off("show_sas" as VerifierEvent, onShowSas);
event.confirm();
resolve(event.sas.emoji);

View file

@ -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

View file

@ -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<IProps, IStat
private renderQRPhase(): JSX.Element {
const { member, request } = this.props;
const showSAS: boolean = request.otherPartySupportsMethod(verificationMethods.SAS);
const showQR: boolean = request.otherPartySupportsMethod(SCAN_QR_CODE_METHOD);
const showSAS: boolean = request.otherPartySupportsMethod(VerificationMethod.Sas);
const showQR: boolean = request.otherPartySupportsMethod(VerificationMethod.ScanQrCode);
const brand = SdkConfig.get().brand;
const noCommonMethodError: JSX.Element | null =
@ -368,9 +367,9 @@ export default class VerificationPanel extends React.PureComponent<IProps, IStat
return this.renderQRPhase();
case Phase.Started:
switch (request.chosenMethod) {
case verificationMethods.RECIPROCATE_QR_CODE:
case VerificationMethod.Reciprocate:
return this.renderQRReciprocatePhase();
case verificationMethods.SAS: {
case VerificationMethod.Sas: {
const emojis = this.state.sasEvent ? (
<VerificationShowSas
displayName={displayName}
@ -400,7 +399,7 @@ export default class VerificationPanel extends React.PureComponent<IProps, IStat
private startSAS = async (): Promise<void> => {
this.setState({ emojiButtonClicked: true });
await this.props.request.startVerification(verificationMethods.SAS);
await this.props.request.startVerification(VerificationMethod.Sas);
};
private onSasMatchesClick = (): void => {

View file

@ -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") {

View file

@ -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, {

View file

@ -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 {