## Step 1: Create Credential Template
As a provider, I can define a credential template so I can share which credentials are supported in my ecosystem with issuers, verifiers, and holders.
I can also specify which issuers are authorized to issue these templates in my trust registry by referencing the credential context.
A credential context is found with a URI.
The credential template includes a context, a json schema, an issuer, and a version.
It is everything that doesn't change about a credential. It's a product abstraction meant to keep things simple for the user.
For the provider, they only care about creating contexts and then hosting them as part of their service.
## Create context from schema
Supply json schema, return a URL of the created context and the created schema
req:
{
"type": VaccineCredential
"schema": {...}
}
res:
{
context_uri: ,
schema_uri:
}
Upload Schema
```
{
type = PriceCredential
json_schema_cred_sub = {}
}
```
Output:
```
{
template_uri: ,
version:
}
```
Auto generate LD context from JSON schema
```jsonld
{
"@version": 1.1,
"name": "http://ri.gov/firstName",
"price": "http://ri.gov/price",
"PriceCredential": "http://ri.gov/PriceCredential",
"StudentCard": "http://ri.gov/StudentCard"
}
```
## Step 5: Issue credential
As issuer
### 1. Create Credential Object from Template
```
req: {
"templateId": <id>,
credential_subject: {
"name": "A green door",
"price": 12.5
}
}
```
```
res {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://www.w3.org/2018/credentials/examples/v1"
],
"id": "http://example.edu/credentials/3732",
"type": ["VerifiableCredential", "UniversityDegreeCredential"],
"credentialSubject": {
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
"degree": {
"type": "BachelorDegree",
"name": {}
}
}
}
```
upload json schema
associate with URL and name
```json
{
"name": "A green door",
"price": 12.5
}
```
Generate
```jsonld
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"http://trinsic.id/contexts/ecosystem_1/v1"
],
"issuer": "did:key",
"name": "",
"description": "",
"type": ["VerifiableCredential", "PriceCredential" ],
"credentialSubject": {
"type": "PriceCard",
"name": "A green door",
"price": 12.5
}
}
```
### Issue credential directly
```jsonld=
....json ld
```w