TBD54566975 / did-nostr

35 stars 8 forks source link

Update serviceEndpoint type to Relay in proposal #8

Closed melvincarvalho closed 1 year ago

melvincarvalho commented 1 year ago

I would like to suggest an update to the DID Nostr proposal regarding the serviceEndpoint type. Currently, the proposal uses the term NostrRelay to refer to a Nostr relay endpoint. However, I believe that the term Relay would be more appropriate, and would align better with existing terminology. The context of the relay is already a did nostr method, and if the term is sourced from a context, Relay would likely come from a nostr specific vocab.

In support of this suggestion, I would like to introduce the Relay type from the Nostr vocabulary (https://w3id.org/nostr#Relay). The Relay type already exists within the Nostr vocabulary and is used to refer to a Nostr relay endpoint. By using this existing term, we can maintain consistency with the Nostr vocabulary and avoid creating unnecessary new terms.

Here is an example of how the serviceEndpoint type could be updated to use the Relay term:

{
  "@context": [
    "https://www.w3.org/ns/did/v1",
  ],
  "id": "did:nostr:e2bdaa90e96a4fafb9f1c36f9b378e4bbd6fea26e5d47063e7b30aa15de37d48",
  "verificationMethod": [
    {
      "id": "did:nostr:e2bdaa90e96a4fafb9f1c36f9b378e4bbd6fea26e5d47063e7b30aa15de37d48#nip06-0",
      "type": "SchnorrSecp256k1VerificationKey2019",
      "controller": "did:nostr:e2bdaa90e96a4fafb9f1c36f9b378e4bbd6fea26e5d47063e7b30aa15de37d48",
      "publicKeyHex": "e2bdaa90e96a4fafb9f1c36f9b378e4bbd6fea26e5d47063e7b30aa15de37d48"
    }
  ],
  "service": [
    {
      "id": "did:nostr:e2bdaa90e96a4fafb9f1c36f9b378e4bbd6fea26e5d47063e7b30aa15de37d48#nostr-relays",
      "type": "Relay",
      "serviceEndpoint": ["wss://relay.damus.io", "wss://relay.nostr.info"]
    },
    {
      "id": "did:nostr:e2bdaa90e96a4fafb9f1c36f9b378e4bbd6fea26e5d47063e7b30aa15de37d48#ln",
      "type": "LightningNode",
      "serviceEndpoint": "ip://024bfaf0cabe7f874fd33ebf7c6f4e5385971fc504ef3f492432e9e3ec77e1b5cf@52.1.72.207:9735"
    }
  ],
  "keyAgreement": [
    {
      "id": "did:nostr:e2bdaa90e96a4fafb9f1c36f9b378e4bbd6fea26e5d47063e7b30aa15de37d48#keyagreement",
      "type": "X25519KeyAgreement2023",
      "controller": "did:nostr:e2bdaa90e96a4fafb9f1c36f9b378e4bbd6fea26e5d47063e7b30aa15de37d48",
      "publicKeyHex": "75d92cea4ab8ef28a0a14acf103d6b8a2bb026120d62d1817fa5a4b11f534038"
    }
  ]
}

This modified json would use the Relay type to refer to a Nostr relay endpoint, as suggested by the Nostr vocabulary. This would make the code more consistent and easier to understand.

I would be happy to extend the vocab and add terms, or change description as necessary.

mistermoe commented 1 year ago

@melvincarvalho makes sense to me. i'll have a PR out to reflect this within the next day

melvincarvalho commented 1 year ago

Great it's actually just a 1 line change: NostrRelay -> Relay, let me do that quickly