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();
}
}
}
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
Field
Type
Description
nonce
string
Value used for the challenge.
endpoint
string
Used by browser to construct URL for QR generation.
credential_types
CredentialType enum
Field
Number
Description
CREDENTIAL_TYPE_UNSPECIFIED
0
Type(s) of the verifiable credential(s) being presented.Credential Type Unspecified.
CREDENTIAL_TYPE_PERMANENT_RESIDENT_CARD
1
Type(s) of the verifiable credential(s) being presented.Credential Type Permanent Resident Card.
CREDENTIAL_TYPE_BANK_CARD
2
Type(s) of the verifiable credential(s) being presented.Credential Type Bank Card.
CREDENTIAL_TYPE_BANK_ACCOUNT
3
Type(s) of the verifiable credential(s) being presented.Credential Type Bank Account.