Send Presentation Request

Initiating the process of presenting credentials for verification

sampleSendPresentationRequest

The sampleSendPresentationRequest function demonstrates how to send a presentation request using the DiceID SDK. It uses the sendPresentationRequest API to send a presentation request to the specified verifier connection.

API Elements:

  1. diceidsdk.verifier.sendPresentationRequest(): Sends a presentation request to the specified verifier connection using the provided parameters.

    • VERIFIER_CONNECTION_ID: The ID of the verifier connection.

    • VERIFIER_TEMPLATE_ID: The ID of the presentation template associated with the verifier.

function sampleSendPresentationRequest() {
  console.log(VERIFIER_CONNECTION_ID);
  console.log(VERIFIER_TEMPLATE_ID);
    diceidsdk.verifier.sendPresentationRequest(VERIFIER_CONNECTION_ID, VERIFIER_TEMPLATE_ID)
    .then(resp => console.log("Presentation request sent"))
    .catch(err => console.log("Error:", err));
}

Running the Code

Step 1: Add the sampleSendPresentationRequest function to your code. Copy the function code provided and paste it after importing the diceidsdk module.

Step 2: Run the function by invoking it in your code. For example:

node sampleSendPresentationRequest.js

The function will use the sendPresentationRequest API to send a presentation request to the specified verifier connection. The response from the API will be logged to the console as "Presentation request sent".

Last updated