1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-23 17:02:25 +03:00

Implement getEncryptionInfoForEvent and deprecate getEventEncryptionInfo (#3693)

* Implement `getEncryptionInfoForEvent` and deprecate `getEventEncryptionInfo`

* fix tsdoc

* fix tests

* Improve test coverage
This commit is contained in:
Richard van der Hoff
2023-09-07 10:39:10 +01:00
committed by GitHub
parent 0700e86f58
commit 7e691bf700
7 changed files with 277 additions and 3 deletions

View File

@@ -39,6 +39,8 @@ import {
CrossSigningStatus,
CryptoCallbacks,
DeviceVerificationStatus,
EventEncryptionInfo,
EventShieldColour,
GeneratedSecretStorageKey,
ImportRoomKeyProgressData,
ImportRoomKeysOpts,
@@ -208,6 +210,11 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, RustCryptoEv
return await this.eventDecryptor.attemptEventDecryption(event);
}
/**
* Implementation of (deprecated) {@link MatrixClient#getEventEncryptionInfo}.
*
* @param event - event to inspect
*/
public getEventEncryptionInfo(event: MatrixEvent): IEncryptedEventInfo {
// TODO: make this work properly. Or better, replace it.
@@ -732,6 +739,16 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, RustCryptoEv
};
}
/**
* Implementation of {@link CryptoApi.getEncryptionInfoForEvent}.
*/
public async getEncryptionInfoForEvent(event: MatrixEvent): Promise<EventEncryptionInfo | null> {
return {
shieldColour: EventShieldColour.NONE,
shieldReason: null,
};
}
/**
* Returns to-device verification requests that are already in progress for the given user id.
*