Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit f2c780b

Browse files
committed
Rearrange comments to deduplicate and be smarter about layout per review.
1 parent 8b4e099 commit f2c780b

File tree

2 files changed

+44
-56
lines changed

2 files changed

+44
-56
lines changed

synapse/replication/http/devices.py

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class ReplicationUploadKeysForUserRestServlet(ReplicationEndpoint):
8787
the database and streamed to workers.( Is this accurate?)
8888
8989
Calls to e2e_keys_handler.upload_keys_for_user(user_id, device_id, keys) on
90-
master to accomplish this.
90+
the main process to accomplish this.
9191
9292
Defined in https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3keysupload
9393
Request format(borrowed and expanded from KeyUploadServlet):
@@ -98,48 +98,12 @@ class ReplicationUploadKeysForUserRestServlet(ReplicationEndpoint):
9898
"user_id": "<user_id>",
9999
"device_id": "<device_id>",
100100
"keys": {
101-
"device_keys": {
102-
"user_id": "<user_id>",
103-
"device_id": "<device_id>",
104-
"valid_until_ts": <millisecond_timestamp>,
105-
"algorithms": [
106-
"m.olm.curve25519-aes-sha2",
107-
]
108-
"keys": {
109-
"<algorithm>:<device_id>": "<key_base64>",
110-
},
111-
"signatures:" {
112-
"<user_id>" {
113-
"<algorithm>:<device_id>": "<signature_base64>"
114-
}
115-
}
116-
},
117-
"fallback_keys": {
118-
"<algorithm>:<device_id>": "<key_base64>",
119-
"signed_<algorithm>:<device_id>": {
120-
"fallback": true,
121-
"key": "<key_base64>",
122-
"signatures": {
123-
"<user_id>": {
124-
"<algorithm>:<device_id>": "<key_base64>"
125-
}
126-
}
127-
}
128-
}
129-
"one_time_keys": {
130-
"<algorithm>:<key_id>": "<key_base64>"
131-
},
101+
....this part can be found in KeyUploadServlet in rest/client/keys.py....
132102
}
133103
}
134-
Response is equivalent to ` /_matrix/client/v3/keys/upload`
135-
response, e.g.:
136104
137-
{
138-
"one_time_key_counts": {
139-
"curve25519": 10,
140-
"signed_curve25519": 20
141-
}
142-
}
105+
Response is equivalent to ` /_matrix/client/v3/keys/upload` found in KeyUploadServlet
106+
143107
"""
144108

145109
NAME = "upload_keys_for_user"

synapse/rest/client/keys.py

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,48 @@ class KeyUploadServlet(RestServlet):
4444
Content-Type: application/json
4545
4646
{
47-
"device_keys": {
48-
"user_id": "<user_id>",
49-
"device_id": "<device_id>",
50-
"valid_until_ts": <millisecond_timestamp>,
51-
"algorithms": [
52-
"m.olm.curve25519-aes-sha2",
53-
]
54-
"keys": {
55-
"<algorithm>:<device_id>": "<key_base64>",
47+
"device_keys": {
48+
"user_id": "<user_id>",
49+
"device_id": "<device_id>",
50+
"valid_until_ts": <millisecond_timestamp>,
51+
"algorithms": [
52+
"m.olm.curve25519-aes-sha2",
53+
]
54+
"keys": {
55+
"<algorithm>:<device_id>": "<key_base64>",
56+
},
57+
"signatures:" {
58+
"<user_id>" {
59+
"<algorithm>:<device_id>": "<signature_base64>"
60+
}
61+
}
5662
},
57-
"signatures:" {
58-
"<user_id>" {
59-
"<algorithm>:<device_id>": "<signature_base64>"
60-
} } },
61-
"one_time_keys": {
62-
"<algorithm>:<key_id>": "<key_base64>"
63-
},
63+
"fallback_keys": {
64+
"<algorithm>:<device_id>": "<key_base64>",
65+
"signed_<algorithm>:<device_id>": {
66+
"fallback": true,
67+
"key": "<key_base64>",
68+
"signatures": {
69+
"<user_id>": {
70+
"<algorithm>:<device_id>": "<key_base64>"
71+
}
72+
}
73+
}
74+
}
75+
"one_time_keys": {
76+
"<algorithm>:<key_id>": "<key_base64>"
77+
},
78+
}
79+
80+
response, e.g.:
81+
82+
{
83+
"one_time_key_counts": {
84+
"curve25519": 10,
85+
"signed_curve25519": 20
86+
}
6487
}
88+
6589
"""
6690

6791
PATTERNS = client_patterns("/keys/upload(/(?P<device_id>[^/]+))?$")

0 commit comments

Comments
 (0)