Create a credential definition

A credential definition defines the format, signing algorithm, key binding, and other features of the credential to be issued at run time.

Following is an example of a mDL based definition.
POST https://<host>/diagency//v2.0/diagency/credential_definitions
{
    "schema_id": "2a8ca47f-233c-449b-ab13-dc10473b419e",
    "credential_document_type": [
        "org.iso.18013.5.1.mDL"
    ],
    "credential_format": "mso_mdoc",
    "credential_signing_algorithm": "Ed25519",
    "cryptographic_binding_methods": [
        "cose_key"
    ],
    "key_proof_types": {
        "jwt": [
            "Ed25519"
        ]
    }
}

To enable requiring key binding, the issuer must include the cryptographic_binding_methods and key_proof_types properties in the POST body of the credential definition. The supported values for these options are available in the API Specification section.

If a credential definition is created with the key proof types (di_vp or jwt), the user wallet must generate a key binding proof of possession of the same type. This proof must be included in the body of the offer acceptance request at the /credential endpoint. The user wallet must generate this proof of possession externally.

Example 1: JWT proof type

If the credential definition contains a JWT key proof type requirement, after the user wallet obtains an access token to request a credential, the request body must contain:

"credential_identifier": “<cred_def_id>”
"proofs": {
    "jwt": [ 
         "<encoded_jwt_proof>”
        ]
}
The <encoded_jwt_proof> must contain properties as defined in the JWT Proof Type specification.
Note: Currently, only a single key proof is supported.

Example 2: DI_VP troof type

If the credential definition contains a di_vp key proof type requirement, after the user wallet obtains an access token to request a credential, the request body must contain:

"credential_identifier": “<cred_def_id>”
"proofs": {
    "di_vp": [
        "<di_vp_proof>”
        ]
}
The <di_vp_proof> must contain properties as defined in the DI_VP Proof Type specification.
Note: Currently, only a single key proof is supported.