mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-02 22:46:03 -04:00
Deal with mypy errors w/ type-hinted pynacl 1.5.0 (#11714)
* Deal with mypy errors w/ type-hinted pynacl 1.5.0 Fixes #11644. I really don't like that we're monkey patching pynacl SignedKey instances with alg and version objects. But I'm too scared to make the changes necessary right now. (Ideally I would replace `signedjson.types.SingingKey` with a runtime class which wraps or inherits from `nacl.signing.SigningKey`.) C.f. https://github.com/matrix-org/python-signedjson/issues/16
This commit is contained in:
parent
3be63654e4
commit
c43dd4d01b
2 changed files with 8 additions and 1 deletions
|
@ -14,6 +14,7 @@
|
|||
|
||||
|
||||
import nacl.signing
|
||||
import signedjson.types
|
||||
from unpaddedbase64 import decode_base64
|
||||
|
||||
from synapse.api.room_versions import RoomVersions
|
||||
|
@ -35,7 +36,12 @@ HOSTNAME = "domain"
|
|||
|
||||
class EventSigningTestCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.signing_key = nacl.signing.SigningKey(SIGNING_KEY_SEED)
|
||||
# NB: `signedjson` expects `nacl.signing.SigningKey` instances which have been
|
||||
# monkeypatched to include new `alg` and `version` attributes. This is captured
|
||||
# by the `signedjson.types.SigningKey` protocol.
|
||||
self.signing_key: signedjson.types.SigningKey = nacl.signing.SigningKey(
|
||||
SIGNING_KEY_SEED
|
||||
)
|
||||
self.signing_key.alg = KEY_ALG
|
||||
self.signing_key.version = KEY_VER
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue