mirror of
https://github.com/element-hq/element-android
synced 2024-12-21 00:42:04 +03:00
crypto: Expose the trust state of our devices
This commit is contained in:
parent
6649aaca2e
commit
6a79d022c3
5 changed files with 22 additions and 3 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
package org.matrix.android.sdk.internal.crypto
|
||||||
|
|
|
@ -23,10 +23,12 @@ version = "0.2.0"
|
||||||
features = ["lax_deserialize"]
|
features = ["lax_deserialize"]
|
||||||
|
|
||||||
[dependencies.matrix-sdk-common]
|
[dependencies.matrix-sdk-common]
|
||||||
version = "0.3.0"
|
git = "https://github.com/matrix-org/matrix-rust-sdk/"
|
||||||
|
rev = "43583c292644e0e9bdaa6c83b2af35721416a263"
|
||||||
|
|
||||||
[dependencies.matrix-sdk-crypto]
|
[dependencies.matrix-sdk-crypto]
|
||||||
version = "0.3.0"
|
git = "https://github.com/matrix-org/matrix-rust-sdk/"
|
||||||
|
rev = "43583c292644e0e9bdaa6c83b2af35721416a263"
|
||||||
features = ["sled_cryptostore"]
|
features = ["sled_cryptostore"]
|
||||||
|
|
||||||
[dependencies.tokio]
|
[dependencies.tokio]
|
||||||
|
|
|
@ -19,6 +19,11 @@ pub struct Device {
|
||||||
/// A flag indicating if the device has been blocked, blocked devices don't
|
/// A flag indicating if the device has been blocked, blocked devices don't
|
||||||
/// receive any room keys from us.
|
/// receive any room keys from us.
|
||||||
pub is_blocked: bool,
|
pub is_blocked: bool,
|
||||||
|
/// Is the device locally trusted
|
||||||
|
pub locally_trusted: bool,
|
||||||
|
/// Is our cross signing identity trusted and does the identity trust the
|
||||||
|
/// device.
|
||||||
|
pub cross_signing_trusted: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<InnerDevice> for Device {
|
impl From<InnerDevice> for Device {
|
||||||
|
@ -34,6 +39,8 @@ impl From<InnerDevice> for Device {
|
||||||
algorithms: d.algorithms().iter().map(|a| a.to_string()).collect(),
|
algorithms: d.algorithms().iter().map(|a| a.to_string()).collect(),
|
||||||
display_name: d.display_name().clone(),
|
display_name: d.display_name().clone(),
|
||||||
is_blocked: d.is_blacklisted(),
|
is_blocked: d.is_blacklisted(),
|
||||||
|
locally_trusted: d.is_locally_trusted(),
|
||||||
|
cross_signing_trusted: d.is_cross_signing_trusted(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,10 @@ pub struct Sas {
|
||||||
pub other_user_id: String,
|
pub other_user_id: String,
|
||||||
pub other_device_id: String,
|
pub other_device_id: String,
|
||||||
pub flow_id: String,
|
pub flow_id: String,
|
||||||
|
pub have_we_confirmed: bool,
|
||||||
pub is_cancelled: bool,
|
pub is_cancelled: bool,
|
||||||
pub is_done: bool,
|
pub is_done: bool,
|
||||||
|
pub cancel_code: Option<CancelCode>,
|
||||||
pub can_be_presented: bool,
|
pub can_be_presented: bool,
|
||||||
pub supports_emoji: bool,
|
pub supports_emoji: bool,
|
||||||
pub timed_out: bool,
|
pub timed_out: bool,
|
||||||
|
@ -73,6 +75,8 @@ impl From<InnerSas> for Sas {
|
||||||
can_be_presented: sas.can_be_presented(),
|
can_be_presented: sas.can_be_presented(),
|
||||||
timed_out: sas.timed_out(),
|
timed_out: sas.timed_out(),
|
||||||
supports_emoji: sas.supports_emoji(),
|
supports_emoji: sas.supports_emoji(),
|
||||||
|
have_we_confirmed: sas.have_we_confirmed(),
|
||||||
|
cancel_code: sas.cancel_code().map(|c| c.into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +106,7 @@ impl From<InnerVerificationRequest> for VerificationRequest {
|
||||||
is_done: v.is_done(),
|
is_done: v.is_done(),
|
||||||
is_ready: v.is_ready(),
|
is_ready: v.is_ready(),
|
||||||
room_id: v.room_id().map(|r| r.to_string()),
|
room_id: v.room_id().map(|r| r.to_string()),
|
||||||
cancel_code: v.cancel_code().map(|c| c.clone().into()),
|
cancel_code: v.cancel_code().map(|c| c.into()),
|
||||||
we_started: v.we_started(),
|
we_started: v.we_started(),
|
||||||
is_passive: v.is_passive(),
|
is_passive: v.is_passive(),
|
||||||
their_methods: v
|
their_methods: v
|
||||||
|
|
|
@ -61,6 +61,8 @@ dictionary Device {
|
||||||
sequence<string> algorithms;
|
sequence<string> algorithms;
|
||||||
string? display_name;
|
string? display_name;
|
||||||
boolean is_blocked;
|
boolean is_blocked;
|
||||||
|
boolean locally_trusted;
|
||||||
|
boolean cross_signing_trusted;
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary StartSasResult {
|
dictionary StartSasResult {
|
||||||
|
@ -72,6 +74,8 @@ dictionary Sas {
|
||||||
string other_user_id;
|
string other_user_id;
|
||||||
string other_device_id;
|
string other_device_id;
|
||||||
string flow_id;
|
string flow_id;
|
||||||
|
CancelCode? cancel_code;
|
||||||
|
boolean have_we_confirmed;
|
||||||
boolean is_done;
|
boolean is_done;
|
||||||
boolean is_cancelled;
|
boolean is_cancelled;
|
||||||
boolean can_be_presented;
|
boolean can_be_presented;
|
||||||
|
|
Loading…
Reference in a new issue