summary refs log tree commit diff
path: root/synapse/federation/federation_client.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-07-23 16:03:38 +0100
committerMark Haines <mark.haines@matrix.org>2015-07-23 16:03:38 +0100
commit62c010283d543db0956066b42eb735b57c000a82 (patch)
tree0ad9dc05ec50ad5995535fe341ccd3b591d8591f /synapse/federation/federation_client.py
parentDisable receipts for now (diff)
downloadsynapse-62c010283d543db0956066b42eb735b57c000a82.tar.xz
Add federation support for end-to-end key requests
Diffstat (limited to 'synapse/federation/federation_client.py')
-rw-r--r--synapse/federation/federation_client.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py
index 7736d14fb5..21a86a4c6d 100644
--- a/synapse/federation/federation_client.py
+++ b/synapse/federation/federation_client.py
@@ -134,6 +134,40 @@ class FederationClient(FederationBase):
             destination, query_type, args, retry_on_dns_fail=retry_on_dns_fail
         )
 
+    @log_function
+    def query_client_keys(self, destination, content, retry_on_dns_fail=True):
+        """Query device keys for a device hosted on a remote server.
+
+        Args:
+            destination (str): Domain name of the remote homeserver
+            content (dict): The query content.
+
+        Returns:
+            a Deferred which will eventually yield a JSON object from the
+            response
+        """
+        sent_queries_counter.inc("client_device_keys")
+        return self.transport_layer.query_client_keys(
+            destination, content, retry_on_dns_fail=retry_on_dns_fail
+        )
+
+    @log_function
+    def claim_client_keys(self, destination, content, retry_on_dns_fail=True):
+        """Claims one-time keys for a device hosted on a remote server.
+
+        Args:
+            destination (str): Domain name of the remote homeserver
+            content (dict): The query content.
+
+        Returns:
+            a Deferred which will eventually yield a JSON object from the
+            response
+        """
+        sent_queries_counter.inc("client_one_time_keys")
+        return self.transport_layer.claim_client_keys(
+            destination, content, retry_on_dns_fail=retry_on_dns_fail
+        )
+
     @defer.inlineCallbacks
     @log_function
     def backfill(self, dest, context, limit, extremities):