more cleanup

This commit is contained in:
Believethehype
2024-10-17 16:12:18 +02:00
parent a3ad0bebc7
commit db7fb286e0
11 changed files with 76 additions and 94 deletions

View File

@@ -1,5 +1,6 @@
import base64
import hashlib
from nostr_sdk import EventBuilder, Tag, Kind, Keys
@@ -7,6 +8,7 @@ def sha256sum(filename):
with open(filename, 'rb', buffering=0) as f:
return hashlib.file_digest(f, 'sha256').hexdigest()
async def generate_nip98_header(pkeys_hex, url="", kind="POST", filepath=""):
keys = Keys.parse(pkeys_hex)
utag = Tag.parse(["u", url])
@@ -20,4 +22,3 @@ async def generate_nip98_header(pkeys_hex, url="", kind="POST", filepath=""):
encoded_nip98_event = base64.b64encode(event.as_json().encode('utf-8')).decode('utf-8')
return "Nostr " + encoded_nip98_event