From 8dbbacfbe618c5301490984f4ba63c4633224264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 6 May 2021 21:44:50 +0200 Subject: [PATCH] client: Add a method to get the ed25519 key of our own device --- matrix_sdk/src/client.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index 8b4fe692..a6d9b651 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -543,6 +543,17 @@ impl Client { session.as_ref().map(|s| s.device_id.clone()) } + /// Get the public ed25519 key of our own device. This is usually what is + /// called the fingerprint of the device. + #[cfg(feature = "encryption")] + #[cfg_attr(feature = "docs", doc(cfg(encryption)))] + pub async fn ed25519_key(&self) -> Option { + self.base_client + .olm_machine() + .await + .map(|o| o.identity_keys().ed25519().to_owned()) + } + /// Fetches the display name of the owner of the client. /// /// # Example