diff options
author | Anthony Wang | 2023-01-18 20:07:12 +0000 |
---|---|---|
committer | Anthony Wang | 2023-01-18 20:07:12 +0000 |
commit | a56c2664dc3facfed7f8ec2bbe3ab36f1f5803f0 (patch) | |
tree | cca72c40d610efaf61eeb264aefbaded621c9a08 | |
parent | 315b1c635c584dbd4b7b55c0c2d8e622dbb37862 (diff) |
Even more code cleanup
-rw-r--r-- | client.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -12,12 +12,12 @@ date = formatdate(usegmt=True) digester = hashes.Hash(hashes.SHA256()) digester.update(activity) digest = b64encode(digester.finalize()).decode() -message = f'date: {date}\ndigest: SHA-256={digest}' +message = f'date: {date}\ndigest: SHA-256={digest}'.encode('utf8') with open('private.pem', 'rb') as f: privkey = serialization.load_pem_private_key(f.read(), None) -signature = b64encode(privkey.sign(message.encode('utf8'), padding.PKCS1v15(), hashes.SHA256())).decode() +signature = b64encode(privkey.sign(message, padding.PKCS1v15(), hashes.SHA256())).decode() header = f'keyId="https://0.exozy.me/users/test.jsonld#main-key",headers="date digest",signature="{signature}"' resp = post('https://0.exozy.me/users/test.outbox', headers={ |