Skip to content

RFC: a did:nostr resolver/indexer mode built on buildDidDocument + the Mongo store #572

Description

@melvincarvalho

Summary

jss already implements most of a did:nostr resolution server. This RFC proposes a resolver/indexer mode so jss can resolve any pubkey's did:nostr document from indexed relay data, not just the pod owner's, and in doing so absorb the aging nostr-labs/nostr-beacon (which maintains a divergent, buggy DID-doc generator: see nostr-labs/nostr-beacon#3).

What jss already has

The one new component: a relay-indexer

Subscribe and upsert, keyed by pubkey, into a collection in the existing Mongo store:

  • kind 0 (profile) -> profile
  • kind 3 (contacts) -> follows
  • kind 10002 (relay list) -> service (Relay) entries

The well-known resolver then builds the doc for an arbitrary pubkey from the offline-derivable base plus whatever the index holds (the spec's enhanced resolution), via buildDidDocument.

Why this shape

The bug class in nostr-beacon#3 (wrong context, missing key material) exists because nostr-beacon has its own DID-doc generator that drifted from jss's. One shared, conformant builder removes that class permanently. Everything except the indexer already exists in jss.

Open questions

  1. Indexing trigger: on-demand (fetch relays on first request for a pubkey, cache in Mongo) vs a background firehose. On-demand is simpler and likely sufficient.
  2. In-process vs sidecar: indexer as a jss module/route, or a separate service writing the same Mongo and importing buildDidDocument as a library.
  3. Owner precedence: if the requested pubkey is the pod owner, serve the owner doc (with WebID backlink); otherwise the indexed/derived doc.
  4. Fallback: if not indexed, return the minimal offline-derived (key-only) doc, not 404.
  5. Dependency: the conformant @context/IRIs (Use CID v1.0 @context in served did:nostr docs so Multikey is defined #569, /private/privkey.jsonld uses external cid/v1 @context, inconsistent with profile.js (inline) and not conneg-expandable #570) should land first.

Companion RFC on the indexer side: filed alongside this on nostr-labs/nostr-beacon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    diddid:nostr method spec + implementation alignment

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions