Wallets

Manage Digital Wallet with Wallets Service.

Install Dependency

Package: affinidi_tdk_wallets_client

pip install affinidi_tdk_wallets_client

Check the latest version on the PyPI repository or view the source on GitHub.

Classes and Methods

Wallet API

Used to manage digital wallets for issuing credentials.

create_wallet

Creates a wallet by type.

Parameters

create_wallet_input CreateWalletInput Optional
Details for the wallet to create, including optional name, description, and DID method.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)

    new_wallet_json = {
        'name': 'Wallet Name',
        'description': 'Description',
        'didMethod': 'key',
    }

    create_wallet_input = affinidi_tdk_wallets_client.CreateWalletInput.from_dict(new_wallet_json)
    api_response = api_instance.create_wallet(create_wallet_input=create_wallet_input)

delete_wallet

Deletes a wallet by ID.

Parameters

walletId str Required
ID of the wallet to delete.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    api_instance.delete_wallet('<WALLET_ID>')

get_wallet

Retrieves the details of a wallet.

Parameters

walletId str Required
ID of the wallet to retrieve.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    api_response = api_instance.get_wallet('<WALLET_ID>')

list_wallets

Returns the list of wallets in the project.

No parameters required.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

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()

sign_credential

Signs a credential with the wallet’s DID document.

Parameters

walletId str Required
ID of the wallet used for signing.
sign_credential_input_dto SignCredentialInputDto Required
Credential data to sign, including unsigned credential and revocation flag.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)

    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_dict(sign_credential_json)
    api_response = api_instance.sign_credential('<WALLET_ID>', sign_credential_input_dto)

sign_jwt_token

Signs a JSON Web Token with the wallet’s DID document.

Parameters

walletId str Required
ID of the wallet used for signing.
sign_jwt_token SignJwtToken Required
JWT header and payload to sign.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)

    sign_jwt_token_json = {
        'header': {},
        'payload': {},
    }

    sign_jwt_token = affinidi_tdk_wallets_client.SignJwtToken.from_dict(sign_jwt_token_json)
    api_response = api_instance.sign_jwt_token('<WALLET_ID>', sign_jwt_token)

update_wallet

Updates an existing wallet by ID.

Parameters

walletId str Required
ID of the wallet to update.
update_wallet_input UpdateWalletInput Required
Updated name and description for the wallet.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)

    update_wallet_json = {
        'name': '',
        'description': '',
    }

    update_wallet_input = affinidi_tdk_wallets_client.UpdateWalletInput.from_dict(update_wallet_json)
    api_response = api_instance.update_wallet('<WALLET_ID>', update_wallet_input)

create_wallet_key

Adds a cryptographic key to an existing wallet.

Note: Multiple keys are only supported for did:web wallets.

Parameters

walletId str Required
ID of the wallet to add a key to.
create_wallet_key_input CreateWalletKeyInput Required
Key type and verification relationships.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)

    create_key_json = {
        'keyType': 'ed25519',
        'relationships': ['authentication', 'assertionMethod'],
    }

    create_wallet_key_input = affinidi_tdk_wallets_client.CreateWalletKeyInput.from_dict(create_key_json)
    api_response = api_instance.create_wallet_key('<WALLET_ID>', create_wallet_key_input=create_wallet_key_input)

list_wallet_keys

Retrieves all keys associated with a wallet.

Note: Multiple keys are only supported for did:web wallets.

Parameters

walletId str Required
ID of the wallet.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    api_response = api_instance.list_wallet_keys('<WALLET_ID>')

remove_wallet_key

Removes a key from a wallet.

Note: Multiple keys are only supported for did:web wallets.

Parameters

walletId str Required
ID of the wallet.
keyId str Required
Wallet-scoped key identifier (for example, key-1).

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    api_instance.remove_wallet_key('<WALLET_ID>', 'key-1')

update_wallet_key

Updates the verification relationships of an existing wallet key.

Note: Multiple keys are only supported for did:web wallets.

Parameters

walletId str Required
ID of the wallet.
keyId str Required
Wallet-scoped key identifier (for example, key-1).
update_wallet_key_input UpdateWalletKeyInput Required
Updated verification relationships for the key.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)

    update_key_json = {
        'relationships': ['authentication', 'keyAgreement'],
    }

    update_wallet_key_input = affinidi_tdk_wallets_client.UpdateWalletKeyInput.from_dict(update_key_json)
    api_response = api_instance.update_wallet_key('<WALLET_ID>', 'key-1', update_wallet_key_input=update_wallet_key_input)

create_service_endpoint

Adds a DID service endpoint to a wallet’s DID document.

Parameters

walletId str Required
ID of the wallet.
service_endpoint_input ServiceEndpointInput Required
Service endpoint URL, name, and type.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)

    service_endpoint_json = {
        'url': 'https://example.com/messaging',
        'name': 'My Messaging Service',
        'serviceType': 'DIDCommMessaging',
    }

    service_endpoint_input = affinidi_tdk_wallets_client.ServiceEndpointInput.from_dict(service_endpoint_json)
    api_response = api_instance.create_service_endpoint('<WALLET_ID>', service_endpoint_input=service_endpoint_input)

list_service_endpoints

Retrieves all service endpoints associated with a wallet.

Parameters

walletId str Required
ID of the wallet.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    api_response = api_instance.list_service_endpoints('<WALLET_ID>')

remove_service_endpoint

Removes a service endpoint from a wallet’s DID document.

Parameters

walletId str Required
ID of the wallet.
serviceId str Required
ID of the service endpoint to remove.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
    api_instance.remove_service_endpoint('<WALLET_ID>', '<SERVICE_ID>')

update_service_endpoint

Updates an existing service endpoint on a wallet.

Parameters

walletId str Required
ID of the wallet.
serviceId str Required
ID of the service endpoint to update.
update_service_endpoint_input UpdateServiceEndpointInput Required
Updated service endpoint name and URL.

Example

import affinidi_tdk_wallets_client

configuration = affinidi_tdk_wallets_client.Configuration()
configuration.api_key['ProjectTokenAuth'] = projectScopedToken

with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)

    update_service_json = {
        'name': 'Updated Service Name',
        'url': 'https://new-endpoint.example.com',
    }

    update_service_endpoint_input = affinidi_tdk_wallets_client.UpdateServiceEndpointInput.from_dict(update_service_json)
    api_response = api_instance.update_service_endpoint('<WALLET_ID>', '<SERVICE_ID>', update_service_endpoint_input=update_service_endpoint_input)