Credential Issuance
Supported Languages
Package: @affinidi-tdk/credential-issuance-client
npm install @affinidi-tdk/credential-issuance-client --save
Package: affinidi_tdk_credential_issuance_client
pip install affinidi_tdk_credential_issuance_client
Package: affinidi-tdk/affinidi-tdk-php
composer require affinidi-tdk/affinidi-tdk-php
Classes and Methods
Configuration API
Manage the issuance configuration for the project. Project only one issuance configuration.
createIssuanceConfig
Create an issuance configuration for the project.
Parameters
CreateIssuanceConfigInput [Object]
JSON object to provide the details of the configuration. See more here.
Module Imports
import { ConfigurationApi, Configuration, CreateIssuanceConfigInput } from '@affinidi-tdk/credential-issuance-client'
import affinidi_tdk_credential_issuance_client
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialIssuanceClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new ConfigurationApi(authConfiguration)
const request: CreateIssuanceConfigInput = {
"credentialSupported": [
{
"credentialTypeId": "SchemaOne",
"jsonSchemaUrl": "https://schema.affinidi.io/SchemaOneV1R1.json",
"jsonLdContextUrl": "https://schema.affinidi.io/SchemaOneV1R1.jsonld"
}
],
"issuerWalletId": "<Wallet_ID>",
"credentialOfferDuration": 3600,
"format": "ldp_vc",
}
const { data } = await api.createIssuanceConfig(request)
configuration = affinidi_tdk_credential_issuance_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_credential_issuance_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_credential_issuance_client.ConfigurationApi(api_client)
request_json = {
"credentialSupported": [
{
"credentialTypeId": "SchemaOne",
"jsonSchemaUrl": "https://schema.affinidi.io/SchemaOneV1R1.json",
"jsonLdContextUrl": "https://schema.affinidi.io/SchemaOneV1R1.jsonld"
}
],
"issuerWalletId": "<Wallet_ID>",
"credentialOfferDuration": 3600,
"format": "ldp_vc",
}
create_issuance_config_input = affinidi_tdk_credential_issuance_client.CreateIssuanceConfigInput.from_dict(request_json)
api_response = api_instance.create_issuance_config(create_issuance_config_input=create_issuance_config_input)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
// Configure API key authorization: ProjectTokenAuth
$config = CredentialIssuanceClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialIssuanceClient\Api\ConfigurationApi(
new GuzzleHttp\Client(),
$config
);
try {
$request = array(
'credentialSupported' => array(
array(
"credentialTypeId" => "SchemaOne",
"jsonSchemaUrl" => "https://schema.affinidi.io/SchemaOneV1R1.json",
"jsonLdContextUrl" => "https://schema.affinidi.io/SchemaOneV1R1.jsonld"
)
),
"issuerWalletId" => "<Wallet_ID>",
"credentialOfferDuration" => 3600,
"format" => "ldp_vc",
);
$result = $apiInstance->createIssuanceConfigRequest($request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}
deleteIssuanceConfigById
Delete the issuance configuration by ID.
Parameters
configurationId [String]
ID of the issuance configuration to delete.
Module Imports
import { ConfigurationApi, Configuration } from '@affinidi-tdk/credential-issuance-client'
import affinidi_tdk_credential_issuance_client
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialIssuanceClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new ConfigurationApi(authConfiguration)
const configurationId = "<Config_ID>"
const result = await api.deleteIssuanceConfigById(configurationId)
configuration = affinidi_tdk_credential_issuance_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_credential_issuance_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_credential_issuance_client.ConfigurationApi(api_client)
configurationId = "<Config_ID>"
api_response = api_instance.delete_issuance_config_by_id(configurationId)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
// Configure API key authorization: ProjectTokenAuth
$config = CredentialIssuanceClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialIssuanceClient\Api\ConfigurationApi(
new GuzzleHttp\Client(),
$config
);
try {
$configurationId = "<Config_ID>";
$apiInstance->deleteIssuanceConfigById($configurationId);
} catch (Exception $e) {
echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}
getIssuanceConfigById
Retrieves the Issuance Configuration details by ID.
Parameters
configurationId [String]
ID of the issuance configuration to retrieve.
Module Imports
import { ConfigurationApi, Configuration } from '@affinidi-tdk/credential-issuance-client'
import affinidi_tdk_credential_issuance_client
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialIssuanceClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new ConfigurationApi(authConfiguration)
const configurationId = "<Config_ID>"
const result = await api.getIssuanceConfigById(configurationId)
configuration = affinidi_tdk_credential_issuance_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_credential_issuance_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_credential_issuance_client.ConfigurationApi(api_client)
configurationId = "<Config_ID>"
api_response = api_instance.get_issuance_config_by_id(configurationId)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
// Configure API key authorization: ProjectTokenAuth
$config = CredentialIssuanceClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialIssuanceClient\Api\ConfigurationApi(
new GuzzleHttp\Client(),
$config
);
try {
$configurationId = "<Config_ID>";
$result = $apiInstance->getIssuanceConfigById($configurationId);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}
getIssuanceConfigList
Get the list of issuance configuration for the current project.
Parameters
No Parameters Required
Module Imports
import { ConfigurationApi, Configuration } from '@affinidi-tdk/credential-issuance-client'
import affinidi_tdk_credential_issuance_client
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialIssuanceClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new ConfigurationApi(authConfiguration)
const { data } = await api.getIssuanceConfigList()
configuration = affinidi_tdk_credential_issuance_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_credential_issuance_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_credential_issuance_client.ConfigurationApi(api_client)
api_response = api_instance.get_issuance_config_list()
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
// Configure API key authorization: ProjectTokenAuth
$config = CredentialIssuanceClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialIssuanceClient\Api\ConfigurationApi(
new GuzzleHttp\Client(),
$config
);
try {
$result = $apiInstance->getIssuanceConfigList();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}
updateIssuanceConfigById
Update the existing Issuance Configuration by ID.
Parameters
configurationId [String]
ID of the issuance configuration to retrieve.
UpdateIssuanceConfigInput [Object]
JSON object to provide the details to update the issuance configuration. See more here.
Module Imports
import { ConfigurationApi, Configuration, UpdateIssuanceConfigInput } from '@affinidi-tdk/credential-issuance-client'
import affinidi_tdk_credential_issuance_client
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialIssuanceClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new ConfigurationApi(authConfiguration)
const configurationId = "<Config_ID>"
const request: UpdateIssuanceConfigInput = {
"credentialSupported": [
{
"credentialTypeId": "SchemaOne",
"jsonSchemaUrl": "https://schema.affinidi.io/SchemaOneV1R1.json",
"jsonLdContextUrl": "https://schema.affinidi.io/SchemaOneV1R1.jsonld"
}
],
"issuerWalletId": "<Wallet_ID>",
"credentialOfferDuration": 3600,
"format": "ldp_vc",
}
const { data } = await api.updateIssuanceConfigById(configurationId, request)
configuration = affinidi_tdk_credential_issuance_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_credential_issuance_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_credential_issuance_client.ConfigurationApi(api_client)
configurationId = "<Config_ID>"
request_json = {
"credentialSupported": [
{
"credentialTypeId": "SchemaOne",
"jsonSchemaUrl": "https://schema.affinidi.io/SchemaOneV1R1.json",
"jsonLdContextUrl": "https://schema.affinidi.io/SchemaOneV1R1.jsonld"
}
],
"issuerWalletId": "<Wallet_ID>",
"credentialOfferDuration": 3600,
"format": "ldp_vc",
}
update_issuance_config_input = affinidi_tdk_credential_issuance_client.UpdateIssuanceConfigInput.from_dict(request_json)
api_response = api_instance.update_issuance_config_by_id(configurationId, update_issuance_config_input=update_issuance_config_input)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
// Configure API key authorization: ProjectTokenAuth
$config = CredentialIssuanceClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialIssuanceClient\Api\ConfigurationApi(
new GuzzleHttp\Client(),
$config
);
try {
$configurationId = "3dfe29b0-941a-4237-8587-c2bd895cb90a";
$request = array(
'credentialSupported' => array(
array(
"credentialTypeId" => "SchemaOne",
"jsonSchemaUrl" => "https://schema.affinidi.io/SchemaOneV1R1.json",
"jsonLdContextUrl" => "https://schema.affinidi.io/SchemaOneV1R1.jsonld"
)
),
"issuerWalletId" => "86d87d4cfba78133864749518ceaec4a",
"credentialOfferDuration" => 4600,
"format" => "ldp_vc",
);
$result = $apiInstance->updateIssuanceConfigById($configurationId, $request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}
Issuance API
Use to initiate issuance of the credential and check the status.
issuanceState
Retrieve the status of issuance.
Parameters
issuanceId [String]
ID of the initiated issuance.
projectId [String]
Project ID from where the issuance was initiated.
Module Imports
import { IssuanceApi, Configuration } from '@affinidi-tdk/credential-issuance-client'
import affinidi_tdk_credential_issuance_client
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialIssuanceClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new IssuanceApi(authConfiguration)
const issuanceId = "<Issuance_ID>"
const projectId = "<Project_ID>"
const { data } = await api.issuanceState(issuanceId, projectId)
configuration = affinidi_tdk_credential_issuance_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_credential_issuance_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_credential_issuance_client.IssuanceApi(api_client)
issuanceId = "<Issuance_ID>"
projectId = "<Project_ID>"
api_response = api_instance.issuance_state(issuanceId, projectId)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
// Configure API key authorization: ProjectTokenAuth
$config = CredentialIssuanceClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialIssuanceClient\Api\IssuanceApi(
new GuzzleHttp\Client(),
$config
);
try {
$issuanceId = "<Issuance_ID>"
$projectId = "<Project_ID>";
$result = $apiInstance->issuanceState($issuanceId, $projectId);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}
listIssuance
Get the list of issuance initiated in the Project.
Parameters
projectId [String]
Project ID from where to list the issuance.
Module Imports
import { IssuanceApi, Configuration } from '@affinidi-tdk/credential-issuance-client'
import affinidi_tdk_credential_issuance_client
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialIssuanceClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new IssuanceApi(authConfiguration)
const projectId = "<Project_ID>"
const { data } = await api.listIssuance(projectId)
configuration = affinidi_tdk_credential_issuance_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_credential_issuance_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_credential_issuance_client.IssuanceApi(api_client)
projectId = "<Project_ID>"
api_response = api_instance.list_issuance(projectId)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
// Configure API key authorization: ProjectTokenAuth
$config = CredentialIssuanceClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialIssuanceClient\Api\IssuanceApi(
new GuzzleHttp\Client(),
$config
);
try {
$projectId = "<Project_ID>";
$result = $apiInstance->listIssuance($projectId);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}
startIssuance
Used to initiate the issuance of the credential.
Parameters
projectId [String]
Project ID from where to initiate the issuance.
StartIssuanceInput [Object]
JSON object to provide the details of the credentials to issue. See more here.
Module Imports
import { IssuanceApi, Configuration, StartIssuanceInput } from '@affinidi-tdk/credential-issuance-client'
import affinidi_tdk_credential_issuance_client
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialIssuanceClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new IssuanceApi(authConfiguration)
const projectId = "<Project_ID>"
const request: StartIssuanceInput = {
"data": [{
"credentialTypeId": "SchemaOne",
"credentialData": {
"first_name": "FirstName",
"last_name": "LastName",
"dob": "1970-01-01",
}
}],
"holderDid": "did:key:holder-did-value",
"claimMode": "FIXED_HOLDER"
}
const { data } = await api.startIssuance(projectId, request)
configuration = affinidi_tdk_credential_issuance_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_credential_issuance_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_credential_issuance_client.IssuanceApi(api_client)
projectId = "<Project_ID>"
request_json = {
"data": [{
"credentialTypeId": "SchemaOne",
"credentialData": {
"first_name": "FirstName",
"last_name": "LastName",
"dob": "1970-01-01",
}
}],
"holderDid": "did:key:holder-did-value",
"claimMode": "FIXED_HOLDER"
}
start_issuance_input = affinidi_tdk_credential_issuance_client.StartIssuanceInput.from_dict(request_json)
api_response = api_instance.start_issuance(projectId, start_issuance_input=start_issuance_input)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
// Configure API key authorization: ProjectTokenAuth
$config = CredentialIssuanceClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialIssuanceClient\Api\IssuanceApi(
new GuzzleHttp\Client(),
$config
);
try {
$projectId = "<Project_ID>";
$request = array(
"data" => array(
array(
"credentialTypeId" => "SchemaOne",
"credentialData" => array(
"Firstname" => "FirstName",
"Lastname" => "LastName",
"dob" => "1970-01-01"
)
)
),
"holderDid" => "did:key:holder-did-value",
"claimMode" => "FIXED_HOLDER"
);
$result = $apiInstance->startIssuance($projectId, $request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}
Credentials API
Issue a Verifiable Credentials to the users.
generateCredentials
Generate and issue a credentil offer to the user.
Parameters
projectId [String]
Project ID from where you want to issue the credential.
CreateCredentialInput [Object]
JSON object to provide the details of the credential to generate. See more here.
Module Imports
import { CredentialsApi, Configuration, CreateCredentialInput } from '@affinidi-tdk/credential-issuance-client'
import affinidi_tdk_credential_issuance_client
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialIssuanceClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new CredentialsApi(authConfiguration)
const projectId = "<Project_ID>"
const request: CreateCredentialInput = {
"credential_identifier": "UniversityDegree-2024",
"proof": {
"proof_type": "jwt",
"jwt":
"eyJ0eXAiOiJvcGVuaWQ0dmNpLXByb29mK2p3dCIsImFsZyI6IkVTMjU2IiwiandrI
jp7Imt0eSI6IkVDIiwiY3J2IjoiUC0yNTYiLCJ4IjoiblVXQW9BdjNYWml0aDhFN2k
xOU9kYXhPTFlGT3dNLVoyRXVNMDJUaXJUNCIsInkiOiJIc2tIVThCalVpMVU5WHFpN
1N3bWo4Z3dBS18weGtjRGpFV183MVNvc0VZIn19.eyJhdWQiOiJodHRwczovL2NyZW
RlbnRpYWwtaXNzdWVyLmV4YW1wbGUuY29tIiwiaWF0IjoxNzAxOTYwNDQ0LCJub25j
ZSI6IkxhclJHU2JtVVBZdFJZTzZCUTR5bjgifQ.-a3EDsxClUB4O3LeDD5DVGEnNMT
01FCQW4P6-2-BNBqc_Zxf0Qw4CWayLEpqkAomlkLb9zioZoipdP-jvh1WlA"
}
}
const { data } = await api.generateCredentials(projectId, request)
configuration = affinidi_tdk_credential_issuance_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_credential_issuance_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_credential_issuance_client.CredentialsApi(api_client)
projectId = "<Project_ID>"
request_json = {
"credential_identifier": "SchemaOne",
"proof": {
"proof_type": "jwt",
"jwt":
"eyJ0eXAiOiJvcGVuaWQ0dmNpLXByb29mK2p3dCIsImFsZyI6IkVTMjU2IiwiandrI
jp7Imt0eSI6IkVDIiwiY3J2IjoiUC0yNTYiLCJ4IjoiblVXQW9BdjNYWml0aDhFN2k
xOU9kYXhPTFlGT3dNLVoyRXVNMDJUaXJUNCIsInkiOiJIc2tIVThCalVpMVU5WHFpN
1N3bWo4Z3dBS18weGtjRGpFV183MVNvc0VZIn19.eyJhdWQiOiJodHRwczovL2NyZW
RlbnRpYWwtaXNzdWVyLmV4YW1wbGUuY29tIiwiaWF0IjoxNzAxOTYwNDQ0LCJub25j
ZSI6IkxhclJHU2JtVVBZdFJZTzZCUTR5bjgifQ.-a3EDsxClUB4O3LeDD5DVGEnNMT
01FCQW4P6-2-BNBqc_Zxf0Qw4CWayLEpqkAomlkLb9zioZoipdP-jvh1WlA"
}
}
create_credential_input = affinidi_tdk_credential_issuance_client.CreateCredentialInput.from_dict(request_json)
api_response = api_instance.generate_credential(projectId, create_credential_input=create_credential_input)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
// Configure API key authorization: ProjectTokenAuth
$config = CredentialIssuanceClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialIssuanceClient\Api\CredentialsApi(
new GuzzleHttp\Client(),
$config
);
try {
$projectId = "<Project_ID>"
$request = array(
"credential_identifier" => "SchemaOne",
"proof" => array(
"proof_type" => "jwt",
"jwt" =>
"eyJ0eXAiOiJvcGVuaWQ0dmNpLXByb29mK2p3dCIsImFsZyI6IkVTMjU2IiwiandrI
jp7Imt0eSI6IkVDIiwiY3J2IjoiUC0yNTYiLCJ4IjoiblVXQW9BdjNYWml0aDhFN2k
xOU9kYXhPTFlGT3dNLVoyRXVNMDJUaXJUNCIsInkiOiJIc2tIVThCalVpMVU5WHFpN
1N3bWo4Z3dBS18weGtjRGpFV183MVNvc0VZIn19.eyJhdWQiOiJodHRwczovL2NyZW
RlbnRpYWwtaXNzdWVyLmV4YW1wbGUuY29tIiwiaWF0IjoxNzAxOTYwNDQ0LCJub25j
ZSI6IkxhclJHU2JtVVBZdFJZTzZCUTR5bjgifQ.-a3EDsxClUB4O3LeDD5DVGEnNMT
01FCQW4P6-2-BNBqc_Zxf0Qw4CWayLEpqkAomlkLb9zioZoipdP-jvh1WlA"
)
);
$result = $apiInstance->generateCredentials($projectId, $request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}
Offer API
Used to get the credential offer initiated by the Issuance API.
getCredentialOffer
Retrieves the credential offer details.
Parameters
issuanceId [String]
ID of the issuance initiated.
Module Imports
import { OfferApi, Configuration } from '@affinidi-tdk/credential-issuance-client'
import affinidi_tdk_credential_issuance_client
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialIssuanceClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new OfferApi(authConfiguration)
const projectId = "<Project_ID>"
const issuanceId = "<Issuance_ID>"
const result = await api.getCredentialOffer(projectId, issuanceId)
configuration = affinidi_tdk_credential_issuance_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_credential_issuance_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_credential_issuance_client.OfferApi(api_client)
projectId = "<Project_ID>"
issuanceId = "<Issuance_ID>"
api_response = api_instance.get_credential_offer(projectId, issuanceId)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
// Configure API key authorization: ProjectTokenAuth
$config = CredentialIssuanceClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialIssuanceClient\Api\OfferApi(
new GuzzleHttp\Client(),
$config
);
try {
$projectId = "<Project_ID>";
$issuanceId = "<Issuance_ID>";
$result = $apiInstance->getCredentialOffer($projectId, $issuanceId);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}
WellKnown API
Used to get the WellKnown OpenID Credential Issuer information.
getWellKnownOpenIdCredentialIssuer
Retrieves the credential issuer well-known configurations.
Parameters
No Parameters Required
Module Imports
import { WellKnownApi, Configuration } from '@affinidi-tdk/credential-issuance-client'
import affinidi_tdk_credential_issuance_client
require_once 'vendor/autoload.php';
use AffinidiTdk\Clients\CredentialIssuanceClient;
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new WellKnownApi(authConfiguration)
const projectId = "<Project_ID>"
const result = await api.getWellKnownOpenIdCredentialIssuer(projectId)
configuration = affinidi_tdk_credential_issuance_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_credential_issuance_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_credential_issuance_client.WellKnownApi(api_client)
projectId = "<Project_ID>"
api_response = api_instance.get_well_known_open_id_credential_issuer(projectId)
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
// Configure API key authorization: ProjectTokenAuth
$config = CredentialIssuanceClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstance = new CredentialIssuanceClient\Api\WellKnownApi(
new GuzzleHttp\Client(),
$config
);
try {
$projectId = "<Project_ID>";
$result = $apiInstance->getWellKnownOpenIdCredentialIssuer($projectId);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling method: ', $e->getMessage(), PHP_EOL;
}
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.