Struct matrix_sdk_crypto::DeviceData
source · 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
§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,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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