Skip to content

Commit 19fbd6b

Browse files
committed
Merge branch 'develop' into florianduros/rip-out-legacy-crypto/remove-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
2 parents b3ec086 + ff1db2b commit 19fbd6b

File tree

257 files changed

+1676
-1461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+1676
-1461
lines changed

.github/workflows/sonarcloud.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
steps:
2828
# We create the status here and then update it to success/failure in the `report` stage
2929
# This provides an easy link to this workflow_run from the PR before Sonarcloud is done.
30-
- uses: guibranco/github-status-action-v2@ecd54a02cf761e85a8fb328fe937710fd4227cda
30+
- uses: guibranco/github-status-action-v2@119b3320db3f04d89e91df840844b92d57ce3468
3131
with:
3232
authToken: ${{ secrets.GITHUB_TOKEN }}
3333
state: pending
@@ -87,7 +87,7 @@ jobs:
8787
revision: ${{ github.event.workflow_run.head_sha }}
8888
token: ${{ secrets.SONAR_TOKEN }}
8989

90-
- uses: guibranco/github-status-action-v2@ecd54a02cf761e85a8fb328fe937710fd4227cda
90+
- uses: guibranco/github-status-action-v2@119b3320db3f04d89e91df840844b92d57ce3468
9191
if: always()
9292
with:
9393
authToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116
steps:
117117
- name: Skip SonarCloud on merge queues
118118
if: env.ENABLE_COVERAGE == 'false'
119-
uses: guibranco/github-status-action-v2@ecd54a02cf761e85a8fb328fe937710fd4227cda
119+
uses: guibranco/github-status-action-v2@119b3320db3f04d89e91df840844b92d57ce3468
120120
with:
121121
authToken: ${{ secrets.GITHUB_TOKEN }}
122122
state: success

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"@babel/preset-typescript": "^7.12.7",
8282
"@casualbot/jest-sonar-reporter": "2.2.7",
8383
"@peculiar/webcrypto": "^1.4.5",
84-
"@stylistic/eslint-plugin": "^2.9.0",
84+
"@stylistic/eslint-plugin": "^3.0.0",
8585
"@types/bs58": "^4.0.1",
8686
"@types/content-type": "^1.1.5",
8787
"@types/debug": "^4.1.7",
@@ -101,7 +101,7 @@
101101
"eslint-plugin-import": "^2.26.0",
102102
"eslint-plugin-jest": "^28.0.0",
103103
"eslint-plugin-jsdoc": "^50.0.0",
104-
"eslint-plugin-matrix-org": "^2.0.1",
104+
"eslint-plugin-matrix-org": "^2.1.0",
105105
"eslint-plugin-n": "^14.0.0",
106106
"eslint-plugin-tsdoc": "^0.4.0",
107107
"eslint-plugin-unicorn": "^56.0.0",

spec/TestClient.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ import type { IDeviceKeys, IOneTimeKey } from "../src/@types/crypto";
2828
import type { IE2EKeyReceiver } from "./test-utils/E2EKeyReceiver";
2929
import { logger } from "../src/logger";
3030
import { syncPromise } from "./test-utils/test-utils";
31-
import { createClient, IStartClientOpts } from "../src/matrix";
32-
import { ICreateClientOpts, IDownloadKeyResult, MatrixClient, PendingEventOrdering } from "../src/client";
33-
import { IKeysUploadResponse, IUploadKeysRequest } from "../src/client";
34-
import { ISyncResponder } from "./test-utils/SyncResponder";
31+
import { createClient, type IStartClientOpts } from "../src/matrix";
32+
import { type ICreateClientOpts, type IDownloadKeyResult, type MatrixClient, PendingEventOrdering } from "../src/client";
33+
import { type IKeysUploadResponse, type IUploadKeysRequest } from "../src/client";
34+
import { type ISyncResponder } from "./test-utils/SyncResponder";
3535

3636
/**
3737
* Wrapper for a MockStorageApi, MockHttpBackend and MatrixClient

spec/integ/crypto/cross-signing.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ import "fake-indexeddb/auto";
1919
import { IDBFactory } from "fake-indexeddb";
2020

2121
import { syncPromise } from "../../test-utils/test-utils";
22-
import { AuthDict, createClient, MatrixClient } from "../../../src";
22+
import { type AuthDict, createClient, type MatrixClient } from "../../../src";
2323
import { mockInitialApiRequests, mockSetupCrossSigningRequests } from "../../test-utils/mockEndpoints";
2424
import encryptAESSecretStorageItem from "../../../src/utils/encryptAESSecretStorageItem.ts";
25-
import { CryptoCallbacks, CrossSigningKey } from "../../../src/crypto-api";
25+
import { type CryptoCallbacks, CrossSigningKey } from "../../../src/crypto-api";
2626
import { SECRET_STORAGE_ALGORITHM_V1_AES } from "../../../src/secret-storage";
27-
import { ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
27+
import { type ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
2828
import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
2929
import {
3030
MASTER_CROSS_SIGNING_PRIVATE_KEY_BASE64,

spec/integ/crypto/crypto.spec.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import anotherjson from "another-json";
1919
import fetchMock from "fetch-mock-jest";
2020
import "fake-indexeddb/auto";
2121
import { IDBFactory } from "fake-indexeddb";
22-
import FetchMock from "fetch-mock";
23-
import Olm from "@matrix-org/olm";
2422

23+
import type FetchMock from "fetch-mock";
24+
import type Olm from "@matrix-org/olm";
2525
import * as testUtils from "../../test-utils/test-utils";
2626
import {
2727
emitPromise,
@@ -47,18 +47,18 @@ import {
4747
ClientEvent,
4848
createClient,
4949
HistoryVisibility,
50-
IClaimOTKsResult,
51-
IContent,
52-
IDownloadKeyResult,
53-
IEvent,
54-
IStartClientOpts,
55-
MatrixClient,
50+
type IClaimOTKsResult,
51+
type IContent,
52+
type IDownloadKeyResult,
53+
type IEvent,
54+
type IStartClientOpts,
55+
type MatrixClient,
5656
MatrixEvent,
5757
MatrixEventEvent,
5858
PendingEventOrdering,
5959
} from "../../../src/matrix";
6060
import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
61-
import { ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
61+
import { type ISyncResponder, SyncResponder } from "../../test-utils/SyncResponder";
6262
import { defer, escapeRegExp } from "../../../src/utils";
6363
import { downloadDeviceToJsDevice } from "../../../src/rust-crypto/device-converter";
6464
import { flushPromises } from "../../test-utils/flushPromises";
@@ -67,15 +67,15 @@ import {
6767
mockSetupCrossSigningRequests,
6868
mockSetupMegolmBackupRequests,
6969
} from "../../test-utils/mockEndpoints";
70-
import { SecretStorageKeyDescription } from "../../../src/secret-storage";
70+
import { type SecretStorageKeyDescription } from "../../../src/secret-storage";
7171
import {
7272
CrossSigningKey,
73-
CryptoCallbacks,
73+
type CryptoCallbacks,
7474
DecryptionFailureCode,
75-
DeviceIsolationMode,
75+
type DeviceIsolationMode,
7676
EventShieldColour,
7777
EventShieldReason,
78-
KeyBackupInfo,
78+
type KeyBackupInfo,
7979
AllDevicesIsolationMode,
8080
OnlySignedDevicesIsolationMode,
8181
} from "../../../src/crypto-api";
@@ -92,7 +92,7 @@ import {
9292
import { AccountDataAccumulator } from "../../test-utils/AccountDataAccumulator";
9393
import { UNSIGNED_MEMBERSHIP_FIELD } from "../../../src/@types/event";
9494
import { KnownMembership } from "../../../src/@types/membership";
95-
import { KeyBackup } from "../../../src/rust-crypto/backup.ts";
95+
import { type KeyBackup } from "../../../src/rust-crypto/backup.ts";
9696
import { CryptoEvent } from "../../../src/crypto-api";
9797

9898
afterEach(() => {

spec/integ/crypto/device-dehydration.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ limitations under the License.
1717
import "fake-indexeddb/auto";
1818
import fetchMock from "fetch-mock-jest";
1919

20-
import { ClientEvent, createClient, MatrixClient, MatrixEvent } from "../../../src";
20+
import { ClientEvent, createClient, type MatrixClient, MatrixEvent } from "../../../src";
2121
import { CryptoEvent } from "../../../src/crypto-api/index";
22-
import { RustCrypto } from "../../../src/rust-crypto/rust-crypto";
23-
import { AddSecretStorageKeyOpts } from "../../../src/secret-storage";
22+
import { type RustCrypto } from "../../../src/rust-crypto/rust-crypto";
23+
import { type AddSecretStorageKeyOpts } from "../../../src/secret-storage";
2424
import { E2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
2525
import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder";
2626
import { emitPromise, EventCounter } from "../../test-utils/test-utils";

spec/integ/crypto/megolm-backup.spec.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ limitations under the License.
1717
import fetchMock from "fetch-mock-jest";
1818
import "fake-indexeddb/auto";
1919
import { IDBFactory } from "fake-indexeddb";
20-
import { Mocked } from "jest-mock";
20+
import { type Mocked } from "jest-mock";
2121

2222
import {
2323
createClient,
2424
encodeBase64,
25-
ICreateClientOpts,
26-
IEvent,
27-
IMegolmSessionData,
28-
MatrixClient,
25+
type ICreateClientOpts,
26+
type IEvent,
27+
type IMegolmSessionData,
28+
type MatrixClient,
2929
TypedEventEmitter,
3030
} from "../../../src";
3131
import { SyncResponder } from "../../test-utils/SyncResponder";
@@ -34,11 +34,11 @@ import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder";
3434
import { mockInitialApiRequests } from "../../test-utils/mockEndpoints";
3535
import { advanceTimersUntil, awaitDecryption, syncPromise } from "../../test-utils/test-utils";
3636
import * as testData from "../../test-utils/test-data";
37-
import { KeyBackupInfo, KeyBackupSession } from "../../../src/crypto-api/keybackup";
37+
import { type KeyBackupInfo, type KeyBackupSession } from "../../../src/crypto-api/keybackup";
3838
import { flushPromises } from "../../test-utils/flushPromises";
39-
import { defer, IDeferred } from "../../../src/utils";
39+
import { defer, type IDeferred } from "../../../src/utils";
4040
import { decodeRecoveryKey, DecryptionFailureCode, CryptoEvent, CryptoApi } from "../../../src/crypto-api";
41-
import { KeyBackup } from "../../../src/rust-crypto/backup.ts";
41+
import { type KeyBackup } from "../../../src/rust-crypto/backup.ts";
4242

4343
const ROOM_ID = testData.TEST_ROOM_ID;
4444

spec/integ/crypto/olm-utils.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@ limitations under the License.
1717
import Olm from "@matrix-org/olm";
1818
import anotherjson from "another-json";
1919

20-
import { IContent, IDeviceKeys, IDownloadKeyResult, IEvent, Keys, MatrixClient, SigningKeys } from "../../../src";
21-
import { IE2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
22-
import { ISyncResponder } from "../../test-utils/SyncResponder";
20+
import {
21+
type IContent,
22+
type IDeviceKeys,
23+
type IDownloadKeyResult,
24+
type IEvent,
25+
type Keys,
26+
type MatrixClient,
27+
type SigningKeys,
28+
} from "../../../src";
29+
import { type IE2EKeyReceiver } from "../../test-utils/E2EKeyReceiver";
30+
import { type ISyncResponder } from "../../test-utils/SyncResponder";
2331
import { syncPromise } from "../../test-utils/test-utils";
24-
import { KeyBackupInfo } from "../../../src/crypto-api";
32+
import { type KeyBackupInfo } from "../../../src/crypto-api";
2533

2634
/**
2735
* @module

spec/integ/crypto/to-device-messages.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import "fake-indexeddb/auto";
1919
import { IDBFactory } from "fake-indexeddb";
2020

2121
import { getSyncResponse, syncPromise } from "../../test-utils/test-utils";
22-
import { createClient, MatrixClient } from "../../../src";
22+
import { createClient, type MatrixClient } from "../../../src";
2323
import * as testData from "../../test-utils/test-data";
2424
import { E2EKeyResponder } from "../../test-utils/E2EKeyResponder";
2525
import { SyncResponder } from "../../test-utils/SyncResponder";

spec/integ/crypto/verification.spec.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@ limitations under the License.
1717
import "fake-indexeddb/auto";
1818

1919
import anotherjson from "another-json";
20-
import FetchMock from "fetch-mock";
2120
import fetchMock from "fetch-mock-jest";
2221
import { IDBFactory } from "fake-indexeddb";
2322
import { createHash } from "crypto";
2423
import Olm from "@matrix-org/olm";
2524

25+
import type FetchMock from "fetch-mock";
2626
import {
2727
createClient,
2828
DeviceVerification,
29-
IContent,
30-
ICreateClientOpts,
31-
IEvent,
32-
MatrixClient,
29+
type IContent,
30+
type ICreateClientOpts,
31+
type IEvent,
32+
type MatrixClient,
3333
MatrixEvent,
3434
MatrixEventEvent,
3535
} from "../../../src";
3636
import {
3737
canAcceptVerificationRequest,
38-
ShowQrCodeCallbacks,
39-
ShowSasCallbacks,
38+
type ShowQrCodeCallbacks,
39+
type ShowSasCallbacks,
4040
VerificationPhase,
41-
VerificationRequest,
41+
type VerificationRequest,
4242
VerificationRequestEvent,
43-
Verifier,
43+
type Verifier,
4444
VerifierEvent,
4545
} from "../../../src/crypto-api/verification";
4646
import { defer, escapeRegExp } from "../../../src/utils";
@@ -71,9 +71,9 @@ import {
7171
encryptMegolmEvent,
7272
encryptSecretSend,
7373
getTestOlmAccountKeys,
74-
ToDeviceEvent,
74+
type ToDeviceEvent,
7575
} from "./olm-utils";
76-
import { KeyBackupInfo, CryptoEvent } from "../../../src/crypto-api";
76+
import { type KeyBackupInfo, CryptoEvent } from "../../../src/crypto-api";
7777
import { encodeBase64 } from "../../../src/base64";
7878

7979
// The verification flows use javascript timers to set timeouts. We tell jest to use mock timer implementations

spec/integ/matrix-client-event-emitter.spec.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import HttpBackend from "matrix-mock-request";
18-
17+
import type HttpBackend from "matrix-mock-request";
1918
import {
2019
ClientEvent,
2120
HttpApiEvent,
22-
IEvent,
23-
MatrixClient,
21+
type IEvent,
22+
type MatrixClient,
2423
RoomEvent,
2524
RoomMemberEvent,
2625
RoomStateEvent,

spec/integ/matrix-client-event-timeline.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ import {
2323
EventTimelineSet,
2424
EventType,
2525
Filter,
26-
IEvent,
27-
MatrixClient,
26+
type IEvent,
27+
type MatrixClient,
2828
MatrixEvent,
2929
PendingEventOrdering,
3030
RelationType,
3131
Room,
3232
} from "../../src/matrix";
3333
import { logger } from "../../src/logger";
34-
import { encodeParams, encodeUri, QueryDict, replaceParam } from "../../src/utils";
34+
import { encodeParams, encodeUri, type QueryDict, replaceParam } from "../../src/utils";
3535
import { TestClient } from "../TestClient";
3636
import { FeatureSupport, Thread, ThreadEvent } from "../../src/models/thread";
3737
import { emitPromise } from "../test-utils/test-utils";

spec/integ/matrix-client-methods.spec.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,28 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16+
import { type Mocked } from "jest-mock";
1617
import HttpBackend from "matrix-mock-request";
1718

19+
import type HttpBackend from "matrix-mock-request";
1820
import * as utils from "../test-utils/test-utils";
19-
import { IStoredClientOpts, MatrixClient } from "../../src/client";
21+
import { type IStoredClientOpts, MatrixClient } from "../../src/client";
2022
import { MatrixEvent } from "../../src/models/event";
2123
import {
2224
Filter,
2325
JoinRule,
24-
KnockRoomOpts,
26+
type KnockRoomOpts,
2527
MemoryStore,
2628
Method,
2729
Room,
28-
RoomSummary,
30+
type RoomSummary,
2931
SERVICE_TYPES,
3032
} from "../../src/matrix";
3133
import { TestClient } from "../TestClient";
3234
import { THREAD_RELATION_TYPE } from "../../src/models/thread";
33-
import { IFilterDefinition } from "../../src/filter";
34-
import { ISearchResults } from "../../src/@types/search";
35-
import { IStore } from "../../src/store";
35+
import { type IFilterDefinition } from "../../src/filter";
36+
import { type ISearchResults } from "../../src/@types/search";
37+
import { type IStore } from "../../src/store";
3638
import { SetPresence } from "../../src/sync";
3739
import { KnownMembership } from "../../src/@types/membership";
3840

spec/integ/matrix-client-opts.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ClientEvent, MatrixClient } from "../../src/matrix";
55
import { MatrixScheduler } from "../../src/scheduler";
66
import { MemoryStore } from "../../src/store/memory";
77
import { MatrixError } from "../../src/http-api";
8-
import { IStore } from "../../src/store";
8+
import { type IStore } from "../../src/store";
99
import { KnownMembership } from "../../src/@types/membership";
1010

1111
describe("MatrixClient opts", function () {

spec/integ/matrix-client-relations.spec.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
*/
1717

18-
import HttpBackend from "matrix-mock-request";
19-
20-
import { Direction, MatrixClient, MatrixScheduler } from "../../src/matrix";
18+
import type HttpBackend from "matrix-mock-request";
19+
import { Direction, type MatrixClient, MatrixScheduler } from "../../src/matrix";
2120
import { TestClient } from "../TestClient";
2221

2322
describe("MatrixClient relations", () => {

spec/integ/matrix-client-retrying.spec.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import HttpBackend from "matrix-mock-request";
18-
19-
import { EventStatus, MatrixClient, MatrixScheduler, MsgType, RoomEvent } from "../../src/matrix";
17+
import type HttpBackend from "matrix-mock-request";
18+
import { EventStatus, type MatrixClient, MatrixScheduler, MsgType, RoomEvent } from "../../src/matrix";
2019
import { Room } from "../../src/models/room";
2120
import { TestClient } from "../TestClient";
2221

0 commit comments

Comments
 (0)