hyperledger / indy-did-method

Indy DID Method Specification
https://hyperledger.github.io/indy-did-method/
Creative Commons Attribution 4.0 International
18 stars 14 forks source link

Do we allow authentication and verificationMethod as strings in DidDocContent? #47

Closed domwoe closed 2 years ago

domwoe commented 2 years ago

The current spec is not entirely clear if authentication and verificationMethod items in diddocContent MUST be arrays or if strings are allowed.

The DID core spec says that both MUST be arrays. I think we should either

  1. Explicitly require arrays and validate/enforce this in indy node
  2. Allow strings and add them to the respective arrays at resolution.

I'd prefer 1, but good with both.

swcurran commented 2 years ago

I think the spec is clear -- curious where you think it is not. In that section it says that the data elements are merged into the base DIDDoc template. In that template, both are arrays.

domwoe commented 2 years ago

From the viewpoint of a resolver who needs to merge the data structures, I want to be certain what I get.

I agree that the spec is clear about the base DIDDoc template. But the description of the diddocContent is less clear:

If the diddocContent item contains verificationMethod and/or authentication items, process them as follows.
1. The entries MUST NOT have the same id values as those from the [NYM](https://hyperledger.github.io/indy-did-method/#term:nym)-generated DIDDoc. If a matching id is found, exit and return an error.
2. Merge the entries into the respective arrays of DIDDoc.

However, the important point for me is that indy-node will only accept arrays on write.

swcurran commented 2 years ago

Got it. So if you have the same thing in the DIDDocContent it has to be an array as well. Sounds good to add that clarification.

swcurran commented 2 years ago

@domwoe to add a PR. Code to check that if the verificationMethod and authentication are included, they must be arrays. This is in the indy-node code and any resolver.