From 4bab678e4685889ba5539c3856b68fffd45046e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Wed, 2 Sep 2020 11:49:49 +0200 Subject: [PATCH] crypto: Allow most of the ReadOnlyDevice to be serialized. --- matrix_sdk_crypto/Cargo.toml | 2 +- matrix_sdk_crypto/src/device.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/matrix_sdk_crypto/Cargo.toml b/matrix_sdk_crypto/Cargo.toml index e1ec78b2..8d38d331 100644 --- a/matrix_sdk_crypto/Cargo.toml +++ b/matrix_sdk_crypto/Cargo.toml @@ -26,7 +26,7 @@ matrix-sdk-common-macros = { version = "0.1.0", path = "../matrix_sdk_common_mac matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" } olm-rs = { git = 'https://gitlab.gnome.org/jhaye/olm-rs/', features = ["serde"]} -serde = { version = "1.0.115", features = ["derive"] } +serde = { version = "1.0.115", features = ["derive", "rc"] } serde_json = "1.0.57" cjson = "0.1.1" zeroize = { version = "1.1.0", features = ["zeroize_derive"] } diff --git a/matrix_sdk_crypto/src/device.rs b/matrix_sdk_crypto/src/device.rs index bfbaface..687401aa 100644 --- a/matrix_sdk_crypto/src/device.rs +++ b/matrix_sdk_crypto/src/device.rs @@ -31,6 +31,7 @@ use matrix_sdk_common::{ events::{room::encrypted::EncryptedEventContent, EventType}, identifiers::{DeviceId, DeviceKeyAlgorithm, DeviceKeyId, EventEncryptionAlgorithm, UserId}, }; +use serde::{Deserialize, Serialize}; use serde_json::{json, Value}; use tracing::warn; @@ -230,7 +231,7 @@ impl UserDevices { } } -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] /// The local trust state of a device. pub enum LocalTrust { /// The device has been verified and is trusted.