Commit 3b423df 1 parent 59566e6 commit 3b423df Copy full SHA for 3b423df
File tree 3 files changed +38
-1
lines changed
3 files changed +38
-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,33 @@ 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 = "is_false" ) ]
90
+ pub fallback : bool ,
91
+ }
92
+
93
+ #[ cfg( feature = "unstable-pre-spec" ) ]
94
+ fn is_false ( value : & bool ) -> bool {
95
+ * value == false
86
96
}
87
97
88
98
impl SignedKey {
89
99
/// Creates a new `SignedKey` with the given key and signatures.
90
100
pub fn new ( key : String , signatures : SignedKeySignatures ) -> Self {
91
- Self { key, signatures }
101
+ Self {
102
+ key,
103
+ signatures,
104
+ #[ cfg( feature = "unstable-pre-spec" ) ]
105
+ fallback : false ,
106
+ }
107
+ }
108
+
109
+ /// Creates a new fallback `SignedKey` with the given key and signatures.
110
+ #[ cfg( feature = "unstable-pre-spec" ) ]
111
+ pub fn new_fallback ( key : String , signatures : SignedKeySignatures ) -> Self {
112
+ Self { key, signatures, fallback : true }
92
113
}
93
114
}
94
115
You can’t perform that action at this time.
0 commit comments