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
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
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"
}
],
"issuerMetadata": {},
"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"
}
],
"issuerMetadata": {},
"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)
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
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)
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
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)
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
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()
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
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"
}
],
"issuerMetadata": {},
"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"
}
],
"issuerMetadata": {},
"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)
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
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)
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
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)
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
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": "01.01.1970",
}
}],
"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": "01.01.1970",
}
}],
"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)
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
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)
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
Sample Codes
// Pass the projectScopedToken generated from AuthProvider package
const authConfiguration = new Configuration({
apiKey: authProvider.fetchProjectScopedToken.bind(authProvider)
})
const api = new OfferApi(authConfiguration)
const issuanceId = "<Issuance_ID>"
const result = await api.getCredentialOffer(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)
issuanceId = "<Issuance_ID>"
api_response = api_instance.get_credential_offer(issuanceId)
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
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)
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.