You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
New CryptoApi.getDeviceVerificationStatus api (#3287)
* Element-R: implement `{get,set}TrustCrossSignedDevices`
A precursor to https://github.com/vector-im/element-web/issues/25092
* Pull out new `DeviceVerificationStatus`
Define a new base class to replace `DeviceTrustLevel`. The intention is to have
a cleaner interface which is easier to expose from the new crypto impl
* Define, and implement, a new `CryptoApi.getDeviceVerificationStatus`
This is similar to `checkDeviceTrust`, which we're deprecating, but:
* is `async`, meaning we can implement it in Rust
* Returns a `DeviceVerificationStatus` instead of a `DeviceTrustLevel`
* Returns `null` rather than "not verified" if the device is unknown
* add some tests
* Export DeviceVerificationStatus as a proper class
... so that we can instantiate it in tests
This commit is contained in:
committed by
GitHub
parent
8c30a3b0df
commit
a03438f2af
@@ -2621,12 +2621,14 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
|
||||
*
|
||||
* @param userId - The ID of the user whose devices is to be checked.
|
||||
* @param deviceId - The ID of the device to check
|
||||
*
|
||||
* @deprecated Use {@link CryptoApi.getDeviceVerificationStatus | `CryptoApi.getDeviceVerificationStatus`}
|
||||
*/
|
||||
public checkDeviceTrust(userId: string, deviceId: string): DeviceTrustLevel {
|
||||
if (!this.cryptoBackend) {
|
||||
if (!this.crypto) {
|
||||
throw new Error("End-to-end encryption disabled");
|
||||
}
|
||||
return this.cryptoBackend.checkDeviceTrust(userId, deviceId);
|
||||
return this.crypto.checkDeviceTrust(userId, deviceId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user