Skip to content

Commit

Permalink
Deprecate remaining legacy functions and move `CryptoEvent.LegacyCryp…
Browse files Browse the repository at this point in the history
…toStoreMigrationProgress` handler (#4560)

* Deprecate legacy functions in `MatrixClient`

* Move `CryptoEvent.LegacyCryptoStoreMigrationProgress` handler in rust crypto

* Remove `olmLib` usage in `MatrixClient`
  • Loading branch information
florianduros authored Nov 29, 2024
1 parent 3781b6e commit 125e45c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -252,6 +251,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

Expand Down Expand Up @@ -2430,6 +2432,8 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
*
* @remarks
* Fires {@link CryptoEvent#DeviceVerificationChanged}
*
* @deprecated Not supported for Rust Cryptography.
*/
public setDeviceVerified(userId: string, deviceId: string, verified = true): Promise<void> {
const prom = this.setDeviceVerification(userId, deviceId, verified, null, null);
Expand Down Expand Up @@ -10115,7 +10119,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
type: EventType.RoomEncryption,
state_key: "",
content: {
algorithm: olmlib.MEGOLM_ALGORITHM,
algorithm: "m.megolm.v1.aes-sha2",
},
},
],
Expand Down
1 change: 1 addition & 0 deletions src/crypto-api/CryptoEventHandlerMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 0 additions & 2 deletions src/crypto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<CryptoEvent, CryptoEventHandlerMap> implements CryptoBackend {
Expand Down

0 comments on commit 125e45c

Please sign in to comment.