From d82ba692c19b56a8102e297d2981c39198dd8319 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Thu, 28 Nov 2024 12:23:01 +0100 Subject: [PATCH 1/3] Deprecate legacy functions in `MatrixClient` --- src/client.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/client.ts b/src/client.ts index 2e72dcf4353..86e49a850b1 100644 --- a/src/client.ts +++ b/src/client.ts @@ -252,6 +252,9 @@ export type Store = IStore; export type ResetTimelineCallback = (roomId: string) => boolean; const SCROLLBACK_DELAY_MS = 3000; +/** + * @deprecated Not supported for Rust Cryptography. + */ export const CRYPTO_ENABLED: boolean = isCryptoAvailable(); const TURN_CHECK_INTERVAL = 10 * 60 * 1000; // poll for turn credentials every 10 minutes @@ -2430,6 +2433,8 @@ export class MatrixClient extends TypedEventEmitter { const prom = this.setDeviceVerification(userId, deviceId, verified, null, null); From aac83ffbc12b42916b5c541c2f60959fef4889b8 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Thu, 28 Nov 2024 12:23:38 +0100 Subject: [PATCH 2/3] Move `CryptoEvent.LegacyCryptoStoreMigrationProgress` handler in rust crypto --- src/crypto-api/CryptoEventHandlerMap.ts | 1 + src/crypto/index.ts | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/crypto-api/CryptoEventHandlerMap.ts b/src/crypto-api/CryptoEventHandlerMap.ts index b7acb105aad..f6c326dc433 100644 --- a/src/crypto-api/CryptoEventHandlerMap.ts +++ b/src/crypto-api/CryptoEventHandlerMap.ts @@ -29,4 +29,5 @@ export type CryptoEventHandlerMap = { [CryptoEvent.KeysChanged]: (data: {}) => void; [CryptoEvent.WillUpdateDevices]: (users: string[], initialFetch: boolean) => void; [CryptoEvent.DevicesUpdated]: (users: string[], initialFetch: boolean) => void; + [CryptoEvent.LegacyCryptoStoreMigrationProgress]: (progress: number, total: number) => void; } & RustBackupCryptoEventMap; diff --git a/src/crypto/index.ts b/src/crypto/index.ts index 8cb04dd5e03..acbb4e318db 100644 --- a/src/crypto/index.ts +++ b/src/crypto/index.ts @@ -326,8 +326,6 @@ export type CryptoEventHandlerMap = CryptoApiCryptoEventHandlerMap & { */ [CryptoEvent.Warning]: (type: string) => void; [CryptoEvent.UserCrossSigningUpdated]: (userId: string) => void; - - [CryptoEvent.LegacyCryptoStoreMigrationProgress]: (progress: number, total: number) => void; }; export class Crypto extends TypedEventEmitter implements CryptoBackend { From d9dd22ae254003e204aa526d628eb9919d0ee069 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Thu, 28 Nov 2024 12:39:59 +0100 Subject: [PATCH 3/3] Remove `olmLib` usage in `MatrixClient` --- src/client.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/client.ts b/src/client.ts index 86e49a850b1..5ef823a298b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -46,7 +46,6 @@ import { noUnsafeEventProps, QueryDict, replaceParam, safeSet, sleep } from "./u import { Direction, EventTimeline } from "./models/event-timeline.ts"; import { IActionsObject, PushProcessor } from "./pushprocessor.ts"; import { AutoDiscovery, AutoDiscoveryAction } from "./autodiscovery.ts"; -import * as olmlib from "./crypto/olmlib.ts"; import { decodeBase64, encodeBase64, encodeUnpaddedBase64Url } from "./base64.ts"; import { IExportedDevice as IExportedOlmDevice } from "./crypto/OlmDevice.ts"; import { IOlmDevice } from "./crypto/algorithms/megolm.ts"; @@ -10120,7 +10119,7 @@ export class MatrixClient extends TypedEventEmitter