1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00

Replace deprecate imports (#4565)

* Replace deprecate imports

* Deprecate `CryptoBackend.getEventEncryptionInfo`

* Add deprecated alternative
This commit is contained in:
Florian Duros
2024-11-29 11:04:20 +01:00
committed by GitHub
parent 97ef1dc6df
commit edac6a9983
4 changed files with 10 additions and 5 deletions

View File

@@ -78,6 +78,7 @@ export interface CryptoBackend extends SyncCryptoCallbacks, CryptoApi {
* Get information about the encryption of an event * Get information about the encryption of an event
* *
* @param event - event to be checked * @param event - event to be checked
* @deprecated Use {@link CryptoApi#getEncryptionInfoForEvent} instead
*/ */
getEventEncryptionInfo(event: MatrixEvent): IEncryptedEventInfo; getEventEncryptionInfo(event: MatrixEvent): IEncryptedEventInfo;

View File

@@ -30,7 +30,6 @@ import {
} from "../crypto-api/keybackup.ts"; } from "../crypto-api/keybackup.ts";
import { logger } from "../logger.ts"; import { logger } from "../logger.ts";
import { ClientPrefix, IHttpOpts, MatrixError, MatrixHttpApi, Method } from "../http-api/index.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 { TypedEventEmitter } from "../models/typed-event-emitter.ts";
import { encodeUri, logDuration } from "../utils.ts"; import { encodeUri, logDuration } from "../utils.ts";
import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts"; import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor.ts";
@@ -38,6 +37,7 @@ import { sleep } from "../utils.ts";
import { BackupDecryptor } from "../common-crypto/CryptoBackend.ts"; import { BackupDecryptor } from "../common-crypto/CryptoBackend.ts";
import { ImportRoomKeyProgressData, ImportRoomKeysOpts, CryptoEvent } from "../crypto-api/index.ts"; import { ImportRoomKeyProgressData, ImportRoomKeysOpts, CryptoEvent } from "../crypto-api/index.ts";
import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts"; import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.ts";
import { IMegolmSessionData } from "../@types/crypto.ts";
/** Authentification of the backup info, depends on algorithm */ /** Authentification of the backup info, depends on algorithm */
type AuthData = KeyBackupInfo["auth_data"]; type AuthData = KeyBackupInfo["auth_data"];

View File

@@ -21,7 +21,6 @@ import { CryptoStore, MigrationState, SecretStorePrivateKeys } from "../crypto/s
import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts"; import { IndexedDBCryptoStore } from "../crypto/store/indexeddb-crypto-store.ts";
import { IHttpOpts, MatrixHttpApi } from "../http-api/index.ts"; import { IHttpOpts, MatrixHttpApi } from "../http-api/index.ts";
import { requestKeyBackupVersion } from "./backup.ts"; import { requestKeyBackupVersion } from "./backup.ts";
import { IRoomEncryption } from "../crypto/RoomList.ts";
import { CrossSigningKeyInfo, Curve25519AuthData } from "../crypto-api/index.ts"; import { CrossSigningKeyInfo, Curve25519AuthData } from "../crypto-api/index.ts";
import { RustCrypto } from "./rust-crypto.ts"; import { RustCrypto } from "./rust-crypto.ts";
import { KeyBackupInfo } from "../crypto-api/keybackup.ts"; import { KeyBackupInfo } from "../crypto-api/keybackup.ts";
@@ -30,6 +29,12 @@ import { encodeBase64 } from "../base64.ts";
import decryptAESSecretStorageItem from "../utils/decryptAESSecretStorageItem.ts"; import decryptAESSecretStorageItem from "../utils/decryptAESSecretStorageItem.ts";
import { AESEncryptedSecretStoragePayload } from "../@types/AESEncryptedSecretStoragePayload.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. * Determine if any data needs migrating from the legacy store, and do so.
* *
@@ -375,7 +380,7 @@ export async function migrateRoomSettingsFromLegacyCrypto({
return; return;
} }
let rooms: Record<string, IRoomEncryption> = {}; let rooms: Record<string, LegacyRoomEncryption> = {};
await legacyStore.doTxn("readwrite", [IndexedDBCryptoStore.STORE_ROOMS], (txn) => { await legacyStore.doTxn("readwrite", [IndexedDBCryptoStore.STORE_ROOMS], (txn) => {
legacyStore.getEndToEndRooms(txn, (result) => { legacyStore.getEndToEndRooms(txn, (result) => {

View File

@@ -25,9 +25,8 @@ limitations under the License.
import { IContent, IEvent, IUnsigned, MatrixEvent } from "./models/event.ts"; import { IContent, IEvent, IUnsigned, MatrixEvent } from "./models/event.ts";
import { RoomMember } from "./models/room-member.ts"; import { RoomMember } from "./models/room-member.ts";
import { EventType } from "./@types/event.ts"; import { EventType } from "./@types/event.ts";
import { DecryptionError } from "./crypto/algorithms/index.ts";
import { DecryptionFailureCode } from "./crypto-api/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}. * Create a {@link MatrixEvent}.