Skip to content

Commit

Permalink
Replace deprecate imports (#4565)
Browse files Browse the repository at this point in the history
* Replace deprecate imports

* Deprecate `CryptoBackend.getEventEncryptionInfo`

* Add deprecated alternative
  • Loading branch information
florianduros authored Nov 29, 2024
1 parent 97ef1dc commit edac6a9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/common-crypto/CryptoBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export interface CryptoBackend extends SyncCryptoCallbacks, CryptoApi {
* Get information about the encryption of an event
*
* @param event - event to be checked
* @deprecated Use {@link CryptoApi#getEncryptionInfoForEvent} instead
*/
getEventEncryptionInfo(event: MatrixEvent): IEncryptedEventInfo;

Expand Down
2 changes: 1 addition & 1 deletion src/rust-crypto/backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ import {
} from "../crypto-api/keybackup.ts";
import { logger } from "../logger.ts";
import { ClientPrefix, IHttpOpts, MatrixError, MatrixHttpApi, Method } from "../http-api/index.ts";
import { IMegolmSessionData } from "../crypto/index.ts";
import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
import { encodeUri, logDuration } from "../utils.ts";
import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts";
import { sleep } from "../utils.ts";
import { BackupDecryptor } from "../common-crypto/CryptoBackend.ts";
import { ImportRoomKeyProgressData, ImportRoomKeysOpts, CryptoEvent } from "../crypto-api/index.ts";
import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts";
import { IMegolmSessionData } from "../@types/crypto.ts";

/** Authentification of the backup info, depends on algorithm */
type AuthData = KeyBackupInfo["auth_data"];
Expand Down
9 changes: 7 additions & 2 deletions src/rust-crypto/libolm_migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { CryptoStore, MigrationState, SecretStorePrivateKeys } from "../crypto/s
import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts";
import { IHttpOpts, MatrixHttpApi } from "../http-api/index.ts";
import { requestKeyBackupVersion } from "./backup.ts";
import { IRoomEncryption } from "../crypto/RoomList.ts";
import { CrossSigningKeyInfo, Curve25519AuthData } from "../crypto-api/index.ts";
import { RustCrypto } from "./rust-crypto.ts";
import { KeyBackupInfo } from "../crypto-api/keybackup.ts";
Expand All @@ -30,6 +29,12 @@ import { encodeBase64 } from "../base64.ts";
import decryptAESSecretStorageItem from "../utils/decryptAESSecretStorageItem.ts";
import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts";

interface LegacyRoomEncryption {
algorithm: string;
rotation_period_ms?: number;
rotation_period_msgs?: number;
}

/**
* Determine if any data needs migrating from the legacy store, and do so.
*
Expand Down Expand Up @@ -375,7 +380,7 @@ export async function migrateRoomSettingsFromLegacyCrypto({
return;
}

let rooms: Record<string, IRoomEncryption> = {};
let rooms: Record<string, LegacyRoomEncryption> = {};

await legacyStore.doTxn("readwrite", [IndexedDBCryptoStore.STORE_ROOMS], (txn) => {
legacyStore.getEndToEndRooms(txn, (result) => {
Expand Down
3 changes: 1 addition & 2 deletions src/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ limitations under the License.
import { IContent, IEvent, IUnsigned, MatrixEvent } from "./models/event.ts";
import { RoomMember } from "./models/room-member.ts";
import { EventType } from "./@types/event.ts";
import { DecryptionError } from "./crypto/algorithms/index.ts";
import { DecryptionFailureCode } from "./crypto-api/index.ts";
import { EventDecryptionResult } from "./common-crypto/CryptoBackend.ts";
import { DecryptionError, EventDecryptionResult } from "./common-crypto/CryptoBackend.ts";

/**
* Create a {@link MatrixEvent}.
Expand Down

0 comments on commit edac6a9

Please sign in to comment.