feat(sdk): Add a method to check the status of our private cross signing keys

This commit is contained in:
Damir Jelić 2021-09-08 13:16:59 +02:00
parent 7c2b6ede1f
commit 05663a42ed

View file

@ -51,7 +51,7 @@ use matrix_sdk_base::crypto::{
ToDeviceRequest,
};
#[cfg(feature = "encryption")]
use matrix_sdk_base::deserialized_responses::RoomEvent;
use matrix_sdk_base::{crypto::CrossSigningStatus, deserialized_responses::RoomEvent};
use matrix_sdk_base::{
deserialized_responses::{JoinedRoom, LeftRoom, SyncResponse},
media::{MediaEventContent, MediaFormat, MediaRequest, MediaThumbnailSize, MediaType},
@ -2521,6 +2521,20 @@ impl Client {
Ok(device.map(|d| Device { inner: d, client: self.clone() }))
}
/// Get the status of the private cross signing keys.
///
/// This can be used to check which private cross signing keys we have
/// stored locally.
#[cfg(feature = "encryption")]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub async fn cross_signing_status(&self) -> Option<CrossSigningStatus> {
if let Some(machine) = self.base_client.olm_machine().await {
Some(machine.cross_signing_status().await)
} else {
None
}
}
/// Create and upload a new cross signing identity.
///
/// # Arguments