Credential Verification
Install Dependency
Package: AffinidiTdk.CredentialVerificationClient
dotnet add package AffinidiTdk.CredentialVerificationClient
You can check the latest version of this module on the nuget.org repository or view the source code at the GitHub repository.
Classes and Methods
Default API
Verify Verifiable Credentials and Verifiable Presentations.
VerifyCredentials
Generate and issue a credentil offer to the user.
Parameters
VerifyCredentialInput [Object]
JSON object to provide the Verifiable Credentials to validate.
The verify credential requires the
Newtonsoft.Json.Linq
library 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
Generate and issue a credentil offer to the user.
Parameters
VerifyPresentationInput [Object]
JSON object to provide the Verifiable Presentation to validate.
The verify presentation requires the
Newtonsoft.Json.Linq
library 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.