feat(relay): advertise the relay via /capabilities + NIP-05 relay hints

So clients can discover + connect to the relay (and self-adapt when it's off):

- /capabilities: features.nostr_relay + a messaging{ relay_url, write_policy,
  inbound_pow_bits, supported_nips } object, with the same config-presence
  downgrade as chains/nostr_identity (advertised only when enabled AND a URL is
  configured — never advertise a relay clients can't reach). OpenAPI regenerated.
- nip05.rs: /.well-known/nostr.json relay hints are now config-driven — this
  instance's own relay (the user's DM inbox) first when enabled, then the public
  interop relays (damus/nos.lol) so cross-wallet delivery still works. Replaces
  the hardcoded-only default.
This commit is contained in:
jwinterm
2026-07-02 07:00:02 -04:00
parent 63d2c75194
commit f1872c781c
4 changed files with 110 additions and 4 deletions
+51
View File
@@ -1976,6 +1976,17 @@
"features": {
"$ref": "#/components/schemas/FeatureCapabilities"
},
"messaging": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/MessagingCapability",
"description": "First-party Nostr relay details; present only when `features.nostr_relay`."
}
]
},
"registration": {
"$ref": "#/components/schemas/RegistrationCapability",
"description": "Registration gates for a new wallet on this instance."
@@ -2253,6 +2264,7 @@
"grin_relay",
"prices",
"nostr_identity",
"nostr_relay",
"tips"
],
"properties": {
@@ -2264,6 +2276,10 @@
"type": "boolean",
"description": "Nostr-native identity (NIP-98 login/link, NIP-05 directory)."
},
"nostr_relay": {
"type": "boolean",
"description": "First-party Nostr relay (encrypted DM inbox). See `messaging` for details."
},
"prices": {
"type": "boolean",
"description": "Fiat price feed."
@@ -2741,6 +2757,41 @@
}
}
},
"MessagingCapability": {
"type": "object",
"description": "First-party Nostr relay details (present only when `features.nostr_relay`).\nThe wallet connects here as its DM inbox (alongside the public interop\nrelays) and adapts its UI to the policy.",
"required": [
"relay_url",
"write_policy",
"inbound_pow_bits",
"supported_nips"
],
"properties": {
"inbound_pow_bits": {
"type": "integer",
"format": "int32",
"description": "NIP-13 PoW bits required on cross-ecosystem inbound (0 = off).",
"minimum": 0
},
"relay_url": {
"type": "string",
"description": "The ws(s):// relay URL clients connect to."
},
"supported_nips": {
"type": "array",
"items": {
"type": "integer",
"format": "int32",
"minimum": 0
},
"description": "NIPs the relay speaks (e.g. `[1, 17, 44, 59]`)."
},
"write_policy": {
"type": "string",
"description": "Write policy: `inbox-outbox` | `author-allowlist` | `open`."
}
}
},
"MyUsernameResponse": {
"type": "object",
"properties": {