Skip to content

Commit

Permalink
ffi: Expose ed25519/curve25519 keys in bindings (#3420)
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed May 17, 2024
1 parent b0558a0 commit 6111bed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bindings/matrix-sdk-ffi/src/encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,18 @@ impl From<encryption::VerificationState> for VerificationState {

#[uniffi::export(async_runtime = "tokio")]
impl Encryption {
/// Get the public ed25519 key of our own device. This is usually what is
/// called the fingerprint of the device.
pub async fn ed25519_key(&self) -> Option<String> {
self.inner.ed25519_key().await
}

/// 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<String> {
self.inner.curve25519_key().await
}

pub fn backup_state_listener(&self, listener: Box<dyn BackupStateListener>) -> Arc<TaskHandle> {
let mut stream = self.inner.backups().state_stream();

Expand Down
6 changes: 6 additions & 0 deletions crates/matrix-sdk/src/encryption/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,12 @@ 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<String> {
self.client.olm_machine().await.as_ref().map(|o| o.identity_keys().curve25519.to_base64())
}

/// Get the status of the private cross signing keys.
///
/// This can be used to check which private cross signing keys we have
Expand Down

0 comments on commit 6111bed

Please sign in to comment.