Affinidi TDK dotnet client for Affinidi CREDENTIAL VERIFICATION
$ dotnet add package AffinidiTdk.CredentialVerificationClientAffinidi TDK dotnet client for Affinidi CREDENTIAL VERIFICATION
Check your installed version:
dotnet --version
These are the steps to get you started with a dotnet project and integration with AffinidiTdk.CredentialVerificationClient.
Steps 1 & 2 are optional if you have already created a project.
On macOS / Linux / Windows (Powershell) :
mkdir MyProject
cd MyProject
dotnet new console
dotnet add package AffinidiTdk.CredentialVerificationClient
The AffinidiTdk.CredentialVerificationClient uses authorisation token to authenticate client requests. You can generate a token with the use of the AuthProvider package which is also available in nuget.org.
To generate a token, you first need to create your Personal Access Token (PAT). Please refer to this link.
The dependencies required may differ based on the Client API used in your application.
using AffinidiTdk.AuthProvider;
using AffinidiTdk.CredentialVerificationClient.Api;
using AffinidiTdk.CredentialVerificationClient.Client;
using AffinidiTdk.CredentialVerificationClient.Model;
var authProvider = new AuthProvider(new AuthProviderParams
{
// Please generate your own Personal Access Tokens (PAT).
// Refer to https://docs.affinidi.com/dev-tools/affinidi-tdk/get-access-token/#create-a-personal-access-token-pat for the guide on creating your own PAT.
TokenId = "YOUR_TOKEN_ID",
PrivateKey = "YOUR_PRIVATE_KEY",
ProjectId = "YOUR_PROJECT_ID"
// Passphrase = "YOUR_PASSPHRASE", // Required only if provided in the PAT
});
string projectScopedToken = await authProvider.FetchProjectScopedTokenAsync();
Configuration config = new Configuration();
config.AddApiKey("authorization", projectScopedToken);
DefaultApi api = new DefaultApi(config);
var verifyCredentialInput = new VerifyCredentialInput();
VerifyCredentialOutput result = api.VerifyCredentials(verifyCredentialInput);
Console.WriteLine(result.ToJson());
For more examples, please refer to the Documentation.
When handling tokens, it is important that your project access token is managed properly to prevent failures due to expired tokens.
We have created an example code which handles the automatic refresh of tokens to ensure that the token used in the client APIs are fresh.
| ClientAPI | Operation | Description |
|---|---|---|
| DefaultApi | VerifyCredentials | Verifying VC |
| DefaultApi | VerifyCredentialsV2 | Verifying VC |
| DefaultApi | VerifyPresentation | Verifying VP |
| DefaultApi | VerifyPresentationV2 | Verifying VP |
Note: Each Client API operation requires a different authorization token. Please check the operation details for the type of token required to use the operation properly.
If you face any issues or have suggestions, please don't hesitate to contact us using this link.
If you have a technical issue with the Affinidi TDK's codebase, you can also create an issue directly in GitHub.
Ensure the bug was not already reported by searching on GitHub under Issues.
If you're unable to find an open issue addressing the problem, open a new one. Be sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring.
We enjoy community contributions! Whether it’s bug fixes, feature requests, or improving docs, your input helps shape the Affinidi TDK.