Skip to content

Commit edac6a9

Browse files
authored
Replace deprecate imports (#4565)
* Replace deprecate imports * Deprecate `CryptoBackend.getEventEncryptionInfo` * Add deprecated alternative
1 parent 97ef1dc commit edac6a9

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

src/common-crypto/CryptoBackend.ts

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export interface CryptoBackend extends SyncCryptoCallbacks, CryptoApi {
7878
* Get information about the encryption of an event
7979
*
8080
* @param event - event to be checked
81+
* @deprecated Use {@link CryptoApi#getEncryptionInfoForEvent} instead
8182
*/
8283
getEventEncryptionInfo(event: MatrixEvent): IEncryptedEventInfo;
8384

src/rust-crypto/backup.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ import {
3030
} from "../crypto-api/keybackup.ts";
3131
import { logger } from "../logger.ts";
3232
import { ClientPrefix, IHttpOpts, MatrixError, MatrixHttpApi, Method } from "../http-api/index.ts";
33-
import { IMegolmSessionData } from "../crypto/index.ts";
3433
import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
3534
import { encodeUri, logDuration } from "../utils.ts";
3635
import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts";
3736
import { sleep } from "../utils.ts";
3837
import { BackupDecryptor } from "../common-crypto/CryptoBackend.ts";
3938
import { ImportRoomKeyProgressData, ImportRoomKeysOpts, CryptoEvent } from "../crypto-api/index.ts";
4039
import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts";
40+
import { IMegolmSessionData } from "../@types/crypto.ts";
4141

4242
/** Authentification of the backup info, depends on algorithm */
4343
type AuthData = KeyBackupInfo["auth_data"];

src/rust-crypto/libolm_migration.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { CryptoStore, MigrationState, SecretStorePrivateKeys } from "../crypto/s
2121
import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts";
2222
import { IHttpOpts, MatrixHttpApi } from "../http-api/index.ts";
2323
import { requestKeyBackupVersion } from "./backup.ts";
24-
import { IRoomEncryption } from "../crypto/RoomList.ts";
2524
import { CrossSigningKeyInfo, Curve25519AuthData } from "../crypto-api/index.ts";
2625
import { RustCrypto } from "./rust-crypto.ts";
2726
import { KeyBackupInfo } from "../crypto-api/keybackup.ts";
@@ -30,6 +29,12 @@ import { encodeBase64 } from "../base64.ts";
3029
import decryptAESSecretStorageItem from "../utils/decryptAESSecretStorageItem.ts";
3130
import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts";
3231

32+
interface LegacyRoomEncryption {
33+
algorithm: string;
34+
rotation_period_ms?: number;
35+
rotation_period_msgs?: number;
36+
}
37+
3338
/**
3439
* Determine if any data needs migrating from the legacy store, and do so.
3540
*
@@ -375,7 +380,7 @@ export async function migrateRoomSettingsFromLegacyCrypto({
375380
return;
376381
}
377382

378-
let rooms: Record<string, IRoomEncryption> = {};
383+
let rooms: Record<string, LegacyRoomEncryption> = {};
379384

380385
await legacyStore.doTxn("readwrite", [IndexedDBCryptoStore.STORE_ROOMS], (txn) => {
381386
legacyStore.getEndToEndRooms(txn, (result) => {

src/testing.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ limitations under the License.
2525
import { IContent, IEvent, IUnsigned, MatrixEvent } from "./models/event.ts";
2626
import { RoomMember } from "./models/room-member.ts";
2727
import { EventType } from "./@types/event.ts";
28-
import { DecryptionError } from "./crypto/algorithms/index.ts";
2928
import { DecryptionFailureCode } from "./crypto-api/index.ts";
30-
import { EventDecryptionResult } from "./common-crypto/CryptoBackend.ts";
29+
import { DecryptionError, EventDecryptionResult } from "./common-crypto/CryptoBackend.ts";
3130

3231
/**
3332
* Create a {@link MatrixEvent}.

0 commit comments

Comments
 (0)