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

Question regarding JsonSchemaCredential #235

Open
mjfelis opened this issue Aug 28, 2024 · 3 comments
Open

Question regarding JsonSchemaCredential #235

mjfelis opened this issue Aug 28, 2024 · 3 comments
Assignees
Labels
editorial enhancement New feature or request

Comments

@mjfelis
Copy link

mjfelis commented Aug 28, 2024

I think it could be interesting to have a third option for using Json Schema in credentials.

The third option would be, in the JsonSchemaCredential, instead of providing the full Json Schema (property "jsonSchema"), provide a "jsonSchemaReference" that would include the id of the Json Schema and a "digestSRI" property. That would be handy to verify several issuers are conforming to the same json schema without having to manually compare the content of the jsonSchema property.

{
  "@context": [
      "https://www.w3.org/ns/credentials/v2",
      "https://www.w3.org/ns/credentials/examples/v2"
  ],
  "id": "https://example.com/credentials/3734",
  "type": ["VerifiableCredential", "JsonSchemaCredential"],
  "issuer": "https://example.com/issuers/14",
  "issuanceDate": "2010-01-01T19:23:24Z",
  "credentialSchema": {
    "id": "https://www.w3.org/2022/credentials/v2/json-schema-credential-schema.json",
    "type": "JsonSchema",
    "digestSRI": "sha384-S57yQDg1MTzF56Oi9DbSQ14u7jBy0RDdx0YbeV7shwhCS88G8SCXeFq82PafhCrW"
  },
  "credentialSubject": {
    "id": "https://example.com/schemas/favorite-color-schema.json",
    "type": "JsonSchema",
    "jsonSchemaReference": {
       "id": "https://example.com/schemas/email-credential-schema.json",
       "digestSRI": "sha384-ABCSGyugst67rs67rdbugsy0RDdx0YbeV7shwhCS88G8SCXeFq82PafhCrW"
    }    
  }
}
@decentralgabe
Copy link
Collaborator

thanks @mjfelis for the issue.

Today we can...

  1. Reference a JSON Schema in a VC with the JsonSchema or JsonSchemaCredential types
  2. The id reference to a JsonSchema could be a schema or reference to a JSON Schema (using $ref).
  3. The id reference to a JsonSchemaCredential could be a VC that contains a reference to another JSON Schema (using $ref) without re-defining the JSON Schema.

I am happy to expand on any/all of those depending on the functionality you're looking for, in addition to improving spec language/examples to illustrate these possibilities.

I think you are looking for (3) -- amending your example it could work with something like...

{
  "@context": [
    "https://www.w3.org/ns/credentials/v2",
    "https://www.w3.org/ns/credentials/examples/v2"
  ],
  "id": "https://example.com/credentials/3734",
  "type": [
    "VerifiableCredential",
    "JsonSchemaCredential"
  ],
  "issuer": "https://example.com/issuers/14",
  "issuanceDate": "2010-01-01T19:23:24Z",
  "credentialSchema": {
    "id": "https://www.w3.org/2022/credentials/v2/json-schema-credential-schema.json",
    "type": "JsonSchema",
    "digestSRI": "sha384-S57yQDg1MTzF56Oi9DbSQ14u7jBy0RDdx0YbeV7shwhCS88G8SCXeFq82PafhCrW"
  },
  "credentialSubject": {
    "id": "https://example.com/schemas/favorite-color-schema.json",
    "type": "JsonSchema",
    "jsonSchema": {
      "$ref": "https://example.com/schemas/email-credential-schema.json"
    },
    "digestSRI": "sha384-ABCSGyugst67rs67rdbugsy0RDdx0YbeV7shwhCS88G8SCXeFq82PafhCrW"
  }
}

If that is what you're looking for we would need to update guidance on how to provide digestSRI for JsonSchemaCredentials with external references.

@mjfelis
Copy link
Author

mjfelis commented Aug 29, 2024

Hi @decentralgabe,

Yes, that's exactly what we need. That would be an optimal solution for referencing json schemas stored in a Trust Registry.

@decentralgabe
Copy link
Collaborator

great - I'll assign myself to add spec text around this.

separately -- does your organization or an organization you're working with belong to the W3C or have an interest in joining? we are looking for more editors and implementers for this spec.

@decentralgabe decentralgabe self-assigned this Aug 29, 2024
@decentralgabe decentralgabe added enhancement New feature or request and removed discuss labels Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants