Nostr
Nostr Channel
Section titled “Nostr Channel”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.
Prerequisites
Section titled “Prerequisites”- Build with
-DHU_ENABLE_NOSTR=ONor-DHU_ENABLE_ALL_CHANNELS=ON - nak installed and on PATH
1. Install nak
Section titled “1. Install nak”go install github.com/fiatjaf/nak@latestEnsure nak is in your PATH.
2. Generate keys
Section titled “2. Generate keys”Generate a Nostr keypair for the bot:
nak key generateThis outputs a hex-encoded secret key. Store it securely. Derive the public key (npub) from the seckey if needed for sharing.
3. Configuration
Section titled “3. Configuration”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": [] } ] }}Fields
Section titled “Fields”| Field | Type | Description |
|---|---|---|
nak_path | string | Path to nak binary |
bot_pubkey | string | Bot’s public key (npub) |
seckey_hex | string | Bot’s hex secret key |
relay_url | string | Nostr relay WebSocket URL |
dm_allowed_pubkeys | array | Allowed sender pubkeys. Empty = allow all |
4. NIP-17 gift-wrapped DMs
Section titled “4. NIP-17 gift-wrapped DMs”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.
5. Legacy NIP-04
Section titled “5. Legacy NIP-04”NIP-04 legacy encryption is supported for older clients. Prefer NIP-17 for new setups.
6. Relay configuration
Section titled “6. Relay configuration”Use a reliable relay. Examples:
wss://relay.damus.iowss://relay.nostr.infowss://nos.lol
7. Run
Section titled “7. Run”Start the agent or gateway with Nostr enabled. The channel uses nak to receive (via nak’s subscribe) and send (via nak event) DMs.