From da810c329d7addce76e4bc7a3f3ee328913ee4a9 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Mon, 7 Oct 2024 17:44:38 +0200 Subject: [PATCH] Use new `CryptoEvent` import --- playwright/e2e/crypto/utils.ts | 3 ++- src/DecryptionFailureTracker.ts | 4 ++-- src/DeviceListener.ts | 3 +-- .../views/dialogs/security/CreateSecretStorageDialog.tsx | 3 +-- src/components/structures/MatrixChat.tsx | 3 +-- .../structures/MatrixClientContextProvider.tsx | 3 ++- src/components/structures/RoomView.tsx | 2 +- src/components/structures/auth/LoginSplashView.tsx | 3 ++- .../views/dialogs/devtools/VerificationExplorer.tsx | 2 +- src/components/views/right_panel/UserInfo.tsx | 3 +-- src/components/views/rooms/EventTile.tsx | 8 ++++++-- src/components/views/rooms/MemberTile.tsx | 3 +-- src/components/views/settings/CrossSigningPanel.tsx | 2 +- src/components/views/settings/SecureBackupPanel.tsx | 3 +-- src/components/views/settings/devices/useOwnDevices.ts | 3 +-- src/stores/SetupEncryptionStore.ts | 2 +- src/stores/right-panel/RightPanelStore.ts | 2 +- test/DecryptionFailureTracker-test.ts | 4 ++-- test/DeviceListener-test.ts | 9 +++++++-- .../structures/MatrixClientContextProvider-test.tsx | 4 ++-- 20 files changed, 37 insertions(+), 32 deletions(-) diff --git a/playwright/e2e/crypto/utils.ts b/playwright/e2e/crypto/utils.ts index 31cf69b0df..1d73781c2b 100644 --- a/playwright/e2e/crypto/utils.ts +++ b/playwright/e2e/crypto/utils.ts @@ -7,8 +7,9 @@ Please see LICENSE files in the repository root for full details. */ import { expect, JSHandle, type Page } from "@playwright/test"; +import { ICreateRoomOpts, MatrixClient } from "matrix-js-sdk/src/matrix"; +import { CryptoEvent } from "matrix-js-sdk/src/crypto-api"; -import type { CryptoEvent, ICreateRoomOpts, MatrixClient } from "matrix-js-sdk/src/matrix"; import type { EmojiMapping, ShowSasCallbacks, diff --git a/src/DecryptionFailureTracker.ts b/src/DecryptionFailureTracker.ts index 54030cdec8..d3f2ad2671 100644 --- a/src/DecryptionFailureTracker.ts +++ b/src/DecryptionFailureTracker.ts @@ -7,9 +7,9 @@ Please see LICENSE files in the repository root for full details. */ import { ScalableBloomFilter } from "bloom-filters"; -import { CryptoEvent, HttpApiEvent, MatrixClient, MatrixEventEvent, MatrixEvent } from "matrix-js-sdk/src/matrix"; +import { HttpApiEvent, MatrixClient, MatrixEventEvent, MatrixEvent } from "matrix-js-sdk/src/matrix"; import { Error as ErrorEvent } from "@matrix-org/analytics-events/types/typescript/Error"; -import { DecryptionFailureCode } from "matrix-js-sdk/src/crypto-api"; +import { DecryptionFailureCode, CryptoEvent } from "matrix-js-sdk/src/crypto-api"; import { PosthogAnalytics } from "./PosthogAnalytics"; import { MEGOLM_ENCRYPTION_ALGORITHM } from "./utils/crypto"; diff --git a/src/DeviceListener.ts b/src/DeviceListener.ts index 813a734260..618d50df92 100644 --- a/src/DeviceListener.ts +++ b/src/DeviceListener.ts @@ -16,8 +16,7 @@ import { ClientStoppedError, } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; -import { KeyBackupInfo } from "matrix-js-sdk/src/crypto-api"; +import { CryptoEvent, KeyBackupInfo } from "matrix-js-sdk/src/crypto-api"; import { CryptoSessionStateChange } from "@matrix-org/analytics-events/types/typescript/CryptoSessionStateChange"; import { PosthogAnalytics } from "./PosthogAnalytics"; diff --git a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx index aee013974e..1f4a82d240 100644 --- a/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx +++ b/src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx @@ -11,9 +11,8 @@ import React, { createRef } from "react"; import FileSaver from "file-saver"; import { logger } from "matrix-js-sdk/src/logger"; import { AuthDict, CrossSigningKeys, MatrixError, UIAFlow, UIAResponse } from "matrix-js-sdk/src/matrix"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; +import { CryptoEvent, BackupTrustInfo, GeneratedSecretStorageKey, KeyBackupInfo } from "matrix-js-sdk/src/crypto-api"; import classNames from "classnames"; -import { BackupTrustInfo, GeneratedSecretStorageKey, KeyBackupInfo } from "matrix-js-sdk/src/crypto-api"; import { MatrixClientPeg } from "../../../../MatrixClientPeg"; import { _t, _td } from "../../../../languageHandler"; diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index f3b75dfce8..ca024fa9c7 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -22,8 +22,7 @@ import { import { defer, IDeferred, QueryDict } from "matrix-js-sdk/src/utils"; import { logger } from "matrix-js-sdk/src/logger"; import { throttle } from "lodash"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; -import { KeyBackupInfo } from "matrix-js-sdk/src/crypto-api"; +import { CryptoEvent, KeyBackupInfo } from "matrix-js-sdk/src/crypto-api"; // what-input helps improve keyboard accessibility import "what-input"; diff --git a/src/components/structures/MatrixClientContextProvider.tsx b/src/components/structures/MatrixClientContextProvider.tsx index a42623f890..384a8fa8ac 100644 --- a/src/components/structures/MatrixClientContextProvider.tsx +++ b/src/components/structures/MatrixClientContextProvider.tsx @@ -7,7 +7,8 @@ Please see LICENSE files in the repository root for full details. */ import React, { PropsWithChildren, useEffect, useState } from "react"; -import { CryptoEvent, MatrixClient } from "matrix-js-sdk/src/matrix"; +import { MatrixClient } from "matrix-js-sdk/src/matrix"; +import { CryptoEvent } from "matrix-js-sdk/src/crypto-api"; import { logger } from "matrix-js-sdk/src/logger"; import MatrixClientContext from "../../contexts/MatrixClientContext"; diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 958c93bebc..9f0a0beea4 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -34,7 +34,7 @@ import { KnownMembership } from "matrix-js-sdk/src/types"; import { logger } from "matrix-js-sdk/src/logger"; import { CallState, MatrixCall } from "matrix-js-sdk/src/webrtc/call"; import { debounce, throttle } from "lodash"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; +import { CryptoEvent } from "matrix-js-sdk/src/crypto-api"; import { ViewRoomOpts } from "@matrix-org/react-sdk-module-api/lib/lifecycles/RoomViewLifecycle"; import shouldHideEvent from "../../shouldHideEvent"; diff --git a/src/components/structures/auth/LoginSplashView.tsx b/src/components/structures/auth/LoginSplashView.tsx index bec3cdbbcb..a75cc14261 100644 --- a/src/components/structures/auth/LoginSplashView.tsx +++ b/src/components/structures/auth/LoginSplashView.tsx @@ -7,7 +7,8 @@ Please see LICENSE files in the repository root for full details. */ import React from "react"; -import { CryptoEvent, MatrixClient } from "matrix-js-sdk/src/matrix"; +import { MatrixClient } from "matrix-js-sdk/src/matrix"; +import { CryptoEvent } from "matrix-js-sdk/src/crypto-api"; import { messageForSyncError } from "../../../utils/ErrorUtils"; import Spinner from "../../views/elements/Spinner"; diff --git a/src/components/views/dialogs/devtools/VerificationExplorer.tsx b/src/components/views/dialogs/devtools/VerificationExplorer.tsx index 9b292c9daf..017f1b95b4 100644 --- a/src/components/views/dialogs/devtools/VerificationExplorer.tsx +++ b/src/components/views/dialogs/devtools/VerificationExplorer.tsx @@ -12,8 +12,8 @@ import { VerificationPhase as Phase, VerificationRequest, VerificationRequestEvent, + CryptoEvent, } from "matrix-js-sdk/src/crypto-api"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; import { useTypedEventEmitter, useTypedEventEmitterState } from "../../../../hooks/useEventEmitter"; import { _t, _td, TranslationKey } from "../../../../languageHandler"; diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index dd4752b783..c895025c85 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -23,9 +23,8 @@ import { EventType, } from "matrix-js-sdk/src/matrix"; import { KnownMembership } from "matrix-js-sdk/src/types"; -import { UserVerificationStatus, VerificationRequest } from "matrix-js-sdk/src/crypto-api"; +import { UserVerificationStatus, VerificationRequest, CryptoEvent } from "matrix-js-sdk/src/crypto-api"; import { logger } from "matrix-js-sdk/src/logger"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; import { Heading, MenuItem, Text, Tooltip } from "@vector-im/compound-web"; import ChatIcon from "@vector-im/compound-design-tokens/assets/web/icons/chat"; import CheckIcon from "@vector-im/compound-design-tokens/assets/web/icons/check"; diff --git a/src/components/views/rooms/EventTile.tsx b/src/components/views/rooms/EventTile.tsx index a41dbc218f..f4fd34c518 100644 --- a/src/components/views/rooms/EventTile.tsx +++ b/src/components/views/rooms/EventTile.tsx @@ -26,8 +26,12 @@ import { } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; import { CallErrorCode } from "matrix-js-sdk/src/webrtc/call"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; -import { EventShieldColour, EventShieldReason, UserVerificationStatus } from "matrix-js-sdk/src/crypto-api"; +import { + CryptoEvent, + EventShieldColour, + EventShieldReason, + UserVerificationStatus, +} from "matrix-js-sdk/src/crypto-api"; import { Tooltip } from "@vector-im/compound-web"; import ReplyChain from "../elements/ReplyChain"; diff --git a/src/components/views/rooms/MemberTile.tsx b/src/components/views/rooms/MemberTile.tsx index d81a54494e..30308fdec8 100644 --- a/src/components/views/rooms/MemberTile.tsx +++ b/src/components/views/rooms/MemberTile.tsx @@ -10,8 +10,7 @@ Please see LICENSE files in the repository root for full details. import React from "react"; import { RoomMember, RoomStateEvent, MatrixEvent, EventType } from "matrix-js-sdk/src/matrix"; import { DeviceInfo } from "matrix-js-sdk/src/crypto/deviceinfo"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; -import { UserVerificationStatus } from "matrix-js-sdk/src/crypto-api"; +import { CryptoEvent, UserVerificationStatus } from "matrix-js-sdk/src/crypto-api"; import dis from "../../../dispatcher/dispatcher"; import { _t } from "../../../languageHandler"; diff --git a/src/components/views/settings/CrossSigningPanel.tsx b/src/components/views/settings/CrossSigningPanel.tsx index 3bae145a1a..6d00e182e8 100644 --- a/src/components/views/settings/CrossSigningPanel.tsx +++ b/src/components/views/settings/CrossSigningPanel.tsx @@ -9,7 +9,7 @@ Please see LICENSE files in the repository root for full details. import React from "react"; import { ClientEvent, MatrixEvent } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; +import { CryptoEvent } from "matrix-js-sdk/src/crypto-api"; import { MatrixClientPeg } from "../../../MatrixClientPeg"; import { _t } from "../../../languageHandler"; diff --git a/src/components/views/settings/SecureBackupPanel.tsx b/src/components/views/settings/SecureBackupPanel.tsx index 54edac2d0e..dac7425e3c 100644 --- a/src/components/views/settings/SecureBackupPanel.tsx +++ b/src/components/views/settings/SecureBackupPanel.tsx @@ -8,9 +8,8 @@ Please see LICENSE files in the repository root for full details. */ import React, { ReactNode } from "react"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; +import { CryptoEvent, BackupTrustInfo, KeyBackupInfo } from "matrix-js-sdk/src/crypto-api"; import { logger } from "matrix-js-sdk/src/logger"; -import { BackupTrustInfo, KeyBackupInfo } from "matrix-js-sdk/src/crypto-api"; import type CreateKeyBackupDialog from "../../../async-components/views/dialogs/security/CreateKeyBackupDialog"; import { MatrixClientPeg } from "../../../MatrixClientPeg"; diff --git a/src/components/views/settings/devices/useOwnDevices.ts b/src/components/views/settings/devices/useOwnDevices.ts index b1143017e0..51a05f6242 100644 --- a/src/components/views/settings/devices/useOwnDevices.ts +++ b/src/components/views/settings/devices/useOwnDevices.ts @@ -20,9 +20,8 @@ import { MatrixError, LocalNotificationSettings, } from "matrix-js-sdk/src/matrix"; -import { VerificationRequest } from "matrix-js-sdk/src/crypto-api"; +import { VerificationRequest, CryptoEvent } from "matrix-js-sdk/src/crypto-api"; import { logger } from "matrix-js-sdk/src/logger"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; import { _t } from "../../../../languageHandler"; import { getDeviceClientInformation, pruneClientInformation } from "../../../../utils/device/clientInformation"; diff --git a/src/stores/SetupEncryptionStore.ts b/src/stores/SetupEncryptionStore.ts index 9f7fb9c85a..56ec7a3ddf 100644 --- a/src/stores/SetupEncryptionStore.ts +++ b/src/stores/SetupEncryptionStore.ts @@ -12,9 +12,9 @@ import { VerificationPhase, VerificationRequest, VerificationRequestEvent, + CryptoEvent, } from "matrix-js-sdk/src/crypto-api"; import { logger } from "matrix-js-sdk/src/logger"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; import { Device, SecretStorage } from "matrix-js-sdk/src/matrix"; import { MatrixClientPeg } from "../MatrixClientPeg"; diff --git a/src/stores/right-panel/RightPanelStore.ts b/src/stores/right-panel/RightPanelStore.ts index 43a36e91b8..94637b9cd4 100644 --- a/src/stores/right-panel/RightPanelStore.ts +++ b/src/stores/right-panel/RightPanelStore.ts @@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details. */ import { logger } from "matrix-js-sdk/src/logger"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; +import { CryptoEvent } from "matrix-js-sdk/src/crypto-api"; import { Optional } from "matrix-events-sdk"; import defaultDispatcher from "../../dispatcher/dispatcher"; diff --git a/test/DecryptionFailureTracker-test.ts b/test/DecryptionFailureTracker-test.ts index 31a2ac3187..41e89fcf94 100644 --- a/test/DecryptionFailureTracker-test.ts +++ b/test/DecryptionFailureTracker-test.ts @@ -6,9 +6,9 @@ Please see LICENSE files in the repository root for full details. */ import { mocked, Mocked, MockedObject } from "jest-mock"; -import { CryptoEvent, HttpApiEvent, MatrixClient, MatrixEvent, MatrixEventEvent } from "matrix-js-sdk/src/matrix"; +import { HttpApiEvent, MatrixClient, MatrixEvent, MatrixEventEvent } from "matrix-js-sdk/src/matrix"; import { decryptExistingEvent, mkDecryptionFailureMatrixEvent } from "matrix-js-sdk/src/testing"; -import { CryptoApi, DecryptionFailureCode, UserVerificationStatus } from "matrix-js-sdk/src/crypto-api"; +import { CryptoApi, DecryptionFailureCode, UserVerificationStatus, CryptoEvent } from "matrix-js-sdk/src/crypto-api"; import { sleep } from "matrix-js-sdk/src/utils"; import { DecryptionFailureTracker, ErrorProperties } from "../src/DecryptionFailureTracker"; diff --git a/test/DeviceListener-test.ts b/test/DeviceListener-test.ts index 8d1315175c..394673e878 100644 --- a/test/DeviceListener-test.ts +++ b/test/DeviceListener-test.ts @@ -9,9 +9,14 @@ Please see LICENSE files in the repository root for full details. import { Mocked, mocked } from "jest-mock"; import { MatrixEvent, Room, MatrixClient, Device, ClientStoppedError } from "matrix-js-sdk/src/matrix"; import { logger } from "matrix-js-sdk/src/logger"; -import { CryptoEvent } from "matrix-js-sdk/src/crypto"; +import { + CryptoEvent, + CrossSigningStatus, + CryptoApi, + DeviceVerificationStatus, + KeyBackupInfo, +} from "matrix-js-sdk/src/crypto-api"; import { CryptoSessionStateChange } from "@matrix-org/analytics-events/types/typescript/CryptoSessionStateChange"; -import { CrossSigningStatus, CryptoApi, DeviceVerificationStatus, KeyBackupInfo } from "matrix-js-sdk/src/crypto-api"; import DeviceListener from "../src/DeviceListener"; import { MatrixClientPeg } from "../src/MatrixClientPeg"; diff --git a/test/components/structures/MatrixClientContextProvider-test.tsx b/test/components/structures/MatrixClientContextProvider-test.tsx index f939b90bf9..b63e07f090 100644 --- a/test/components/structures/MatrixClientContextProvider-test.tsx +++ b/test/components/structures/MatrixClientContextProvider-test.tsx @@ -8,8 +8,8 @@ Please see LICENSE files in the repository root for full details. import { act, render } from "@testing-library/react"; import React, { useContext } from "react"; -import { CryptoEvent, MatrixClient } from "matrix-js-sdk/src/matrix"; -import { UserVerificationStatus } from "matrix-js-sdk/src/crypto-api"; +import { MatrixClient } from "matrix-js-sdk/src/matrix"; +import { CryptoEvent, UserVerificationStatus } from "matrix-js-sdk/src/crypto-api"; import MatrixClientContext from "../../../src/contexts/MatrixClientContext"; import { MatrixClientContextProvider } from "../../../src/components/structures/MatrixClientContextProvider";