CreatePresentationChallenge

Called by the holder to the verifier to initiate the challenge needed to verify the presentation with the verifier.

rpc CreatePresentationChallenge

vc_api.v1.CreatePresentationChallenge

Called by the holder to the verifier to initiate the challenge needed to verify the presentation with the verifier.

requests CreatePresentationChallengeRequest

vc_api.v1.CreatePresentationChallengeRequest

FieldTypeDescription
credential_typesCredentialType enum
FieldNumberDescription
CREDENTIAL_TYPE_UNSPECIFIED0Type(s) of the verifiable credential(s) being presented.Credential Type Unspecified.
CREDENTIAL_TYPE_PERMANENT_RESIDENT_CARD1Type(s) of the verifiable credential(s) being presented.Credential Type Permanent Resident Card.
CREDENTIAL_TYPE_BANK_CARD2Type(s) of the verifiable credential(s) being presented.Credential Type Bank Card.
CREDENTIAL_TYPE_BANK_ACCOUNT3Type(s) of the verifiable credential(s) being presented.Credential Type Bank Account.
resp, _ := credentialAdapterService.CreatePresentationChallenge(ctx, &v1.CreatePresentationChallengeRequest{
  CredentialTypes: []v1.CredentialType{
    v1.CredentialType_CREDENTIAL_TYPE_UNSPECIFIED,
    v1.CredentialType_CREDENTIAL_TYPE_PERMANENT_RESIDENT_CARD,
  },
})
fmt.Println(resp)
const createpresentationchallengerequest = new CreatePresentationChallengeRequest();
createpresentationchallengerequest.setCredentialTypesList([CredentialType.CREDENTIAL_TYPE_BANK_ACCOUNT, CredentialType.CREDENTIAL_TYPE_BANK_ACCOUNT]);

service.createPresentationChallenge(createpresentationchallengerequest, (err, value:CreatePresentationChallengeResponse|null) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
using System;
using Grpc.Core;
using VcApi.V1;

namespace main
{
  class Program
  {
    static void Main(string[] args)
    {
      Channel channel = new Channel("vc.YOUR_SANDBOX_ID.knoxnetworks.io:443", ChannelCredentials.Insecure); 
      var client = new CredentialAdapterService.CredentialAdapterServiceClient(channel); 
      var headers = new Metadata();
      var createPresentationChallengeRequest = new CreatePresentationChallengeRequest{
        CredentialTypes = {CredentialType.Credential_type_unspecified, CredentialType.Credential_type_permanent_resident_card},
      };
      var reply = client.CreatePresentationChallenge(createPresentationChallengeRequest, headers);
      Console.WriteLine("Response: " + reply);
      channel.ShutdownAsync().Wait();
    }
  }
}
package demo;

import io.grpc.Channel;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import vc_api.v1.CredentialAdapterServiceGrpc;
import vc_api.v1.Vc.CreatePresentationChallengeRequest;
import vc_api.v1.Vc.CreatePresentationChallengeResponse;
import vc_api.v1.Vc.CredentialType;

public class App {
  public static void main(String[] args) {
    ManagedChannel channel = ManagedChannelBuilder
      .forAddress("vc.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
      .usePlaintext()
      .build();
    CredentialAdapterServiceGrpc.CredentialAdapterServiceBlockingStub blockStub =
        CredentialAdapterServiceGrpc.newBlockingStub(channel);
    
    CreatePresentationChallengeRequest req_CreatePresentationChallengeRequest =
        CreatePresentationChallengeRequest.newBuilder()
          .addCredentialTypes(CredentialType.CREDENTIAL_TYPE_UNSPECIFIED)
          .addCredentialTypes(CredentialType.CREDENTIAL_TYPE_PERMANENT_RESIDENT_CARD)
          .build();
    CreatePresentationChallengeResponse resp = blockStub.createPresentationChallenge(req_CreatePresentationChallengeRequest);
    System.out.println(resp);
    channel.shutdown();
  }
}
const createpresentationchallengerequest = new CreatePresentationChallengeRequest();
createpresentationchallengerequest.setCredentialTypesList([CredentialType.CREDENTIAL_TYPE_BANK_ACCOUNT, CredentialType.CREDENTIAL_TYPE_BANK_ACCOUNT]);

service.createPresentationChallenge(createpresentationchallengerequest, (err, value) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
extern crate grpc-sdks;
use tonic::transport::Channel;

use grpc-sdks::vc_api::v1::credential_adapter_service_client::CredentialAdapterServiceClient;
use grpc-sdks::vc_api::v1::CredentialType;
use grpc-sdks::vc_api::v1::CreatePresentationChallengeRequest;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
  let channel = Channel::from_static("vc.YOUR_SANDBOX_ID.knoxnetworks.io")
    .connect()
    .await?;
  let mut client = CredentialAdapterServiceClient::new(channel); 

  let request = tonic::Request::new(
    CreatePresentationChallengeRequest{
      credential_types: Vec::from([CredentialType::CredentialTypeUnspecified as i32, CredentialType::CredentialTypePermanentResidentCard as i32])
    });
// sending request and waiting for response
  let response = client.create_presentation_challenge(request).await?.into_inner();
  println!("RESPONSE={:?}", response);
  Ok(())
}
package app

import io.grpc.ManagedChannelBuilder
import vc_api.v1.CredentialAdapterServiceGrpc
import vc_api.v1.Vc.CreatePresentationChallengeRequest
import vc_api.v1.Vc.CreatePresentationChallengeResponse
import vc_api.v1.Vc.CredentialType

fun main() {
    val channel = ManagedChannelBuilder
            .forAddress("vc.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
            .usePlaintext()
            .build()
    var blockStub = CredentialAdapterServiceGrpc.newBlockingStub(channel)
    
    val req_CreatePresentationChallengeRequest = CreatePresentationChallengeRequest.newBuilder()
          .addCredentialTypes(CredentialType.CREDENTIAL_TYPE_UNSPECIFIED)
          .addCredentialTypes(CredentialType.CREDENTIAL_TYPE_PERMANENT_RESIDENT_CARD)
          .build()
    val resp = blockStub.createPresentationChallenge(req_CreatePresentationChallengeRequest)
    println(resp)
    channel.shutdown()
}


returns CreatePresentationChallengeResponse

vc_api.v1.CreatePresentationChallengeResponse

FieldTypeDescription
noncestringValue used for the challenge.
endpointstringUsed by browser to construct URL for QR generation.
credential_typesCredentialType enum
FieldNumberDescription
CREDENTIAL_TYPE_UNSPECIFIED0Type(s) of the verifiable credential(s) being presented.Credential Type Unspecified.
CREDENTIAL_TYPE_PERMANENT_RESIDENT_CARD1Type(s) of the verifiable credential(s) being presented.Credential Type Permanent Resident Card.
CREDENTIAL_TYPE_BANK_CARD2Type(s) of the verifiable credential(s) being presented.Credential Type Bank Card.
CREDENTIAL_TYPE_BANK_ACCOUNT3Type(s) of the verifiable credential(s) being presented.Credential Type Bank Account.
{
  "nonce": "NonceLengthVariesByAlgo",
  "endpoint": "QR_URL_ENDPOINT",
  "credential_types": [
    0,
    1
  ]
}