mirror of
https://github.com/girlbossceo/ruwuma.git
synced 2025-04-29 06:49:48 -04:00
default to an empty signatures, alias msc2732 fallback_keys, add random unspecced field to device_keys
Signed-off-by: June Clementine Strawberry <june@3.dog>
This commit is contained in:
parent
bb42118bd8
commit
d577100f54
2 changed files with 24 additions and 3 deletions
|
@ -44,7 +44,11 @@ pub mod v3 {
|
|||
pub one_time_keys: BTreeMap<OwnedOneTimeKeyId, Raw<OneTimeKey>>,
|
||||
|
||||
/// Fallback public keys for "pre-key" messages.
|
||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||
#[serde(
|
||||
default,
|
||||
skip_serializing_if = "BTreeMap::is_empty",
|
||||
alias = "org.matrix.msc2732.fallback_keys"
|
||||
)]
|
||||
pub fallback_keys: BTreeMap<OwnedOneTimeKeyId, Raw<OneTimeKey>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ use serde::{Deserialize, Serialize};
|
|||
use crate::{
|
||||
serde::{Base64, StringEnum},
|
||||
CrossSigningOrDeviceSignatures, DeviceSignatures, EventEncryptionAlgorithm,
|
||||
OwnedCrossSigningKeyId, OwnedDeviceId, OwnedDeviceKeyId, OwnedUserId, PrivOwnedStr,
|
||||
MilliSecondsSinceUnixEpoch, OwnedCrossSigningKeyId, OwnedDeviceId, OwnedDeviceKeyId,
|
||||
OwnedUserId, PrivOwnedStr,
|
||||
};
|
||||
|
||||
/// Identity keys for a device.
|
||||
|
@ -33,12 +34,19 @@ pub struct DeviceKeys {
|
|||
pub keys: BTreeMap<OwnedDeviceKeyId, String>,
|
||||
|
||||
/// Signatures for the device key object.
|
||||
///
|
||||
/// serde default is because synapse doesn't seem to mandate this field
|
||||
#[serde(default)]
|
||||
pub signatures: CrossSigningOrDeviceSignatures,
|
||||
|
||||
/// Additional data added to the device key information by intermediate servers, and
|
||||
/// not covered by the signatures.
|
||||
#[serde(default, skip_serializing_if = "UnsignedDeviceInfo::is_empty")]
|
||||
pub unsigned: UnsignedDeviceInfo,
|
||||
|
||||
/// unspecced legacy synapse/client field?
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub valid_until_ts: Option<MilliSecondsSinceUnixEpoch>,
|
||||
}
|
||||
|
||||
impl DeviceKeys {
|
||||
|
@ -50,8 +58,17 @@ impl DeviceKeys {
|
|||
algorithms: Vec<EventEncryptionAlgorithm>,
|
||||
keys: BTreeMap<OwnedDeviceKeyId, String>,
|
||||
signatures: CrossSigningOrDeviceSignatures,
|
||||
valid_until_ts: Option<MilliSecondsSinceUnixEpoch>,
|
||||
) -> Self {
|
||||
Self { user_id, device_id, algorithms, keys, signatures, unsigned: Default::default() }
|
||||
Self {
|
||||
user_id,
|
||||
device_id,
|
||||
algorithms,
|
||||
keys,
|
||||
signatures,
|
||||
unsigned: Default::default(),
|
||||
valid_until_ts,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue