From 2de2bc658ccd3195bdcbeb120a5999eeaa45eca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 24 May 2024 11:17:56 +0200 Subject: [PATCH] feat(sdk): Return the Curve25519Public key type instead of a string (#3450) --- bindings/matrix-sdk-ffi/src/encryption.rs | 2 +- crates/matrix-sdk/src/encryption/mod.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bindings/matrix-sdk-ffi/src/encryption.rs b/bindings/matrix-sdk-ffi/src/encryption.rs index d7cb93ce1..b39c5ec14 100644 --- a/bindings/matrix-sdk-ffi/src/encryption.rs +++ b/bindings/matrix-sdk-ffi/src/encryption.rs @@ -222,7 +222,7 @@ impl Encryption { /// Get the public curve25519 key of our own device in base64. This is /// usually what is called the identity key of the device. pub async fn curve25519_key(&self) -> Option { - self.inner.curve25519_key().await + self.inner.curve25519_key().await.map(|k| k.to_base64()) } pub fn backup_state_listener(&self, listener: Box) -> Arc { diff --git a/crates/matrix-sdk/src/encryption/mod.rs b/crates/matrix-sdk/src/encryption/mod.rs index 301d85c6b..256b15dbd 100644 --- a/crates/matrix-sdk/src/encryption/mod.rs +++ b/crates/matrix-sdk/src/encryption/mod.rs @@ -57,6 +57,7 @@ use ruma::{ }; use tokio::sync::RwLockReadGuard; use tracing::{debug, error, instrument, trace, warn}; +use vodozemac::Curve25519PublicKey; use self::{ backups::{types::BackupClientState, Backups}, @@ -613,10 +614,9 @@ impl Encryption { self.client.olm_machine().await.as_ref().map(|o| o.identity_keys().ed25519.to_base64()) } - /// Get the public curve25519 key of our own device in base64. This is - /// usually what is called the identity key of the device. - pub async fn curve25519_key(&self) -> Option { - self.client.olm_machine().await.as_ref().map(|o| o.identity_keys().curve25519.to_base64()) + /// Get the public Curve25519 key of our own device. + pub async fn curve25519_key(&self) -> Option { + self.client.olm_machine().await.as_ref().map(|o| o.identity_keys().curve25519) } /// Get the status of the private cross signing keys.