pub struct DeviceData { /* private fields */ }
Expand description
A read-only version of a Device
.
Implementations§
Source§impl DeviceData
impl DeviceData
Sourcepub fn new(device_keys: DeviceKeys, trust_state: LocalTrust) -> Self
pub fn new(device_keys: DeviceKeys, trust_state: LocalTrust) -> Self
Create a new Device, this constructor skips signature verification of
the keys, TryFrom
should be used for completely new devices we
receive.
Sourcepub fn display_name(&self) -> Option<&str>
pub fn display_name(&self) -> Option<&str>
Get the human readable name of the device.
Sourcepub fn get_key(&self, algorithm: DeviceKeyAlgorithm) -> Option<&DeviceKey>
pub fn get_key(&self, algorithm: DeviceKeyAlgorithm) -> Option<&DeviceKey>
Get the key of the given key algorithm belonging to this device.
Sourcepub fn curve25519_key(&self) -> Option<Curve25519PublicKey>
pub fn curve25519_key(&self) -> Option<Curve25519PublicKey>
Get the Curve25519 key of the given device.
Sourcepub fn ed25519_key(&self) -> Option<Ed25519PublicKey>
pub fn ed25519_key(&self) -> Option<Ed25519PublicKey>
Get the Ed25519 key of the given device.
Sourcepub fn keys(&self) -> &BTreeMap<OwnedDeviceKeyId, DeviceKey>
pub fn keys(&self) -> &BTreeMap<OwnedDeviceKeyId, DeviceKey>
Get a map containing all the device keys.
Sourcepub fn signatures(&self) -> &Signatures
pub fn signatures(&self) -> &Signatures
Get a map containing all the device signatures.
Sourcepub fn local_trust_state(&self) -> LocalTrust
pub fn local_trust_state(&self) -> LocalTrust
Get the trust state of the device.
Sourcepub fn is_locally_trusted(&self) -> bool
pub fn is_locally_trusted(&self) -> bool
Is the device locally marked as trusted.
Sourcepub fn is_blacklisted(&self) -> bool
pub fn is_blacklisted(&self) -> bool
Is the device locally marked as blacklisted.
Blacklisted devices won’t receive any group sessions.
Sourcepub fn was_withheld_code_sent(&self) -> bool
pub fn was_withheld_code_sent(&self) -> bool
Returns true if the m.no_olm
withheld code was already sent to this
device.
Sourcepub fn algorithms(&self) -> &[EventEncryptionAlgorithm]
pub fn algorithms(&self) -> &[EventEncryptionAlgorithm]
Get the list of algorithms this device supports.
Sourcepub fn supports_olm(&self) -> bool
pub fn supports_olm(&self) -> bool
Does this device support any of our known Olm encryption algorithms.
Sourcepub fn olm_session_config(&self) -> SessionConfig
pub fn olm_session_config(&self) -> SessionConfig
Get the optimal SessionConfig
for this device.
Sourcepub fn is_deleted(&self) -> bool
pub fn is_deleted(&self) -> bool
Is the device deleted.
Sourcepub fn as_device_keys(&self) -> &DeviceKeys
pub fn as_device_keys(&self) -> &DeviceKeys
Return the device keys
Sourcepub fn from_account(account: &Account) -> DeviceData
pub fn from_account(account: &Account) -> DeviceData
Create DeviceData
from an Account
.
We will have our own device data in the store once we receive a
/keys/query
response, but this is useful to create it before we
receive such a response.
It also makes it easier to check that the server doesn’t lie about our own device.
Don’t use this after we received a /keys/query
response, other
users/devices might add signatures to our own device, which can’t be
replicated locally.
Sourcepub fn first_time_seen_ts(&self) -> MilliSecondsSinceUnixEpoch
pub fn first_time_seen_ts(&self) -> MilliSecondsSinceUnixEpoch
Get the local timestamp of when this device was first persisted, in milliseconds since epoch (client local time).
Trait Implementations§
Source§impl Clone for DeviceData
impl Clone for DeviceData
Source§fn clone(&self) -> DeviceData
fn clone(&self) -> DeviceData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DeviceData
Available on non-tarpaulin_include
only.
impl Debug for DeviceData
tarpaulin_include
only.Source§impl<'de> Deserialize<'de> for DeviceData
impl<'de> Deserialize<'de> for DeviceData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for DeviceData
impl PartialEq for DeviceData
Source§impl Serialize for DeviceData
impl Serialize for DeviceData
Source§impl TryFrom<&DeviceKeys> for DeviceData
impl TryFrom<&DeviceKeys> for DeviceData
Source§type Error = SignatureError
type Error = SignatureError
Auto Trait Implementations§
impl Freeze for DeviceData
impl RefUnwindSafe for DeviceData
impl Send for DeviceData
impl Sync for DeviceData
impl Unpin for DeviceData
impl UnwindSafe for DeviceData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more