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.
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.
- If you are using iOS, download the streetcred identity agent
- If you are using Android, download the Mattr Proton Wallet
-
clone the repository
git clone https://github.com/streetcred-id/iiw-demo
-
navigate into the directory
cd iiw-demo
-
install the dependencies
npm install .
-
Open up the repository in a code editor of your choice
-
rename the .env-template file to .env
-
go to the Streetcred developer portal and create an account
- 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.
- In the .env file, add your organization's subscription key and access token to the respective fields.
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
- Click on your organization's Show Keys button.
- Navigate to the
POST /definitions/credentials/{SchemaId}
endpoint - 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
- Click the
Try it out
button to prepare the API call to write the credential definition to the ledger - In the .env file, find the ledger you're using and remove the
#
from before that SCHEMA_ID line. - Copy that schema ID into the
schema_id
field in swagger hub. - 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 - If you get a 504 Gateway Timeout error, go to the GET /definitions/credentials endpoint, click
try it out
and thenexecute
to get your newly minted credential definition.
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.