spruceid / ssi

Core library for decentralized identity.
https://spruceid.dev
Apache License 2.0
193 stars 61 forks source link

W3 DID context omiting 'www.' is rejected #345

Closed oeed closed 3 years ago

oeed commented 3 years ago

A context of https://w3.org/ns/did/v1 is rejected because current it only expects the context be prefixed with 'www.'.

https://w3.org/ns/did/v1 redirects to https://www.w3.org/ns/did/v1, so it'd be good to have both accepted.

oeed commented 3 years ago

For context, the NZ Covid Pass specification omits this. If this is believed to be a violation of the DID spec let me know and I'll reach out to them.

Otherwise, I'm quite happy to make a PR to fix - should be fairly straight forward (trying to release asap).

clehner commented 3 years ago

Hi @oeed,

Nice work on the nzcp-rust implementation.

The requirement for the DID document @context property is in the JSON-LD representation production rules: https://www.w3.org/TR/did-core/#production-0 ("The serialized value of @context MUST be the JSON String https://www.w3.org/ns/did/v1, or a JSON Array where the first item is the JSON String https://www.w3.org/ns/did/v1" ...) (tested in DID Test Suite).

ssi applies a check on @context for all DID document representations; this is probably not needed for e.g. the JSON representation, where the production/consumption rules do not make mention of @context.

I don't see that the did:web method specification specifies whether a resolved did:web DID document is in JSON or JSON-LD representation (or whether that may be based on the returned HTTP header). But it does refer to the DID document file as a JSON-LD file in 2.5.1 Create (Register). ssi's did:web implementation assumes the resolved DID document is always JSON-LD.

Anyway, ssi also allows some alternative URIs for the DID document base context, for compatibility purposes. So we could just add another for that here [#349].

oeed commented 3 years ago

Thanks for the fix @clehner!