File tree 3 files changed +33
-1
lines changed
3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ ruma_api! {
29
29
/// One-time public keys for "pre-key" messages.
30
30
#[ serde( skip_serializing_if = "Option::is_none" ) ]
31
31
pub one_time_keys: Option <BTreeMap <Box <DeviceKeyId >, Raw <OneTimeKey >>>,
32
+
33
+ /// Fallback public keys for "pre-key" messages.
34
+ #[ cfg( feature = "unstable-pre-spec" ) ]
35
+ #[ serde( skip_serializing_if = "Option::is_none" , rename = "org.matrix.msc2732.fallback_keys" ) ]
36
+ pub fallback_keys: Option <BTreeMap <Box <DeviceKeyId >, Raw <OneTimeKey >>>,
32
37
}
33
38
34
39
response: {
Original file line number Diff line number Diff line change @@ -93,6 +93,15 @@ ruma_api! {
93
93
/// currently held on the server for a device.
94
94
#[ serde( default , skip_serializing_if = "BTreeMap::is_empty" ) ]
95
95
pub device_one_time_keys_count: BTreeMap <DeviceKeyAlgorithm , UInt >,
96
+
97
+ /// For each key algorithm, the number of unclaimed one-time keys
98
+ /// currently held on the server for a device.
99
+ ///
100
+ /// The presence of this field indicates that the server supports
101
+ /// fallback keys.
102
+ #[ cfg( feature = "unstable-pre-spec" ) ]
103
+ #[ serde( rename = "org.matrix.msc2732.device_unused_fallback_key_types" ) ]
104
+ pub device_unused_fallback_key_types: Option <Vec <DeviceKeyAlgorithm >>,
96
105
}
97
106
98
107
error: crate :: Error
@@ -116,6 +125,8 @@ impl Response {
116
125
to_device : Default :: default ( ) ,
117
126
device_lists : Default :: default ( ) ,
118
127
device_one_time_keys_count : BTreeMap :: new ( ) ,
128
+ #[ cfg( feature = "unstable-pre-spec" ) ]
129
+ device_unused_fallback_key_types : None ,
119
130
}
120
131
}
121
132
}
Original file line number Diff line number Diff line change @@ -83,12 +83,28 @@ pub struct SignedKey {
83
83
84
84
/// Signatures for the key object.
85
85
pub signatures : SignedKeySignatures ,
86
+
87
+ /// Is this key considered to be a fallback key, defaults to false.
88
+ #[ cfg( feature = "unstable-pre-spec" ) ]
89
+ #[ serde( default , skip_serializing_if = "ruma_serde::is_default" ) ]
90
+ pub fallback : bool ,
86
91
}
87
92
88
93
impl SignedKey {
89
94
/// Creates a new `SignedKey` with the given key and signatures.
90
95
pub fn new ( key : String , signatures : SignedKeySignatures ) -> Self {
91
- Self { key, signatures }
96
+ Self {
97
+ key,
98
+ signatures,
99
+ #[ cfg( feature = "unstable-pre-spec" ) ]
100
+ fallback : false ,
101
+ }
102
+ }
103
+
104
+ /// Creates a new fallback `SignedKey` with the given key and signatures.
105
+ #[ cfg( feature = "unstable-pre-spec" ) ]
106
+ pub fn new_fallback ( key : String , signatures : SignedKeySignatures ) -> Self {
107
+ Self { key, signatures, fallback : true }
92
108
}
93
109
}
94
110
You can’t perform that action at this time.
0 commit comments