Start implementing auth conflict res

This commit is contained in:
Erik Johnston 2015-01-28 16:16:53 +00:00
parent c92d64a6c3
commit 0ef5bfd6a9
6 changed files with 253 additions and 52 deletions

View file

@ -331,6 +331,45 @@ class FederationClient(object):
defer.returnValue(pdu)
@defer.inlineCallbacks
def query_auth(self, destination, room_id, event_id, local_auth):
"""
Params:
destination (str)
event_it (str)
local_auth (list)
"""
time_now = self._clock.time_msec()
send_content = {
"auth_chain": [e.get_pdu_json(time_now) for e in local_auth],
}
code, content = yield self.transport_layer.send_invite(
destination=destination,
room_id=room_id,
event_id=event_id,
content=send_content,
)
auth_chain = [
(yield self._check_sigs_and_hash(self.event_from_pdu_json(e)))
for e in content["auth_chain"]
]
missing = [
(yield self._check_sigs_and_hash(self.event_from_pdu_json(e)))
for e in content.get("missing", [])
]
ret = {
"auth_chain": auth_chain,
"rejects": content.get("rejects", []),
"missing": missing,
}
defer.returnValue(ret)
def event_from_pdu_json(self, pdu_json, outlier=False):
event = FrozenEvent(
pdu_json