ffi: Expose ed25519/curve25519 keys in bindings (#3420)

This commit is contained in:
Valere
2024-05-17 13:55:18 +02:00
committed by GitHub
parent b0558a002b
commit 6111beded7
2 changed files with 18 additions and 0 deletions

View File

@@ -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();

View File

@@ -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