Skip to content

Credential Templates

“Credential Templates” enable providers to define the formats and types of verifiable credentials that will be issued to holders inside and outside of their ecosystem. Credential templates are an abstraction provided by Trinsic that makes getting started easy, improves ongoing management of an ecosystem, and enables tighter integration with other features in the Trinsic platform such as Trust Registries.

When you understand how credential templates work in Trinsic, you inherit the benefits of semantic interoperability and Trust Registry without needing to understand the nuts and bolts of schemas, credential definitions, JSON-LD contexts, credential restrictions, and more.

Defining credential templates isn’t just helpful for issuer and verifier adoption, but when done correctly also provides increased interoperability.

How to approach credential templates in your product

Credential templates enable you to to remove friction for the participants of your ecosystem. Therefore first and foremost, you should ensure whatever templates you provide satisfy the needs of the issuers and verifiers you’re working with.

Before you create your own template, you should consider whether a schema for your desired credential already exists. Standards bodies or industry best-practice sometimes dictate the kind of data that should be issued. For example, you may use this document as a starting point for a Covid-19 vaccine credential or this document for a driver’s license in the USA.

Verifiable credentials enable the decoupling of datasets included in issuance and verification. That means you can provide a template for issuers to issue 10 attributes, even if the verifiers in your ecosystem only plan to verify 5 attributes. This allows you to be forward-looking as you’re considering the use cases for a given credential. That said, for simplicity’s sake, we tend to recommend limiting the attributes included in a template to those which you can reasonably foresee being useful in the near- to medium-term.

Because attributes from different credentials can be combined together into a “compound proof”, you do not need to worry about fitting all possible attributes into a single template.

Anatomy of a credential template

When you create a template, you do the following:

  1. Decide which attributes are included
  2. Determine the type of data (string, integer, etc.)
  3. Optionally, you may
    1. Assign optional or required value to each attribute
    2. Provide a description of the attribute

Trinsic then translates that input into a JSON schema and JSON-LD context, generates a unique identifier for the credential template, creates a resource with the details needed to maintain public resolution of these artifacts, and hosts it on your behalf.

For example, you may create a credential template with the following:

{
    "name": {
        "type": "string",
        "description": "Name of the business",
    },
    "website": {
        "type": "string",
        "description": "More information about the business"
    },
    "rating":{
        "type": "number",
        "description": "rating on scale of 1-10",
        "optional": false
    },
    "details":{
        "type": "string",
        "description": "An individual's last name",
        "optional": false
    }
}

This will create a credential template that has the following structure:

TemplateData {
    id: "urn:template:alices-local-guides:review",
    name: "Review",
    version: 1,
    fields: {
        "name": TemplateField {
            description: "Name of the business",
            optional: false,
            r#type: String,
        },
        "rating": TemplateField {
            description: "rating on scale of 1-10",
            optional: false,
            r#type: Number,
        },
        "details": TemplateField {
            description: "An individual's last name",
            optional: false,
            r#type: String,
        },
        "website": TemplateField {
            description: "More information about the business",
            optional: false,
            r#type: String,
        },
    },
    allow_additional_fields: true,
    schema_uri: "https://staging-schema.trinsic.cloud/__default/review",
    context_uri: "https://staging-schema.trinsic.cloud/__default/review/context",
    ecosystem_id: "__default",
    r#type: "VerifiableCredential",
}

At any point you can view the schema_uri and the context_uri in the browser as raw JSON.