aboutsummaryrefslogtreecommitdiff
path: root/server.py
diff options
context:
space:
mode:
authorAnthony Wang2023-01-18 20:06:17 +0000
committerAnthony Wang2023-01-18 20:06:17 +0000
commit315b1c635c584dbd4b7b55c0c2d8e622dbb37862 (patch)
tree64d7ee42acb0891e58e91a79f27a0eeeaa7a47d0 /server.py
parent183267030d756936ae90e8b6cc646a378fe79ff1 (diff)
More code cleanup
Diffstat (limited to 'server.py')
-rw-r--r--server.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/server.py b/server.py
index acad94d..cbd5602 100644
--- a/server.py
+++ b/server.py
@@ -32,9 +32,8 @@ def collection_pop(username, file, item):
def iri_to_actor(iri):
if domain in iri:
- name = search(f'^{domain}/users/(.*?)$',
- iri.removesuffix('#main-key')).group(1)
- actorfile = f'users/{name}'
+ username = search(f'^{domain}/users/(.*?)$', iri.removesuffix('#main-key')).group(1)
+ actorfile = f'users/{username}'
else:
actorfile = f'users/{quote_plus(iri.removesuffix("#main-key"))}'
if not isfile(actorfile):
@@ -82,14 +81,8 @@ class fuwuqi(SimpleHTTPRequestHandler):
message += f'{header}: {headerval}\n'
# Verify HTTP signature
- signature = search('signature="(.*?)"',
- self.headers['Signature']).group(1)
- pubkey.verify(
- b64decode(signature),
- message[:-1].encode('utf8'),
- padding.PKCS1v15(),
- hashes.SHA256()
- )
+ signature = search('signature="(.*?)"', self.headers['Signature']).group(1)
+ pubkey.verify(b64decode(signature), message[:-1].encode('utf8'), padding.PKCS1v15(), hashes.SHA256())
# Make sure activity doer matches HTTP signature
actor = keyid.removesuffix('#main-key')