Skip to content

Nostr

Human can send and receive Nostr direct messages using nak and the NIP-17 gift-wrapped DM format. Legacy NIP-04 encryption is also supported.

  • Build with -DHU_ENABLE_NOSTR=ON or -DHU_ENABLE_ALL_CHANNELS=ON
  • nak installed and on PATH
Terminal window
go install github.com/fiatjaf/nak@latest

Ensure nak is in your PATH.

Generate a Nostr keypair for the bot:

Terminal window
nak key generate

This outputs a hex-encoded secret key. Store it securely. Derive the public key (npub) from the seckey if needed for sharing.

Add to ~/.human/config.json:

{
"channels": {
"nostr": [
{
"nak_path": "/usr/local/bin/nak",
"bot_pubkey": "npub1...",
"seckey_hex": "your-hex-secret-key",
"relay_url": "wss://relay.damus.io",
"dm_allowed_pubkeys": []
}
]
}
}
FieldTypeDescription
nak_pathstringPath to nak binary
bot_pubkeystringBot’s public key (npub)
seckey_hexstringBot’s hex secret key
relay_urlstringNostr relay WebSocket URL
dm_allowed_pubkeysarrayAllowed sender pubkeys. Empty = allow all

Human uses NIP-17 for encrypted DMs. The nak tool handles event creation and relay publishing. The channel sends kind 14 (gift-wrapped) events to the recipient’s pubkey.

NIP-04 legacy encryption is supported for older clients. Prefer NIP-17 for new setups.

Use a reliable relay. Examples:

  • wss://relay.damus.io
  • wss://relay.nostr.info
  • wss://nos.lol

Start the agent or gateway with Nostr enabled. The channel uses nak to receive (via nak’s subscribe) and send (via nak event) DMs.