Adds the specified W3C Verifiable Credential type for the wallet by calling out to the Credential Adapter. Based on the bearer JWT token provided by User Management to ensure the caller has been authenticated and authorized.
rpc AddCredential
AddCredential
wallet_api.v1.AddCredential
wallet_api.v1.AddCredential
Adds the specified W3C Verifiable Credential type for the wallet by calling out to the Credential Adapter. Based on the bearer JWT token provided by User Management to ensure the caller has been authenticated and authorized.
requests AddCredentialRequest
AddCredentialRequest
wallet_api.v1.AddCredentialRequest
wallet_api.v1.AddCredentialRequest
Field | Type | Description |
---|---|---|
credential_type | string | Type of Verifiable Credential- Ex “BankAccount“, “PermanentResidentCard“. |
wallet_id | string | UUID of the wallet. |
api_key | string | API key given to the wallet owner at the time of owner creation. |
resp, _ := custodialWallet.AddCredential(ctx, &v1.AddCredentialRequest{
ApiKey: "API_KEY",
CredentialType: "CREDENTIAL_TYPE",
WalletId: "zWalletIDMultibase58Encoded",
})
fmt.Println(resp)
const addcredentialrequest = new AddCredentialRequest();
addcredentialrequest.setApiKey("API_KEY");
addcredentialrequest.setCredentialType("CREDENTIAL_TYPE");
addcredentialrequest.setWalletId("zWalletIDMultibase58Encoded");
service.addCredential(addcredentialrequest, (err, value:AddCredentialResponse|null) => {
const resp = JSON.stringify(err ? err : value);
console.log("received ", resp);
})
using System;
using Grpc.Core;
using WalletApi.V1;
namespace main
{
class Program
{
static void Main(string[] args)
{
Channel channel = new Channel("wallet.YOUR_SANDBOX_ID.knoxnetworks.io:443", ChannelCredentials.Insecure);
var client = new CustodialWallet.CustodialWalletClient(channel);
var headers = new Metadata();
var addCredentialRequest = new AddCredentialRequest{
ApiKey = "API_KEY",
CredentialType = "CREDENTIAL_TYPE",
WalletId = "zWalletIDMultibase58Encoded",
};
var reply = client.AddCredential(addCredentialRequest, headers);
Console.WriteLine("Response: " + reply);
channel.ShutdownAsync().Wait();
}
}
}
package demo;
import io.grpc.Channel;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import wallet_api.v1.Wallet.AddCredentialRequest;
import wallet_api.v1.Wallet.AddCredentialResponse;
import wallet_api.v1.CustodialWalletGrpc;
public class App {
public static void main(String[] args) {
ManagedChannel channel = ManagedChannelBuilder
.forAddress("wallet.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
.usePlaintext()
.build();
CustodialWalletGrpc.CustodialWalletBlockingStub blockStub =
CustodialWalletGrpc.newBlockingStub(channel);
AddCredentialRequest req_AddCredentialRequest =
AddCredentialRequest.newBuilder()
.setApiKey("API_KEY")
.setCredentialType("CREDENTIAL_TYPE")
.setWalletId("zWalletIDMultibase58Encoded")
.build();
AddCredentialResponse resp = blockStub.addCredential(req_AddCredentialRequest);
System.out.println(resp);
channel.shutdown();
}
}
const addcredentialrequest = new AddCredentialRequest();
addcredentialrequest.setApiKey("API_KEY");
addcredentialrequest.setCredentialType("CREDENTIAL_TYPE");
addcredentialrequest.setWalletId("zWalletIDMultibase58Encoded");
service.addCredential(addcredentialrequest, (err, value) => {
const resp = JSON.stringify(err ? err : value);
console.log("received ", resp);
})
extern crate grpc-sdks;
use tonic::transport::Channel;
use grpc-sdks::wallet_api::v1::wallet_service_client::CustodialWalletClient;
use grpc-sdks::wallet_api::v1::AddCredentialRequest;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let channel = Channel::from_static("wallet.YOUR_SANDBOX_ID.knoxnetworks.io")
.connect()
.await?;
let mut client = CustodialWalletClient::new(channel);
let request = tonic::Request::new(
AddCredentialRequest{
api_key: String::from("API_KEY"),
credential_type: String::from("CREDENTIAL_TYPE"),
wallet_id: String::from("zWalletIDMultibase58Encoded")
});
// sending request and waiting for response
let response = client.add_credential(request).await?.into_inner();
println!("RESPONSE={:?}", response);
Ok(())
}
package app
import io.grpc.ManagedChannelBuilder
import wallet_api.v1.Wallet.AddCredentialRequest
import wallet_api.v1.Wallet.AddCredentialResponse
import wallet_api.v1.CustodialWalletGrpc
fun main() {
val channel = ManagedChannelBuilder
.forAddress("wallet.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
.usePlaintext()
.build()
var blockStub = CustodialWalletGrpc.newBlockingStub(channel)
val req_AddCredentialRequest = AddCredentialRequest.newBuilder()
.setApiKey("API_KEY")
.setCredentialType("CREDENTIAL_TYPE")
.setWalletId("zWalletIDMultibase58Encoded")
.build()
val resp = blockStub.addCredential(req_AddCredentialRequest)
println(resp)
channel.shutdown()
}
returns AddCredentialResponse
AddCredentialResponse
wallet_api.v1.AddCredentialResponse
wallet_api.v1.AddCredentialResponse
Field | Type | Description |
---|---|---|
credential | string | W3C Verifiable Credential representing the subject. |
{
"credential": "CREDENTIAL"
}