Credential Verification
Validate Verifiable Credentials using Verification Service.
Install Dependency
Package: affinidi-tdk/affinidi-tdk-php
composer require affinidi-tdk/affinidi-tdk-phpCheck the latest version on the Packagist repository or view the source on GitHub.
Classes and Methods
Default API
Verify Verifiable Credentials and Verifiable Presentations.
verifyCredentials
Validates Verifiable Credentials.
Parameters
verifyCredentialInput
VerifyCredentialInput
RequiredList of Verifiable Credentials to validate.
Example
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialVerificationClient;
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
$config = CredentialVerificationClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialVerificationClient\Api\DefaultApi(new GuzzleHttp\Client(), $config);
try {
$request = [
'verifiableCredentials' => [
[ /* W3C credential object */ ]
]
];
$result = $apiInstance->verifyCredentials($request);
print_r($result);
} catch (Exception $e) {
echo 'Exception: ', $e->getMessage(), PHP_EOL;
}verifyPresentation
Validates a Verifiable Presentation.
Parameters
verifyPresentationInput
VerifyPresentationInput
RequiredVerifiable Presentation to validate.
Example
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialVerificationClient;
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
$config = CredentialVerificationClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialVerificationClient\Api\DefaultApi(new GuzzleHttp\Client(), $config);
try {
$request = [
'verifiablePresentation' => [ /* W3C presentation object */ ]
];
$result = $apiInstance->verifyPresentation($request);
print_r($result);
} catch (Exception $e) {
echo 'Exception: ', $e->getMessage(), PHP_EOL;
}Was this page helpful?
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.