Closed f321x closed 1 year ago
One thing that jumps out is you are doing PrivateKey()
, which creates a new private key object with a new secret. To decrypt the message, you need to be using the private key that corresponds to public key in the p
tag of event_msg.event
.
Or you need to use the private key that corresponds to event_msg.event.public_key
.
Oh ok makes sense, thanks. I'll try it.
Worked, my fault. Thanks for the help. Correct code in my case is:
private_key = PrivateKey().from_nsec("My nostr nsec private key")
...
if event_msg.event.kind == 4:
user_pk = event_msg.event.public_key
content = private_key.decrypt_message(event_msg.event.content, user_pk)
print(content)
When trying to decode a received Type 4 DM from Amethyst or Astral i get a Value Error "Invalid padding bytes." (using Nostr 0.0.2 from pip)
Code i used:
after receiving a type 4 dm it returns the following error:
Am i doing this wrong or could this be a bug?