Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Latest commit

 

History

History
77 lines (49 loc) · 3.82 KB

README.md

File metadata and controls

77 lines (49 loc) · 3.82 KB

Streetcred's API Quickstart

This demo shows how to add Streetcred API calls into a nodejs app with our service client. It also shows a webhook implementation can create automated workflows in your app.

Use Case

In this simple use case, you control a (very simple) issuer portal for your organization, which can issue a business card to anyone with a mobile wallet in your organization. Once a business card is issued, that holder can do business card verifications to other peers using the Streetcred mobile app.

Prerequisites:

Install mobile wallet

iOS

  1. If you are using iOS, download the streetcred identity agent

Android

  1. If you are using Android, download the Mattr Proton Wallet

Steps to issue a business card:

Prepare issuer portal

  1. clone the repository git clone https://github.com/streetcred-id/iiw-demo

  2. navigate into the directory cd iiw-demo

  3. install the dependencies npm install .

  4. Open up the repository in a code editor of your choice

  5. rename the .env-template file to .env

  6. go to the Streetcred developer portal and create an account

Register your organization

  1. Create a new organization and select the Sovrin Staging Network if you are using iOS, and the BCovrin Test network if you are using the Mattr global app.
  2. In the .env file, add your organization's subscription key and access token to the respective fields.

If you are using the Mattr Global Agent on Android:

Add a transaction endorser on the BCovrin Test network by registering your did and verkey on the BCovrin network: http://test.bcovrin.vonx.io/ Here are 32 ascii characters, replace some characters to make it unique. 00000000000000000000000000000000

Create a credential definition with Swaggerhub

  1. Click on your organization's Show Keys button.
  2. Navigate to the POST /definitions/credentials/{SchemaId} endpoint
  3. Click the lock button on the right hand side and authorize swaggerhub by pasting "bearer " + your access token in the access token field & your subscription key into its field
  4. Click the Try it out button to prepare the API call to write the credential definition to the ledger
  5. In the .env file, find the ledger you're using and remove the # from before that SCHEMA_ID line.
  6. Copy that schema ID into the schema_id field in swagger hub.
  7. Click "execute" and after a couple seconds you will see "curl", "request URL", and "server response". Copy the definitionId value from the "server response" section and add it to your .env file for the CRED_DEF_ID value
  8. If you get a 504 Gateway Timeout error, go to the GET /definitions/credentials endpoint, click try it out and then execute to get your newly minted credential definition.

Running the application

Assuming everything still works correctly, you are ready to run the application.

  • Run with npm npm run start

  • On the web app, fill in the details and click issue credential

  • If you're using the Streetcred Wallet, make sure your agent is configured to the Sovrin Staging network (upper-left on the home tab)

  • Scan the QR with your mobile wallet

This is a connection invitation. Webhooks will automatically issue you a credential once this is scanned

  • Accept the credential offer

  • Receive a business card!

  • If you are on iOS, you can also use the Streetcred Identity Agent to connect with others and send verified email and phone number between each other.