mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
SYN-383: Fix parsing of verify_keys and catching of _DefGen_Return
This commit is contained in:
parent
c6a03c46e6
commit
2aeee2a905
@ -129,23 +129,24 @@ class Keyring(object):
|
|||||||
def _get_server_verify_key_impl(self, server_name, key_ids):
|
def _get_server_verify_key_impl(self, server_name, key_ids):
|
||||||
keys = None
|
keys = None
|
||||||
|
|
||||||
perspective_results = []
|
@defer.inlineCallbacks
|
||||||
for perspective_name, perspective_keys in self.perspective_servers.items():
|
def get_key(perspective_name, perspective_keys):
|
||||||
@defer.inlineCallbacks
|
try:
|
||||||
def get_key():
|
result = yield self.get_server_verify_key_v2_indirect(
|
||||||
try:
|
server_name, key_ids, perspective_name, perspective_keys
|
||||||
result = yield self.get_server_verify_key_v2_indirect(
|
)
|
||||||
server_name, key_ids, perspective_name, perspective_keys
|
defer.returnValue(result)
|
||||||
)
|
except Exception as e:
|
||||||
defer.returnValue(result)
|
logging.info(
|
||||||
except:
|
"Unable to getting key %r for %r from %r: %s %s",
|
||||||
logging.info(
|
key_ids, server_name, perspective_name,
|
||||||
"Unable to getting key %r for %r from %r",
|
type(e).__name__, str(e.message),
|
||||||
key_ids, server_name, perspective_name,
|
)
|
||||||
)
|
|
||||||
perspective_results.append(get_key())
|
|
||||||
|
|
||||||
perspective_results = yield defer.gatherResults(perspective_results)
|
perspective_results = yield defer.gatherResults([
|
||||||
|
get_key(name, keys)
|
||||||
|
for name, keys in self.perspective_servers.items()
|
||||||
|
])
|
||||||
|
|
||||||
for results in perspective_results:
|
for results in perspective_results:
|
||||||
if results is not None:
|
if results is not None:
|
||||||
@ -311,9 +312,8 @@ class Keyring(object):
|
|||||||
time_now_ms = self.clock.time_msec()
|
time_now_ms = self.clock.time_msec()
|
||||||
response_keys = {}
|
response_keys = {}
|
||||||
verify_keys = {}
|
verify_keys = {}
|
||||||
for key_id, key_data in response_json["verify_keys"].items():
|
for key_id, key_base64 in response_json["verify_keys"].items():
|
||||||
if is_signing_algorithm_supported(key_id):
|
if is_signing_algorithm_supported(key_id):
|
||||||
key_base64 = key_data["key"]
|
|
||||||
key_bytes = decode_base64(key_base64)
|
key_bytes = decode_base64(key_base64)
|
||||||
verify_key = decode_verify_key_bytes(key_id, key_bytes)
|
verify_key = decode_verify_key_bytes(key_id, key_bytes)
|
||||||
verify_key.time_added = time_now_ms
|
verify_key.time_added = time_now_ms
|
||||||
|
Loading…
Reference in New Issue
Block a user