Skip to content

Relay serviceEndpoint URLs should include trailing slash #5

@melvincarvalho

Description

@melvincarvalho

Issue

According to the DID Nostr specification:

Relay URLs at the origin level MUST include a trailing slash (e.g., wss://relay.example.com/).

Currently, the resolver outputs relay URLs without trailing slashes:

{
  "id": "did:nostr:...#1",
  "type": "Relay",
  "serviceEndpoint": "wss://relay.damus.io"
}

Expected

{
  "id": "did:nostr:...#1",
  "type": "Relay", 
  "serviceEndpoint": "wss://relay.damus.io/"
}

Suggested Fix

When constructing the service array, append a trailing slash to relay URLs if not already present:

const relayUrl = url.endsWith('/') ? url : url + '/';

This ensures compliance with the DID Nostr specification's MUST requirement for relay service endpoints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions