Wallets
Install Dependency
Package: affinidi_tdk_wallets_client
pip install affinidi_tdk_wallets_client
You 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)
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.