Merge pull request #5296 from matrix-org/rav/server_keys/04-use-attrs-for_verify-request
use attr.s for VerifyKeyRequestpull/5307/head
commit
2ae3cc287e
|
@ -0,0 +1 @@
|
||||||
|
Refactor keyring.VerifyKeyRequest to use attr.s.
|
|
@ -15,12 +15,12 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
import six
|
import six
|
||||||
from six import raise_from
|
from six import raise_from
|
||||||
from six.moves import urllib
|
from six.moves import urllib
|
||||||
|
|
||||||
|
import attr
|
||||||
from signedjson.key import (
|
from signedjson.key import (
|
||||||
decode_verify_key_bytes,
|
decode_verify_key_bytes,
|
||||||
encode_verify_key_base64,
|
encode_verify_key_base64,
|
||||||
|
@ -57,15 +57,14 @@ from synapse.util.retryutils import NotRetryingDestination
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
VerifyKeyRequest = namedtuple(
|
@attr.s(slots=True, cmp=False)
|
||||||
"VerifyRequest", ("server_name", "key_ids", "json_object", "deferred")
|
class VerifyKeyRequest(object):
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
A request for a verify key to verify a JSON object.
|
A request for a verify key to verify a JSON object.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
server_name(str): The name of the server to verify against.
|
server_name(str): The name of the server to verify against.
|
||||||
key_ids(set(str)): The set of key_ids to that could be used to verify the
|
key_ids(set[str]): The set of key_ids to that could be used to verify the
|
||||||
JSON object
|
JSON object
|
||||||
json_object(dict): The JSON object to verify.
|
json_object(dict): The JSON object to verify.
|
||||||
deferred(Deferred[str, str, nacl.signing.VerifyKey]):
|
deferred(Deferred[str, str, nacl.signing.VerifyKey]):
|
||||||
|
@ -74,6 +73,11 @@ Attributes:
|
||||||
logcontext.
|
logcontext.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
server_name = attr.ib()
|
||||||
|
key_ids = attr.ib()
|
||||||
|
json_object = attr.ib()
|
||||||
|
deferred = attr.ib()
|
||||||
|
|
||||||
|
|
||||||
class KeyLookupError(ValueError):
|
class KeyLookupError(ValueError):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue