From f03dd7b7bcafa6131f36ba8bca059e4d9300e180 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 15 May 2024 16:23:04 +0100 Subject: [PATCH] Remove deprecated methods and fields (#4201) * Remove legacy `threepidCreds` field Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove deprecated shouldUpgradeToVersion Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove `added` legacy login request field Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove deprecated re-exports Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove `home_server` field Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update imports in tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- spec/unit/crypto/cross-signing.spec.ts | 20 +++++------ spec/unit/crypto/secrets.spec.ts | 11 +++--- spec/unit/models/MSC3089Branch.spec.ts | 35 +++++++++---------- src/@types/auth.ts | 5 --- src/@types/event.ts | 6 ---- src/@types/registration.ts | 6 ---- src/client.ts | 7 ++-- src/crypto/CrossSigning.ts | 18 +++++----- src/crypto/EncryptionSetup.ts | 13 ++----- src/crypto/index.ts | 16 +++------ src/crypto/store/base.ts | 6 ++-- .../store/indexeddb-crypto-store-backend.ts | 6 ++-- src/crypto/store/indexeddb-crypto-store.ts | 6 ++-- src/crypto/store/localStorage-crypto-store.ts | 8 ++--- src/crypto/store/memory-crypto-store.ts | 8 ++--- src/interactive-auth.ts | 8 ----- src/matrix.ts | 4 --- src/models/room.ts | 21 ----------- 18 files changed, 69 insertions(+), 135 deletions(-) diff --git a/spec/unit/crypto/cross-signing.spec.ts b/spec/unit/crypto/cross-signing.spec.ts index 18ff191f5..90a6e2b31 100644 --- a/spec/unit/crypto/cross-signing.spec.ts +++ b/spec/unit/crypto/cross-signing.spec.ts @@ -23,12 +23,12 @@ import HttpBackend from "matrix-mock-request"; import * as olmlib from "../../../src/crypto/olmlib"; import { MatrixError } from "../../../src/http-api"; import { logger } from "../../../src/logger"; -import { ICrossSigningKey, ICreateClientOpts, ISignedKey, MatrixClient } from "../../../src/client"; +import { ICreateClientOpts, ISignedKey, MatrixClient } from "../../../src/client"; import { CryptoEvent } from "../../../src/crypto"; import { IDevice } from "../../../src/crypto/deviceinfo"; import { TestClient } from "../../TestClient"; import { resetCrossSigningKeys } from "./crypto-utils"; -import { BootstrapCrossSigningOpts } from "../../../src/crypto-api"; +import { BootstrapCrossSigningOpts, CrossSigningKeyInfo } from "../../../src/crypto-api"; const PUSH_RULES_RESPONSE: Response = { method: "GET", @@ -377,7 +377,7 @@ describe("Cross Signing", function () { const bobSigning = new global.Olm.PkSigning(); const bobPrivkey = bobSigning.generate_seed(); const bobPubkey = bobSigning.init_with_seed(bobPrivkey); - const bobSSK: ICrossSigningKey = { + const bobSSK: CrossSigningKeyInfo = { user_id: "@bob:example.com", usage: ["self_signing"], keys: { @@ -515,7 +515,7 @@ describe("Cross Signing", function () { }; olmlib.pkSign(bobDevice, selfSigningKey as unknown as PkSigning, "@bob:example.com", ""); - const bobMaster: ICrossSigningKey = { + const bobMaster: CrossSigningKeyInfo = { user_id: "@bob:example.com", usage: ["master"], keys: { @@ -630,7 +630,7 @@ describe("Cross Signing", function () { const bobSigning = new global.Olm.PkSigning(); const bobPrivkey = bobSigning.generate_seed(); const bobPubkey = bobSigning.init_with_seed(bobPrivkey); - const bobSSK: ICrossSigningKey = { + const bobSSK: CrossSigningKeyInfo = { user_id: "@bob:example.com", usage: ["self_signing"], keys: { @@ -696,7 +696,7 @@ describe("Cross Signing", function () { const bobSigning = new global.Olm.PkSigning(); const bobPrivkey = bobSigning.generate_seed(); const bobPubkey = bobSigning.init_with_seed(bobPrivkey); - const bobSSK: ICrossSigningKey = { + const bobSSK: CrossSigningKeyInfo = { user_id: "@bob:example.com", usage: ["self_signing"], keys: { @@ -763,7 +763,7 @@ describe("Cross Signing", function () { const bobSigning2 = new global.Olm.PkSigning(); const bobPrivkey2 = bobSigning2.generate_seed(); const bobPubkey2 = bobSigning2.init_with_seed(bobPrivkey2); - const bobSSK2: ICrossSigningKey = { + const bobSSK2: CrossSigningKeyInfo = { user_id: "@bob:example.com", usage: ["self_signing"], keys: { @@ -913,7 +913,7 @@ describe("Cross Signing", function () { const aliceSigning = new global.Olm.PkSigning(); const alicePrivkey = aliceSigning.generate_seed(); const alicePubkey = aliceSigning.init_with_seed(alicePrivkey); - const aliceSSK: ICrossSigningKey = { + const aliceSSK: CrossSigningKeyInfo = { user_id: "@alice:example.com", usage: ["self_signing"], keys: { @@ -988,7 +988,7 @@ describe("Cross Signing", function () { const aliceSigning = new global.Olm.PkSigning(); const alicePrivkey = aliceSigning.generate_seed(); const alicePubkey = aliceSigning.init_with_seed(alicePrivkey); - const aliceSSK: ICrossSigningKey = { + const aliceSSK: CrossSigningKeyInfo = { user_id: "@alice:example.com", usage: ["self_signing"], keys: { @@ -1048,7 +1048,7 @@ describe("Cross Signing", function () { const aliceSigning = new global.Olm.PkSigning(); const alicePrivkey = aliceSigning.generate_seed(); const alicePubkey = aliceSigning.init_with_seed(alicePrivkey); - const aliceSSK: ICrossSigningKey = { + const aliceSSK: CrossSigningKeyInfo = { user_id: "@alice:example.com", usage: ["self_signing"], keys: { diff --git a/spec/unit/crypto/secrets.spec.ts b/spec/unit/crypto/secrets.spec.ts index 27842e877..835c593d8 100644 --- a/spec/unit/crypto/secrets.spec.ts +++ b/spec/unit/crypto/secrets.spec.ts @@ -23,12 +23,13 @@ import { makeTestClients } from "./verification/util"; import { encryptAES } from "../../../src/crypto/aes"; import { createSecretStorageKey, resetCrossSigningKeys } from "./crypto-utils"; import { logger } from "../../../src/logger"; -import { ClientEvent, ICreateClientOpts, ICrossSigningKey, MatrixClient } from "../../../src/client"; +import { ClientEvent, ICreateClientOpts, MatrixClient } from "../../../src/client"; import { DeviceInfo } from "../../../src/crypto/deviceinfo"; import { ISignatures } from "../../../src/@types/signed"; import { ICurve25519AuthData } from "../../../src/crypto/keybackup"; import { SecretStorageKeyDescription, SECRET_STORAGE_ALGORITHM_V1_AES } from "../../../src/secret-storage"; import { decodeBase64 } from "../../../src/base64"; +import { CrossSigningKeyInfo } from "../../../src/crypto-api"; async function makeTestClient( userInfo: { userId: string; deviceId: string }, @@ -475,7 +476,7 @@ describe("Secrets", function () { [`ed25519:${XSPubKey}`]: XSPubKey, }, }, - self_signing: sign( + self_signing: sign( { user_id: "@alice:example.com", usage: ["self_signing"], @@ -486,7 +487,7 @@ describe("Secrets", function () { XSK, "@alice:example.com", ), - user_signing: sign( + user_signing: sign( { user_id: "@alice:example.com", usage: ["user_signing"], @@ -631,7 +632,7 @@ describe("Secrets", function () { [`ed25519:${XSPubKey}`]: XSPubKey, }, }, - self_signing: sign( + self_signing: sign( { user_id: "@alice:example.com", usage: ["self_signing"], @@ -642,7 +643,7 @@ describe("Secrets", function () { XSK, "@alice:example.com", ), - user_signing: sign( + user_signing: sign( { user_id: "@alice:example.com", usage: ["user_signing"], diff --git a/spec/unit/models/MSC3089Branch.spec.ts b/spec/unit/models/MSC3089Branch.spec.ts index 9fe718697..7151e9680 100644 --- a/spec/unit/models/MSC3089Branch.spec.ts +++ b/spec/unit/models/MSC3089Branch.spec.ts @@ -16,11 +16,12 @@ limitations under the License. import { IContent, MatrixClient, MatrixEvent } from "../../../src"; import { Room } from "../../../src/models/room"; -import { IEncryptedFile, RelationType, UNSTABLE_MSC3089_BRANCH } from "../../../src/@types/event"; +import { RelationType, UNSTABLE_MSC3089_BRANCH } from "../../../src/@types/event"; import { EventTimelineSet } from "../../../src/models/event-timeline-set"; import { EventTimeline } from "../../../src/models/event-timeline"; import { MSC3089Branch } from "../../../src/models/MSC3089Branch"; import { MSC3089TreeSpace } from "../../../src/models/MSC3089TreeSpace"; +import { EncryptedFile } from "../../../src/@types/media"; describe("MSC3089Branch", () => { let client: MatrixClient; @@ -254,7 +255,7 @@ describe("MSC3089Branch", () => { it("should create new versions of itself", async () => { const canaryName = "canary"; const canaryContents = "contents go here"; - const canaryFile = {} as IEncryptedFile; + const canaryFile = {} as EncryptedFile; const canaryAddl = { canary: true }; indexEvent.getContent = () => ({ active: true, retained: true }); const stateKeyOrder = [fileEventId2, fileEventId]; @@ -287,23 +288,21 @@ describe("MSC3089Branch", () => { const createFn = jest .fn() - .mockImplementation( - (name: string, contents: ArrayBuffer, info: Partial, addl: IContent) => { - expect(name).toEqual(canaryName); - expect(contents).toBe(canaryContents); - expect(info).toBe(canaryFile); - expect(addl).toMatchObject({ - ...canaryAddl, - "m.new_content": true, - "m.relates_to": { - rel_type: RelationType.Replace, - event_id: fileEventId, - }, - }); + .mockImplementation((name: string, contents: ArrayBuffer, info: Partial, addl: IContent) => { + expect(name).toEqual(canaryName); + expect(contents).toBe(canaryContents); + expect(info).toBe(canaryFile); + expect(addl).toMatchObject({ + ...canaryAddl, + "m.new_content": true, + "m.relates_to": { + rel_type: RelationType.Replace, + event_id: fileEventId, + }, + }); - return Promise.resolve({ event_id: fileEventId2 }); - }, - ); + return Promise.resolve({ event_id: fileEventId2 }); + }); directory.createFile = createFn; await branch.createNewVersion(canaryName, canaryContents, canaryFile, canaryAddl); diff --git a/src/@types/auth.ts b/src/@types/auth.ts index 665046307..649a85176 100644 --- a/src/@types/auth.ts +++ b/src/@types/auth.ts @@ -147,11 +147,6 @@ export interface LoginRequest { * The login type being used. */ type: "m.login.password" | "m.login.token" | string; - /** - * Third-party identifier for the user. - * @deprecated in favour of `identifier`. - */ - address?: string; /** * ID of the client device. * If this does not correspond to a known client device, a new device will be created. diff --git a/src/@types/event.ts b/src/@types/event.ts index 04f1e969c..5d8a26c9b 100644 --- a/src/@types/event.ts +++ b/src/@types/event.ts @@ -56,7 +56,6 @@ import { SDPStreamMetadataKey, } from "../webrtc/callEventTypes"; import { EncryptionKeysEventContent, ICallNotifyContent } from "../matrixrtc/types"; -import { EncryptedFile } from "./media"; import { M_POLL_END, M_POLL_START, PollEndEventContent, PollStartEventContent } from "./polls"; export enum EventType { @@ -305,11 +304,6 @@ export const UNSIGNED_THREAD_ID_FIELD = new UnstableValue("thread_id", "org.matr */ export const UNSIGNED_MEMBERSHIP_FIELD = new UnstableValue("membership", "io.element.msc4115.membership"); -/** - * @deprecated in favour of {@link EncryptedFile} - */ -export type IEncryptedFile = EncryptedFile; - /** * Mapped type from event type to content type for all specified non-state room events. */ diff --git a/src/@types/registration.ts b/src/@types/registration.ts index 98eb1977e..90fc098e4 100644 --- a/src/@types/registration.ts +++ b/src/@types/registration.ts @@ -107,10 +107,4 @@ export interface RegisterResponse { * Omitted if the inhibit_login option is true. */ refresh_token?: string; - /** - * The server_name of the homeserver on which the account has been registered. - * - * @deprecated Clients should extract the server_name from user_id (by splitting at the first colon) if they require it. - */ - home_server?: string; } diff --git a/src/client.ts b/src/client.ts index 78afe5387..27485d076 100644 --- a/src/client.ts +++ b/src/client.ts @@ -560,16 +560,13 @@ export interface Capabilities { "org.matrix.msc3882.get_login_token"?: IGetLoginTokenCapability; } -/** @deprecated prefer {@link CrossSigningKeyInfo}. */ -export type ICrossSigningKey = CrossSigningKeyInfo; - enum CrossSigningKeyType { MasterKey = "master_key", SelfSigningKey = "self_signing_key", UserSigningKey = "user_signing_key", } -export type CrossSigningKeys = Record; +export type CrossSigningKeys = Record; export type SendToDeviceContentMap = Map>>; @@ -581,7 +578,7 @@ export interface ISignedKey { device_id: string; } -export type KeySignatures = Record>; +export type KeySignatures = Record>; export interface IUploadKeySignaturesResponse { failures: Record< string, diff --git a/src/crypto/CrossSigning.ts b/src/crypto/CrossSigning.ts index 1bc3d9e8e..95d20da05 100644 --- a/src/crypto/CrossSigning.ts +++ b/src/crypto/CrossSigning.ts @@ -24,13 +24,13 @@ import { logger } from "../logger"; import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store"; import { decryptAES, encryptAES } from "./aes"; import { DeviceInfo } from "./deviceinfo"; -import { ICrossSigningKey, ISignedKey, MatrixClient } from "../client"; +import { ISignedKey, MatrixClient } from "../client"; import { OlmDevice } from "./OlmDevice"; import { ICryptoCallbacks } from "."; import { ISignatures } from "../@types/signed"; import { CryptoStore, SecretStorePrivateKeys } from "./store/base"; import { ServerSideSecretStorage, SecretStorageKeyDescription } from "../secret-storage"; -import { DeviceVerificationStatus, UserVerificationStatus as UserTrustLevel } from "../crypto-api"; +import { CrossSigningKeyInfo, DeviceVerificationStatus, UserVerificationStatus as UserTrustLevel } from "../crypto-api"; import { decodeBase64, encodeBase64 } from "../base64"; // backwards-compatibility re-exports @@ -38,7 +38,7 @@ export { UserTrustLevel }; const KEY_REQUEST_TIMEOUT_MS = 1000 * 60; -function publicKeyFromKeyInfo(keyInfo: ICrossSigningKey): string { +function publicKeyFromKeyInfo(keyInfo: CrossSigningKeyInfo): string { // `keys` is an object with { [`ed25519:${pubKey}`]: pubKey } // We assume only a single key, and we want the bare form without type // prefix, so we select the values. @@ -51,13 +51,13 @@ export interface ICacheCallbacks { } export interface ICrossSigningInfo { - keys: Record; + keys: Record; firstUse: boolean; crossSigningVerifiedBefore: boolean; } export class CrossSigningInfo { - public keys: Record = {}; + public keys: Record = {}; public firstUse = true; // This tracks whether we've ever verified this user with any identity. // When you verify a user, any devices online at the time that receive @@ -296,7 +296,7 @@ export class CrossSigningInfo { } const privateKeys: Record = {}; - const keys: Record = {}; + const keys: Record = {}; let masterSigning: PkSigning | undefined; let masterPub: string | undefined; @@ -368,8 +368,8 @@ export class CrossSigningInfo { this.keys = {}; } - public setKeys(keys: Record): void { - const signingKeys: Record = {}; + public setKeys(keys: Record): void { + const signingKeys: Record = {}; if (keys.master) { if (keys.master.user_id !== this.userId) { const error = "Mismatched user ID " + keys.master.user_id + " in master key from " + this.userId; @@ -457,7 +457,7 @@ export class CrossSigningInfo { } } - public async signUser(key: CrossSigningInfo): Promise { + public async signUser(key: CrossSigningInfo): Promise { if (!this.keys.user_signing) { logger.info("No user signing key: not signing user"); return; diff --git a/src/crypto/EncryptionSetup.ts b/src/crypto/EncryptionSetup.ts index 1641c2f9d..b7015b5a0 100644 --- a/src/crypto/EncryptionSetup.ts +++ b/src/crypto/EncryptionSetup.ts @@ -20,22 +20,15 @@ import { createCryptoStoreCacheCallbacks, ICacheCallbacks } from "./CrossSigning import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store"; import { Method, ClientPrefix } from "../http-api"; import { Crypto, ICryptoCallbacks } from "./index"; -import { - ClientEvent, - ClientEventHandlerMap, - CrossSigningKeys, - ICrossSigningKey, - ISignedKey, - KeySignatures, -} from "../client"; +import { ClientEvent, ClientEventHandlerMap, CrossSigningKeys, ISignedKey, KeySignatures } from "../client"; import { IKeyBackupInfo } from "./keybackup"; import { TypedEventEmitter } from "../models/typed-event-emitter"; import { AccountDataClient, SecretStorageKeyDescription } from "../secret-storage"; -import { BootstrapCrossSigningOpts } from "../crypto-api"; +import { BootstrapCrossSigningOpts, CrossSigningKeyInfo } from "../crypto-api"; interface ICrossSigningKeys { authUpload: BootstrapCrossSigningOpts["authUploadDeviceSigningKeys"]; - keys: Record<"master" | "self_signing" | "user_signing", ICrossSigningKey>; + keys: Record<"master" | "self_signing" | "user_signing", CrossSigningKeyInfo>; } /** diff --git a/src/crypto/index.ts b/src/crypto/index.ts index 10751ca56..ff62c429c 100644 --- a/src/crypto/index.ts +++ b/src/crypto/index.ts @@ -56,14 +56,7 @@ import { Room, RoomEvent } from "../models/room"; import { RoomMember, RoomMemberEvent } from "../models/room-member"; import { EventStatus, IContent, IEvent, MatrixEvent, MatrixEventEvent } from "../models/event"; import { ToDeviceBatch } from "../models/ToDeviceMessage"; -import { - ClientEvent, - ICrossSigningKey, - IKeysUploadResponse, - ISignedKey, - IUploadKeySignaturesResponse, - MatrixClient, -} from "../client"; +import { ClientEvent, IKeysUploadResponse, ISignedKey, IUploadKeySignaturesResponse, MatrixClient } from "../client"; import { IRoomEncryption, RoomList } from "./RoomList"; import { IKeyBackupInfo } from "./keybackup"; import { ISyncStateData } from "../sync"; @@ -89,6 +82,7 @@ import { ISecretRequest } from "./SecretSharing"; import { BackupTrustInfo, BootstrapCrossSigningOpts, + CrossSigningKeyInfo, CrossSigningStatus, DecryptionFailureCode, DeviceVerificationStatus, @@ -1527,7 +1521,7 @@ export class Crypto extends TypedEventEmitter, ): Promise { const deviceIds: string[] = []; @@ -1904,7 +1898,7 @@ export class Crypto extends TypedEventEmitter | null): Promise { + private async storeTrustedSelfKeys(keys: Record | null): Promise { if (keys) { this.crossSigningInfo.setKeys(keys); } else { @@ -2390,7 +2384,7 @@ export class Crypto extends TypedEventEmitter, - ): Promise { + ): Promise { // Check if the 'device' is actually a cross signing key // The js-sdk's verification treats cross-signing keys as devices // and so uses this method to mark them verified. diff --git a/src/crypto/store/base.ts b/src/crypto/store/base.ts index e978b24e3..871804b73 100644 --- a/src/crypto/store/base.ts +++ b/src/crypto/store/base.ts @@ -16,7 +16,6 @@ limitations under the License. import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "../index"; import { RoomKeyRequestState } from "../OutgoingRoomKeyRequestManager"; -import { ICrossSigningKey } from "../../client"; import { IOlmDevice } from "../algorithms/megolm"; import { TrackingStatus } from "../DeviceList"; import { IRoomEncryption } from "../RoomList"; @@ -27,6 +26,7 @@ import { InboundGroupSessionData } from "../OlmDevice"; import { MatrixEvent } from "../../models/event"; import { DehydrationManager } from "../dehydration"; import { IEncryptedPayload } from "../aes"; +import { CrossSigningKeyInfo } from "../../crypto-api"; /** * Internal module. Definitions for storage for the crypto module @@ -100,13 +100,13 @@ export interface CryptoStore { // Olm Account getAccount(txn: unknown, func: (accountPickle: string | null) => void): void; storeAccount(txn: unknown, accountPickle: string): void; - getCrossSigningKeys(txn: unknown, func: (keys: Record | null) => void): void; + getCrossSigningKeys(txn: unknown, func: (keys: Record | null) => void): void; getSecretStorePrivateKey( txn: unknown, func: (key: SecretStorePrivateKeys[K] | null) => void, type: K, ): void; - storeCrossSigningKeys(txn: unknown, keys: Record): void; + storeCrossSigningKeys(txn: unknown, keys: Record): void; storeSecretStorePrivateKey( txn: unknown, type: K, diff --git a/src/crypto/store/indexeddb-crypto-store-backend.ts b/src/crypto/store/indexeddb-crypto-store-backend.ts index c4908aee1..08d4c0f6e 100644 --- a/src/crypto/store/indexeddb-crypto-store-backend.ts +++ b/src/crypto/store/indexeddb-crypto-store-backend.ts @@ -33,11 +33,11 @@ import { ACCOUNT_OBJECT_KEY_MIGRATION_STATE, } from "./base"; import { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from "../index"; -import { ICrossSigningKey } from "../../client"; import { IOlmDevice } from "../algorithms/megolm"; import { IRoomEncryption } from "../RoomList"; import { InboundGroupSessionData } from "../OlmDevice"; import { IndexedDBCryptoStore } from "./indexeddb-crypto-store"; +import { CrossSigningKeyInfo } from "../../crypto-api"; const PROFILE_TRANSACTIONS = false; @@ -418,7 +418,7 @@ export class Backend implements CryptoStore { public getCrossSigningKeys( txn: IDBTransaction, - func: (keys: Record | null) => void, + func: (keys: Record | null) => void, ): void { const objectStore = txn.objectStore("account"); const getReq = objectStore.get("crossSigningKeys"); @@ -447,7 +447,7 @@ export class Backend implements CryptoStore { }; } - public storeCrossSigningKeys(txn: IDBTransaction, keys: Record): void { + public storeCrossSigningKeys(txn: IDBTransaction, keys: Record): void { const objectStore = txn.objectStore("account"); objectStore.put(keys, "crossSigningKeys"); } diff --git a/src/crypto/store/indexeddb-crypto-store.ts b/src/crypto/store/indexeddb-crypto-store.ts index dc104e19e..8fe488e08 100644 --- a/src/crypto/store/indexeddb-crypto-store.ts +++ b/src/crypto/store/indexeddb-crypto-store.ts @@ -36,10 +36,10 @@ import { ACCOUNT_OBJECT_KEY_MIGRATION_STATE, } from "./base"; import { IRoomKeyRequestBody } from "../index"; -import { ICrossSigningKey } from "../../client"; import { IOlmDevice } from "../algorithms/megolm"; import { IRoomEncryption } from "../RoomList"; import { InboundGroupSessionData } from "../OlmDevice"; +import { CrossSigningKeyInfo } from "../../crypto-api"; /* * Internal module. indexeddb storage for e2e. @@ -420,7 +420,7 @@ export class IndexedDBCryptoStore implements CryptoStore { */ public getCrossSigningKeys( txn: IDBTransaction, - func: (keys: Record | null) => void, + func: (keys: Record | null) => void, ): void { this.backend!.getCrossSigningKeys(txn, func); } @@ -444,7 +444,7 @@ export class IndexedDBCryptoStore implements CryptoStore { * @param txn - An active transaction. See doTxn(). * @param keys - keys object as getCrossSigningKeys() */ - public storeCrossSigningKeys(txn: IDBTransaction, keys: Record): void { + public storeCrossSigningKeys(txn: IDBTransaction, keys: Record): void { this.backend!.storeCrossSigningKeys(txn, keys); } diff --git a/src/crypto/store/localStorage-crypto-store.ts b/src/crypto/store/localStorage-crypto-store.ts index 9a8dbf38a..41821ec62 100644 --- a/src/crypto/store/localStorage-crypto-store.ts +++ b/src/crypto/store/localStorage-crypto-store.ts @@ -31,9 +31,9 @@ import { } from "./base"; import { IOlmDevice } from "../algorithms/megolm"; import { IRoomEncryption } from "../RoomList"; -import { ICrossSigningKey } from "../../client"; import { InboundGroupSessionData } from "../OlmDevice"; import { safeSet } from "../../utils"; +import { CrossSigningKeyInfo } from "../../crypto-api"; /** * Internal module. Partial localStorage backed storage for e2e. @@ -531,8 +531,8 @@ export class LocalStorageCryptoStore extends MemoryCryptoStore implements Crypto setJsonItem(this.store, KEY_END_TO_END_ACCOUNT, accountPickle); } - public getCrossSigningKeys(txn: unknown, func: (keys: Record | null) => void): void { - const keys = getJsonItem>(this.store, KEY_CROSS_SIGNING_KEYS); + public getCrossSigningKeys(txn: unknown, func: (keys: Record | null) => void): void { + const keys = getJsonItem>(this.store, KEY_CROSS_SIGNING_KEYS); func(keys); } @@ -545,7 +545,7 @@ export class LocalStorageCryptoStore extends MemoryCryptoStore implements Crypto func(key); } - public storeCrossSigningKeys(txn: unknown, keys: Record): void { + public storeCrossSigningKeys(txn: unknown, keys: Record): void { setJsonItem(this.store, KEY_CROSS_SIGNING_KEYS, keys); } diff --git a/src/crypto/store/memory-crypto-store.ts b/src/crypto/store/memory-crypto-store.ts index 32d83f24d..4fd8a57f8 100644 --- a/src/crypto/store/memory-crypto-store.ts +++ b/src/crypto/store/memory-crypto-store.ts @@ -32,10 +32,10 @@ import { SESSION_BATCH_SIZE, } from "./base"; import { IRoomKeyRequestBody } from "../index"; -import { ICrossSigningKey } from "../../client"; import { IOlmDevice } from "../algorithms/megolm"; import { IRoomEncryption } from "../RoomList"; import { InboundGroupSessionData } from "../OlmDevice"; +import { CrossSigningKeyInfo } from "../../crypto-api"; function encodeSessionKey(senderCurve25519Key: string, sessionId: string): string { return encodeURIComponent(senderCurve25519Key) + "/" + encodeURIComponent(sessionId); @@ -56,7 +56,7 @@ export class MemoryCryptoStore implements CryptoStore { private migrationState: MigrationState = MigrationState.NOT_STARTED; private outgoingRoomKeyRequests: OutgoingRoomKeyRequest[] = []; private account: string | null = null; - private crossSigningKeys: Record | null = null; + private crossSigningKeys: Record | null = null; private privateKeys: Partial = {}; private sessions: { [deviceKey: string]: { [sessionId: string]: ISessionInfo } } = {}; @@ -319,7 +319,7 @@ export class MemoryCryptoStore implements CryptoStore { this.account = accountPickle; } - public getCrossSigningKeys(txn: unknown, func: (keys: Record | null) => void): void { + public getCrossSigningKeys(txn: unknown, func: (keys: Record | null) => void): void { func(this.crossSigningKeys); } @@ -332,7 +332,7 @@ export class MemoryCryptoStore implements CryptoStore { func(result || null); } - public storeCrossSigningKeys(txn: unknown, keys: Record): void { + public storeCrossSigningKeys(txn: unknown, keys: Record): void { this.crossSigningKeys = keys; } diff --git a/src/interactive-auth.ts b/src/interactive-auth.ts index 8b6a686d8..8ecfc64a0 100644 --- a/src/interactive-auth.ts +++ b/src/interactive-auth.ts @@ -121,10 +121,6 @@ interface ThreepidCreds { type EmailIdentityDict = { type: AuthType.Email; threepid_creds: ThreepidCreds; - /** - * @deprecated in favour of `threepid_creds` - kept for backwards compatibility - */ - threepidCreds?: ThreepidCreds; session: string; }; @@ -349,11 +345,7 @@ export class InteractiveAuth { } authDict = { type: EMAIL_STAGE_TYPE, - // TODO: Remove `threepid_creds` once servers support proper UIA - // See https://github.com/matrix-org/synapse/issues/5665 - // See https://github.com/matrix-org/matrix-doc/issues/2220 threepid_creds: creds, - threepidCreds: creds, }; } } diff --git a/src/matrix.ts b/src/matrix.ts index db185f149..ed71f7dfc 100644 --- a/src/matrix.ts +++ b/src/matrix.ts @@ -105,10 +105,6 @@ export { IdentityProviderBrand, SSOAction } from "./@types/auth"; export type { ISSOFlow as SSOFlow, LoginFlow } from "./@types/auth"; export type { IHierarchyRelation as HierarchyRelation, IHierarchyRoom as HierarchyRoom } from "./@types/spaces"; export { LocationAssetType } from "./@types/location"; -/** - * @deprecated in favour of RoomJoinRulesEventContent on the types export - */ -export type { RoomJoinRulesEventContent as IJoinRuleEventContent } from "./@types/state_events"; /** * Types supporting cryptography. diff --git a/src/models/room.ts b/src/models/room.ts index 679fbc749..974d0ab9f 100644 --- a/src/models/room.ts +++ b/src/models/room.ts @@ -605,27 +605,6 @@ export class Room extends ReadReceipt { return createEvent.getContent()["room_version"] ?? "1"; } - /** - * Determines whether this room needs to be upgraded to a new version - * @returns What version the room should be upgraded to, or null if - * the room does not require upgrading at this time. - * @deprecated Use #getRecommendedVersion() instead - */ - public shouldUpgradeToVersion(): string | null { - // TODO: Remove this function. - // This makes assumptions about which versions are safe, and can easily - // be wrong. Instead, people are encouraged to use getRecommendedVersion - // which determines a safer value. This function doesn't use that function - // because this is not async-capable, and to avoid breaking the contract - // we're deprecating this. - - if (!SAFE_ROOM_VERSIONS.includes(this.getVersion())) { - return KNOWN_SAFE_ROOM_VERSION; - } - - return null; - } - /** * Determines the recommended room version for the room. This returns an * object with 3 properties: `version` as the new version the