Wallets

Manage Digital Wallet with Wallets Service.

Supported Languages

Package: @affinidi-tdk/wallets-client

npm install @affinidi-tdk/wallets-client --save

Package: affinidi_tdk_wallets_client

pip install affinidi_tdk_wallets_client

Classes and Methods

Wallet API

Used to manage digital wallets for issuing credentials.

createWallet

Create a wallet by type.

Parameters

CreateWalletInput [Object]

JSON object to provide details for the wallet to create. See more here.

Example
const walletApi = new WalletApi(authConfiguration)

// create a did:key wallet
const { data } = await walletApi.createWallet({didMethod: 'key'})

// create a did:web wallet - didWebUrl is mandatory
const { data } = await walletApi.createWallet({didMethod: 'web', didWebUrl: 'https://<DOMAIN>'})
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)

    # create a did:key request json
    new_wallet_json = "{
        did_method: 'key'
    }"

    create_wallet_input = affinidi_tdk_wallets_client.CreateWalletInput.from_json(new_wallet_json)

    # create a did:key
    api_response = api_instance.create_wallet(create_wallet_input=create_wallet_input)

    # ===================================
    
    # create a did:web request json - didWebUrl is mandatory
    new_wallet_json = "{
        did_method: 'key'
        did_web_url: 'https://<DOMAIN>'
    }"

    create_wallet_input = affinidi_tdk_wallets_client.CreateWalletInput.from_json(new_wallet_json)

    # create a did:key
    api_response = api_instance.create_wallet(create_wallet_input=create_wallet_input)

deleteWallet

Delete a Wallet by ID.

Parameters

walletId [String]

ID of the Wallet to delete.

Example
const walletApi = new WalletApi(authConfiguration)

const walletId: string = '<wallet-id-to-delete>'

const result = await walletApi.deleteWallet(walletId)
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    
    wallet_id = '<wallet-id-to-delete>'

    api_instance.delete_wallet(wallet_id)

getWallet

Retrieves the details of the Wallet.

Parameters

walletId [String]

ID of the Wallet to retrieve.

Example
const walletApi = new WalletApi(authConfiguration)

const walletId: string = '<wallet-id>'

const result = await walletApi.getWallet(walletId)
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    
    wallet_id = '<wallet-id>'

    api_response = api_instance.get_wallet(wallet_id)

listWallets

Get the list of the Wallets.

Parameters

No Parameters Required

Example
const walletApi = new WalletApi(authConfiguration)

const result = await walletApi.listWallets()
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    
    api_response = api_instance.list_wallets()

signCredential

Sign a credentials with the Wallet details (DID document).

Parameters

walletId [String]

ID of the Wallet used for signing the credential.

SignCredentialInputDto [Object]

JSON object to provide the credential data to sign. See more here.

Example
const walletApi = new WalletApi(authConfiguration)

const walletId: string = '<wallet-id>'

const credentialRequest : SignCredentialInputDto = {
    unsignedCredential: {},
    revocable: true,
    unsignedCredentialParams: {
        jsonLdContextUrl: '',
        jsonSchemaUrl: '',
        typeName: '',
        credentialSubject: '',
        holderDid: '',
        expiresAt: ''
    }
}

const result = await walletApi.signCredential(walletId, credentialRequest)
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    
    wallet_id = 'wallet_id'
    
    sign_credential_json = "{
        unsigned_credential: {},
        revocable: true,
        unsigned_credential_params: {
            json_ld_context_url: '',
            json_schema_url: '',
            type_name: '',
            credential_subject: '',
            holder_did: '',
            expires_at: ''
    }
    }"

    sign_credential_input_dto = affinidi_tdk_wallets_client.SignCredentialInputDto.from_json() 

    api_response = api_instance.sign_credential(wallet_id, sign_credential_input_dto)

signJwtToken

Sign the JSON Web Token with the Wallet details (DID document).

Parameters

walletId [String]

ID of the Wallet used for signing the JWT.

SignCredentialInputDto [Object]

JSON object to provide the JWT data to sign. See more here.

Example
const walletApi = new WalletApi(authConfiguration)

const walletId: string = '<wallet-id>'

const signJwtTokenRequest : SignJwtToken = {
    header: {},
    payload: {}
}

const result = await walletApi.signJwtToken(walletId, signJwtTokenRequest)
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    
    wallet_id = 'wallet_id'
    
    sign_jwt_token_request_json = "{
        header: {},
        payload: {}
    }"

    sign_jwt_token = affinidi_tdk_wallets_client.SignJwtToken.from_json(sign_jwt_token_request_json)

    try:
        api_response = api_instance.sign_jwt_token(wallet_id, sign_jwt_token)

updateWallet

Update an existing Wallet by ID.

Parameters

walletId [String]

ID of the Wallet to update.

UpdateWalletInput [Object]

JSON object to provide details for the wallet to update. See more here.

Example
const walletApi = new WalletApi(authConfiguration)

const walletId: string = '<wallet-id>'

const updateWalletRequest : UpdateWalletInput = {
    name: '',
    description: ''
}

const result = await walletApi.updateWallet(walletId, updateWalletRequest)
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    
    wallet_id = 'wallet_id'
    
    update_wallet_request_json = "{
        name: '',
        description: ''
    }"

    update_wallet_input = affinidi_tdk_wallets_client.UpdateWalletInput.from_json(update_wallet_request_json) 

    try:
        api_response = api_instance.update_wallet(wallet_id, update_wallet_input)

Revocation API

Used to retrieve and revoke issued credentials.

getRevocationListCredential

Retrieve the Revocation List of the Wallet. Used this to check if the Credential is revoked.

Parameters

listId [String]

ID of the Revocation List to retrieve.

walletId [String]

ID of the Wallet associated with the revocation list.

Example
const revokeApi = new RevocationApi(authConfiguration)

const listId : string = '<listId>'
const walletId : string = '<walletId>'

const { data } = await revokeApi.getRevocationListCredential(listId, walletId)
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.RevocationApi(api_client)
    
    list_id = '<listId>' 
    
    wallet_id = '<walletId>'
    
    api_response = api_instance.get_revocation_list_credential(list_id, wallet_id)

revokeCredential

Used to revoke issued credential.

Parameters

walletId [String]

ID of the Wallet associated with the credential to revoke.

RevokeCredentialInput [Object]

JSON object to provide the credential info and reason for revoking the credential. See more here.

Example
const revokeApi = new RevocationApi(authConfiguration)

const walletId : string = '<walletId>'

const revokeCredentialRequest : RevokeCredentialInput = {
    revocationReason: '',
    credentialId: ''
}

const { data } = await revokeApi.revokeCredential(walletId, revokeCredentialRequest)
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:

    api_instance = affinidi_tdk_wallets_client.RevocationApi(api_client)

    wallet_id = '<wallet_id>'
    
    revoke_credential_json = "{
        revocationReason: '',
        credentialId: ''
    }"

    revoke_credential_input = affinidi_tdk_wallets_client.RevokeCredentialInput.from_json(revoke_credential_json)

    api_instance.revoke_credential(wallet_id, revoke_credential_input)