decentralized-identity / sidetree

Sidetree Specification and Reference Implementation
https://identity.foundation/sidetree/spec
Apache License 2.0
437 stars 112 forks source link

Contexts need updated to produce valid JSON-LD DID Documents #1144

Open kdenhartog opened 3 years ago

kdenhartog commented 3 years ago

Not sure if this should be filed here or in https://github.com/decentralized-identity/ion/ so going to post in both and cross link.

Due to recent changes in the DID Core context file, we now need to make sure that the key suite contexts are getting added to the outputted DID Document on resolution. In ION specifically, DID Documents are limited to JWKs so I believe we should be able to add the URL https://w3id.org/security/suites/jws-2020/v1 for LDS-JWS2020 which includes the context definition for JsonWebKey2020.

@OR13 do you know what the specific URL for that is? Found it inside the perma-id/w3id file

For service endpoints, we may need to allow the service endpoint to pass a context URL in as well in the internal sidetree data model so that the contexts are properly working. However, this introduces some difficulties on preventing garbage-in-garbage-out scenarios and more thought will be needed on it.

Cross post link: https://github.com/decentralized-identity/ion/issues/217

OR13 commented 3 years ago

for each of the key types listed here: https://did.key.transmute.industries/

We have tested that both the JSON and JSON-LD DID Documents work with JSON-LD and VC-JWT.

In order to make the JSON work with JSON-LD https://w3id.org/security/suites/jws-2020/v1 is required for any case where you want to use publicKeyJwk + JsonWebKey2020.

...however, if you want to use other representations like publicKeyBase58 or publicKeyMultibase, you will need to register additional contexts....

it is possible to infer the correct context values based on a pure JSON data model, and inject the correct context, but only if your did method limits the verification method types (as did:key does).

See these 2 functions:

decentralgabe commented 1 year ago

@kdenhartog @OR13 are either of you able to help make this work for v1.1?

OR13 commented 1 year ago

Our implementation works. We inject vocab to protect users from carrying about sidetree's general lack of support for JSON-LD...

decentralgabe commented 1 year ago

Ok, this is something we should improve for v1.1

kdenhartog commented 1 year ago

When I was at MATTR and encountered this issue we ended up doing the same thing and injecting the context on the fly in our resolver. Was a hacky solution, but ended up resolving it for the time being.