Credential Verification
Install Dependency
Package: AffinidiTdk.CredentialVerificationClient
dotnet add package AffinidiTdk.CredentialVerificationClientCheck the latest version on nuget.org or view the source on GitHub.
Classes and Methods
Default API
Verify Verifiable Credentials and Verifiable Presentations.
VerifyCredentials
Verify the provided Verifiable Credentials.
Parameters
JSON object to provide the Verifiable Credentials to validate.
The verify credential requires the
Newtonsoft.Json.Linqlibrary to build the VC Object.
Example
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
JSON object to provide the Verifiable Presentation to validate.
The verify presentation requires the
Newtonsoft.Json.Linqlibrary to build the VC Object.
Example
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);Glad to hear it! Please tell us how we can improve more.
Sorry to hear that. Please tell us how we can improve.
Thank you for sharing your feedback so we can improve your experience.