mirror of
https://git.exozy.me/a/fuwuqi.git
synced 2024-11-22 05:01:05 +00:00
Even more code cleanup
This commit is contained in:
parent
315b1c635c
commit
a56c2664dc
1 changed files with 2 additions and 2 deletions
|
@ -12,12 +12,12 @@ date = formatdate(usegmt=True)
|
||||||
digester = hashes.Hash(hashes.SHA256())
|
digester = hashes.Hash(hashes.SHA256())
|
||||||
digester.update(activity)
|
digester.update(activity)
|
||||||
digest = b64encode(digester.finalize()).decode()
|
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:
|
with open('private.pem', 'rb') as f:
|
||||||
privkey = serialization.load_pem_private_key(f.read(), None)
|
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}"'
|
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={
|
resp = post('https://0.exozy.me/users/test.outbox', headers={
|
||||||
|
|
Loading…
Reference in a new issue