From 0f9e33100299e9e97872c0ff92e3ccf61cff07a0 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Sat, 14 Sep 2024 00:33:20 +0300 Subject: [PATCH] fix: receipt event --- nostr/key.py | 6 ++---- tasks.py | 8 +++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/nostr/key.py b/nostr/key.py index 6713b64..aea430b 100644 --- a/nostr/key.py +++ b/nostr/key.py @@ -8,7 +8,7 @@ from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from . import bech32 -from .event import EncryptedDirectMessage, EventKind +from .event import EncryptedDirectMessage, Event class PublicKey: @@ -118,9 +118,7 @@ def sign_message_hash(self, message_hash: bytes) -> str: sig = sk.schnorr_sign(message_hash, None, raw=True) return sig.hex() - def sign_event(self, event: EncryptedDirectMessage) -> None: - if event.kind == EventKind.ENCRYPTED_DIRECT_MESSAGE and event.content is None: - self.encrypt_dm(event) + def sign_event(self, event: Event) -> None: if event.public_key is None: event.public_key = self.public_key.hex() event.signature = self.sign_message_hash(bytes.fromhex(event.id)) diff --git a/tasks.py b/tasks.py index 3381807..4da06c2 100644 --- a/tasks.py +++ b/tasks.py @@ -14,7 +14,7 @@ from .crud import get_or_create_lnurlp_settings, get_pay_link from .models import PayLink -from .nostr.event import EncryptedDirectMessage +from .nostr.event import Event async def wait_for_paid_invoices(): @@ -132,12 +132,10 @@ def get_tag(event_json, tag): pubkey = next((pk[1] for pk in tags if pk[0] == "p"), None) assert pubkey, "Cannot create zap receipt. Recepient pubkey is missing." - zap_receipt = EncryptedDirectMessage( + zap_receipt = Event( kind=9735, - recipient_pubkey=pubkey, tags=tags, - content=payment.extra.get("comment") or "", - cleartext_content=payment.extra.get("comment") or "", + content="", ) settings = await get_or_create_lnurlp_settings()