Skip to content

Support non-propagating protected terms #361

Open
@Fak3

Description

@Fak3

I bumped into a practical limitation of json-ld with Verifiable credentials data model

VC context defines few protected terms at the top level of the json object - namely issuer and credentialSubject. According to the spec, ids of those properties must be protected, and the content that goes under them is left for the users of the spec to be changed (mostly) freely. But unfortunately json-ld 1.1 protected terms prevent users from modifying property-scoped context of protected term:

{
  "@context": [
   {
      "@protected": true,
      "issuer": { "@id": "https://www.w3.org/2018/credentials#issuer", "@type": "@id" }
   },
   {
      "issuer": {
        "@id": "https://www.w3.org/2018/credentials#issuer", "@type": "@id",
        "@context": { "name": "http://example.org/name" }  // This raises error - modifying protected `issuer` term is not allowed
      }
   }
  ],
  "type": ["VerifiableCredential"],
  "issuer": {
    "name": "My issuer"
  }
}

This ticked is moved from digitalbazaar/jsonld.js#404

@dlongley wrote: this use case was something that was discussed in the JSON-LD WG, but we couldn't find a way to support it given the time constraints. I also wanted this use case supported. Something similar would have been very useful for "credentialSubject" as well.

The alternative here is to define a type instead -- and use a type-scoped context. Like this:

"issuer": {
   "type": "MyIssuerType",
}

The workaround suggested by @dlongley works, but I wonder if there might be better way to handle this usecase in the next version of json-ld spec.

Something that comes to mind is to use "@Protected" keyword inside a property-scoped context of a protected term to allow its redefinition:

   {
      "@protected": true,
      "issuer": { 
         "@id": "https://www.w3.org/2018/credentials#issuer", "@type": "@id" ,
         "@context": { "@protected": false }  // Indicates that property-scoped context of this protected term can be overriden.
      }
   },

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions