Skip to content

Commit f03dd7b

Browse files
authored
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>
1 parent 51fa186 commit f03dd7b

18 files changed

+69
-135
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ import HttpBackend from "matrix-mock-request";
2323
import * as olmlib from "../../../src/crypto/olmlib";
2424
import { MatrixError } from "../../../src/http-api";
2525
import { logger } from "../../../src/logger";
26-
import { ICrossSigningKey, ICreateClientOpts, ISignedKey, MatrixClient } from "../../../src/client";
26+
import { ICreateClientOpts, ISignedKey, MatrixClient } from "../../../src/client";
2727
import { CryptoEvent } from "../../../src/crypto";
2828
import { IDevice } from "../../../src/crypto/deviceinfo";
2929
import { TestClient } from "../../TestClient";
3030
import { resetCrossSigningKeys } from "./crypto-utils";
31-
import { BootstrapCrossSigningOpts } from "../../../src/crypto-api";
31+
import { BootstrapCrossSigningOpts, CrossSigningKeyInfo } from "../../../src/crypto-api";
3232

3333
const PUSH_RULES_RESPONSE: Response = {
3434
method: "GET",
@@ -377,7 +377,7 @@ describe("Cross Signing", function () {
377377
const bobSigning = new global.Olm.PkSigning();
378378
const bobPrivkey = bobSigning.generate_seed();
379379
const bobPubkey = bobSigning.init_with_seed(bobPrivkey);
380-
const bobSSK: ICrossSigningKey = {
380+
const bobSSK: CrossSigningKeyInfo = {
381381
user_id: "@bob:example.com",
382382
usage: ["self_signing"],
383383
keys: {
@@ -515,7 +515,7 @@ describe("Cross Signing", function () {
515515
};
516516
olmlib.pkSign(bobDevice, selfSigningKey as unknown as PkSigning, "@bob:example.com", "");
517517

518-
const bobMaster: ICrossSigningKey = {
518+
const bobMaster: CrossSigningKeyInfo = {
519519
user_id: "@bob:example.com",
520520
usage: ["master"],
521521
keys: {
@@ -630,7 +630,7 @@ describe("Cross Signing", function () {
630630
const bobSigning = new global.Olm.PkSigning();
631631
const bobPrivkey = bobSigning.generate_seed();
632632
const bobPubkey = bobSigning.init_with_seed(bobPrivkey);
633-
const bobSSK: ICrossSigningKey = {
633+
const bobSSK: CrossSigningKeyInfo = {
634634
user_id: "@bob:example.com",
635635
usage: ["self_signing"],
636636
keys: {
@@ -696,7 +696,7 @@ describe("Cross Signing", function () {
696696
const bobSigning = new global.Olm.PkSigning();
697697
const bobPrivkey = bobSigning.generate_seed();
698698
const bobPubkey = bobSigning.init_with_seed(bobPrivkey);
699-
const bobSSK: ICrossSigningKey = {
699+
const bobSSK: CrossSigningKeyInfo = {
700700
user_id: "@bob:example.com",
701701
usage: ["self_signing"],
702702
keys: {
@@ -763,7 +763,7 @@ describe("Cross Signing", function () {
763763
const bobSigning2 = new global.Olm.PkSigning();
764764
const bobPrivkey2 = bobSigning2.generate_seed();
765765
const bobPubkey2 = bobSigning2.init_with_seed(bobPrivkey2);
766-
const bobSSK2: ICrossSigningKey = {
766+
const bobSSK2: CrossSigningKeyInfo = {
767767
user_id: "@bob:example.com",
768768
usage: ["self_signing"],
769769
keys: {
@@ -913,7 +913,7 @@ describe("Cross Signing", function () {
913913
const aliceSigning = new global.Olm.PkSigning();
914914
const alicePrivkey = aliceSigning.generate_seed();
915915
const alicePubkey = aliceSigning.init_with_seed(alicePrivkey);
916-
const aliceSSK: ICrossSigningKey = {
916+
const aliceSSK: CrossSigningKeyInfo = {
917917
user_id: "@alice:example.com",
918918
usage: ["self_signing"],
919919
keys: {
@@ -988,7 +988,7 @@ describe("Cross Signing", function () {
988988
const aliceSigning = new global.Olm.PkSigning();
989989
const alicePrivkey = aliceSigning.generate_seed();
990990
const alicePubkey = aliceSigning.init_with_seed(alicePrivkey);
991-
const aliceSSK: ICrossSigningKey = {
991+
const aliceSSK: CrossSigningKeyInfo = {
992992
user_id: "@alice:example.com",
993993
usage: ["self_signing"],
994994
keys: {
@@ -1048,7 +1048,7 @@ describe("Cross Signing", function () {
10481048
const aliceSigning = new global.Olm.PkSigning();
10491049
const alicePrivkey = aliceSigning.generate_seed();
10501050
const alicePubkey = aliceSigning.init_with_seed(alicePrivkey);
1051-
const aliceSSK: ICrossSigningKey = {
1051+
const aliceSSK: CrossSigningKeyInfo = {
10521052
user_id: "@alice:example.com",
10531053
usage: ["self_signing"],
10541054
keys: {

spec/unit/crypto/secrets.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ import { makeTestClients } from "./verification/util";
2323
import { encryptAES } from "../../../src/crypto/aes";
2424
import { createSecretStorageKey, resetCrossSigningKeys } from "./crypto-utils";
2525
import { logger } from "../../../src/logger";
26-
import { ClientEvent, ICreateClientOpts, ICrossSigningKey, MatrixClient } from "../../../src/client";
26+
import { ClientEvent, ICreateClientOpts, MatrixClient } from "../../../src/client";
2727
import { DeviceInfo } from "../../../src/crypto/deviceinfo";
2828
import { ISignatures } from "../../../src/@types/signed";
2929
import { ICurve25519AuthData } from "../../../src/crypto/keybackup";
3030
import { SecretStorageKeyDescription, SECRET_STORAGE_ALGORITHM_V1_AES } from "../../../src/secret-storage";
3131
import { decodeBase64 } from "../../../src/base64";
32+
import { CrossSigningKeyInfo } from "../../../src/crypto-api";
3233

3334
async function makeTestClient(
3435
userInfo: { userId: string; deviceId: string },
@@ -475,7 +476,7 @@ describe("Secrets", function () {
475476
[`ed25519:${XSPubKey}`]: XSPubKey,
476477
},
477478
},
478-
self_signing: sign<ICrossSigningKey>(
479+
self_signing: sign<CrossSigningKeyInfo>(
479480
{
480481
user_id: "@alice:example.com",
481482
usage: ["self_signing"],
@@ -486,7 +487,7 @@ describe("Secrets", function () {
486487
XSK,
487488
"@alice:example.com",
488489
),
489-
user_signing: sign<ICrossSigningKey>(
490+
user_signing: sign<CrossSigningKeyInfo>(
490491
{
491492
user_id: "@alice:example.com",
492493
usage: ["user_signing"],
@@ -631,7 +632,7 @@ describe("Secrets", function () {
631632
[`ed25519:${XSPubKey}`]: XSPubKey,
632633
},
633634
},
634-
self_signing: sign<ICrossSigningKey>(
635+
self_signing: sign<CrossSigningKeyInfo>(
635636
{
636637
user_id: "@alice:example.com",
637638
usage: ["self_signing"],
@@ -642,7 +643,7 @@ describe("Secrets", function () {
642643
XSK,
643644
"@alice:example.com",
644645
),
645-
user_signing: sign<ICrossSigningKey>(
646+
user_signing: sign<CrossSigningKeyInfo>(
646647
{
647648
user_id: "@alice:example.com",
648649
usage: ["user_signing"],

spec/unit/models/MSC3089Branch.spec.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ limitations under the License.
1616

1717
import { IContent, MatrixClient, MatrixEvent } from "../../../src";
1818
import { Room } from "../../../src/models/room";
19-
import { IEncryptedFile, RelationType, UNSTABLE_MSC3089_BRANCH } from "../../../src/@types/event";
19+
import { RelationType, UNSTABLE_MSC3089_BRANCH } from "../../../src/@types/event";
2020
import { EventTimelineSet } from "../../../src/models/event-timeline-set";
2121
import { EventTimeline } from "../../../src/models/event-timeline";
2222
import { MSC3089Branch } from "../../../src/models/MSC3089Branch";
2323
import { MSC3089TreeSpace } from "../../../src/models/MSC3089TreeSpace";
24+
import { EncryptedFile } from "../../../src/@types/media";
2425

2526
describe("MSC3089Branch", () => {
2627
let client: MatrixClient;
@@ -254,7 +255,7 @@ describe("MSC3089Branch", () => {
254255
it("should create new versions of itself", async () => {
255256
const canaryName = "canary";
256257
const canaryContents = "contents go here";
257-
const canaryFile = {} as IEncryptedFile;
258+
const canaryFile = {} as EncryptedFile;
258259
const canaryAddl = { canary: true };
259260
indexEvent.getContent = () => ({ active: true, retained: true });
260261
const stateKeyOrder = [fileEventId2, fileEventId];
@@ -287,23 +288,21 @@ describe("MSC3089Branch", () => {
287288

288289
const createFn = jest
289290
.fn()
290-
.mockImplementation(
291-
(name: string, contents: ArrayBuffer, info: Partial<IEncryptedFile>, addl: IContent) => {
292-
expect(name).toEqual(canaryName);
293-
expect(contents).toBe(canaryContents);
294-
expect(info).toBe(canaryFile);
295-
expect(addl).toMatchObject({
296-
...canaryAddl,
297-
"m.new_content": true,
298-
"m.relates_to": {
299-
rel_type: RelationType.Replace,
300-
event_id: fileEventId,
301-
},
302-
});
291+
.mockImplementation((name: string, contents: ArrayBuffer, info: Partial<EncryptedFile>, addl: IContent) => {
292+
expect(name).toEqual(canaryName);
293+
expect(contents).toBe(canaryContents);
294+
expect(info).toBe(canaryFile);
295+
expect(addl).toMatchObject({
296+
...canaryAddl,
297+
"m.new_content": true,
298+
"m.relates_to": {
299+
rel_type: RelationType.Replace,
300+
event_id: fileEventId,
301+
},
302+
});
303303

304-
return Promise.resolve({ event_id: fileEventId2 });
305-
},
306-
);
304+
return Promise.resolve({ event_id: fileEventId2 });
305+
});
307306
directory.createFile = createFn;
308307

309308
await branch.createNewVersion(canaryName, canaryContents, canaryFile, canaryAddl);

src/@types/auth.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,6 @@ export interface LoginRequest {
147147
* The login type being used.
148148
*/
149149
type: "m.login.password" | "m.login.token" | string;
150-
/**
151-
* Third-party identifier for the user.
152-
* @deprecated in favour of `identifier`.
153-
*/
154-
address?: string;
155150
/**
156151
* ID of the client device.
157152
* If this does not correspond to a known client device, a new device will be created.

src/@types/event.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ import {
5656
SDPStreamMetadataKey,
5757
} from "../webrtc/callEventTypes";
5858
import { EncryptionKeysEventContent, ICallNotifyContent } from "../matrixrtc/types";
59-
import { EncryptedFile } from "./media";
6059
import { M_POLL_END, M_POLL_START, PollEndEventContent, PollStartEventContent } from "./polls";
6160

6261
export enum EventType {
@@ -305,11 +304,6 @@ export const UNSIGNED_THREAD_ID_FIELD = new UnstableValue("thread_id", "org.matr
305304
*/
306305
export const UNSIGNED_MEMBERSHIP_FIELD = new UnstableValue("membership", "io.element.msc4115.membership");
307306

308-
/**
309-
* @deprecated in favour of {@link EncryptedFile}
310-
*/
311-
export type IEncryptedFile = EncryptedFile;
312-
313307
/**
314308
* Mapped type from event type to content type for all specified non-state room events.
315309
*/

src/@types/registration.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,4 @@ export interface RegisterResponse {
107107
* Omitted if the inhibit_login option is true.
108108
*/
109109
refresh_token?: string;
110-
/**
111-
* The server_name of the homeserver on which the account has been registered.
112-
*
113-
* @deprecated Clients should extract the server_name from user_id (by splitting at the first colon) if they require it.
114-
*/
115-
home_server?: string;
116110
}

src/client.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -560,16 +560,13 @@ export interface Capabilities {
560560
"org.matrix.msc3882.get_login_token"?: IGetLoginTokenCapability;
561561
}
562562

563-
/** @deprecated prefer {@link CrossSigningKeyInfo}. */
564-
export type ICrossSigningKey = CrossSigningKeyInfo;
565-
566563
enum CrossSigningKeyType {
567564
MasterKey = "master_key",
568565
SelfSigningKey = "self_signing_key",
569566
UserSigningKey = "user_signing_key",
570567
}
571568

572-
export type CrossSigningKeys = Record<CrossSigningKeyType, ICrossSigningKey>;
569+
export type CrossSigningKeys = Record<CrossSigningKeyType, CrossSigningKeyInfo>;
573570

574571
export type SendToDeviceContentMap = Map<string, Map<string, Record<string, any>>>;
575572

@@ -581,7 +578,7 @@ export interface ISignedKey {
581578
device_id: string;
582579
}
583580

584-
export type KeySignatures = Record<string, Record<string, ICrossSigningKey | ISignedKey>>;
581+
export type KeySignatures = Record<string, Record<string, CrossSigningKeyInfo | ISignedKey>>;
585582
export interface IUploadKeySignaturesResponse {
586583
failures: Record<
587584
string,

src/crypto/CrossSigning.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ import { logger } from "../logger";
2424
import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store";
2525
import { decryptAES, encryptAES } from "./aes";
2626
import { DeviceInfo } from "./deviceinfo";
27-
import { ICrossSigningKey, ISignedKey, MatrixClient } from "../client";
27+
import { ISignedKey, MatrixClient } from "../client";
2828
import { OlmDevice } from "./OlmDevice";
2929
import { ICryptoCallbacks } from ".";
3030
import { ISignatures } from "../@types/signed";
3131
import { CryptoStore, SecretStorePrivateKeys } from "./store/base";
3232
import { ServerSideSecretStorage, SecretStorageKeyDescription } from "../secret-storage";
33-
import { DeviceVerificationStatus, UserVerificationStatus as UserTrustLevel } from "../crypto-api";
33+
import { CrossSigningKeyInfo, DeviceVerificationStatus, UserVerificationStatus as UserTrustLevel } from "../crypto-api";
3434
import { decodeBase64, encodeBase64 } from "../base64";
3535

3636
// backwards-compatibility re-exports
3737
export { UserTrustLevel };
3838

3939
const KEY_REQUEST_TIMEOUT_MS = 1000 * 60;
4040

41-
function publicKeyFromKeyInfo(keyInfo: ICrossSigningKey): string {
41+
function publicKeyFromKeyInfo(keyInfo: CrossSigningKeyInfo): string {
4242
// `keys` is an object with { [`ed25519:${pubKey}`]: pubKey }
4343
// We assume only a single key, and we want the bare form without type
4444
// prefix, so we select the values.
@@ -51,13 +51,13 @@ export interface ICacheCallbacks {
5151
}
5252

5353
export interface ICrossSigningInfo {
54-
keys: Record<string, ICrossSigningKey>;
54+
keys: Record<string, CrossSigningKeyInfo>;
5555
firstUse: boolean;
5656
crossSigningVerifiedBefore: boolean;
5757
}
5858

5959
export class CrossSigningInfo {
60-
public keys: Record<string, ICrossSigningKey> = {};
60+
public keys: Record<string, CrossSigningKeyInfo> = {};
6161
public firstUse = true;
6262
// This tracks whether we've ever verified this user with any identity.
6363
// When you verify a user, any devices online at the time that receive
@@ -296,7 +296,7 @@ export class CrossSigningInfo {
296296
}
297297

298298
const privateKeys: Record<string, Uint8Array> = {};
299-
const keys: Record<string, ICrossSigningKey> = {};
299+
const keys: Record<string, CrossSigningKeyInfo> = {};
300300
let masterSigning: PkSigning | undefined;
301301
let masterPub: string | undefined;
302302

@@ -368,8 +368,8 @@ export class CrossSigningInfo {
368368
this.keys = {};
369369
}
370370

371-
public setKeys(keys: Record<string, ICrossSigningKey>): void {
372-
const signingKeys: Record<string, ICrossSigningKey> = {};
371+
public setKeys(keys: Record<string, CrossSigningKeyInfo>): void {
372+
const signingKeys: Record<string, CrossSigningKeyInfo> = {};
373373
if (keys.master) {
374374
if (keys.master.user_id !== this.userId) {
375375
const error = "Mismatched user ID " + keys.master.user_id + " in master key from " + this.userId;
@@ -457,7 +457,7 @@ export class CrossSigningInfo {
457457
}
458458
}
459459

460-
public async signUser(key: CrossSigningInfo): Promise<ICrossSigningKey | undefined> {
460+
public async signUser(key: CrossSigningInfo): Promise<CrossSigningKeyInfo | undefined> {
461461
if (!this.keys.user_signing) {
462462
logger.info("No user signing key: not signing user");
463463
return;

src/crypto/EncryptionSetup.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,15 @@ import { createCryptoStoreCacheCallbacks, ICacheCallbacks } from "./CrossSigning
2020
import { IndexedDBCryptoStore } from "./store/indexeddb-crypto-store";
2121
import { Method, ClientPrefix } from "../http-api";
2222
import { Crypto, ICryptoCallbacks } from "./index";
23-
import {
24-
ClientEvent,
25-
ClientEventHandlerMap,
26-
CrossSigningKeys,
27-
ICrossSigningKey,
28-
ISignedKey,
29-
KeySignatures,
30-
} from "../client";
23+
import { ClientEvent, ClientEventHandlerMap, CrossSigningKeys, ISignedKey, KeySignatures } from "../client";
3124
import { IKeyBackupInfo } from "./keybackup";
3225
import { TypedEventEmitter } from "../models/typed-event-emitter";
3326
import { AccountDataClient, SecretStorageKeyDescription } from "../secret-storage";
34-
import { BootstrapCrossSigningOpts } from "../crypto-api";
27+
import { BootstrapCrossSigningOpts, CrossSigningKeyInfo } from "../crypto-api";
3528

3629
interface ICrossSigningKeys {
3730
authUpload: BootstrapCrossSigningOpts["authUploadDeviceSigningKeys"];
38-
keys: Record<"master" | "self_signing" | "user_signing", ICrossSigningKey>;
31+
keys: Record<"master" | "self_signing" | "user_signing", CrossSigningKeyInfo>;
3932
}
4033

4134
/**

0 commit comments

Comments
 (0)