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§impl Serialize for DeviceKeys
impl Serialize for DeviceKeys
Source§impl TryFrom<&DeviceKeys> for DeviceData
impl TryFrom<&DeviceKeys> for DeviceData
Source§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§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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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