Title: Resolve did:nostr globally via Nostr relays (decentralized step in resolver chain) · Issue #414 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub
Open Graph Title: Resolve did:nostr globally via Nostr relays (decentralized step in resolver chain) · Issue #414 · JavaScriptSolidServer/JavaScriptSolidServer
X Title: Resolve did:nostr globally via Nostr relays (decentralized step in resolver chain) · Issue #414 · JavaScriptSolidServer/JavaScriptSolidServer
Description: Refs #42 (did:nostr resolution spec), #4 (NIP-98 SSO), #386 (LWS 1.0 alignment). Builds on #408 (HTTP .well-known endpoint) and #411 (subdomain-mode local index). Where we are today src/auth/nostr.js's verifyNostrAuth resolves a Nostr pu...
Open Graph Description: Refs #42 (did:nostr resolution spec), #4 (NIP-98 SSO), #386 (LWS 1.0 alignment). Builds on #408 (HTTP .well-known endpoint) and #411 (subdomain-mode local index). Where we are today src/auth/nostr....
X Description: Refs #42 (did:nostr resolution spec), #4 (NIP-98 SSO), #386 (LWS 1.0 alignment). Builds on #408 (HTTP .well-known endpoint) and #411 (subdomain-mode local index). Where we are today src/auth/nostr....
Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/414
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Resolve did:nostr globally via Nostr relays (decentralized step in resolver chain)","articleBody":"Refs #42 (did:nostr resolution spec), #4 (NIP-98 SSO), #386 (LWS 1.0 alignment). Builds on #408 (HTTP `.well-known` endpoint) and #411 (subdomain-mode local index).\n\n## Where we are today\n\n`src/auth/nostr.js`'s `verifyNostrAuth` resolves a Nostr pubkey to a WebID via a 4-step chain:\n\n1. **CID v1 verificationMethod** lookup against the resource owner's WebID profile (resource-side, #399)\n2. **Local in-process index** of `\u003cDATA_ROOT>/.idp/accounts/_webid_index.json` (#407 / #411 — same-pod users)\n3. **External HTTP `.well-known/did/nostr`** resolver (configured URL, e.g. `nostr.social`) — cross-pod, but trusts the indexer\n4. **Fallback** to `did:nostr:\u003cpubkey>` as the agent identity\n\nStep 3 is the only \"cross-pod\" path today, and it relies on a **single configured HTTP indexer**. That's a centralization point: every JSS deployment delegates global resolution to whoever runs that indexer.\n\n## The proposal\n\nInsert a **direct Nostr relay** resolution step between today's #2 (local index) and #3 (HTTP indexer):\n\n> **2.5 Relay-based resolution.** Connect to a configured set of Nostr relays, query for the user's DID-metadata replaceable event (kind defined by the [did:nostr spec](https://nostrcg.github.io/did-nostr/)), verify the event signature, parse `content` as the DID document, and extract `alsoKnownAs[0]` as the candidate WebID. Then run the same backlink check the other steps use (does the WebID profile declare this pubkey via CID-VM?).\n\nThis is what makes did:nostr **genuinely decentralized**. The pubkey-to-DID-doc binding is verifiable from the Schnorr signature on the relay event alone — no trusted indexer in the loop. The user controls publication via their own relays.\n\n## Why this matters\n\nWithout this step:\n- Every JSS deployment depends on `nostr.social` (or whoever is configured) staying online + honest\n- A user changing pods mid-session has to wait for the indexer to re-scrape\n- The `alsoKnownAs` claim could be silently rewritten by a compromised/malicious indexer\n\nWith it:\n- JSS reads the user's DID doc straight from relays the user chose\n- Indexers (`nostr.social`, `nostr.rocks`) become *one* path among many — useful as an HTTP cache layer, not the source of truth\n- A user who runs their own relay can be fully self-sovereign — no third party in the auth path\n\n## Implementation sketch\n\n- **Relay client**: NDK or `@nostr/client` already in the dependency tree from elsewhere — pick whichever is lightest. Subscribe pattern, not long-lived.\n- **Default relay set**: configurable via `JSS_NOSTR_RELAYS` env (comma-separated). Default to a small set of public relays (`relay.damus.io`, `nos.lol`).\n- **Per-user relay hint**: optional NIP-05 lookup on the WebID's domain to find user-preferred relays before falling back to defaults.\n- **DID-metadata event kind**: per the did:nostr spec (likely a replaceable kind in the `30000–39999` range — confirm against current spec draft).\n- **Replaceable-event race**: pick the event with the highest `created_at` across responding relays.\n- **Caching**: same TTL semantics as the current `did-nostr.js` cache (5m success, 1m transient failure), keyed on `pubkey + relay-set-fingerprint`.\n- **Verification**: signature check + signed-by-target-pubkey check + DID-doc shape validation + `alsoKnownAs` backlink check (reuses existing `checkCidVmBacklink` from #408).\n\nInsert into `verifyNostrAuth`'s chain in `src/auth/nostr.js`:\n\n```\n1. tryResolveViaCidVerificationMethod\n2. resolveDidNostrLocally (gated on idpEnabled)\n2.5 resolveDidNostrViaRelays (NEW)\n3. resolveDidNostrToWebId (HTTP indexer fallback)\n4. did:nostr fallback\n```\n\n## Test plan\n\n- [ ] Unit tests for `resolveDidNostrViaRelays` with a mocked relay client (success, no event, signature mismatch, replaceable-event ordering)\n- [ ] Integration test against `relay.damus.io` (or a local relay) with a published test DID-metadata event\n- [ ] Confirm the chain order: a known-local user still resolves via step 2 without ever hitting the relays\n- [ ] Confirm the HTTP indexer step still fires for users without published DID-metadata events on the configured relay set\n\n## Related deferred work\n\n- Real-time updates on the local index when the LDP write path mutates a profile (mentioned in #408 description) — relay-based resolution makes the local index less load-bearing for cross-pod identities, but the same hook would benefit both\n- Per-pod NIP-05 `didResolver` discovery (mentioned in #408) — overlaps with the \"user-preferred relays\" hint above\n\n## Refs\n\n- [did:nostr spec — Resolution](https://nostrcg.github.io/did-nostr/) — defines both HTTP `.well-known` and relay-based paths\n- Existing chain: `src/auth/nostr.js` (verifyNostrAuth)\n- Existing HTTP resolver: `src/auth/did-nostr.js` (resolveDidNostrToWebId, with SSRF + redirect hardening from #408)","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-05-10T08:39:47Z","url":"https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/414"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:58e83337-5dd1-4bef-335e-e0e0fc609c76 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA8A:19854D:57B673:737C4A:6B03898B |
| html-safe-nonce | 7eb245525596cf0ee8074d44bead6c0a684e8a5920e5140244eb7a2afd6f64e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQThBOjE5ODU0RDo1N0I2NzM6NzM3QzRBOjZCMDM4OThCIiwidmlzaXRvcl9pZCI6IjE3ODkwOTU1NzQ1NDc2ODUyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 449011f3af8094df5df36793f195f17877bb9b0eaa93e9bb62ef8ca0ecf24a15 |
| hovercard-subject-tag | issue:4415135639 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptSolidServer/JavaScriptSolidServer/414/issue_layout |
| twitter:image | https://opengraph.githubassets.com/789c97579155db9f13631496d43eb5cb1abe8987daa81473ccd60e8c5b221ac2/JavaScriptSolidServer/JavaScriptSolidServer/issues/414 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/789c97579155db9f13631496d43eb5cb1abe8987daa81473ccd60e8c5b221ac2/JavaScriptSolidServer/JavaScriptSolidServer/issues/414 |
| og:image:alt | Refs #42 (did:nostr resolution spec), #4 (NIP-98 SSO), #386 (LWS 1.0 alignment). Builds on #408 (HTTP .well-known endpoint) and #411 (subdomain-mode local index). Where we are today src/auth/nostr.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | melvincarvalho |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git |
| octolytics-dimension-user_id | 205442424 |
| octolytics-dimension-user_login | JavaScriptSolidServer |
| octolytics-dimension-repository_id | 958025407 |
| octolytics-dimension-repository_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 958025407 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width