QR Codes
How to use QR codes to convey connection, credential, and verification information
Quick Response (QR) codes can be used to represent information in a computer-readable image. It is easier for users to scan a QR code with their smartphone than to manually enter URLs or other information. Therefore, we frequently use QR codes to present information to users, and we support its use wherever possible.
Connections, connectionless credentials, and connectionless verifications can all be shared using QR codes.
The URL scheme and host can be anything, but they are generally used as a utility to redirect the user to a page to download a mobile agent.
URL schemes can also be used as deep linking tool, to launch mobile agents directly from the link. This is useful if you're developing custom agent apps and would like to support connections and invitations in a convenient user experience.
How it works
QR codes should decode into a URL of the format:
[url_scheme]://[host]?c_i=[invitation_data]
https://example.com/?c_i=...
When mobile apps scan this code, they will look for the query parameter c_i
and use the value of this parameter to decode the Base64 Url encoded string into an Invitation Message.
Example
There are many technologies you can use to generate QR codes. Perhaps the simplest method is to use the completely free-to-use Google Charts API. Endpoints that create connectionless entities return a URL attribute with a value something like “https://redir.streetcred.id/hvYS7...”. Simply extract that URL and insert it into the Google Charts API like so:
let qrCodeUrl = "https://chart.googleapis.com/chart?cht=qr&chl=" + entityUrl + "&chs=300x300&chld=L|1"
The full details on how to use this Google Charts endpoint are documented here. Simply use the above URL as a source for an image element on a webpage and it will render as a scannable QR code that opens the verification request in the Trinsic Wallet. The finished product would look something like the following:
<img alt="QR Code" src="https://chart.googleapis.com/chart?cht=qr&chl=https://redir.streetcred.id/hvYS7mEV0twN&chs=300x300&chld=L|1"/>
You can see a live example of this in our Verifier Reference App.
Updated about 3 years ago