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

Provide reusable context compatible with VC data model context #51

Closed
Fak3 opened this issue Jul 20, 2020 · 9 comments
Closed

Provide reusable context compatible with VC data model context #51

Fak3 opened this issue Jul 20, 2020 · 9 comments
Assignees

Comments

@Fak3
Copy link

Fak3 commented Jul 20, 2020

Would it be possible to cook up a context for the security vocabulary that is compatible with VC data model context? So that it would be simple to reuse terms from the security vocabulary in the verifiable claims and presentations.

Currently both contexts are conflicting on some protected terms - namely Ed25519Signature2018 and maybe others.

The following example fails with jsonld.SyntaxError: Invalid JSON-LD syntax; tried to redefine a protected term. :

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/security/v1"
  ],
  "@type": ["VerifiableCredential"],
  "issuer": {
    "name": "My issuer"
  }
}

open in playground

@dlongley
Copy link
Contributor

Yes, this is possible -- it's just a matter of someone putting in the time to do it, including thinking about how to best accomplish it and testing it. For example, should we have a different context per signature/proof type -- so you just attach your signature/proof type context? Or should there be one comprehensive security/v3 context that includes all of the latest? Should we do both?

@dlongley
Copy link
Contributor

cc: @OR13 and @tplooker for opinions.

@OR13
Copy link
Collaborator

OR13 commented Jul 20, 2020

yes, this seems like a critical thing to do.

@kdenhartog
Copy link
Contributor

kdenhartog commented Oct 8, 2020

Ran into this problem when trying to update the BbsBlsSignature2020 to use the v3-unstable context. It's conflicting because it's bringing in the v2 context, which brings in the v1 context which has a few property collisions. My suggestion is that we should update the verifiable credential context to remove EcdsaSecp256k1Signature2019, EcdsaSecp256r1Signature2019, Ed25519Signature2018, RsaSignature2018 and then VCs should use the VC context and the latest security context instead.

{
  "@context": {
    "@version": 1.1,
    "@protected": true,

    "id": "@id",
    "type": "@type",

    "VerifiableCredential": {
      "@id": "https://www.w3.org/2018/credentials#VerifiableCredential",
      "@context": {
        "@version": 1.1,
        "@protected": true,

        "id": "@id",
        "type": "@type",

        "cred": "https://www.w3.org/2018/credentials#",
        "sec": "https://w3id.org/security#",
        "xsd": "http://www.w3.org/2001/XMLSchema#",

        "credentialSchema": {
          "@id": "cred:credentialSchema",
          "@type": "@id",
          "@context": {
            "@version": 1.1,
            "@protected": true,

            "id": "@id",
            "type": "@type",

            "cred": "https://www.w3.org/2018/credentials#",

            "JsonSchemaValidator2018": "cred:JsonSchemaValidator2018"
          }
        },
        "credentialStatus": { "@id": "cred:credentialStatus", "@type": "@id" },
        "credentialSubject": {
          "@id": "cred:credentialSubject",
          "@type": "@id"
        },
        "evidence": { "@id": "cred:evidence", "@type": "@id" },
        "expirationDate": {
          "@id": "cred:expirationDate",
          "@type": "xsd:dateTime"
        },
        "holder": { "@id": "cred:holder", "@type": "@id" },
        "issued": { "@id": "cred:issued", "@type": "xsd:dateTime" },
        "issuer": { "@id": "cred:issuer", "@type": "@id" },
        "issuanceDate": { "@id": "cred:issuanceDate", "@type": "xsd:dateTime" },
        "proof": { "@id": "sec:proof", "@type": "@id", "@container": "@graph" },
        "refreshService": {
          "@id": "cred:refreshService",
          "@type": "@id",
          "@context": {
            "@version": 1.1,
            "@protected": true,

            "id": "@id",
            "type": "@type",

            "cred": "https://www.w3.org/2018/credentials#",

            "ManualRefreshService2018": "cred:ManualRefreshService2018"
          }
        },
        "termsOfUse": { "@id": "cred:termsOfUse", "@type": "@id" },
        "validFrom": { "@id": "cred:validFrom", "@type": "xsd:dateTime" },
        "validUntil": { "@id": "cred:validUntil", "@type": "xsd:dateTime" }
      }
    },

    "VerifiablePresentation": {
      "@id": "https://www.w3.org/2018/credentials#VerifiablePresentation",
      "@context": {
        "@version": 1.1,
        "@protected": true,

        "id": "@id",
        "type": "@type",

        "cred": "https://www.w3.org/2018/credentials#",
        "sec": "https://w3id.org/security#",

        "holder": { "@id": "cred:holder", "@type": "@id" },
        "proof": { "@id": "sec:proof", "@type": "@id", "@container": "@graph" },
        "verifiableCredential": {
          "@id": "cred:verifiableCredential",
          "@type": "@id",
          "@container": "@graph"
        }
      }
    },
    "proof": {
      "@id": "https://w3id.org/security#proof",
      "@type": "@id",
      "@container": "@graph"
    }
  }
}

Sent a message to the VC mailing list to try and get attention to this topic: https://lists.w3.org/Archives/Public/public-vc-wg/2020Oct/0000.html

@OR13
Copy link
Collaborator

OR13 commented Oct 9, 2020

yep, see also:

https://github.com/w3c-ccg/lds-ed25519-2020/blob/master/contexts/lds-ed25519-2020-v1.json

https://github.com/transmute-industries/vc.js/tree/master/packages/ed25519-signature-2020

TL;DR is JSON-LD and VC Context and document loaders remain confusing for developers :( we need better examples.

@dlongley
Copy link
Contributor

dlongley commented Oct 9, 2020

The v3 context should not bring in the v1 and v2 contexts, but instead define all of their terms directly, use @protected, and use type-scoped definitions for things like signature suites. That should bring it inline with the VC context which uses these newer JSON-LD 1.1 features. We may find that there are no conflicts after that is done. If there are, we can decide where to go from there.

@OR13
Copy link
Collaborator

OR13 commented Oct 9, 2020

agreed, PRs welcome to start that process for this file:

https://github.com/w3c-ccg/security-vocab/blob/master/contexts/security-v3-unstable.jsonld

@kdenhartog
Copy link
Contributor

The v3 context should not bring in the v1 and v2 contexts, but instead define all of their terms directly, use @protected, and use type-scoped definitions for things like signature suites. That should bring it inline with the VC context which uses these newer JSON-LD 1.1 features. We may find that there are no conflicts after that is done. If there are, we can decide where to go from there.

That makes sense to me now. Wasn't thinking about that option. I'll start that effort so I can finish up v3 for BBS+ signatures

@kdenhartog
Copy link
Contributor

kdenhartog commented Nov 12, 2020

I believe with the merging of #70 this issue can now be closed. There's additional follow up issues that still need to be addressed to get v3 in a better state, but it's at least usable with the VC context now.

Please re-open or file a new issue if you've got more concerns @Fak3

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

5 participants