feat: listen for direct messages
This commit is contained in:
parent
9a82577493
commit
cec7d2ee25
6 changed files with 142 additions and 11 deletions
|
|
@ -6,7 +6,7 @@ from typing import List, Optional
|
|||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from .helpers import sign_message_hash
|
||||
from .helpers import decrypt_message, get_shared_secret, sign_message_hash
|
||||
from .nostr.event import NostrEvent
|
||||
|
||||
######################################## NOSTR ########################################
|
||||
|
|
@ -39,6 +39,10 @@ class Merchant(PartialMerchant):
|
|||
def sign_hash(self, hash: bytes) -> str:
|
||||
return sign_message_hash(self.private_key, hash)
|
||||
|
||||
def decrypt_message(self, encrypted_message: str, public_key: str) -> str:
|
||||
encryption_key = get_shared_secret(self.private_key, public_key)
|
||||
return decrypt_message(encrypted_message, encryption_key)
|
||||
|
||||
@classmethod
|
||||
def from_row(cls, row: Row) -> "Merchant":
|
||||
merchant = cls(**dict(row))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue