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

Disclose only one element of an @type object array? #193

Open
uvdsl opened this issue Jul 5, 2022 · 0 comments
Open

Disclose only one element of an @type object array? #193

uvdsl opened this issue Jul 5, 2022 · 0 comments

Comments

@uvdsl
Copy link

uvdsl commented Jul 5, 2022

Hi all,
maybe a quite simple question but I could not get it to work:
Can I (and if so, how) extract only one element of an @type object array to be disclosed in the derived proof?
It works for the demo attribute but not for @type and I am confused.

It is probably only related to the JSON-LD framing, but maybe I am just not seeing something obvious...

I appreciate any help!

Example VC:

{"@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/citizenship/v1",
    "https://w3id.org/security/bbs/v1",
    { 
      "DemoCred": { "@id": "http://example.org/vocab#DemoCred","@type": "@id" },
      "Student": { "@id": "http://example.org/vocab#Student","@type": "@id" },
      "demo": { "@id": "http://example.org/vocab#demo" }
    }
  ],
  "@id": "https://example.org/cred#1656530237291",
  "type": [ "DemoCred", "VerifiableCredential" ],
  "name": "Demo Credential",
  "credentialSubject": {
    "id": "alice",
    "type": [ "Student", "Person" ],
    "demo": [ "true", "abc" ],
    "http://schema.org/DateTime": "2022-06-29T19:17:17.291Z"
  }}

Example JSON-LD frame:

{"@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/citizenship/v1",
    "https://w3id.org/security/bbs/v1",
    { 
      "DemoCred": { "@id": "http://example.org/vocab#DemoCred","@type": "@id" },
      "Student": { "@id": "http://example.org/vocab#Student","@type": "@id" },
      "demo": { "@id": "http://example.org/vocab#demo" }
    }
  ],
 "@id": "https://example.org/cred#1656530237291",
 "type": "VerifiableCredential",
 "@explicit": true,
 "credentialSubject": {
    "id": "alice",
    "type": [ "Person" ],
    "demo": [ "abc" ], 
    "@explicit":true
  }}

Output

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/citizenship/v1",
    "https://w3id.org/security/bbs/v1",
   { 
      "DemoCred": { "@id": "http://example.org/vocab#DemoCred","@type": "@id" },
      "Student": { "@id": "http://example.org/vocab#Student","@type": "@id" },
      "demo": { "@id": "http://example.org/vocab#demo" }
    }
  ],
  "id": "https://example.org/cred#1656530237291",
  "type": [ "DemoCred", "VerifiableCredential" ],
  "credentialSubject": {
    "id": "alice",
    "type": [ "Student", "Person" ],
    "demo": "abc"
  }
}

Desired / expected output:

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/citizenship/v1",
    "https://w3id.org/security/bbs/v1",
   { 
      "DemoCred": { "@id": "http://example.org/vocab#DemoCred","@type": "@id" },
      "Student": { "@id": "http://example.org/vocab#Student","@type": "@id" },
      "demo": { "@id": "http://example.org/vocab#demo" }
    }
  ],
  "id": "https://example.org/cred#1656530237291",
  "type": "VerifiableCredential",
  "credentialSubject": {
    "id": "alice",
    "type": "Person",
    "demo": "abc"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant