w3c / did-core

W3C Decentralized Identifier Specification v1.0
https://www.w3.org/TR/did-core/
Other
410 stars 97 forks source link

Add example for Verification Method ID as a fragment #860

Open wip-abramson opened 3 months ago

wip-abramson commented 3 months ago

For example

{
      "id": "#key-3",
      "type": "JsonWebKey2020",
      "controller": "did:example:123",
      "publicKeyJwk": {
        "kty": "EC", // external (property name)
        "crv": "secp256k1", // external (property name)
        "x": "U1V4TVZVMUpUa0ZVU1NBcU9CRm5IbmFaaEpGNkxkdWx", // external (property name)
        "y": "i5a2NtJoUKXkLm6q8nOEu9WOkso1Ag6FTUT6k_LMnGk" // external (property name)
    }
}

My understanding was that this was possible, but reading the spec I am not not sure.

The spec states for the id property:

The value of the id property for a verification method MUST be a string that conforms to the rules in Section 3.2 DID URL Syntax.

The did-url ABNF is below.

did-url = did path-abempty [ "?" query ] [ "#" fragment ]
decentralgabe commented 3 months ago

See 3.2.2. Relative DID URLs

Relative DID URLs are often used to reference verification methods and services in a DID Document without having to use absolute URLs. DID methods where storage size is a consideration might use relative URLs to reduce the storage size of DID documents.

It would be helpful to add references to this section

wip-abramson commented 3 months ago

Ah great, I missed that. Think this can be closed, unless you are suggesting we should update the references?

I think it is in there, as it references 3.2 which includes 3.2.2. I just didn't read far enough down, my bad.

One thing we might consider is adding an example that uses relative DID-URLs to section A.

decentralgabe commented 3 months ago

I believe an example would be useful...it took me a few minutes to find the section.