Wallets
Install Dependency
Package: affinidi_tdk_wallets_client
pip install affinidi_tdk_wallets_clientCheck 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
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
RequiredExample
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
RequiredExample
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
RequiredExample
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
RequiredExample
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
RequiredExample
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:webwallets.
Parameters
walletId
str
RequiredExample
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:webwallets.
Parameters
walletId
str
RequiredExample
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:webwallets.
Parameters
walletId
str
RequiredkeyId
str
Requiredkey-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:webwallets.
Parameters
walletId
str
RequiredkeyId
str
Requiredkey-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)
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
RequiredExample
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
RequiredExample
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
RequiredserviceId
str
RequiredExample
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
RequiredserviceId
str
RequiredExample
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)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.