Credential Verification
Validate Verifiable Credentials using Verification Service.
Install Dependency
Package: affinidi-tdk/affinidi-tdk-php
composer require affinidi-tdk/affinidi-tdk-php
You can check the latest version of this module on the Packagist 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.
Example
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialVerificationClient;
$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.
Example
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialVerificationClient;
$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;
}
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.