vc-json-schema
vc-json-schema copied to clipboard
Question regarding JsonSchemaCredential
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"
}
}
}
thanks @mjfelis for the issue.
Today we can...
- Reference a JSON Schema in a VC with the
JsonSchemaorJsonSchemaCredentialtypes - The
idreference to aJsonSchemacould be a schema or reference to a JSON Schema (using$ref). - The
idreference to aJsonSchemaCredentialcould 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.
Hi @decentralgabe,
Yes, that's exactly what we need. That would be an optimal solution for referencing json schemas stored in a Trust Registry.
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.
The issue was discussed in a meeting on 2025-01-29
- no resolutions were taken
View the transcript
2.9. Question regarding JsonSchemaCredential (issue vc-json-schema#235)
See github issue vc-json-schema#235.
Brent Zundel: A PR has been raised that addresses this.
Mahmoud Alkhraishi: I would love it if we could get more implementers.
… I'm going to be working on the JSON Schema suite as well.
Ivan Herman: You don't have to be a W3C member to participate in the testing.
@decentralgabe @iherman @brentzundel thanks folks!