Credential Verification

Validate Verifiable Credentials using Verification Service.

Supported Languages

Package: @affinidi-tdk/credential-verification-client

npm install @affinidi-tdk/credential-verification-client --save

Package: affinidi_tdk_credential_verification_client

pip install affinidi_tdk_credential_verification_client

Package: affinidi-tdk/affinidi-tdk-php

composer require affinidi-tdk/affinidi-tdk-php

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.

Module Imports
import { DefaultApi, Configuration, VerifyCredentialInput } from '@affinidi-tdk/credential-verification-client'
import affinidi_tdk_credential_verification_client
require_once 'vendor/autoload.php';

use AffinidiTdk\Clients\CredentialVerificationClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
  apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})

const api = new DefaultApi(authConfiguration)

const request: VerifyCredentialInput = {
        "verifiableCredentials": [
            {
                ...
            }
        ]
    }

const { data } = await api.verifyCredentials(request)
configuration = affinidi_tdk_credential_verification_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_credential_verification_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_credential_verification_client.DefaultApi(api_client)

    request_json = {
        "verifiableCredentials": [
            {
                ...
            }
        ]
    }

    verify_credentials_input = affinidi_tdk_credential_verification_client.VerifyCredentialInput.from_dict(request_json)

    api_response = api_instance.verify_credentials(verify_credentials_input=verify_credentials_input)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];

// Configure API key authorization: ProjectTokenAuth
$config = CredentialVerificationClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);

$apiInstance = new CredentialVerificationClient\Api\DefaultApi(
    new GuzzleHttp\Client(),
    $config
);

try {

    $request = array(
       "verifiableCredentials" => array(
            array(
                ...
            )
       )
    );

    $result = $apiInstance->verifyCredentials($request);

    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}

verifyPresentation

Generate and issue a credentil offer to the user.

Parameters

VerifyPresentationInput [Object]

JSON object to provide the Verifiable Presentation to validate.

Module Imports
import { DefaultApi, Configuration, VerifyPresentationInput } from '@affinidi-tdk/credential-verification-client'
import affinidi_tdk_credential_verification_client
require_once 'vendor/autoload.php';

use AffinidiTdk\Clients\CredentialVerificationClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
  apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})

const api = new DefaultApi(authConfiguration)

const request: VerifyPresentationInput = {
        "verifiablePresentation": {...}
    }

const { data } = await api.verifyPresentation(projectId, request)
configuration = affinidi_tdk_credential_verification_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_credential_verification_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_credential_verification_client.DefaultApi(api_client)

    request_json = {
            "verifiablePresentation": {...}
        }

    verify_presentation_input = affinidi_tdk_credential_verification_client.VerifyPresentationInput.from_dict(request_json)

    api_response = api_instance.verify_presentation(projectId, verify_presentation_input=verify_presentation_input)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];

// Configure API key authorization: ProjectTokenAuth
$config = CredentialVerificationClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);

$apiInstance = new CredentialVerificationClient\Api\DefaultApi(
    new GuzzleHttp\Client(),
    $config
);

try {

    $request = array(
        "verifiablePresentation" => array(
            ...
        )
    );

    $result = $apiInstance->verifyPresentation($request);

    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}