Skip to main content

ShareRing Link Sample Queries

The ShareRing Link sample queries below demonstrate the following:

Zero Knowledge Queries

The ShareRing Link Guide demonstrates a simple query that can be used to query a user's Vault to answer the question: "Are you over 18?"

In this example, the answer is a simple Yes or No.

This is an example of a Zero Knowledge query because it answers the question without providing any further knowledge about the user.

Traditionally, when people have been asked to provide evidence they are over 18, for example to access a venue or service, it has been necessary for them to produce physical identification that reveals information about them than is unnecessary to prove they are over the age of 18.

For example, a person's ID also includes their date of birth and physical address.

With ShareRing Link it is possible to answer the question, "Are you over 18?" without exposing any other information about the person, including their date of birth. Their date of birth is used to provide the answer to the question, but it is not included in the answer.

Non Zero Knowledge Queries

With ShareRing Link you can also query for specific information. For instance:

  • Name
  • Age
  • Email address
  • etc

See ShareRing Link Verification Levels and Keywords for the complete list of keywords.

For instance, you could use the following to query a customer's name:

return "Name is: " +VALUE("name");

Querying Verified Information

The example query:

return "Name is: " +VALUE("name");

requires the minimum verification level for the user's identification. This is user-added information that has not been checked or verified in any way.

If you want to change the verification level to the maximum verification level, you need to use:

return "Name is: " +VALUE("name.verified");

For a medium level of verification, you need to use:

return "Name is: " +VALUE("name.checked");

For a complete list of keywords and their verification levels, see ShareRing Link Verification Levels and Keywords.

Combining Queries

With ShareRing Link you can query two or more pieces of information at a time.

For instance, you could use the following to query a customer's name and email address:

return "Name is: " +VALUE("name.verified") +".\n"+"Email address is: " +VALUE("email_address")+ ".";

Using Variables for API Friendly Results

If you're using dynamic QR codes to view the results as your customers scan the QR codes, you will see the results on the webpage the customer scanned. However, if you're using static QR codes and viewing the results through an API you should use variables to capture the results and make the results more useful to any system that is consuming your API.

For instance, if you wanted to query if a customer is over 18 and from Australia, you can define the variables:

  • Over_18
  • From_Australia

And then use the variables in your query:

var Over_18 = VALUE("age.verified") > 18 ? "Yes" : "No" ; var From_Australia = VALUE("country.verified") == "Australia" ? "Yes" : "No";
return "Over 18? " + Over_18 + ".\n" + "From Australia? " + From_Australia;

Which will send the following results to the API endpoint:

{
"queryId": ...
"sessionId": "",
"values": {
"Over_18": "Yes",
"From_Australia": "Yes"
},
"result": "Over 18? Yes.\nFrom Australia? Yes"
}

The result will still be displayed in the ShareRing Link dashboard and on the webpages that display dynamic QR codes, but the variables Over_18 and From_Australia and their values will be available from your API, making it easier for any services using your API to consume the data.

You can define as many variables as you need.

Querying a Verified Image

If you need to query a verified image as part of your query from a user's Vault, for instance their passport photo, you can use the following:

var PassportPhoto = VALUE("passport.photo.verified");
return "Passport Photo: " +PassportPhoto;

This will return a base64 representation of the passport photo.

On its own this is unlikely to be useful. You could use the following to include this as part of a larger query:

var Name = VALUE("name.verified"); var Email = VALUE("email_address"); var PassportPhoto = VALUE("passport.photo.verified");
return "Name is" +Name +".\n"+"Email address is "+Email+ ".\n"+"Passport Photo:"+PassportPhoto;

Using Custom Values

The above examples are examples of defined values. A defined value is a value that is extracted from documents uploaded to a user's Vault. You can see the full list of defined values on the ShareRing Link keywords page.

In addition to defined values, you can use custom values. A custom value is inputted manually by the user when the query runs if they do not already have a corresponding custom value in their Vault.

Custom values are not verified or checked by ShareRing, however, they can be a useful way of collecting information from users. For instance, a ski resort might use the following query to collect user's shoe size and helmet size.

return  "shoes size:" + CUSTOM_VALUE("shoes_size") + "\n" + "helmet size: " + CUSTOM_VALUE("helmet_size");

Querying a One-Time Custom Value

You can also query custom values that aren't stored in the user's vault, for instance, a hotel might need to verify a customer's booking number on check-in, but don't want to add the booking number to the user's vault.

return  "Booking number:" + CUSTOM_VALUE("booking_number");

When you create the query select required so the customer must provide the information, and also select One-time.

When the user scans the QR code, the one-time value, booking_number will be requested alongside the other information being requested, however, when the user adds the booking number to the query, the value will be shared with the requestor, but it will not be stored in the user's vault.