From 16d2ee496e3bcfbf8773cf021b5d49be4915cc64 Mon Sep 17 00:00:00 2001
From: Nate Otto
+The `json-card` render suite uses the JSONata templating language to
+transform a [=verifiable credential=] into a standardized JSON card format.
+This format enables wallets to display credentials in a responsive card layout
+with key data highlighted and configurable additional fields. Wallets that
+implement this method can render the standardized JSON output into their own
+card UI designs, allowing credentials to be displayed even when a wallet
+doesn't natively support a specific credential type.
+
+The template is expressed as a JSONata expression string. When the template
+is evaluated against the [=verifiable credential=] data, it MUST produce
+output that conforms to the json-card JSON schema defined below.
+
+The output of a `json-card` template MUST be a JSON object that conforms to
+the following structure:
+
+The following example shows a valid json-card output:
+
+In the example below, a fully embedded JSONata template is used as the rendering
+template.
+
+The next example links to the JSONata template on the Web and secures it against
+modification by using the `digestMultibase` property.
+
+The next example links to the rendering template on the Web and secures it
+using the `digestMultibase` property:
+
From 0b9b6806fe9b08945dcfea266f902cd6062d68ab Mon Sep 17 00:00:00 2001
From: Nate Otto
-The `json-card` render suite uses the JSONata templating language to
-transform a [=verifiable credential=] into a standardized JSON card format.
-This format enables wallets to display credentials in a responsive card layout
-with key data highlighted and configurable additional fields. Wallets that
-implement this method can render the standardized JSON output into their own
-card UI designs, allowing credentials to be displayed even when a wallet
-doesn't natively support a specific credential type.
+The `json-card` render suite uses JSON templates to transform a
+[=verifiable credential=] into a standardized JSON card format. This format
+enables wallets to display credentials in a responsive card layout with key
+data highlighted and configurable additional fields. Wallets that implement
+this method can render the standardized JSON output into their own card UI
+designs, allowing credentials to be displayed even when a wallet doesn't
+natively support a specific credential type.
-The template is expressed as a JSONata expression string. When the template
-is evaluated against the [=verifiable credential=] data, it MUST produce
-output that conforms to the json-card JSON schema defined below.
+The template is a JSON object that matches the json-card output structure.
+String values in the template can be JSON pointer strings (as specified in
+[[[RFC6901]]]) that reference fields in the [=verifiable credential=]. When
+processing the template, JSON pointer strings are evaluated against the
+credential data and replaced with the resolved values. The template MUST
+conform to the JSON template schema defined below, and the resulting output
+MUST conform to the json-card output schema. Compound data across multiple
+fields is not supported; each field references a single JSON pointer.
+The template for a `json-card` render suite MUST be a JSON object that
+conforms to the following structure. The template structure matches the
+output structure, but string values can be either literal strings or JSON
+pointer strings (starting with `/`) that reference fields in the
+[=verifiable credential=]. The template SHOULD be validated against this
+schema before processing.
+
+The following JSON Schema implements the template structure rules defined
+above:
+
+The following example shows a valid json-card template with JSON pointer
+strings:
+
The output of a `json-card` template MUST be a JSON object that conforms to
the following structure:
@@ -729,9 +927,60 @@
+When processing a `json-card` template, the following steps MUST be
+performed:
+
+Note that compound data across multiple fields is not supported. Each field
+in the template references a single JSON pointer that resolves to a single
+value from the credential.
+
-In the example below, a fully embedded JSONata template is used as the rendering
-template.
+In the example below, a fully embedded JSON template is used as the rendering
+template. The template uses JSON pointer strings to reference credential data.
-The next example links to the JSONata template on the Web and secures it against
+The next example links to the JSON template on the Web and secures it against
modification by using the `digestMultibase` property.
-The template is a JSON object that matches the json-card output structure.
+The template is a JSON object that matches the `json-card` output structure.
String values in the template can be JSON pointer strings (as specified in
[[[RFC6901]]]) that reference fields in the [=verifiable credential=]. When
processing the template, JSON pointer strings are evaluated against the
credential data and replaced with the resolved values. The template MUST
conform to the JSON template schema defined below, and the resulting output
-MUST conform to the json-card output schema. Compound data across multiple
+MUST conform to the `json-card` output schema. Compound data across multiple
fields is not supported; each field references a single JSON pointer.
-The following example shows a valid json-card template with JSON pointer
+The following example shows a valid `json-card` template with JSON pointer
strings:
-The following example shows a valid json-card output:
+The following example shows a valid `json-card` output:
The `pdf-mustache` Render Suite
+ The `json-card` Render Suite
+ JSON Card Schema
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+ name
+ [=string=]
+
+A REQUIRED display name for the credential card.
+
+
+
+ description
+ [=string=]
+
+A REQUIRED description text for the credential card.
+
+
+
+ icon
+ [=string=]
+
+An OPTIONAL URL or data URI for an icon or image to display on the card.
+
+
+
+ theme
+ [=ordered map|map=]
+
+An OPTIONAL color theme object with the following properties:
+
+
+
+ primaryColor ([=string=]): Primary color for backgrounds and highlightsaccentColor ([=string=]): Accent color for highlights and emphasis
+
+ fields
+ [=list=]
+
+A REQUIRED ordered list of custom data fields. Each field is an object with:
+
+
+
+ label ([=string=]): The field labelvalue ([=string=]): The field value
+
+ issueDate
+ [=string=]
+
+An OPTIONAL ISO 8601 date string indicating when the credential was issued.
+
+
+
+
+ expirationDate
+ [=string=]
+
+An OPTIONAL ISO 8601 date string indicating when the credential expires.
+
+
+{
+ "name": "Bachelor of Science and Arts",
+ "description": "University Degree Credential",
+ "icon": "https://example.edu/icons/degree.svg",
+ "theme": {
+ "primaryColor": "#1a5490",
+ "accentColor": "#4a90e2"
+ },
+ "fields": [
+ {
+ "label": "Institution",
+ "value": "Example University"
+ },
+ {
+ "label": "Degree Type",
+ "value": "BachelorDegree"
+ },
+ {
+ "label": "Graduation Date",
+ "value": "2010-05-15"
+ }
+ ],
+ "issueDate": "2010-01-01T19:23:24Z",
+ "expirationDate": null
+}
+
+
+
+{
+ ...
+ "renderMethod": {
+ "type": "TemplateRenderMethod",
+ "renderSuite": "json-card",
+ "template": "data:text/plain;base64,eyJuYW1lIjogY3JlZGVudGlhbFN1YmplY3QuZGVncmVlLm5hbWUsICJkZXNjcmlwdGlvbiI6ICJVbml2ZXJzaXR5IERlZ3JlZSBDcmVkZW50aWFsIiwgImZpZWxkcyI6IFt7ImxhYmVsIjogIkluc3RpdHV0aW9uIiwgInZhbHVlIjogaXNzdWVyfV19"
+ }
+}
+
+
+
+{
+...
+"renderMethod": {
+ "type": "TemplateRenderMethod",
+ "renderSuite": "json-card",
+ "template": {
+ "id": "https://degree.example/credential-templates/bachelors.jsonata",
+ "mediaType": "text/plain",
+ "digestMultibase": "zQmerWC85Wg6wFl9znFCwYxApG270iEu5h6JqWAPdhyxz2dR"
+ }
+}
+
+
+
+{
+...
+"renderMethod": {
+ // this render method is fetched from the Web
+ "id": "https://degrees.example/bachelors-json-card.jsonld",
+ "mediaType": "application/ld+json",
+ "type": "TemplateRenderMethod",
+ "renderSuite": "json-card",
+ "digestMultibase": "zQmG270iEu5h6JqWAPdhyxz2dRerWC85Wg6wFl9znFCwYxAp"
+}
+
+
+ The `nfc` Render Suite
The `pdf-mustache` Render Suite
The `json-card` Render Suite
JSON Card Schema
+ JSON Template Schema
+
+
+
+
+
+
+
+
+ Property
+ Type
+ Description
+
+
+ name
+ [=string=]
+
+A REQUIRED string that is either a literal display name or a JSON pointer
+string (e.g.,
+ "/credentialSubject/degree/name") that references
+the credential data.
+
+
+ description
+ [=string=]
+
+A REQUIRED string that is either a literal description or a JSON pointer
+string that references the credential data.
+
+
+
+ icon
+ [=string=]
+
+An OPTIONAL string that is either a literal URL/data URI or a JSON pointer
+string that references the credential data.
+
+
+
+ theme
+ [=ordered map|map=]
+
+An OPTIONAL color theme object with the following properties:
+
+
+
+ primaryColor ([=string=]): Primary color as a literal string or JSON pointeraccentColor ([=string=]): Accent color as a literal string or JSON pointer
+
+ fields
+ [=list=]
+
+A REQUIRED ordered list of custom data fields. Each field is an object with:
+
+
+
+ label ([=string=]): The field label (MUST be a literal string, not a JSON pointer)value ([=string=]): The field value as a JSON pointer string (e.g., "/issuer")
+
+ issueDate
+ [=string=]
+
+An OPTIONAL string that is either a literal ISO 8601 date or a JSON pointer
+string that references the credential data.
+
+
+
+
+ expirationDate
+ [=string=]
+
+An OPTIONAL string that is either a literal ISO 8601 date or a JSON pointer
+string that references the credential data.
+
+
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "required": ["name", "description", "fields"],
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Display name as a literal string or JSON pointer (e.g., \"/credentialSubject/degree/name\")"
+ },
+ "description": {
+ "type": "string",
+ "description": "Description as a literal string or JSON pointer"
+ },
+ "icon": {
+ "type": "string",
+ "description": "Icon URL/data URI as a literal string or JSON pointer"
+ },
+ "theme": {
+ "type": "object",
+ "properties": {
+ "primaryColor": {
+ "type": "string",
+ "description": "Primary color as a literal string or JSON pointer"
+ },
+ "accentColor": {
+ "type": "string",
+ "description": "Accent color as a literal string or JSON pointer"
+ }
+ },
+ "additionalProperties": false
+ },
+ "fields": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "type": "object",
+ "required": ["label", "value"],
+ "properties": {
+ "label": {
+ "type": "string",
+ "description": "Field label (MUST be a literal string, not a JSON pointer)"
+ },
+ "value": {
+ "type": "string",
+ "pattern": "^/",
+ "description": "Field value as a JSON pointer string (MUST start with \"/\")"
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "issueDate": {
+ "type": "string",
+ "description": "Issue date as a literal ISO 8601 date string or JSON pointer"
+ },
+ "expirationDate": {
+ "type": "string",
+ "description": "Expiration date as a literal ISO 8601 date string or JSON pointer"
+ }
+ },
+ "additionalProperties": false
+}
+
+
+
+{
+ "name": "/credentialSubject/degree/name",
+ "description": "University Degree Credential",
+ "icon": "/credentialSubject/icon",
+ "theme": {
+ "primaryColor": "#1a5490",
+ "accentColor": "/credentialSubject/theme/accentColor"
+ },
+ "fields": [
+ {
+ "label": "Institution",
+ "value": "/issuer"
+ },
+ {
+ "label": "Degree Type",
+ "value": "/credentialSubject/degree/type"
+ },
+ {
+ "label": "Issue Date",
+ "value": "/validFrom"
+ }
+ ],
+ "issueDate": "/validFrom",
+ "expirationDate": "/validUntil"
+}
+
+
+ JSON Card Output Schema
JSON Card Schema
Template Processing
+
+
+
+
+
+ JSON Card Schema
"renderMethod": {
"type": "TemplateRenderMethod",
"renderSuite": "json-card",
- "template": "data:text/plain;base64,eyJuYW1lIjogY3JlZGVudGlhbFN1YmplY3QuZGVncmVlLm5hbWUsICJkZXNjcmlwdGlvbiI6ICJVbml2ZXJzaXR5IERlZ3JlZSBDcmVkZW50aWFsIiwgImZpZWxkcyI6IFt7ImxhYmVsIjogIkluc3RpdHV0aW9uIiwgInZhbHVlIjogaXNzdWVyfV19"
+ // the JSON template is embedded in the VC
+ "template": "data:application/json;base64,eyJuYW1lIjogIi9jcmVkZW50aWFsU3ViamVjdC9kZWdyZWUvbmFtZSIsICJkZXNjcmlwdGlvbiI6ICJVbml2ZXJzaXR5IERlZ3JlZSBDcmVkZW50aWFsIiwgImZpZWxkcyI6IFt7ImxhYmVsIjogIkluc3RpdHV0aW9uIiwgInZhbHVlIjogIi9pc3N1ZXIifV19"
}
}
+ title="A remotely hosted JSON template for a json-card render template">
{
...
"renderMethod": {
"type": "TemplateRenderMethod",
"renderSuite": "json-card",
"template": {
- "id": "https://degree.example/credential-templates/bachelors.jsonata",
- "mediaType": "text/plain",
+ // this JSON template is fetched from the Web
+ "id": "https://degree.example/credential-templates/bachelors.json",
+ "mediaType": "application/json",
"digestMultibase": "zQmerWC85Wg6wFl9znFCwYxApG270iEu5h6JqWAPdhyxz2dR"
}
}
From 15fd0ab641f70b27e053d5a42442ba2b829abde8 Mon Sep 17 00:00:00 2001
From: Nate Otto The `json-card` Render Suite
[=verifiable credential=] into a standardized JSON card format. This format
enables wallets to display credentials in a responsive card layout with key
data highlighted and configurable additional fields. Wallets that implement
-this method can render the standardized JSON output into their own card UI
+this method can render the standardized JSON output in their own card UI
designs, allowing credentials to be displayed even when a wallet doesn't
natively support a specific credential type.
JSON Template Schema
JSON Card Output Schema
Template Processing
The `json-card` Render Suite
[=verifiable credential=] into a standardized JSON card format. This format
enables wallets to display credentials in a responsive card layout with key
data highlighted and configurable additional fields. Wallets that implement
-this method can render the standardized JSON output in their own card UI
+this method can render the standardized JSON output in their own card UI
designs, allowing credentials to be displayed even when a wallet doesn't
natively support a specific credential type.
-The template is a JSON object that matches the `json-card` output structure. +The template is a JSON object that matches the `json-card` output structure. String values in the template can be JSON pointer strings (as specified in [[[RFC6901]]]) that reference fields in the [=verifiable credential=]. When processing the template, JSON pointer strings are evaluated against the credential data and replaced with the resolved values. The template MUST conform to the JSON template schema defined below, and the resulting output -MUST conform to the `json-card` output schema. Compound data across multiple +MUST conform to the `json-card` output schema. Compound data across multiple fields is not supported; each field references a single JSON pointer.
@@ -687,23 +692,24 @@label ([=string=]): The field label (MUST be a literal string, not a JSON pointer)value ([=string=]): The field value as a JSON pointer string (e.g., "/issuer")language ([=string=]): An OPTIONAL language tag (as specified in [[[BCP47]]]) indicating the language of the field's label and/or value-The following example shows a valid `json-card` template with JSON pointer +The following example shows a valid `json-card` template with JSON pointer strings:
@@ -809,8 +819,8 @@label ([=string=]): The field labelvalue ([=string=]): The field valuelanguage ([=string=]): An OPTIONAL language tag (as specified in [[[BCP47]]]) indicating the language of the field-The following example shows a valid `json-card` output: +The following example shows a valid `json-card` output:
JSON Card Output Schema
"value": "2010-05-15"
}
],
- "issueDate": "2010-01-01T19:23:24Z",
- "expirationDate": null
+ "validFrom": "2010-01-01T19:23:24Z",
+ "validUntil": null
}
@@ -965,7 +976,7 @@