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

View File

@ -6,6 +6,9 @@ pub struct Device {
pub user_id: String,
pub device_id: String,
pub keys: HashMap<String, String>,
pub algorithms: Vec<String>,
pub display_name: Option<String>,
pub is_blocked: bool,
}
impl From<InnerDevice> for Device {
@ -18,6 +21,9 @@ impl From<InnerDevice> 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(),
}
}
}

View File

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