Connects to MongoDB to find Trustroots users with nostrNpub set and listen for direct messages on Nostr relays.
Will be redundant when
- a working app has push notifications
- trustroots is completely decentralized.
For now it's probably a good way to move nostroots forward.
Important: If a nostr pubkey (npub) is found in our MongoDB database with an associated username, this implies that username@trustroots.org is a valid NIP-5 identifier. The system constructs NIP-5 identifiers directly from the database without performing external NIP-5 lookups at trustroots.org, as the presence of the npub in our database already validates the association.
cp env.example .env
cp config.json.example config.json
# Edit config.json with your settings
docker-compose up -d- Copy config:
cp config.json.example config.json - Install deps:
go mod tidy - Edit
config.jsonwith the sending npub/nsec keys
go run main.go # Show summary
go run main.go --list-users # List users in categories
go run main.go --nostr-listen # Listen for direct messages
go run main.go --test --send-to-npub <npub> --msg "<message>" # Send test direct messagePreview how email notifications will look in the browser:
./preview.sh # Start preview server
# or
go run preview_server.go # Alternative way to startThen open http://localhost:8080 in your browser to see:
- HTML Direct Message Preview: How encrypted DM notifications look
- Text Direct Message Preview: Plain text version of DMs
This makes it easy to see how emails will appear to users and test template changes.
{
"mongodb": {
"uri": "mongodb://localhost:27017",
"database": "trustroots"
},
"sender-npub": "profile-npub",
"sender-nsec": "profile-nsec",
"sender-email": "noreply@trustroots.org",
"relays": ["wss://relay1.com", "wss://relay2.com"],
"smtp": {
"host": "smtp.gmail.com",
"port": 587,
"username": "your-email@gmail.com",
"password": "your-app-password",
"from_name": "Trustroots Nostr"
}
}docker-compose up -d # Start
docker-compose logs -f # View logs
docker-compose down # Stop
docker-compose restart # RestartUnlicense - Public Domain