sidetree icon indicating copy to clipboard operation
sidetree copied to clipboard

Contexts need updated to produce valid JSON-LD DID Documents

Open kdenhartog opened this issue 2 years ago • 5 comments

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

kdenhartog avatar Jul 14 '21 01:07 kdenhartog

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:

  • https://github.com/transmute-industries/did-key.js/blob/main/packages/did-key-common/src/securityVocabTypeToContext.ts
  • https://github.com/transmute-industries/did-key.js/blob/main/packages/did-key-common/src/publicKeyJwkToSecurityVocabType.ts

OR13 avatar Jul 14 '21 13:07 OR13

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

decentralgabe avatar Feb 07 '23 18:02 decentralgabe

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

OR13 avatar Feb 07 '23 19:02 OR13

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

decentralgabe avatar Feb 07 '23 20:02 decentralgabe

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.

kdenhartog avatar Feb 07 '23 21:02 kdenhartog