w3c-ccg / did-method-key

DID (Decentralized Identifier) did:key method for embedding keys in DID urls
https://w3c-ccg.github.io/did-method-key
Other
18 stars 12 forks source link

Spec raises `invalidDid` on valid dids #60

Open aljones15 opened 1 year ago

aljones15 commented 1 year ago

The following normative statement causes issues with the definition of invalidDid from did-core

Check the validity of the input identifier. The scheme MUST be the value did. The method MUST be the value key. The version MUST be convertible to a positive integer value. The multibaseValue MUST be a string and begin with the letter z. If any of these requirements fail, an invalidDid error MUST be raised.

The definition of invalidDid is:

invalidDid The DID supplied to the DID resolution function does not conform to valid syntax. (See 3.1 DID Syntax.)

The following statements should not raise invalidDid

The following is a valid did that breaks these rules: did:sov:staging:PiEVD2uU2qKEQ5oxx1BJ6A

I suggest adding a new error invalidDidKey for when something is a valid did, but not a valid did:key. We could make these more specific such as:

Also of note: the normative statement The method MUST be the value key conflicts with the did-resolver spec We could solve this issue by using the error code from did resolution methodNotSupported

peacekeeper commented 1 year ago

I agree with most of what you're saying here, but I'm not sure if introducing too many DID method-specific errors (such as invalidDidKeyVersion) is very smart. This can become complicated for both resolvers and clients if you want to support multiple DID methods.

We could also make use of other metadata properties. E.g. a resolver could return a generic invalidDid or notFound error that every client understand, but in the metadata we could include additional information WHY it was invalid or not found, etc.