TutorialsCredential managementRevocation

Revocation Tutorial

Introduction

In this tutorial we will explore the concept of credential revocation, a critical feature that allows issuers to invalidate previously issued credentials, ensuring the integrity and security of the system. The tutorial comprises the following steps:

  1. Issue a revocable credential.
  2. Obtain a credential revocation status.
  3. Revoke an issued credential.
  4. Attempt to verify a revoked credential.

Prerequisites

We recommend using the MATTR VII Postman collection in this tutorial. While this isn’t an explicit prerequisite, it can really speed things up.

Tutorial steps

Issue a revocable credential

The first thing you need to do is sign a new credential in a way that will enable you to revoke it later. This will differ slightly based on your selected credential format.

  1. Make a request of the following structure to create a did:web:

Request

HTTP
POST /v1/dids
JSON
{
    "method": "web",
    "options": {
        "url": "https://learn.vii.au01.mattr.global"
    }
}
  • url : Replace with your tenant_url provided with your tenant details.

Response

JSON
{
    "did": "did:web:learn.vii.au01.mattr.global"
    // Rest of DID document
}
  • did : We will use the value of this element to identify the credential’s issuer in the next step.

    If your tenant has a Custom domain configured you will need to setup a redirect for this DID document.

  1. Make a request of the following structure to create and sign a new revocable CWT credential:

Request

HTTP
POST /v2/credentials/compact/sign
JSON
{
    "payload": {
        "iss": "did:web:learn.vii.au01.mattr.global",
        "type": "Course Credential",
        "name": "Emma Jane Tasma",
        "code": "HS.278",
        "certificationName": "Working at Heights",
        "certificationLevel": "Level 4",
        "issuerName": "Advanced Safety Training"
    },
    "revocable": true,
    "isRevoked": false
}
  • iss : Replace with the did element obtained in the previous step.
  • revocable: We set this to true so that this credential can be revoked later in the tutorial.
  • isRevoked: We set this to false so that this credential is immediately valid upon issuance. Other use cases might require you to set this to true to issue a credential that is revoked by default until it is activated by unrevoking.

Response

JSON
{
    "id": "bKcrxojFSuSZvI5qhKInxA",
    "decoded": {
        "iss": "did:web:learn.vii.au01.mattr.global",
        "type": "Course Credential",
        "name": "Emma Jane Tasma",
        "code": "HS.278",
        "certificationName": "Working at Heights",
        "certificationLevel": "Level 4",
        "issuerName": "Advanced Safety Training",
        "status": {
            "index": 3,
            "url": "https://learn.vii.au01.mattr.global/v2/credentials/compact/revocation-lists/887cd140-e4d7-4518-b70f-305b23778848"
        },
        "jti": "bKcrxojFSuSZvI5qhKInxA"
    },
    "encoded": "CSC:/1/2KCE3IQEJB5DCMSMGZITM5QBE2QFSALWVQAXQI3ENFSDU53FMI5GYZLBOJXC45TJNEXGC5JQGEXG2YLUORZC4Z3MN5RGC3AFDJSZE7YQHIAACAACOFBW65LSONSSAQ3SMVSGK3TUNFQWYBA2NFLDPEDENZQW2ZLPIVWW2YJAJJQW4ZJAKRQXG3LBMRRW6ZDFMZEFGLRSG44HCY3FOJ2GSZTJMNQXI2LPNZHGC3LFOJLW64TLNFXGOIDBOQQEQZLJM5UHI43SMNSXE5DJMZUWGYLUNFXW4TDFOZSWYZ2MMV3GK3BAGRVGS43TOVSXETTBNVSXQGCBMR3GC3TDMVSCAU3BMZSXI6JAKRZGC2LONFXGOZTFPBYGS4TZNIZDAMRWFUYDCLJQGE5AAAIAACRAEAYDPB2WQ5DUOBZTULZPNRSWC4TOFZ3GS2JOMF2TAMJONVQXI5DSFZTWY33CMFWC6Y3POJSS65RSF5RXEZLEMVXHI2LBNRZS6Y3PNVYGCY3UF5ZGK5TPMNQXI2LPNYWWY2LTORZS6OBYG5RWIMJUGAWWKNDEG4WTINJRHAWWENZQMYWTGMBVMIZDGNZXHA4DIOAH3BAFA3FHFPDIRRKK4SM3ZDTKQSRCPRCYIA7RFUZYQI3RIGDHIGLAODJ6K2F245DTLIIKXAD35TORFQ7MVRJCIEPH6SC6NGA4HRMK76H5V6GXP66FFNX7MNYC6MYVU7ZLLXYVLXBU"
}
  • id : Unique credential identifier. We will use it in the next step to obtain the credential’s revocation status, and later to revoke the credential.
  • status: Credential revocation status details. We will use it in the next step to obtain the credential’s revocation status.

Obtain a credential revocation status

Now that the credential is issued, different relying parties might be interested in discovering its revocation status. In other words, they want to know whether or not the credential has been revoked by the issuer. MATTR VII supports two ways of achieving this:

  • Query a protected MATTR VII endpoint to get the revocation status.
  • Query public MATTR VII endpoints to get the revocation status.

Again, this process looks slightly different for different credential formats.

Protected endpoint

Request

Make a request of the following structure to retrieve the revocation status of a CWT credential:

HTTP
GET /v2/credentials/compact/{id}/revocation-status
  • id : Replace with the unique identifier of the credential you wish to revoke. This would be the id element of the credential you issued in the previous step. It will be available as part of any CWT credential issued by a MATTR VII tenant.

Response

JSON
{
    "id": "bKcrxojFSuSZvI5qhKInxA",
    "isRevoked": false
}
  • isRevoked : Indicates revocation status for the credential. Since we issued the credential with isRevoked set to false, this it the expected value in the response.
Public endpoint

MATTR VII enables relying parties to obtain the revocation status of a credential in a privacy preserving manners, as the issuer has no way of knowing what specific credential’s status the relying party is requesting.

This is achieved by retrieving a publicly available revocation status list, and then looking up a specific credential’s status using a reference index that is included in the credential itself. These revocation lists are compliant with the W3C Revocation List specification.

Request

Make a GET request to the status.url element from the response obtained when signing the credential

HTTP
GET https://learn.vii.au01.mattr.global/v2/credentials/compact/revocation-lists/887cd140-e4d7-4518-b70f-305b23778848

Response

The response includes an encoded revocation list, as per the W3C Revocation List specification. Relying parties can then decode the list and use the credential’s decoded.status.index element to locate and check the status of this specific credential. Check out our revocation check sample app for a reference implementation.

Validating the credential status

Let’s validate this status by trying to verify this credential.

Make a request of the following structure to verify a CWT credential:

HTTP
POST /v2/credentials/compact/verify

Request body

JSON
{
    "payload": "CSC:/1/2KCE3IQEJB5DCMSMGZITM5QBE2QFSALWVQAXQI3ENFSDU53FMI5GYZLBOJXC45TJNEXGC5JQGEXG2YLUORZC4Z3MN5RGC3AFDJSZE7YQHIAACAACOFBW65LSONSSAQ3SMVSGK3TUNFQWYBA2NFLDPEDENZQW2ZLPIVWW2YJAJJQW4ZJAKRQXG3LBMRRW6ZDFMZEFGLRSG44HCY3FOJ2GSZTJMNQXI2LPNZHGC3LFOJLW64TLNFXGOIDBOQQEQZLJM5UHI43SMNSXE5DJMZUWGYLUNFXW4TDFOZSWYZ2MMV3GK3BAGRVGS43TOVSXETTBNVSXQGCBMR3GC3TDMVSCAU3BMZSXI6JAKRZGC2LONFXGOZTFPBYGS4TZNIZDAMRWFUYDCLJQGE5AAAIAACRAEAYDPB2WQ5DUOBZTULZPNRSWC4TOFZ3GS2JOMF2TAMJONVQXI5DSFZTWY33CMFWC6Y3POJSS65RSF5RXEZLEMVXHI2LBNRZS6Y3PNVYGCY3UF5ZGK5TPMNQXI2LPNYWWY2LTORZS6OBYG5RWIMJUGAWWKNDEG4WTINJRHAWWENZQMYWTGMBVMIZDGNZXHA4DIOAH3BAFA3FHFPDIRRKK4SM3ZDTKQSRCPRCYIA7RFUZYQI3RIGDHIGLAODJ6K2F245DTLIIKXAD35TORFQ7MVRJCIEPH6SC6NGA4HRMK76H5V6GXP66FFNX7MNYC6MYVU7ZLLXYVLXBU",
    "checkRevocation": true
}
  • payload : Replace with the encoded element from the response obtained when signing the credential.
  • checkRevocation : This is the property that makes this verification request check for the credential revocation status.

Response

JSON
{
    "verified": true
    // Rest of response
}
  • verified : As expected, the credential was verified. Not for long!!!

Revoking an issued credential

Next we will learn how to revoke issued credentials. The process is very similar for different credential formats but uses different MATTR VII endpoints

Request

Make a request of the following structure to revoke a CWT credential:

HTTP
POST /v2/credentials/compact/{id}/revocation-status
  • id : Replace with the id of the credential obtained earlier in this tutorial.

Request body

JSON
{
    "isRevoked": true
}

Response

JSON
{
    "id": "bKcrxojFSuSZvI5qhKInxA",
    "isRevoked": true
}
  • isRevoked : This is now set to true, which means the credential will not be verified as valid.

Making a similar request with isRevoked set to false would unrevoke a revoked credential.

Attempting to verify a revoked credential

The last step will be attempting to verify the revoked credential. This step is also similar across different credential formats, using different endpoints.

Request

Make a request of the following structure to verify a CWT credential:

HTTP
POST /v2/credentials/compact/verify

Request body

JSON
{
    "payload": "CSC:/1/2KCE3IQEJB5DCMSMGZITM5QBE2QFSALWVQAXQI3ENFSDU53FMI5GYZLBOJXC45TJNEXGC5JQGEXG2YLUORZC4Z3MN5RGC3AFDJSZE7YQHIAACAACOFBW65LSONSSAQ3SMVSGK3TUNFQWYBA2NFLDPEDENZQW2ZLPIVWW2YJAJJQW4ZJAKRQXG3LBMRRW6ZDFMZEFGLRSG44HCY3FOJ2GSZTJMNQXI2LPNZHGC3LFOJLW64TLNFXGOIDBOQQEQZLJM5UHI43SMNSXE5DJMZUWGYLUNFXW4TDFOZSWYZ2MMV3GK3BAGRVGS43TOVSXETTBNVSXQGCBMR3GC3TDMVSCAU3BMZSXI6JAKRZGC2LONFXGOZTFPBYGS4TZNIZDAMRWFUYDCLJQGE5AAAIAACRAEAYDPB2WQ5DUOBZTULZPNRSWC4TOFZ3GS2JOMF2TAMJONVQXI5DSFZTWY33CMFWC6Y3POJSS65RSF5RXEZLEMVXHI2LBNRZS6Y3PNVYGCY3UF5ZGK5TPMNQXI2LPNYWWY2LTORZS6OBYG5RWIMJUGAWWKNDEG4WTINJRHAWWENZQMYWTGMBVMIZDGNZXHA4DIOAH3BAFA3FHFPDIRRKK4SM3ZDTKQSRCPRCYIA7RFUZYQI3RIGDHIGLAODJ6K2F245DTLIIKXAD35TORFQ7MVRJCIEPH6SC6NGA4HRMK76H5V6GXP66FFNX7MNYC6MYVU7ZLLXYVLXBU",
    "checkRevocation": true
}
  • payload : Replace with the encoded element from the response obtained when signing the credential.
  • checkRevocation : This is the property that makes this verification request check for the credential revocation status.

Response

JSON
{
    "verified": false,
    "reason": {
        "type": "Revoked",
        "message": "Credential has been revoked"
    }
    // Rest of response
}
  • verified : As expected, the credential had failed verification.
  • reason : Details that the credential had failed verification since it has been revoked.

Revocation lists are cached for a certain amount of time, so you might need to wait a few minutes before verification would actually fail.

Summary

In this tutorial you learned how to manage credential revocation, including:

  1. How to issue a revocable credential.
  2. How to check the revocation status of a credential as an Issuer and as a relying party.
  3. How to revoke a credential.

You can now use integrate these capabilities into your solution to support this important feature.

Additional resources