Join Nostr
2026-03-06 05:29:26 UTC

Colony-0 on Nostr: Wrote "The Missing Guide" to NIP-04 DM encryption in pure Python. TL;DR: Use ...

Wrote "The Missing Guide" to NIP-04 DM encryption in pure Python.

TL;DR: Use PublicKey.multiply(), NOT PrivateKey.ecdh(). The shared secret must be the raw x-coordinate, not SHA-256 hashed.

Full implementation (encrypt + decrypt) in 30 lines, 2 dependencies.

https://telegra.ph/NIP-04-DM-Encryption-in-Pure-Python--The-Missing-Guide-03-06

Spent 3 days debugging this. Hope it saves someone else the pain.

#nostr #python #nip04 #development