How to write verifiable credentials in golang

Ringaile Valiaugaite
2 min readMar 9, 2021

--

What is SSI (Self-sovereign identity)?

  • SSI is a term used to describe the digital movement that recognizes an individual should own and control their identity without the intervening administrative authorities.
  • SSI allows people to interact in the digital world with the same freedom and capacity for trust as they do in the offline world.

SSI Benefits:

  • Eliminates the effort of collecting documents that have already been collected
  • Allows to deliver only the information that is approved to receive
  • Establish a cryptographically secure distributed ledger recording transactions that prevents modification
  • No need to store personal data in a central repository
  • ”No one owns, everyone has access”

What is a credential ?

A qualification, achievement, quality, or aspect of a person’s background, especially when used to indicate their suitability for something.

It may consist of:

  • Information related to identifying the subject of the credential
  • Information related to the issuing authority
  • Information related to the type of credential this is
  • Information related to specific attributes or properties being asserted by the issuing authority about the subject
  • Evidence related to how the credential was derived
  • Information related to constraints on the credential

What is a verifiable credential?

  • It can represent the same information as a physical credential.

But also it

  • Includes digital signatures which makes them more trustworthy
  • Can generate verifiable presentations that proof the holder holds the credential with the certain information
  • Could be transmitted rapidly

How to write a verifiable credential in golang?

Note: the code is written following the Verifiable Credentials Data Model 1.0

First, we define a struct of verifiable credential:

then, we add a struct of a presentation:

We will create four methods to create / verify a credential / presentation.

  1. Create a credential:

2. Verify a credential:

3. Create a presentation:

4. and finally, verify a presentation:

You can find full code here: https://github.com/ringaile/ver-cred

--

--