Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant