Credential Issuance

Issue a Verifiable Credentials using Credential Issuance Service.

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.

Example
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': {},
    'walletId': 'wallet_id',
    'offerDuration': 3600,
    'format': 'ldp_vc',
}

const { data } = await api.createIssuanceConfig(request)
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': {},
        'walletId': 'wallet_id',
        'offerDuration': 3600,
        'format': 'ldp_vc',
    }"

    create_issuance_config_input = affinidi_tdk_iam_client.CreateIssuanceConfigInput.from_json(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.

Example
const api = new ConfigurationApi(authConfiguration)

const configurationId : string = 'Config_ID'

const result = await api.deleteIssuanceConfigById(configurationId)
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.

Example
const api = new ConfigurationApi(authConfiguration)

const configurationId : string = 'Config_ID'

const result = await api.getIssuanceConfigById(configurationId)
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

Example
const api = new ConfigurationApi(authConfiguration)

const { data } = await api.getIssuanceConfigList()
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.

Example
const api = new ConfigurationApi(authConfiguration)

const configurationId : string = 'Config_ID'
const request: UpdateIssuanceConfigInput = {
     'credentialSupported': [
    {
      'credentialTypeId': 'SchemaOne',
      'jsonSchemaUrl': 'https://schema.affinidi.io/SchemaOneV1R1.json',
      'jsonLdContextUrl': 'https://schema.affinidi.io/SchemaOneV1R1.jsonld'
    }
  ],
    'issuerMetadata': {},
    'walletId': 'wallet_id',
    'offerDuration': 3600,
    'format': 'ldp_vc',
}

const { data } = await api.updateIssuanceConfigById(configurationId, request)
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': {},
        'walletId': 'wallet_id',
        'offerDuration': 3600,
        'format': 'ldp_vc',
    }"

    update_issuance_config_input = affinidi_tdk_iam_client.UpdateIssuanceConfigInput.from_json(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.

Example
const api = new IssuanceApi(authConfiguration)

const issuanceId : string = 'Issuance_ID'
const projectId : string = 'Project_ID'

const { data } = await api.issuanceState(issuanceId, projectId)
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.

Example
const api = new IssuanceApi(authConfiguration)

const projectId : string = 'Project_ID'

const { data } = await api.listIssuance(projectId)
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.

Example
const api = new IssuanceApi(authConfiguration)

const projectId : string = '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',
   'issuanceId': 'issuance_id',
   'claimMode': 'NORMAL'
}


const { data } = await api.startIssuance(projectId, request)
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',
        'issuanceId': 'issuance_id',
        'claimMode': 'NORMAL'
    }"

    start_issuance_input = affinidi_tdk_iam_client.StartIssuanceInput.from_json(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.

Example
const api = new CredentialsApi(authConfiguration)

const projectId : string = '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)
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_iam_client.CreateCredentialInput.from_json(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.

Example
const api = new OfferApi(authConfiguration)

const issuanceId : string = 'Issuance_ID'

const result = await api.getCredentialOffer(issuanceId)
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

Example
const api = new WellKnownApi(authConfiguration)

const projectId : string = 'Project_ID'

const result = await api.getWellKnownOpenIdCredentialIssuer(projectId)
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)