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

Commit

Permalink
Rearrange comments to deduplicate and be smarter about layout per rev…
Browse files Browse the repository at this point in the history
…iew.
  • Loading branch information
realtyem committed Nov 14, 2022
1 parent 8b4e099 commit f2c780b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 56 deletions.
44 changes: 4 additions & 40 deletions synapse/replication/http/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ReplicationUploadKeysForUserRestServlet(ReplicationEndpoint):
the database and streamed to workers.( Is this accurate?)
Calls to e2e_keys_handler.upload_keys_for_user(user_id, device_id, keys) on
master to accomplish this.
the main process to accomplish this.
Defined in https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3keysupload
Request format(borrowed and expanded from KeyUploadServlet):
Expand All @@ -98,48 +98,12 @@ class ReplicationUploadKeysForUserRestServlet(ReplicationEndpoint):
"user_id": "<user_id>",
"device_id": "<device_id>",
"keys": {
"device_keys": {
"user_id": "<user_id>",
"device_id": "<device_id>",
"valid_until_ts": <millisecond_timestamp>,
"algorithms": [
"m.olm.curve25519-aes-sha2",
]
"keys": {
"<algorithm>:<device_id>": "<key_base64>",
},
"signatures:" {
"<user_id>" {
"<algorithm>:<device_id>": "<signature_base64>"
}
}
},
"fallback_keys": {
"<algorithm>:<device_id>": "<key_base64>",
"signed_<algorithm>:<device_id>": {
"fallback": true,
"key": "<key_base64>",
"signatures": {
"<user_id>": {
"<algorithm>:<device_id>": "<key_base64>"
}
}
}
}
"one_time_keys": {
"<algorithm>:<key_id>": "<key_base64>"
},
....this part can be found in KeyUploadServlet in rest/client/keys.py....
}
}
Response is equivalent to ` /_matrix/client/v3/keys/upload`
response, e.g.:
{
"one_time_key_counts": {
"curve25519": 10,
"signed_curve25519": 20
}
}
Response is equivalent to ` /_matrix/client/v3/keys/upload` found in KeyUploadServlet
"""

NAME = "upload_keys_for_user"
Expand Down
56 changes: 40 additions & 16 deletions synapse/rest/client/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,48 @@ class KeyUploadServlet(RestServlet):
Content-Type: application/json
{
"device_keys": {
"user_id": "<user_id>",
"device_id": "<device_id>",
"valid_until_ts": <millisecond_timestamp>,
"algorithms": [
"m.olm.curve25519-aes-sha2",
]
"keys": {
"<algorithm>:<device_id>": "<key_base64>",
"device_keys": {
"user_id": "<user_id>",
"device_id": "<device_id>",
"valid_until_ts": <millisecond_timestamp>,
"algorithms": [
"m.olm.curve25519-aes-sha2",
]
"keys": {
"<algorithm>:<device_id>": "<key_base64>",
},
"signatures:" {
"<user_id>" {
"<algorithm>:<device_id>": "<signature_base64>"
}
}
},
"signatures:" {
"<user_id>" {
"<algorithm>:<device_id>": "<signature_base64>"
} } },
"one_time_keys": {
"<algorithm>:<key_id>": "<key_base64>"
},
"fallback_keys": {
"<algorithm>:<device_id>": "<key_base64>",
"signed_<algorithm>:<device_id>": {
"fallback": true,
"key": "<key_base64>",
"signatures": {
"<user_id>": {
"<algorithm>:<device_id>": "<key_base64>"
}
}
}
}
"one_time_keys": {
"<algorithm>:<key_id>": "<key_base64>"
},
}
response, e.g.:
{
"one_time_key_counts": {
"curve25519": 10,
"signed_curve25519": 20
}
}
"""

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

0 comments on commit f2c780b

Please sign in to comment.