crypto: Expose more device data from the rust side
This commit is contained in:
		
							parent
							
								
									188d2d57c0
								
							
						
					
					
						commit
						9296cab4fc
					
				@ -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
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
@ -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(),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user