A simple, reliable CLI tool for sending encrypted direct messages (DMs) on Nostr.
- Send NIP-17 encrypted DMs from the command line
- Supports nsec, ncryptsec, and hex secret key formats
- Supports npub and hex public key formats for recipients
- Configurable relay list
- JSON output for scripting
- Timeout control
- Verbose mode for debugging
go install github.com/klabo/ndm@latestbrew install ndm- Download the latest release for your platform
- Make it executable:
chmod +x ndm - Move it to your PATH:
mv ndm /usr/local/bin/
- NAK must be installed and in your PATH
go install github.com/fiatjaf/nak@latestndm -k <your-nsec> -r <recipient-npub> -m "Hello, world!"| Flag | Description |
|---|---|
-k, --key |
Your private key (nsec, ncryptsec, or hex format) [required] |
-r, --recipient |
Recipient's public key (npub or hex) [required] |
-m, --message |
The message to send [required] |
-relay, --relays |
Comma-separated relay URLs (default: uses well-known relays) |
-t, --timeout |
Timeout duration (default: 30s) |
-v, --verbose |
Print verbose output |
-j, --json |
Output result as JSON |
-h, --help |
Show help message |
--version |
Show version number |
Send a DM using nsec:
ndm -k nsec1... -r npub1... -m "Hello!"Send a DM using hex keys:
ndm -k 0123456789abcdef... -r abcdef0123456789... -m "Hello!"Use custom relays:
ndm -k nsec1... -r npub1... -m "Hello!" -relay wss://relay.damus.io,wss://nos.lolGet JSON output for scripting:
ndm -k nsec1... -r npub1... -m "Hello!" -jVerbose mode for debugging:
ndm -k nsec1... -r npub1... -m "Hello!" -v0- Success1- Invalid arguments or other error2- Failed to encrypt message3- Failed to sign event4- Failed to publish to all relays
go build -o ndm .go test -v ./...golangci-lint runMIT