diff options
Diffstat (limited to 'server.py')
-rw-r--r-- | server.py | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -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') |