mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 14:03:53 +01:00
add some comments
This commit is contained in:
parent
39864f45ec
commit
f4b6d43ec3
1 changed files with 10 additions and 2 deletions
|
@ -699,7 +699,10 @@ class E2eKeysHandler(object):
|
||||||
user_id, "self_signing"
|
user_id, "self_signing"
|
||||||
)
|
)
|
||||||
|
|
||||||
# get our master key, since it may be signed
|
# get our master key, since we may have received a signature of it.
|
||||||
|
# We need to fetch it here so that we know what its key ID is, so
|
||||||
|
# that we can check if a signature that was sent is a signature of
|
||||||
|
# the master key or of a device
|
||||||
master_key, _, master_verify_key = yield self._get_e2e_cross_signing_verify_key(
|
master_key, _, master_verify_key = yield self._get_e2e_cross_signing_verify_key(
|
||||||
user_id, "master"
|
user_id, "master"
|
||||||
)
|
)
|
||||||
|
@ -719,8 +722,10 @@ class E2eKeysHandler(object):
|
||||||
return signature_list, failures
|
return signature_list, failures
|
||||||
|
|
||||||
for device_id, device in signatures.items():
|
for device_id, device in signatures.items():
|
||||||
|
# make sure submitted data is in the right form
|
||||||
if not isinstance(device, dict):
|
if not isinstance(device, dict):
|
||||||
raise SynapseError(400, "Invalid parameter", Codes.INVALID_PARAM)
|
raise SynapseError(400, "Invalid parameter", Codes.INVALID_PARAM)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if "signatures" not in device or user_id not in device["signatures"]:
|
if "signatures" not in device or user_id not in device["signatures"]:
|
||||||
# no signature was sent
|
# no signature was sent
|
||||||
|
@ -729,6 +734,8 @@ class E2eKeysHandler(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
if device_id == master_verify_key.version:
|
if device_id == master_verify_key.version:
|
||||||
|
# The signature is of the master key. This needs to be
|
||||||
|
# handled differently from signatures of normal devices.
|
||||||
master_key_signature_list = self._check_master_key_signature(
|
master_key_signature_list = self._check_master_key_signature(
|
||||||
user_id, device_id, device, master_key, devices
|
user_id, device_id, device, master_key, devices
|
||||||
)
|
)
|
||||||
|
@ -743,7 +750,6 @@ class E2eKeysHandler(object):
|
||||||
400, "Invalid signature", Codes.INVALID_SIGNATURE
|
400, "Invalid signature", Codes.INVALID_SIGNATURE
|
||||||
)
|
)
|
||||||
|
|
||||||
stored_device = None
|
|
||||||
try:
|
try:
|
||||||
stored_device = devices[device_id]["keys"]
|
stored_device = devices[device_id]["keys"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -848,11 +854,13 @@ class E2eKeysHandler(object):
|
||||||
return signature_list, failures
|
return signature_list, failures
|
||||||
|
|
||||||
for target_user, devicemap in signatures.items():
|
for target_user, devicemap in signatures.items():
|
||||||
|
# make sure submitted data is in the right form
|
||||||
if not isinstance(devicemap, dict):
|
if not isinstance(devicemap, dict):
|
||||||
raise SynapseError(400, "Invalid parameter", Codes.INVALID_PARAM)
|
raise SynapseError(400, "Invalid parameter", Codes.INVALID_PARAM)
|
||||||
for device in devicemap.values():
|
for device in devicemap.values():
|
||||||
if not isinstance(device, dict):
|
if not isinstance(device, dict):
|
||||||
raise SynapseError(400, "Invalid parameter", Codes.INVALID_PARAM)
|
raise SynapseError(400, "Invalid parameter", Codes.INVALID_PARAM)
|
||||||
|
|
||||||
device_id = None
|
device_id = None
|
||||||
try:
|
try:
|
||||||
# get the target user's master key, to make sure it matches
|
# get the target user's master key, to make sure it matches
|
||||||
|
|
Loading…
Reference in a new issue