diff --git a/matrix_sdk_crypto/src/user_identity.rs b/matrix_sdk_crypto/src/user_identity.rs index 4594b6f9..8b154a2f 100644 --- a/matrix_sdk_crypto/src/user_identity.rs +++ b/matrix_sdk_crypto/src/user_identity.rs @@ -20,6 +20,7 @@ use std::{ }, }; +use serde::{Deserialize, Serialize}; use serde_json::to_value; use matrix_sdk_common::{ @@ -33,19 +34,19 @@ use crate::{error::SignatureError, verify_json, ReadOnlyDevice}; /// /// Master keys are used to sign other cross signing keys, the self signing and /// user signing keys of an user will be signed by their master key. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct MasterPubkey(Arc); /// Wrapper for a cross signing key marking it as a self signing key. /// /// Self signing keys are used to sign the user's own devices. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct SelfSigningPubkey(Arc); /// Wrapper for a cross signing key marking it as a user signing key. /// /// User signing keys are used to sign the master keys of other users. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct UserSigningPubkey(Arc); impl PartialEq for MasterPubkey { @@ -233,7 +234,7 @@ impl SelfSigningPubkey { } /// Enum over the different user identity types we can have. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub enum UserIdentities { /// Our own user identity. Own(OwnUserIdentity), @@ -279,7 +280,7 @@ impl PartialEq for UserIdentities { /// This is the user identity of a user that isn't our own. Other users will /// only contain a master key and a self signing key, meaning that only device /// signatures can be checked with this identity. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Deserialize, Serialize)] pub struct UserIdentity { user_id: Arc, master_key: MasterPubkey, @@ -370,7 +371,7 @@ impl UserIdentity { /// /// This identity can verify other identities as well as devices belonging to /// the identity. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Deserialize, Serialize)] pub struct OwnUserIdentity { user_id: Arc, master_key: MasterPubkey,