Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
099829d5
Commit
099829d5
authored
5 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
use attr.s for VerifyKeyRequest
because namedtuple is awful
parent
f76d407e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/5296.misc
+1
-0
1 addition, 0 deletions
changelog.d/5296.misc
synapse/crypto/keyring.py
+21
-17
21 additions, 17 deletions
synapse/crypto/keyring.py
with
22 additions
and
17 deletions
changelog.d/5296.misc
0 → 100644
+
1
−
0
View file @
099829d5
Refactor keyring.VerifyKeyRequest to use attr.s.
This diff is collapsed.
Click to expand it.
synapse/crypto/keyring.py
+
21
−
17
View file @
099829d5
...
@@ -15,12 +15,12 @@
...
@@ -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,22 +57,26 @@ from synapse.util.retryutils import NotRetryingDestination
...
@@ -57,22 +57,26 @@ 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]):
A deferred (server_name, key_id, verify_key) tuple that resolves when
A deferred (server_name, key_id, verify_key) tuple that resolves when
a verify key has been fetched. The deferreds
'
callbacks are run with no
a verify key has been fetched. The deferreds
'
callbacks are run with no
logcontext.
logcontext.
"""
"""
server_name
=
attr
.
ib
()
key_ids
=
attr
.
ib
()
json_object
=
attr
.
ib
()
deferred
=
attr
.
ib
()
class
KeyLookupError
(
ValueError
):
class
KeyLookupError
(
ValueError
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment