# Credential Verification

> Validate Verifiable Credentials using Verification Service.

## Install Dependency

Package: AffinidiTdk.CredentialVerificationClient

```bash
dotnet add package AffinidiTdk.CredentialVerificationClient
```

Check the latest version on [nuget.org](https://www.nuget.org/packages/AffinidiTdk.CredentialVerificationClient) or view the source on [GitHub](https://github.com/affinidi/affinidi-tdk-dotnet/blob/main/src/Clients/CredentialVerificationClient).

## Classes and Methods

### Default API

Verify Verifiable Credentials and Verifiable Presentations.

#### VerifyCredentials

Verify the provided Verifiable Credentials.

Parameters

    VerifyCredentialInput
    [Object](https://github.com/affinidi/affinidi-tdk-dotnet/blob/main/src/Clients/CredentialVerificationClient/docs/VerifyCredentialInput.md)
    Required

JSON object to provide the Verifiable Credentials to validate.

The verify credential requires the Newtonsoft.Json.Linq library to build the VC Object.

Example

```csharp
using AffinidiTdk.CredentialVerificationClient.Api;
using AffinidiTdk.CredentialVerificationClient.Client;
using AffinidiTdk.CredentialVerificationClient.Model;
using Newtonsoft.Json.Linq;

// Pass the projectScopedToken generated from AuthProvider package
Configuration config = new Configuration();
config.AddApiKey("authorization", projectScopedToken);

DefaultApi api = new DefaultApi(config);

// Sample VC data from the portal
var vc = new JObject
{
    {
        "@context", new JArray(
            "https://www.w3.org/2018/credentials/v1",
            "https://schema.affinidi.com/EmailV1-0.jsonld"
        )
    },
    {
        "id", "claimId:97fa9b2e9d1f70bd5da4f202"
    },
    {
        "type", new JArray(
            "VerifiableCredential",
            "Email"
        )
    },
    {
        "holder", new JObject 
        {
            { "id", "did:key:890890890890890" }
        }
    },
    {
        "credentialSubject", new JObject
        {
            { "email", "lorem@ipsum.com" }
        }
    },
    {
        "credentialSchema", new JObject
        {
            { "id", "https://schema.affinidi.com/EmailV1-0.json" },
            { "type", "JsonSchemaValidator2018" }
        }
    },
    { "issuanceDate", "2025-06-01T06:10:15.081Z" },
    { "expirationDate", "2030-06-01T06:10:14.954Z" },
    { "issuer", "did:key:890890890890890" },
    {
        "proof", new JObject
        {
            ...
        }
    }
};

VerifyCredentialInput input = new VerifyCredentialInput(verifiableCredentials: [vc]);
VerifyCredentialOutput result = api.VerifyCredentials(input);
```

#### VerifyPresentation

Verify the provided Verifiable Presentation.

Parameters

    VerifyPresentationInput
    [Object](https://github.com/affinidi/affinidi-tdk-dotnet/blob/main/src/Clients/CredentialVerificationClient/docs/VerifyPresentationInput.md)
    Required

JSON object to provide the Verifiable Presentation to validate.

The verify presentation requires the Newtonsoft.Json.Linq library to build the VC Object.

Example

```csharp
using AffinidiTdk.CredentialVerificationClient.Api;
using AffinidiTdk.CredentialVerificationClient.Client;
using AffinidiTdk.CredentialVerificationClient.Model;
using Newtonsoft.Json.Linq;

// Pass the projectScopedToken generated from AuthProvider package
Configuration config = new Configuration();
config.AddApiKey("authorization", projectScopedToken);

DefaultApi api = new DefaultApi(config);

// Sample VP data from the portal
var vp = new JObject
{
    { "id", "claimId:YHX_e5ouPqyiamSAPw9D2" },
    { "type", new JArray("VerifiablePresentation") },
    { "@context", new JArray("https://www.w3.org/2018/credentials/v1") },
    {
        "verifiableCredential", new JArray(
            new JObject
            {
                {
                    "@context", new JArray(
                        "https://www.w3.org/2018/credentials/v1",
                        "https://schema.affinidi.io/TGamerVCV1R0.jsonld"
                    )
                },
                { "id", "claimId:158617d7a10de4ad" },
                {
                    "type", new JArray(
                        "VerifiableCredential",
                        "gamerProfile"
                    )
                },
                {
                    "holder", new JObject
                    {
                        { "id", "did:key:890890890890890" }
                    }
                },
                {
                    "credentialSubject", new JObject
                    {
                        { "name", "iopiopiop" },
                        ...
                    }
                },
                {
                    "credentialSchema", new JObject
                    {
                        { "id", "https://schema.affinidi.io/TGamerVCV1R0.json" },
                        { "type", "gamerProfile" }
                    }
                },
                { "issuanceDate", "2025-09-23T02:23:27.298Z" },
                { "expirationDate", "2025-09-23T02:53:26.817Z" },
                { "issuer", "did:key:890890890890890" },
                {
                    "proof", new JObject
                    {
                        ...
                    }
                }
            }
        )
    },
    {
        "holder", new JObject
        {
            { "id", "did:key:890890890890890" }
        }
    },
    {
        "proof", new JObject
        {
            ...
        }
    }
};

VerifyPresentationInput input = new VerifyPresentationInput(verifiablePresentation: vp);
VerifyPresentationOutput result = api.VerifyPresentation(input);
```
