w3c-ccg / vp-request-spec

Specification for a query language to request Verifiable Presentations from wallets etc.

Home Page:https://w3c-ccg.github.io/vp-request-spec/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example 2 provides invalid JSON object

kdenhartog opened this issue · comments

In example 2 the addition of the "AnotherQueryType" object falls within the "example" property value. Should this be another example query and should be the second index of the credentialQuery Array property value?

@Liam-Tait

I think this would be the valid form of json (bar comments)

{
  "query": [
    {
      "type": "QueryByExample",
      "credentialQuery": [
        {
          // One or more example query entries
          "required": false, // (Optional) Defaults to 'true' if omitted
          // (Optional) Reason for requesting this credential that
          // may be shown to a user by their wallet software
          "reason": "We need you to prove your eligibility to work.",
          "example": {
            "@context": ["https://www.w3.org/2018/credentials/v1", "https://w3id.org/citizenship/v1"],
            "type": "PermanentResidentCard",
            // (Optional) You can request a specific subject id
            "credentialSubject": {
              "id": "...",
              "name": "..."
            },
            // (Optional) Specify only credentials of a particular schema
            "credentialSchema": {
              "id": "urn:foo:1234",
              "type": "SomeType"
            },
            // (Optional) Specify credentials from a particular issuer only
            "trustedIssuer": [
              {
                "required": true,
                "issuer": "urn:some:required:issuer"
              }
            ],
            // (Optional)
            "issuerQuery": [
              //
            ]
          }
        },
        {
          // Another example query
          "type": "AnotherQueryType"
          // ...
        }
      ]
    }
  ],
  "challenge": "3182bdea-63d9-11ea-b6de-3b7c1404d57f",
  // the domain that will be digitally signed in the authentication
  // proof that will be attached to the VerifiablePresentation
  // response, identifying the recipient
  "domain": "jobs.example.com"
}

Should this be another example query and should be the second index of the credentialQuery Array property value?

No, it's a typo -- it's in the wrong place. The intention was for it to represent an entirely different type of query (other than a "query by example"). The purpose was to show that QueryByExample isn't the only possible query type. So it should be moved to be the second index in the query array. As for @Liam-Tait's comments -- we should also add another entry under the QueryByExample credentialQuery array to demonstrate that you can ask for more than one VC (by example) at a time. So there are really two separate things going on here:

  1. The format supports multiple query types.
  2. The QueryByExample query type supports multiple credentialQuery examples.

Thanks @Liam-Tait! Fixed in PR #4, closing.

(Reopening to address @dlongley's suggestion.)

(Reopening to address @dlongley's suggestion.)

Will this suggestion be addressed anytime? I'd like to consider #10 as well, since even when the JSON in example 2 is valid and contains a more "realistic" example, it does not seem to adhere to existing JSON-LD contexts.

This has been partially covered by #30 and will be fully addressed once #27 is merged as it will show how to combined multiple and/or queries.