summary refs log tree commit diff
path: root/synapse/crypto/keyclient.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-10-31 23:14:39 +1100
committerGitHub <noreply@github.com>2018-10-31 23:14:39 +1100
commit916efc824950f924c3f7bced09b9cd5759b1532e (patch)
tree00080f6b5169921fd6591830560d2598630e2d12 /synapse/crypto/keyclient.py
parentRemove deprecated v1 key exchange endpoint (#4119) (diff)
downloadsynapse-916efc824950f924c3f7bced09b9cd5759b1532e.tar.xz
Remove fetching keys via the deprecated v1 kex method (#4120)
Diffstat (limited to 'synapse/crypto/keyclient.py')
-rw-r--r--synapse/crypto/keyclient.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/crypto/keyclient.py b/synapse/crypto/keyclient.py
index 080c81f14b..d40e4b8591 100644
--- a/synapse/crypto/keyclient.py
+++ b/synapse/crypto/keyclient.py
@@ -15,6 +15,8 @@
 
 import logging
 
+from six.moves import urllib
+
 from canonicaljson import json
 
 from twisted.internet import defer, reactor
@@ -28,15 +30,15 @@ from synapse.util import logcontext
 
 logger = logging.getLogger(__name__)
 
-KEY_API_V1 = b"/_matrix/key/v1/"
+KEY_API_V2 = "/_matrix/key/v2/server/%s"
 
 
 @defer.inlineCallbacks
-def fetch_server_key(server_name, tls_client_options_factory, path=KEY_API_V1):
+def fetch_server_key(server_name, tls_client_options_factory, key_id):
     """Fetch the keys for a remote server."""
 
     factory = SynapseKeyClientFactory()
-    factory.path = path
+    factory.path = KEY_API_V2 % (urllib.parse.quote(key_id), )
     factory.host = server_name
     endpoint = matrix_federation_endpoint(
         reactor, server_name, tls_client_options_factory, timeout=30