Wallets
Install Dependency
Package: affinidi_tdk_wallets_client
pip install affinidi_tdk_wallets_clientYou can check the latest version of this module on the PyPi repository or view the source code at the GitHub repository.
Classes and Methods
Wallet API
Used to manage digital wallets for issuing credentials.
create_wallet
Create a wallet by type.
Parameters
CreateWalletInput [Object]
JSON object to provide details for the wallet to create. See more here.
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
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 a did:web request json - didWebUrl is mandatory
new_wallet_json = {
name: "Wallet Name",
description: "Description",
didMethod: "key"
}
create_wallet_input = affinidi_tdk_wallets_client.CreateWalletInput.from_dict(new_wallet_json)
# create a did:key
api_response = api_instance.create_wallet(create_wallet_input=create_wallet_input)delete_wallet
Delete a Wallet by ID.
Parameters
walletId [String]
ID of the Wallet to delete.
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
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)get_wallet
Retrieves the details of the Wallet.
Parameters
walletId [String]
ID of the Wallet to retrieve.
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
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)list_wallets
Get the list of the Wallets.
Parameters
No Parameters Required
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
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
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
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
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_dict()
api_response = api_instance.sign_credential(wallet_id, sign_credential_input_dto)sign_jwt_token
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
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
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_dict(sign_jwt_token_request_json)
try:
api_response = api_instance.sign_jwt_token(wallet_id, sign_jwt_token)update_wallet
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
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
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_dict(update_wallet_request_json)
try:
api_response = api_instance.update_wallet(wallet_id, update_wallet_input)create_wallet_key
Add a cryptographic key to an existing wallet.
Note: Multiple keys are only supported for
did:webwallets.
Parameters
walletId [String]
ID of the Wallet to add a key to.
CreateWalletKeyInput [Object]
JSON object to provide the key details. See more here.
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
wallet_id = "<WALLET_ID>"
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
Retrieve all keys associated with a wallet.
Note: Multiple keys are only supported for
did:webwallets.
Parameters
walletId [String]
ID of the Wallet.
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
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.list_wallet_keys(wallet_id)remove_wallet_key
Remove a key from a wallet.
Note: Multiple keys are only supported for
did:webwallets.
Parameters
walletId [String]
ID of the Wallet.
keyId [String]
Wallet-scoped key identifier (e.g. "key-1").
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
wallet_id = "<WALLET_ID>"
key_id = "key-1"
api_instance.remove_wallet_key(wallet_id, key_id)update_wallet_key
Update the verification relationships of an existing wallet key.
Note: Multiple keys are only supported for
did:webwallets.
Parameters
walletId [String]
ID of the Wallet.
keyId [String]
Wallet-scoped key identifier (e.g. "key-1").
UpdateWalletKeyInput [Object]
JSON object to provide the updated key relationships. See more here.
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
wallet_id = "<WALLET_ID>"
key_id = "key-1"
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_id, update_wallet_key_input=update_wallet_key_input)create_service_endpoint
Add a DID service endpoint to a wallet’s DID document.
Parameters
walletId [String]
ID of the Wallet.
ServiceEndpointInput [Object]
JSON object to provide the service endpoint details. See more here.
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
wallet_id = "<WALLET_ID>"
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
Retrieve all service endpoints associated with a wallet.
Parameters
walletId [String]
ID of the Wallet.
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
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.list_service_endpoints(wallet_id)remove_service_endpoint
Remove a service endpoint from a wallet’s DID document.
Parameters
walletId [String]
ID of the Wallet.
serviceId [String]
ID of the service endpoint to remove.
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
wallet_id = "<WALLET_ID>"
service_id = "<SERVICE_ID>"
api_instance.remove_service_endpoint(wallet_id, service_id)update_service_endpoint
Update an existing service endpoint on a wallet.
Parameters
walletId [String]
ID of the Wallet.
serviceId [String]
ID of the service endpoint to update.
UpdateServiceEndpointInput [Object]
JSON object to provide the updated service endpoint details. See more here.
Example
import affinidi_tdk_wallets_client
configuration = affinidi_tdk_wallets_client.Configuration()
# Pass the projectScopedToken generated from AuthProvider package
configuration.api_key['ProjectTokenAuth'] = projectScopedToken
with affinidi_tdk_wallets_client.ApiClient(configuration) as api_client:
api_instance = affinidi_tdk_wallets_client.WalletApi(api_client)
wallet_id = "<WALLET_ID>"
service_id = "<SERVICE_ID>"
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.