Merge pull request #704 from matrix-org/poljar/eq-store-encryption
feat(store-encryption): Derive Eq for some structs
This commit is contained in:
@@ -177,7 +177,13 @@ impl Room {
|
||||
|
||||
/// Get the avatar url of this room.
|
||||
pub fn avatar_url(&self) -> Option<OwnedMxcUri> {
|
||||
self.inner.read().unwrap().base_info.avatar.as_ref()?.as_original()?.content.url.clone()
|
||||
self.inner
|
||||
.read()
|
||||
.unwrap()
|
||||
.base_info
|
||||
.avatar
|
||||
.as_ref()
|
||||
.and_then(|e| e.as_original().and_then(|e| e.content.url.clone()))
|
||||
}
|
||||
|
||||
/// Get the canonical alias of this room.
|
||||
@@ -194,7 +200,13 @@ impl Room {
|
||||
/// It can also be redacted in current room versions, leaving only the
|
||||
/// `creator` field.
|
||||
pub fn create_content(&self) -> Option<RoomCreateEventContent> {
|
||||
Some(self.inner.read().unwrap().base_info.create.as_ref()?.as_original()?.content.clone())
|
||||
self.inner
|
||||
.read()
|
||||
.unwrap()
|
||||
.base_info
|
||||
.create
|
||||
.as_ref()
|
||||
.and_then(|e| e.as_original().map(|e| e.content.clone()))
|
||||
}
|
||||
|
||||
/// Is this room considered a direct message.
|
||||
|
||||
@@ -43,7 +43,7 @@ use crate::{
|
||||
};
|
||||
|
||||
/// An error describing why a key share request won't be honored.
|
||||
#[derive(Debug, Clone, Error, PartialEq)]
|
||||
#[derive(Debug, Clone, Error, PartialEq, Eq)]
|
||||
pub enum KeyForwardDecision {
|
||||
/// The key request is from a device that we don't own, we're only sharing
|
||||
/// sessions that we know the requesting device already was supposed to get.
|
||||
|
||||
@@ -348,7 +348,7 @@ impl UserDevices {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
/// The local trust state of a device.
|
||||
pub enum LocalTrust {
|
||||
/// The device has been verified and is trusted.
|
||||
|
||||
@@ -45,7 +45,7 @@ use std::collections::{BTreeMap, BTreeSet};
|
||||
use ruma::OwnedRoomId;
|
||||
|
||||
/// Return type for the room key importing.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct RoomKeyImportResult {
|
||||
/// The number of room keys that were imported.
|
||||
pub imported_count: usize,
|
||||
|
||||
@@ -29,7 +29,7 @@ use vodozemac::{Curve25519PublicKey, Ed25519Signature};
|
||||
pub type SignedKeySignatures = BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceKeyId, Ed25519Signature>>;
|
||||
|
||||
/// A key for the SignedCurve25519 algorithm
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct SignedKey {
|
||||
// /// The Curve25519 key that can be used to establish Olm sessions.
|
||||
#[serde(deserialize_with = "deserialize_curve_key", serialize_with = "serialize_curve_key")]
|
||||
@@ -151,7 +151,7 @@ impl SignedKey {
|
||||
}
|
||||
|
||||
/// A one-time public key for "pre-key" messages.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(untagged)]
|
||||
pub enum OneTimeKey {
|
||||
/// A signed Curve25519 one-time key.
|
||||
|
||||
@@ -376,7 +376,7 @@ impl Cancelled {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Hash, PartialEq, PartialOrd)]
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd)]
|
||||
pub enum FlowId {
|
||||
ToDevice(OwnedTransactionId),
|
||||
InRoom(OwnedRoomId, OwnedEventId),
|
||||
|
||||
@@ -500,7 +500,7 @@ impl MacKey {
|
||||
|
||||
/// Encrypted value, ready for storage, as created by the
|
||||
/// [`StoreCipher::encrypt_value_data()`]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct EncryptedValue {
|
||||
version: u8,
|
||||
ciphertext: Vec<u8>,
|
||||
@@ -557,7 +557,7 @@ impl Keys {
|
||||
}
|
||||
|
||||
/// Version specific info for the key derivation method that is used.
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
enum KdfInfo {
|
||||
/// The PBKDF2 to Chacha key derivation variant.
|
||||
Pbkdf2ToChaCha20Poly1305 {
|
||||
@@ -572,7 +572,7 @@ enum KdfInfo {
|
||||
|
||||
/// Version specific info for encryption method that is used to encrypt our
|
||||
/// store cipher.
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
enum CipherTextInfo {
|
||||
/// A store cipher encrypted using the ChaCha20Poly1305 AEAD.
|
||||
ChaCha20Poly1305 {
|
||||
@@ -585,7 +585,7 @@ enum CipherTextInfo {
|
||||
|
||||
/// An encrypted version of our store cipher, this can be safely stored in a
|
||||
/// database.
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
struct EncryptedStoreCipher {
|
||||
/// Info about the key derivation method that was used to expand the
|
||||
/// passphrase into an encryption key.
|
||||
|
||||
Reference in New Issue
Block a user