Skip to content

Commit

Permalink
Merge branch 'develop' into florianduros/rip-out-legacy-crypto/remove…
Browse files Browse the repository at this point in the history
…-legacy-crypto

# Conflicts:
#	spec/TestClient.ts
#	spec/integ/crypto/cross-signing.spec.ts
#	spec/integ/crypto/crypto.spec.ts
#	spec/integ/crypto/megolm-backup.spec.ts
#	spec/integ/crypto/olm-encryption-spec.ts
#	spec/integ/crypto/to-device-messages.spec.ts
#	spec/integ/crypto/verification.spec.ts
#	spec/integ/matrix-client-methods.spec.ts
#	spec/integ/matrix-client-syncing.spec.ts
#	spec/unit/crypto.spec.ts
#	spec/unit/crypto/DeviceList.spec.ts
#	spec/unit/crypto/algorithms/megolm.spec.ts
#	spec/unit/crypto/algorithms/olm.spec.ts
#	spec/unit/crypto/backup.spec.ts
#	spec/unit/crypto/cross-signing.spec.ts
#	spec/unit/crypto/crypto-utils.ts
#	spec/unit/crypto/outgoing-room-key-requests.spec.ts
#	spec/unit/crypto/secrets.spec.ts
#	spec/unit/crypto/verification/InRoomChannel.spec.ts
#	spec/unit/crypto/verification/sas.spec.ts
#	spec/unit/crypto/verification/secret_request.spec.ts
#	spec/unit/crypto/verification/util.ts
#	spec/unit/crypto/verification/verification_request.spec.ts
#	spec/unit/embedded.spec.ts
#	spec/unit/matrix-client.spec.ts
#	spec/unit/models/event.spec.ts
#	spec/unit/room.spec.ts
#	src/client.ts
#	src/common-crypto/CryptoBackend.ts
#	src/crypto/CrossSigning.ts
#	src/crypto/DeviceList.ts
#	src/crypto/EncryptionSetup.ts
#	src/crypto/OlmDevice.ts
#	src/crypto/OutgoingRoomKeyRequestManager.ts
#	src/crypto/RoomList.ts
#	src/crypto/SecretSharing.ts
#	src/crypto/SecretStorage.ts
#	src/crypto/algorithms/base.ts
#	src/crypto/algorithms/megolm.ts
#	src/crypto/algorithms/olm.ts
#	src/crypto/api.ts
#	src/crypto/backup.ts
#	src/crypto/dehydration.ts
#	src/crypto/device-converter.ts
#	src/crypto/deviceinfo.ts
#	src/crypto/index.ts
#	src/crypto/keybackup.ts
#	src/crypto/olmlib.ts
#	src/crypto/store/base.ts
#	src/crypto/store/indexeddb-crypto-store-backend.ts
#	src/crypto/store/indexeddb-crypto-store.ts
#	src/crypto/store/localStorage-crypto-store.ts
#	src/crypto/store/memory-crypto-store.ts
#	src/crypto/verification/Base.ts
#	src/crypto/verification/IllegalMethod.ts
#	src/crypto/verification/QRCode.ts
#	src/crypto/verification/SAS.ts
#	src/crypto/verification/request/Channel.ts
#	src/crypto/verification/request/InRoomChannel.ts
#	src/crypto/verification/request/ToDeviceChannel.ts
#	src/crypto/verification/request/VerificationRequest.ts
#	src/embedded.ts
#	src/models/event.ts
#	src/sync.ts
  • Loading branch information
florianduros committed Feb 5, 2025
2 parents b3ec086 + ff1db2b commit 19fbd6b
Show file tree
Hide file tree
Showing 257 changed files with 1,676 additions and 1,461 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
# We create the status here and then update it to success/failure in the `report` stage
# This provides an easy link to this workflow_run from the PR before Sonarcloud is done.
- uses: guibranco/github-status-action-v2@ecd54a02cf761e85a8fb328fe937710fd4227cda
- uses: guibranco/github-status-action-v2@119b3320db3f04d89e91df840844b92d57ce3468
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
state: pending
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
revision: ${{ github.event.workflow_run.head_sha }}
token: ${{ secrets.SONAR_TOKEN }}

- uses: guibranco/github-status-action-v2@ecd54a02cf761e85a8fb328fe937710fd4227cda
- uses: guibranco/github-status-action-v2@119b3320db3f04d89e91df840844b92d57ce3468
if: always()
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
steps:
- name: Skip SonarCloud on merge queues
if: env.ENABLE_COVERAGE == 'false'
uses: guibranco/github-status-action-v2@ecd54a02cf761e85a8fb328fe937710fd4227cda
uses: guibranco/github-status-action-v2@119b3320db3f04d89e91df840844b92d57ce3468
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
state: success
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"@babel/preset-typescript": "^7.12.7",
"@casualbot/jest-sonar-reporter": "2.2.7",
"@peculiar/webcrypto": "^1.4.5",
"@stylistic/eslint-plugin": "^2.9.0",
"@stylistic/eslint-plugin": "^3.0.0",
"@types/bs58": "^4.0.1",
"@types/content-type": "^1.1.5",
"@types/debug": "^4.1.7",
Expand All @@ -101,7 +101,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^28.0.0",
"eslint-plugin-jsdoc": "^50.0.0",
"eslint-plugin-matrix-org": "^2.0.1",
"eslint-plugin-matrix-org": "^2.1.0",
"eslint-plugin-n": "^14.0.0",
"eslint-plugin-tsdoc": "^0.4.0",
"eslint-plugin-unicorn": "^56.0.0",
Expand Down
8 changes: 4 additions & 4 deletions spec/TestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import type { IDeviceKeys, IOneTimeKey } from "../src/@types/crypto";
import type { IE2EKeyReceiver } from "./test-utils/E2EKeyReceiver";
import { logger } from "../src/logger";
import { syncPromise } from "./test-utils/test-utils";
import { createClient, IStartClientOpts } from "../src/matrix";
import { ICreateClientOpts, IDownloadKeyResult, MatrixClient, PendingEventOrdering } from "../src/client";
import { IKeysUploadResponse, IUploadKeysRequest } from "../src/client";
import { ISyncResponder } from "./test-utils/SyncResponder";
import { createClient, type IStartClientOpts } from "../src/matrix";
import { type ICreateClientOpts, type IDownloadKeyResult, type MatrixClient, PendingEventOrdering } from "../src/client";
import { type IKeysUploadResponse, type IUploadKeysRequest } from "../src/client";
import { type ISyncResponder } from "./test-utils/SyncResponder";

/**
* Wrapper for a MockStorageApi, MockHttpBackend and MatrixClient
Expand Down
6 changes: 3 additions & 3 deletions spec/integ/crypto/cross-signing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import "fake-indexeddb/auto";
import { IDBFactory } from "fake-indexeddb";

import { syncPromise } from "../../test-utils/test-utils";
import { AuthDict, createClient, MatrixClient } from "../../../src";
import { type AuthDict, createClient, type MatrixClient } from "../../../src";
import { mockInitialApiRequests, mockSetupCrossSigningRequests } from "../../test-utils/mockEndpoints";
import encryptAESSecretStorageItem from "../../../src/utils/encryptAESSecretStorageItem.ts";
import { CryptoCallbacks, CrossSigningKey } from "../../../src/crypto-api";
import { type CryptoCallbacks, CrossSigningKey } from "../../../src/crypto-api";
import { SECRET_STORAGE_ALGORITHM_V1_AES } from "../../../src/secret-storage";
import { ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
import { type ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
import {
MASTER_CROSS_SIGNING_PRIVATE_KEY_BASE64,
Expand Down
28 changes: 14 additions & 14 deletions spec/integ/crypto/crypto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import anotherjson from "another-json";
import fetchMock from "fetch-mock-jest";
import "fake-indexeddb/auto";
import { IDBFactory } from "fake-indexeddb";
import FetchMock from "fetch-mock";
import Olm from "@matrix-org/olm";

import type FetchMock from "fetch-mock";
import type Olm from "@matrix-org/olm";
import * as testUtils from "../../test-utils/test-utils";
import {
emitPromise,
Expand All @@ -47,18 +47,18 @@ import {
ClientEvent,
createClient,
HistoryVisibility,
IClaimOTKsResult,
IContent,
IDownloadKeyResult,
IEvent,
IStartClientOpts,
MatrixClient,
type IClaimOTKsResult,
type IContent,
type IDownloadKeyResult,
type IEvent,
type IStartClientOpts,
type MatrixClient,
MatrixEvent,
MatrixEventEvent,
PendingEventOrdering,
} from "../../../src/matrix";
import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
import { ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
import { type ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
import { defer, escapeRegExp } from "../../../src/utils";
import { downloadDeviceToJsDevice } from "../../../src/rust-crypto/device-converter";
import { flushPromises } from "../../test-utils/flushPromises";
Expand All @@ -67,15 +67,15 @@ import {
mockSetupCrossSigningRequests,
mockSetupMegolmBackupRequests,
} from "../../test-utils/mockEndpoints";
import { SecretStorageKeyDescription } from "../../../src/secret-storage";
import { type SecretStorageKeyDescription } from "../../../src/secret-storage";
import {
CrossSigningKey,
CryptoCallbacks,
type CryptoCallbacks,
DecryptionFailureCode,
DeviceIsolationMode,
type DeviceIsolationMode,
EventShieldColour,
EventShieldReason,
KeyBackupInfo,
type KeyBackupInfo,
AllDevicesIsolationMode,
OnlySignedDevicesIsolationMode,
} from "../../../src/crypto-api";
Expand All @@ -92,7 +92,7 @@ import {
import { AccountDataAccumulator } from "../../test-utils/AccountDataAccumulator";
import { UNSIGNED_MEMBERSHIP_FIELD } from "../../../src/@types/event";
import { KnownMembership } from "../../../src/@types/membership";
import { KeyBackup } from "../../../src/rust-crypto/backup.ts";
import { type KeyBackup } from "../../../src/rust-crypto/backup.ts";
import { CryptoEvent } from "../../../src/crypto-api";

afterEach(() => {
Expand Down
6 changes: 3 additions & 3 deletions spec/integ/crypto/device-dehydration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ limitations under the License.
import "fake-indexeddb/auto";
import fetchMock from "fetch-mock-jest";

import { ClientEvent, createClient, MatrixClient, MatrixEvent } from "../../../src";
import { ClientEvent, createClient, type MatrixClient, MatrixEvent } from "../../../src";
import { CryptoEvent } from "../../../src/crypto-api/index";
import { RustCrypto } from "../../../src/rust-crypto/rust-crypto";
import { AddSecretStorageKeyOpts } from "../../../src/secret-storage";
import { type RustCrypto } from "../../../src/rust-crypto/rust-crypto";
import { type AddSecretStorageKeyOpts } from "../../../src/secret-storage";
import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder";
import { emitPromise, EventCounter } from "../../test-utils/test-utils";
Expand Down
16 changes: 8 additions & 8 deletions spec/integ/crypto/megolm-backup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ limitations under the License.
import fetchMock from "fetch-mock-jest";
import "fake-indexeddb/auto";
import { IDBFactory } from "fake-indexeddb";
import { Mocked } from "jest-mock";
import { type Mocked } from "jest-mock";

import {
createClient,
encodeBase64,
ICreateClientOpts,
IEvent,
IMegolmSessionData,
MatrixClient,
type ICreateClientOpts,
type IEvent,
type IMegolmSessionData,
type MatrixClient,
TypedEventEmitter,
} from "../../../src";
import { SyncResponder } from "../../test-utils/SyncResponder";
Expand All @@ -34,11 +34,11 @@ import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder";
import { mockInitialApiRequests } from "../../test-utils/mockEndpoints";
import { advanceTimersUntil, awaitDecryption, syncPromise } from "../../test-utils/test-utils";
import * as testData from "../../test-utils/test-data";
import { KeyBackupInfo, KeyBackupSession } from "../../../src/crypto-api/keybackup";
import { type KeyBackupInfo, type KeyBackupSession } from "../../../src/crypto-api/keybackup";
import { flushPromises } from "../../test-utils/flushPromises";
import { defer, IDeferred } from "../../../src/utils";
import { defer, type IDeferred } from "../../../src/utils";
import { decodeRecoveryKey, DecryptionFailureCode, CryptoEvent, CryptoApi } from "../../../src/crypto-api";
import { KeyBackup } from "../../../src/rust-crypto/backup.ts";
import { type KeyBackup } from "../../../src/rust-crypto/backup.ts";

const ROOM_ID = testData.TEST_ROOM_ID;

Expand Down
16 changes: 12 additions & 4 deletions spec/integ/crypto/olm-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ limitations under the License.
import Olm from "@matrix-org/olm";
import anotherjson from "another-json";

import { IContent, IDeviceKeys, IDownloadKeyResult, IEvent, Keys, MatrixClient, SigningKeys } from "../../../src";
import { IE2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
import { ISyncResponder } from "../../test-utils/SyncResponder";
import {
type IContent,
type IDeviceKeys,
type IDownloadKeyResult,
type IEvent,
type Keys,
type MatrixClient,
type SigningKeys,
} from "../../../src";
import { type IE2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
import { type ISyncResponder } from "../../test-utils/SyncResponder";
import { syncPromise } from "../../test-utils/test-utils";
import { KeyBackupInfo } from "../../../src/crypto-api";
import { type KeyBackupInfo } from "../../../src/crypto-api";

/**
* @module
Expand Down
2 changes: 1 addition & 1 deletion spec/integ/crypto/to-device-messages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import "fake-indexeddb/auto";
import { IDBFactory } from "fake-indexeddb";

import { getSyncResponse, syncPromise } from "../../test-utils/test-utils";
import { createClient, MatrixClient } from "../../../src";
import { createClient, type MatrixClient } from "../../../src";
import * as testData from "../../test-utils/test-data";
import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder";
import { SyncResponder } from "../../test-utils/SyncResponder";
Expand Down
22 changes: 11 additions & 11 deletions spec/integ/crypto/verification.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@ limitations under the License.
import "fake-indexeddb/auto";

import anotherjson from "another-json";
import FetchMock from "fetch-mock";
import fetchMock from "fetch-mock-jest";
import { IDBFactory } from "fake-indexeddb";
import { createHash } from "crypto";
import Olm from "@matrix-org/olm";

import type FetchMock from "fetch-mock";
import {
createClient,
DeviceVerification,
IContent,
ICreateClientOpts,
IEvent,
MatrixClient,
type IContent,
type ICreateClientOpts,
type IEvent,
type MatrixClient,
MatrixEvent,
MatrixEventEvent,
} from "../../../src";
import {
canAcceptVerificationRequest,
ShowQrCodeCallbacks,
ShowSasCallbacks,
type ShowQrCodeCallbacks,
type ShowSasCallbacks,
VerificationPhase,
VerificationRequest,
type VerificationRequest,
VerificationRequestEvent,
Verifier,
type Verifier,
VerifierEvent,
} from "../../../src/crypto-api/verification";
import { defer, escapeRegExp } from "../../../src/utils";
Expand Down Expand Up @@ -71,9 +71,9 @@ import {
encryptMegolmEvent,
encryptSecretSend,
getTestOlmAccountKeys,
ToDeviceEvent,
type ToDeviceEvent,
} from "./olm-utils";
import { KeyBackupInfo, CryptoEvent } from "../../../src/crypto-api";
import { type KeyBackupInfo, CryptoEvent } from "../../../src/crypto-api";
import { encodeBase64 } from "../../../src/base64";

// The verification flows use javascript timers to set timeouts. We tell jest to use mock timer implementations
Expand Down
7 changes: 3 additions & 4 deletions spec/integ/matrix-client-event-emitter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import HttpBackend from "matrix-mock-request";

import type HttpBackend from "matrix-mock-request";
import {
ClientEvent,
HttpApiEvent,
IEvent,
MatrixClient,
type IEvent,
type MatrixClient,
RoomEvent,
RoomMemberEvent,
RoomStateEvent,
Expand Down
6 changes: 3 additions & 3 deletions spec/integ/matrix-client-event-timeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import {
EventTimelineSet,
EventType,
Filter,
IEvent,
MatrixClient,
type IEvent,
type MatrixClient,
MatrixEvent,
PendingEventOrdering,
RelationType,
Room,
} from "../../src/matrix";
import { logger } from "../../src/logger";
import { encodeParams, encodeUri, QueryDict, replaceParam } from "../../src/utils";
import { encodeParams, encodeUri, type QueryDict, replaceParam } from "../../src/utils";
import { TestClient } from "../TestClient";
import { FeatureSupport, Thread, ThreadEvent } from "../../src/models/thread";
import { emitPromise } from "../test-utils/test-utils";
Expand Down
14 changes: 8 additions & 6 deletions spec/integ/matrix-client-methods.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,28 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { type Mocked } from "jest-mock";
import HttpBackend from "matrix-mock-request";

import type HttpBackend from "matrix-mock-request";
import * as utils from "../test-utils/test-utils";
import { IStoredClientOpts, MatrixClient } from "../../src/client";
import { type IStoredClientOpts, MatrixClient } from "../../src/client";
import { MatrixEvent } from "../../src/models/event";
import {
Filter,
JoinRule,
KnockRoomOpts,
type KnockRoomOpts,
MemoryStore,
Method,
Room,
RoomSummary,
type RoomSummary,
SERVICE_TYPES,
} from "../../src/matrix";
import { TestClient } from "../TestClient";
import { THREAD_RELATION_TYPE } from "../../src/models/thread";
import { IFilterDefinition } from "../../src/filter";
import { ISearchResults } from "../../src/@types/search";
import { IStore } from "../../src/store";
import { type IFilterDefinition } from "../../src/filter";
import { type ISearchResults } from "../../src/@types/search";
import { type IStore } from "../../src/store";
import { SetPresence } from "../../src/sync";
import { KnownMembership } from "../../src/@types/membership";

Expand Down
2 changes: 1 addition & 1 deletion spec/integ/matrix-client-opts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ClientEvent, MatrixClient } from "../../src/matrix";
import { MatrixScheduler } from "../../src/scheduler";
import { MemoryStore } from "../../src/store/memory";
import { MatrixError } from "../../src/http-api";
import { IStore } from "../../src/store";
import { type IStore } from "../../src/store";
import { KnownMembership } from "../../src/@types/membership";

describe("MatrixClient opts", function () {
Expand Down
5 changes: 2 additions & 3 deletions spec/integ/matrix-client-relations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import HttpBackend from "matrix-mock-request";

import { Direction, MatrixClient, MatrixScheduler } from "../../src/matrix";
import type HttpBackend from "matrix-mock-request";
import { Direction, type MatrixClient, MatrixScheduler } from "../../src/matrix";
import { TestClient } from "../TestClient";

describe("MatrixClient relations", () => {
Expand Down
5 changes: 2 additions & 3 deletions spec/integ/matrix-client-retrying.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import HttpBackend from "matrix-mock-request";

import { EventStatus, MatrixClient, MatrixScheduler, MsgType, RoomEvent } from "../../src/matrix";
import type HttpBackend from "matrix-mock-request";
import { EventStatus, type MatrixClient, MatrixScheduler, MsgType, RoomEvent } from "../../src/matrix";
import { Room } from "../../src/models/room";
import { TestClient } from "../TestClient";

Expand Down
Loading

0 comments on commit 19fbd6b

Please sign in to comment.