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

Generated credential is not valid JSON-LD #13

Open
4 tasks
dysbulic opened this issue Feb 12, 2021 · 6 comments
Open
4 tasks

Generated credential is not valid JSON-LD #13

dysbulic opened this issue Feb 12, 2021 · 6 comments

Comments

@dysbulic
Copy link
Contributor

dysbulic commented Feb 12, 2021

The current Verifiable Credential looks like:

{
  iat: 1613091180
  iss: "did:web:oiekhuylog.execute-api.us-west-2.amazonaws.com"
  nbf: 1613091180
  sub: "did:3:kjzl6cwe1jw14b66fwpkbtsjr6l12rhtbrp48u0myiooozc0w559sv6e5yty0z4"
  vc: {
    @context: ["https://www.w3.org/2018/credentials/v1"]
    type: ["VerifiableCredential"]
    credentialSubject:
      account: {
        type: "Github"
        url: "https://gist.githubusercontent.com/dysbulic/2d6173168e3418d91acb9d83d53f35b6/raw/b342e5b8ab56781dc7adda4af2b693077bcabb84/IDX%20DID"
        username: "dysbulic"
      }
    }
  }
}

There are several parts of the VC & JSON-LD specifications are not followed. These include:

  • the credential should contain an issuer property specifying creator's DID
  • the credentialSubject should contain an id specifying the subject's DID
  • the @context should contain a contextualization for the contents of the account property
  • the type should contain a descriptor for the account property

The issuer and subject are present as the iss & sub properties, but I'm pretty sure they're also supposed to be present in the VC in case the JWT wrapper is stripped off in a presentation.

My understanding is JSON-LD's context is supposed to contain entries for all the elements in the document.

@oed
Copy link
Member

oed commented Feb 12, 2021

This service is using the JWT VC format and not the JSON-LD format.
See the JWT-VC as part of the w3c VC spec here: https://www.w3.org/TR/vc-data-model/#json-web-token
It's using this implementation: https://github.com/decentralized-identity/did-jwt-vc

Although I would be happy to accept contributions that enable the use of JSON-LD as well. Both are accepted encodings of verifiable credentials in the w3c spec.

@dysbulic
Copy link
Contributor Author

dysbulic commented Feb 12, 2021

I missed:

If these specific claim names and header parameters are present, their respective counterpart in the standard verifiable credential and verifiable presentation MAY be omitted to avoid duplication.

I just saw:

vc: JSON object, which MUST be present in a JWT verifiable credential. The object contains the verifiable credential according to this specification.

So, I'll concede the issuer and id don't have to be set. I also found the JSON-LD Playground & not having a context just makes the object opaque to semantic parsers.

In the long term, I think having a valid semantic representation would be nice. schema.org is a morass of definitions. I think maybe RegisterAction

@oed
Copy link
Member

oed commented Feb 12, 2021

Happy to add a relevant context if you want to create one!
Are you saying that RegiserAction might be relevant here?

@dysbulic
Copy link
Contributor Author

dysbulic commented Feb 12, 2021

Here's where I'm at currently:

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "http://schema.org/"
  ],
  "type": [
    "VerifiableCredential",
    "RegisterAction"
  ],
  "credentialSubject": {
    "verification": {
      "agent": { "name": "dysbulic" },
      "location": {
        "name": "Github",
        "url": "https://github.com"
      },
      "result": {
        "name": "gist",
        "url": "https://gist.githubusercontent.com/dysbulic/2d6173168e3418%20DID"
      }
    }
  }
}

My statement is "dysbulic created a gist at http://gist… verifying their control of their Github account."

The potentially useful contexts are:

  • agent: John wrote a book.
  • instrument: John wrote a book with a pen.
  • location: John read a book at home. (Also includes virtual locations.)
  • object: John read a book.
  • result: John wrote a book.

@oed
Copy link
Member

oed commented Feb 12, 2021

Interesting, I'm learning as we go here 😅 Haven't played around with JSON-LD much tbh!

Maybe it could make sense to use Claim here somehow?

@dysbulic
Copy link
Contributor Author

Interesting, I'm learning as we go here. Haven't played around with JSON-LD much tbh!

Linked Data is black magic to me. I get the sense it would be really useful if I could but grasp it. Especially for systems that are doing data discovery.

It's all apparently analogous to building a directed graph. I've not been able to find a tutorial depicting it pictorially though.

Maybe it could make sense to use Claim here somehow?

I'm having difficulty finding properties where I'd stick the gist and site info. I see how I could represent the claim "there is no God", but not "the user controls the username dysbulic on Github".

Maybe though, there's alot of properties on a Claim.

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

No branches or pull requests

3 participants