crypto: Expose more device data from the rust side

This commit is contained in:
Damir Jelić 2021-04-09 13:53:55 +02:00
parent 188d2d57c0
commit 9296cab4fc
3 changed files with 13 additions and 7 deletions

View File

@ -108,17 +108,14 @@ class Device(inner: InnerDevice, machine: InnerMachine) {
return CryptoDeviceInfo( return CryptoDeviceInfo(
this.deviceId(), this.deviceId(),
this.userId(), this.userId(),
// TODO pass the algorithms here. this.inner.algorithms,
listOf(),
this.keys(), this.keys(),
// TODO pass the signatures here. // TODO pass the signatures here, do we need this?
mapOf(), mapOf(),
// TODO pass the display name here. UnsignedDeviceInfo(this.inner.displayName),
UnsignedDeviceInfo(),
// TODO pass trust levels here // TODO pass trust levels here
DeviceTrustLevel(false, false), DeviceTrustLevel(false, false),
// TODO is the device blacklisted this.inner.isBlocked,
false,
// TODO // TODO
null null
) )

View File

@ -6,6 +6,9 @@ pub struct Device {
pub user_id: String, pub user_id: String,
pub device_id: String, pub device_id: String,
pub keys: HashMap<String, String>, pub keys: HashMap<String, String>,
pub algorithms: Vec<String>,
pub display_name: Option<String>,
pub is_blocked: bool,
} }
impl From<InnerDevice> for Device { impl From<InnerDevice> for Device {
@ -18,6 +21,9 @@ impl From<InnerDevice> for Device {
.iter() .iter()
.map(|(k, v)| (k.to_string(), v.to_string())) .map(|(k, v)| (k.to_string(), v.to_string()))
.collect(), .collect(),
algorithms: d.algorithms().iter().map(|a| a.to_string()).collect(),
display_name: d.display_name().clone(),
is_blocked: d.is_blacklisted(),
} }
} }
} }

View File

@ -57,6 +57,9 @@ dictionary Device {
string user_id; string user_id;
string device_id; string device_id;
record<DOMString, string> keys; record<DOMString, string> keys;
sequence<string> algorithms;
string? display_name;
boolean is_blocked;
}; };
dictionary Sas { dictionary Sas {