From 9296cab4fcc6f64e1318a306eac4f5b97c349303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 9 Apr 2021 13:53:55 +0200 Subject: [PATCH] crypto: Expose more device data from the rust side --- .../matrix/android/sdk/internal/crypto/OlmMachine.kt | 11 ++++------- rust-sdk/src/device.rs | 6 ++++++ rust-sdk/src/olm.udl | 3 +++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt index 6c6b5abbe7..b4d929724d 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt @@ -108,17 +108,14 @@ class Device(inner: InnerDevice, machine: InnerMachine) { return CryptoDeviceInfo( this.deviceId(), this.userId(), - // TODO pass the algorithms here. - listOf(), + this.inner.algorithms, this.keys(), - // TODO pass the signatures here. + // TODO pass the signatures here, do we need this? mapOf(), - // TODO pass the display name here. - UnsignedDeviceInfo(), + UnsignedDeviceInfo(this.inner.displayName), // TODO pass trust levels here DeviceTrustLevel(false, false), - // TODO is the device blacklisted - false, + this.inner.isBlocked, // TODO null ) diff --git a/rust-sdk/src/device.rs b/rust-sdk/src/device.rs index 2e3a0a78e1..c8557c5de9 100644 --- a/rust-sdk/src/device.rs +++ b/rust-sdk/src/device.rs @@ -6,6 +6,9 @@ pub struct Device { pub user_id: String, pub device_id: String, pub keys: HashMap, + pub algorithms: Vec, + pub display_name: Option, + pub is_blocked: bool, } impl From for Device { @@ -18,6 +21,9 @@ impl From for Device { .iter() .map(|(k, v)| (k.to_string(), v.to_string())) .collect(), + algorithms: d.algorithms().iter().map(|a| a.to_string()).collect(), + display_name: d.display_name().clone(), + is_blocked: d.is_blacklisted(), } } } diff --git a/rust-sdk/src/olm.udl b/rust-sdk/src/olm.udl index 66ebb09f80..9dc626667c 100644 --- a/rust-sdk/src/olm.udl +++ b/rust-sdk/src/olm.udl @@ -57,6 +57,9 @@ dictionary Device { string user_id; string device_id; record keys; + sequence algorithms; + string? display_name; + boolean is_blocked; }; dictionary Sas {