python-nostr icon indicating copy to clipboard operation
python-nostr copied to clipboard

Can we receive DMs?

Open yaohaizhou opened this issue 2 years ago • 1 comments

I try to use python-nostr to send a direct message to my Damus account and it works well. I am wondering how we can receive DMs using this tool?

yaohaizhou avatar Feb 20 '23 21:02 yaohaizhou

You can use this snippet

private_key = PrivateKey(hex_to_raw_bytes("PRIVATE KEY HEX"))
dmContent = private_key.decrypt_message(dmContent, senderPubKey)

where dmContent = ['content'] from a received event and senderPubKey = ['pubkey'] from the event.

blackcoffeexbt avatar Apr 12 '23 15:04 blackcoffeexbt