Skip to content

Commit

Permalink
Cleanup (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
UTXOnly authored Mar 30, 2024
1 parent 1d51736 commit 506dfcc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/nostr.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,14 @@ def calc_event_id(
def parse_tags(self, logger):
try:
tag_list = [tag_pair for tag_pair in self.kind9734["tags"]]
for tag in self.zap_reciept_tags:
for tag in self.zap_reciept_tags:
tag_list.append(tag)
return tag_list
except Exception as exc:
logger.error(f"Error parsing kind 9735 tags: {exc}")

def create_event(self, kind_number, logger):
kind_9735_tags = self.parse_tags(logger)
#content = ""
event_id = self.calc_event_id(
self.pubkey, self.created_at, kind_number, kind_9735_tags, content=""
)
Expand All @@ -60,7 +59,7 @@ def create_event(self, kind_number, logger):
"kind": kind_number,
"created_at": self.created_at,
"tags": kind_9735_tags,
"content": '',#content,
"content": "",
"sig": signature_hex,
}
return event_data
Expand All @@ -85,7 +84,9 @@ def send_event(self, ws_relay, logger):
ws = create_connection(ws_relay)
logger.info(f"WebSocket connection created with {ws_relay}")
event_data = self.create_event(9735, logger)
signature_valid = self.verify_signature(event_data["id"], self.pubkey, event_data["sig"], logger)
signature_valid = self.verify_signature(
event_data["id"], self.pubkey, event_data["sig"], logger
)
if signature_valid:
json_event = json.dumps(("EVENT", event_data))
ws.send(json_event)
Expand Down

0 comments on commit 506dfcc

Please sign in to comment.