mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-18 12:04:13 +01:00
The algorithm is part of the key id
This commit is contained in:
parent
6ebe2d23b1
commit
58a35366be
1 changed files with 4 additions and 4 deletions
|
@ -144,14 +144,14 @@ class EndToEndKeyStore(SQLBaseStore):
|
||||||
)
|
)
|
||||||
|
|
||||||
existing_key_map = {
|
existing_key_map = {
|
||||||
row["key_id"]: (row["algorithm"], row["key_json"]) for row in rows
|
(row["algorithm"], row["key_id"]): row["key_json"] for row in rows
|
||||||
}
|
}
|
||||||
|
|
||||||
new_keys = [] # Keys that we need to insert
|
new_keys = [] # Keys that we need to insert
|
||||||
for algorithm, key_id, json_bytes in key_list:
|
for algorithm, key_id, json_bytes in key_list:
|
||||||
if key_id in existing_key_map:
|
if (algorithm, key_id) in existing_key_map:
|
||||||
ex_algo, ex_bytes = existing_key_map[key_id]
|
ex_bytes = existing_key_map[key_id]
|
||||||
if algorithm != ex_algo or json_bytes != ex_bytes:
|
if json_bytes != ex_bytes:
|
||||||
raise SynapseError(
|
raise SynapseError(
|
||||||
400, "One time key with key_id %r already exists" % (key_id,)
|
400, "One time key with key_id %r already exists" % (key_id,)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue