Create Connection
Establish seamless connections between entities.
Create connection is to establish connection between end user and DICE ID issuer.
It involves prompting the user for their email address, setting the email in the invitation input, creating a connection invitation, and receiving the invitation using the wallet ID and token.
API Elements
WALLET_ID: Holds the wallet ID obtained from the 'appconfig' file.
WALLET_TOKEN: Holds the wallet token obtained from the 'appconfig' file.
diceidsdk.issuer.createConnectionInvitation(): Creates a connection invitation using the invitationInput.
invitationInput: An object that holds the credential email for the invitation.
user_email: Stores the email address entered by the user.
resp: Holds the response from the createConnectionInvitation API, including the invitation.
diceidsdk.cloudwallet.receiveInvitation(): Receives the invitation using the wallet ID, wallet token, and the invitation received from createConnectionInvitation.
err: Stores any error that occurs during the process.
Import appconfig: In your JavaScript file, import the 'appconfig' file using the following code:
sampleCreateConnection()
Running the Code
Step 1: Add the sampleCreateConnection function: Copy the sampleCreateConnection function code and paste it into your JavaScript file after importing the diceidsdk module and the 'appconfig' file..
Step 2: Run the function: Invoke the sampleCreateConnection function in your code to execute it. For example:
Step 3: Provide input: The function will prompt you to enter the user's email address. Enter the email address in the terminal or command prompt.
Step 4: Handle the response: Once the receiveInvitation function completes, you can handle the response within the .then()
block of the promise or perform any necessary error handling in the .catch()
block.
Last updated