diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 07:57:54 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 07:57:54 +0000 |
| commit | 7cc5d37cbf4f02f0bb7eee6342dc1ede5a841a7b (patch) | |
| tree | 62d3dcf291a7ca67d18cf397b448fb98d62553ba /README.md | |
| parent | 6bc2d70f6dd351521e522cc4d0f1ac188848ad26 (diff) | |
feat: replace owner-npub with relay-owner-nsec for persistent operator identity
Replace the owner-npub configuration option with relay-owner-nsec to provide
a persistent cryptographic identity for the relay operator. This addresses
NIP-42 authentication requirements discovered during sync debugging.
Motivation:
- Some relays (e.g., relay.damus.io) require NIP-42 authentication for
advanced features like NIP-77 negentropy sync
- Previously used random ephemeral keys per connection, providing no
persistent identity
- Other relays can now recognize us by pubkey for reputation-based rate
limiting
- Ensures consistency between NIP-11 pubkey and authentication key
Changes:
- Config: relay_owner_nsec with auto-load/generate from .relay-owner.nsec
- NIP-11: Pubkey derived from nsec instead of separate npub field
- Sync: RelayConnection now uses operator keys for NIP-42 auth
- Docs: Updated README, .env.example, and added .relay-owner.nsec to gitignore
Key Features:
- Auto-generates key on first run and saves to .relay-owner.nsec
- Loads existing key from file on subsequent runs
- Can override via CLI flag or environment variable
- Enables reputation building across relay network
- Future-ready for event signing and WoT calculations
Testing:
- 225/232 tests passing (7 pre-existing purgatory failures unrelated)
- Verified key generation, loading, and NIP-11 derivation
- Release build successful
Related: work/sync-debug-analysis.md, work/relay-owner-nsec-implementation.md
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 8 |
1 files changed, 4 insertions, 4 deletions
| @@ -287,10 +287,10 @@ This means CLI flags always take precedence over environment variables, which ta | |||
| 287 | ngit-grasp --help | 287 | ngit-grasp --help |
| 288 | 288 | ||
| 289 | # Run with CLI flags (override everything else) | 289 | # Run with CLI flags (override everything else) |
| 290 | ngit-grasp --domain relay.example.com --owner-npub npub1... --bind-address 0.0.0.0:8080 | 290 | ngit-grasp --domain relay.example.com --relay-owner-nsec nsec1... --bind-address 0.0.0.0:8080 |
| 291 | 291 | ||
| 292 | # Mix CLI flags with environment variables | 292 | # Mix CLI flags with environment variables |
| 293 | NGIT_OWNER_NPUB=npub1... ngit-grasp --domain relay.example.com | 293 | NGIT_RELAY_OWNER_NSEC=nsec1... ngit-grasp --domain relay.example.com |
| 294 | ``` | 294 | ``` |
| 295 | 295 | ||
| 296 | ### Configuration Options | 296 | ### Configuration Options |
| @@ -300,7 +300,7 @@ NGIT_OWNER_NPUB=npub1... ngit-grasp --domain relay.example.com | |||
| 300 | | Option | CLI Flag | Environment Variable | Default | | 300 | | Option | CLI Flag | Environment Variable | Default | |
| 301 | | ----------------- | --------------------- | ------------------------ | -------------------------------------------- | | 301 | | ----------------- | --------------------- | ------------------------ | -------------------------------------------- | |
| 302 | | Domain | `--domain` | `NGIT_DOMAIN` | (required) | | 302 | | Domain | `--domain` | `NGIT_DOMAIN` | (required) | |
| 303 | | Owner npub | `--owner-npub` | `NGIT_OWNER_NPUB` | (optional) | | 303 | | Relay owner nsec | `--relay-owner-nsec` | `NGIT_RELAY_OWNER_NSEC` | `.relay-owner.nsec` file (auto-generated) | |
| 304 | | Relay name | `--relay-name` | `NGIT_RELAY_NAME` | `${domain} grasp relay` | | 304 | | Relay name | `--relay-name` | `NGIT_RELAY_NAME` | `${domain} grasp relay` | |
| 305 | | Relay description | `--relay-description` | `NGIT_RELAY_DESCRIPTION` | `Git Nostr Relay - a grasp implementation` | | 305 | | Relay description | `--relay-description` | `NGIT_RELAY_DESCRIPTION` | `Git Nostr Relay - a grasp implementation` | |
| 306 | | Git data path | `--git-data-path` | `NGIT_GIT_DATA_PATH` | `./data/git` (temp dir for memory backend) | | 306 | | Git data path | `--git-data-path` | `NGIT_GIT_DATA_PATH` | `./data/git` (temp dir for memory backend) | |
| @@ -339,7 +339,7 @@ NGIT_OWNER_NPUB=npub1... ngit-grasp --domain relay.example.com | |||
| 339 | ```bash | 339 | ```bash |
| 340 | # Using environment variables (recommended for production) | 340 | # Using environment variables (recommended for production) |
| 341 | export NGIT_DOMAIN=gitnostr.com | 341 | export NGIT_DOMAIN=gitnostr.com |
| 342 | export NGIT_OWNER_NPUB=npub1... | 342 | export NGIT_RELAY_OWNER_NSEC=nsec1... # Or let it auto-generate from .relay-owner.nsec |
| 343 | export NGIT_BIND_ADDRESS=0.0.0.0:8080 | 343 | export NGIT_BIND_ADDRESS=0.0.0.0:8080 |
| 344 | export NGIT_DATABASE_BACKEND=lmdb | 344 | export NGIT_DATABASE_BACKEND=lmdb |
| 345 | 345 | ||