A common feature of a website where you can do something is to have accounts for your users. The traditional way is letting the user provide a username and password which are stored in your database. The next generation of accounts is federated, where an identity provider like Google or Facebook stores the information for you, and you can use that account to log in to other websites. What would accounts look like when you use Verifiable Credentials?
Looking at Trinsic.id
Trinsic.id provides a system where you can create an account and log in later by scanning a QR-code.
When you register at Trinsic.id, you provide your name and email address. At that moment you are immediately logged-in. In your mail you receive a QR-code. When you scan the QR-code with your wallet app, a credential is added to your wallet.
When you log out and want to log in again, you need to scan a QR-code with the Trinsic.id Wallet App.
What is the technology behind it?
When you enter your name and email address, a user is created for you in the database. It contains your name, email, and a randomly generated UUID.
At that moment, a mail will be sent to your email address.
The email contains a QR-code. When you scan the QR-code with a barcode scanner, you can see what data it contains. In this case it’s a URL:
When you follow the link, you get forwarded to a URL that looks like:
The value of the query parameter
d_m is a base64 encoded value. When you decode that value, it looks like:
As you can see, this is a credential offer that contains the information you entered while registering. Note here that the
@type fields are version 1.0 types, for example:
did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/1.0/offer-credential. This means that Trinsic.id uses the version 1.0 protocols.
Usually, a credential would be offered using an existing connection. You don’t have a connection yet, so in this case a
~service block is attached to the offer. The
~service block contains information for your wallet app to know where it can connect to.
You receive your QR-code on your email address. If you are able to scan the QR-code, you must have access to that email address. Therefore, this is a way to verify your email address.
offers~attach.data field contains a base64 encoded field again. Decoding that gives you:
This is the actual credential offer. It contains references to the schema and credential definition used to generate the offer.
When you are logged out and want to log in, you need to scan a QR-code again. This QR-code contains a URL again:
When you follow the URL, you get redirected to a URL that looks like:
Base64 decoding the
d_m parameter gives you:
It is a presentation request! Let’s take a look at the
request_presentations~attach.data field and decode it:
Trinsic.id has sent you a request to prove that you own a Login credential which has been issued by them to you email address. Your wallet will look for a credential which has been made with their schema and their credential definition and a construct a proof with it.
When Trinisic.id verifier the proof, you will be logged in to your account on the website.
Implementing with ACA-py V1 protocols
When you want to recreate this flow with ACA-py, you have to take a couple of hurdles.
As noted before, Trinsic.id uses the version 1.0 protocols as defined in Aries RFC0160, RFC0023 and RFC0037. The V2 protocols are defined in RFC0434, RFC0453 and RFC0454. ACA-py has implemented the first two and is working on the last one.
V1 Connection-less credential offer
Unfortunately, ACA-py does not expose an API to create a connection-less credential (the QR-code in your email). In the issue credential V1 endpoints there is function called
credential_exchange_create_free_offer which will add a
oob_url to a credential offer. However, this endpoint is not exposed via any Admin endpoint, so there is no way of getting to it.
Issue credential V1 contains a similar function which is also not exposed via an endpoint.
However, we can create the offer ourselves.
Let’s start with creating a schema:
Then lets create a credential definition:
Now we need to create a credential exchange record using
/issue-credential/create. I know the description in the Swagger docs says
Send holder a credential, automating entire flow
but that is a lie. It is a copy-paste mistake from the
/issue-credential/send endpoint :)
Second, create a new connection invitation using
To construct the connection-less credential, you should create this structure:
From the credential exchange record copy
From the connection invitation copy
Great, now we have a connection-less credential. How do we get it to our users?
QR-codes and links
As explored before, you can make a QR-code from the connection-less credential and try to scan it with the wallet app. Unfortunately there is a limit to the amount of data that can be encoded in a QR-code, and a basic connection-less credential goes over that limit. This is why Trinsic.id is not creating a QR-code directly from the credential.
Instead, the credential should be stored in a database and be accessible via a randomly generated identifier. This is what a URL like
https://trinsic.studio/url/dc50d919-0e20-41f6-b015-... represents. When the Trinsic.id wallet scans the QR-code, it follows the URL. The URL gets redirected to URL in the form of
https://trinsic.studio/link/?d_m=eyJyZXF1Z... where the
d_m parameter is the base64 encoded version of the connection-less credential that is stored in the database.
The Trinsic.id wallet reads the URL and looks for the
d_m query parameter. It base64 decodes the parameter and adds the credential to the wallet.
Using a connection-less credential with ACA-py
Unfortunately, there is no endpoint to receive a connection-less credential with ACA-py. This means that, in order to test if your credential works, you need to deploy your ACA-py instance to a publicly available location where the Trinsic.id wallet app can connect with your ACA-py instance that created the credential. If you do this, don’t forget to switch your Trinsic.id wallet network to the ledger that you used when issuing the credential. This means that you need to have your ACA-py set up to run against the publicly available development ledgers that are supported by the Trinsic.id wallet.
A connection-less proof request
Similarly, a connection-less proof request can be constructed.
First, create a proof request:
For the connection-less proof request, create a structure like:
~service properties can be copied in the same way as we did for the connection-less credential. The
request_presentations~attach field should be filled with the
presentation_request field from the Proof Request Record.
Again, there is no endpoint for receiving a connection-less presentation proof.
Implementing with ACA-py V2 protocols
What it means for the issuing of credentials or presenting a proof without connection, is that this communication is out-of-band. Meaning there is no prior connection between the issuer and holder or holder and verifier. With the introduction of the next iteration of protocols including RFC0434 came to life. It describes the Out-of-Band communication of invitations as well as issuing credentials and presenting proof.
Creating an Out-of-Band credential-offer or presentation-request should become a lot easier than it was in V1. However, receiving a credential offer is not yet supported in the Out-of-Band endpoint, and wallet apps do not support the new protocols yet.
It looks like implementing connection-less credentials and proofs are a bit messy to implement using the V1. Testing them with a wallet app is even more of a challenge due to the required infrastructure.
You can expect a follow-up post whenever Out-of-Band implements full support.