Struct matrix_sdk_crypto::types::DeviceKeys
source · pub struct DeviceKeys {
pub user_id: OwnedUserId,
pub device_id: OwnedDeviceId,
pub algorithms: Vec<EventEncryptionAlgorithm>,
pub keys: BTreeMap<OwnedDeviceKeyId, DeviceKey>,
pub signatures: Signatures,
pub dehydrated: JsOption<bool>,
pub unsigned: UnsignedDeviceInfo,
/* private fields */
}
Expand description
Represents a Matrix cryptographic device
This struct models a Matrix cryptographic device involved in end-to-end
encrypted messaging, specifically for to-device communication. It aligns
with the DeviceKeys
struct in the Matrix
Specification, encapsulating essential elements such as the public device
identity keys.
Fields§
§user_id: OwnedUserId
The ID of the user the device belongs to.
Must match the user ID used when logging in.
device_id: OwnedDeviceId
The ID of the device these keys belong to.
Must match the device ID used when logging in.
algorithms: Vec<EventEncryptionAlgorithm>
The encryption algorithms supported by this device.
keys: BTreeMap<OwnedDeviceKeyId, DeviceKey>
Public identity keys.
signatures: Signatures
Signatures for the device key object.
dehydrated: JsOption<bool>
Whether the device is a dehydrated device or not
unsigned: UnsignedDeviceInfo
Additional data added to the device key information by intermediate servers, and not covered by the signatures.
Implementations§
source§impl DeviceKeys
impl DeviceKeys
sourcepub fn new(
user_id: OwnedUserId,
device_id: OwnedDeviceId,
algorithms: Vec<EventEncryptionAlgorithm>,
keys: BTreeMap<OwnedDeviceKeyId, DeviceKey>,
signatures: Signatures,
) -> Self
pub fn new( user_id: OwnedUserId, device_id: OwnedDeviceId, algorithms: Vec<EventEncryptionAlgorithm>, keys: BTreeMap<OwnedDeviceKeyId, DeviceKey>, signatures: Signatures, ) -> Self
Creates a new DeviceKeys
from the given user id, device ID,
algorithms, keys and signatures.
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.
Trait Implementations§
source§impl Clone for DeviceKeys
impl Clone for DeviceKeys
source§fn clone(&self) -> DeviceKeys
fn clone(&self) -> DeviceKeys
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DeviceKeys
impl Debug for DeviceKeys
source§impl<'de> Deserialize<'de> for DeviceKeys
impl<'de> Deserialize<'de> for DeviceKeys
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 DeviceKeys
impl PartialEq for DeviceKeys
source§fn eq(&self, other: &DeviceKeys) -> bool
fn eq(&self, other: &DeviceKeys) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for DeviceKeys
impl Serialize for DeviceKeys
source§impl TryFrom<&DeviceKeys> for DeviceData
impl TryFrom<&DeviceKeys> for DeviceData
§type Error = SignatureError
type Error = SignatureError
impl StructuralPartialEq for DeviceKeys
Auto Trait Implementations§
impl Freeze for DeviceKeys
impl RefUnwindSafe for DeviceKeys
impl Send for DeviceKeys
impl Sync for DeviceKeys
impl Unpin for DeviceKeys
impl UnwindSafe for DeviceKeys
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