Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DID Context mgmnt? #337

Open
jandrieu opened this issue Feb 24, 2022 · 6 comments
Open

DID Context mgmnt? #337

jandrieu opened this issue Feb 24, 2022 · 6 comments

Comments

@jandrieu
Copy link

I'm trying to understand how additional contexts are managed.

I see that DIDs are created with just the default https://www.w3.org/ns/did/v1.

How would one specify additional contexts? I see that in neither the MsgCreateDidDocument nor MsgUpdateDidDocument

Is that even possible?

@PaddyMc
Copy link
Contributor

PaddyMc commented Mar 1, 2022

Thanks for reviewing 🙇

You can use the MsgUpdateDidDocument and a custom script to update a did doc context

https://github.com/allinbits/cosmos-cash/blob/main/proto/did/tx.proto#L68

@jandrieu
Copy link
Author

jandrieu commented Mar 1, 2022

Ok. So, the document in the MsgUpdateDidDocument has no constraints? I can change the context, add verification methods, add properties?

@PaddyMc
Copy link
Contributor

PaddyMc commented Mar 2, 2022

Yeah, we left it this way so it will ease the burden on client developers. All data will still be validated wrt the standard.

@jandrieu
Copy link
Author

jandrieu commented Mar 2, 2022

Does that include handling custom contexts with additional properties?

JSON-LD validation would work in that case, but without JSON-LD validation, you would need to update the code any time a property is added to the DID Spec Registries.

For example, did:ethr supports arbitrary properties only partially. You can store it on chain, but the resolver won't be able to read it. You can use a different resolver, but on most timeframes, did:ethr is essentially locked to just a few top-level properties.

@PaddyMc
Copy link
Contributor

PaddyMc commented Mar 22, 2022

Yeah it does, so long as the context is a valid URL, we can update the context with multiple contexts 😄

@jandrieu
Copy link
Author

What if the context is more complicated?

For example, this is (structurally) a valid context

   "@context": [
    "https://www.w3.org/ns/did/v1",
    {
      "EcdsaSecp256k1VerificationKey2019": "https://w3id.org/security#EcdsaSecp256k1VerificationKey2019",
      "publicKeyJwk": {
        "@id": "https://w3id.org/security#publicKeyJwk",
        "@type": "@json"
      }
    }
  ]

Although you could almost restructure the document a bit to get the following

   "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/security/v1",
  ]

But it turns out that https://w3id.org/security/v1 doesn't actually contain the definitions for EcdsaSecp256k1VerificationKey2019 and publicKeyJwk, so you can't recreate the contexts in that way, even if you change the DID document to stay in sync. The initial example is a valid, inline context.

The other work around would be for someone to publish a new context with EcdsaSecp256k1VerificationKey2019 and publicKeyJwk defined, and use that URL. That would be a viable work-around, but definitely extra overhead.

In a separate note, are unknown contexts retrieved to validate the JSON-LD? Or simply recorded as is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants