mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-10-31 04:01:59 +01:00
fix: include public key in API response for configured room servers
This commit is contained in:
1 parent
ab2e79d771
commit
63ce5b4294
2 files changed
+9
No files matched your search
@@ -5963,6 +5963,12 @@ class APIEndpoints:
|
|||||||
(r for r in registered_identities if r["name"] == f"room_server:{name}"), None
|
(r for r in registered_identities if r["name"] == f"room_server:{name}"), None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
pk_display = None
|
||||||
|
if matching:
|
||||||
|
pk_display = matching.get("public_key")
|
||||||
|
else:
|
||||||
|
pk_display = derive_companion_public_key_hex(room_config.get("identity_key"))
|
||||||
|
|
||||||
configured.append(
|
configured.append(
|
||||||
{
|
{
|
||||||
"name": name,
|
"name": name,
|
||||||
@@ -5974,6 +5980,7 @@ class APIEndpoints:
|
|||||||
"settings": settings,
|
"settings": settings,
|
||||||
"hash": matching["hash"] if matching else None,
|
"hash": matching["hash"] if matching else None,
|
||||||
"address": matching["address"] if matching else None,
|
"address": matching["address"] if matching else None,
|
||||||
|
"public_key": pk_display,
|
||||||
"registered": matching is not None,
|
"registered": matching is not None,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -125,3 +125,5 @@ def test_name_repeater_is_reserved_by_the_default_identity(cherrypy_ctx):
|
|||||||
room_entry = data["configured"][0]
|
room_entry = data["configured"][0]
|
||||||
assert room_entry["registered"] is False
|
assert room_entry["registered"] is False
|
||||||
assert room_entry["hash"] is None
|
assert room_entry["hash"] is None
|
||||||
|
expected_pubkey = LocalIdentity(seed=bytes.fromhex("aa" * 32)).get_public_key().hex()
|
||||||
|
assert room_entry["public_key"] == expected_pubkey
|
||||||
Reference in new issue
Block a user