Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
nacl/signedjson confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Mar 29, 2022
1 parent 81dcbc3 commit 9f79562
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion synapse/events/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union

import attr
from nacl.signing import SigningKey
from signedjson.types import SigningKey

from synapse.api.constants import MAX_DEPTH
from synapse.api.room_versions import (
Expand Down
16 changes: 11 additions & 5 deletions tests/rest/key/v2/test_remote_key_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def get_json(
"verify_keys": {
key_id: {
"key": signedjson.key.encode_verify_key_base64(
signing_key.verify_key
signedjson.key.get_verify_key(signing_key)
)
}
},
Expand Down Expand Up @@ -175,7 +175,7 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
% (
self.hs_signing_key.version,
): signedjson.key.encode_verify_key_base64(
self.hs_signing_key.verify_key
signedjson.key.get_verify_key(self.hs_signing_key)
)
},
}
Expand Down Expand Up @@ -229,7 +229,9 @@ def test_get_key(self) -> None:
assert isinstance(keyres, FetchKeyResult)
self.assertEqual(
signedjson.key.encode_verify_key_base64(keyres.verify_key),
signedjson.key.encode_verify_key_base64(testkey.verify_key),
signedjson.key.encode_verify_key_base64(
signedjson.key.get_verify_key(testkey)
),
)

def test_get_notary_key(self) -> None:
Expand All @@ -251,7 +253,9 @@ def test_get_notary_key(self) -> None:
assert isinstance(keyres, FetchKeyResult)
self.assertEqual(
signedjson.key.encode_verify_key_base64(keyres.verify_key),
signedjson.key.encode_verify_key_base64(testkey.verify_key),
signedjson.key.encode_verify_key_base64(
signedjson.key.get_verify_key(testkey)
),
)

def test_get_notary_keyserver_key(self) -> None:
Expand All @@ -268,5 +272,7 @@ def test_get_notary_keyserver_key(self) -> None:
assert isinstance(keyres, FetchKeyResult)
self.assertEqual(
signedjson.key.encode_verify_key_base64(keyres.verify_key),
signedjson.key.encode_verify_key_base64(self.hs_signing_key.verify_key),
signedjson.key.encode_verify_key_base64(
signedjson.key.get_verify_key(self.hs_signing_key)
),
)

0 comments on commit 9f79562

Please sign in to comment.