Create a Request Template

Introduction

In order to obtain information from a Verifiable Credential that's being held in a Mobile Wallet, the OIDC Provider (OP) must request these claims from the Credential holder. This request is included in a request template which defines what Credential is being requested from the holder.

Pre-Requisites

You need access to the MATTR Platform APIs. If you're experiencing difficulty, contact us

Setup the Claim Mappings. This is used when the Mobile Wallet provides the Credential to the OpenID Provider, and the OpenID Provider translates the claims from the Credential into OpenID Connect.

In order to request a certain credential, you need to know the following properties of that credential:

  • the Type of the credential
  • the JSON-LD schema of the credential
  • the public DIDs of Issuers whose credentials you are willing to accept

Presentation Request Template

A Presentation Request Template defines which credentials are required for presentation. This is used to create the actual Presentation Request, which is used by the Mobile Wallet to select which credential it should send.

Create Presentation Request Template

Create a Presentation Request Template by providing a payload:

POST https://tenant.platform.mattr.global/v1/presentations/templates

Request

{
"domain":"tenant.platform.mattr.global",
"name":"certificate-presentation",
"query":[{
"type": "QueryByExample",
"credentialQuery": [{
"required": true,
"reason": "Please provide your certificate.",
"example": {
"@context": ["https://www.w3.org/2018/credentials/v1"],
"type": "Course",
"trustedIssuer": [{
"required": true,
"issuer": "did:key:z6MkjBWPPa1njEKygyr3LR3pRKkqv714vyTkfnUdP6ToFSH5"
}]
}
}]
}]
}

The domain shows to the Mobile Wallet user which domain is asking for information. Based on who is asking for credentials, the holder may accept to send those credentials to the relying party or verifier.

The reason is shown in the Mobile Wallet to give context why a credential is being asked for.

@context is the JSON-LD schema, which should match the schema as defined in the credential that is being requested.

type is the credential type that the Mobile Wallet will use to find the matching credentials that it holds.

The issuer in trustedIssuer filters which Credentials will be acceptable. An employer, for instance, might only accept the public DIDs of certain universities.

Response

{
"id": "f95e71b0-9bdf-11ea-aec9-3b5c35fc28c8",
"domain": "tenant.platform.mattr.global",
"query": [
{
"type": "QueryByExample",
"credentialQuery": [
{
"required": true,
"reason": "Please provide your certificate.",
"example": {
"@context": [
"https://www.w3.org/2018/credentials/examples/v1"
],
"type": "Course",
"trustedIssuer": [
{
"required": true,
"issuer": "did:key:z6MkjBWPPa1njEKygyr3LR3pRKkqv714vyTkfnUdP6ToFSH5"
}
]
}
}
]
}
],
"name": "certificate-presentation"
}