Skip to main content

Working with Wallet content

Prerequisites

There are two approaches to working with wallet content:

  1. Working directly with an object by its DID
  2. Listing objects by type

Working with Credentials

Get a Credential

To retrieve the latest available version of a credential, use the following code:

curl --request GET \
--url "https://api.truvity.com/api/wallet/v1/credential/${CREDENTIAL_DID}?entityDid=${ENTITY_DID}&walletDid=${WALLET_DID}" \
--header "X-API-KEY: ${TRUVITY_API_KEY}"

List Credentials

To retrieve the latest available versions of credentials, use the following code:

curl --request GET \
--url "https://api.truvity.com/api/wallet/v1/credentials?entityDid=${ENTITY_DID}&walletDid=${WALLET_DID}' \
--header "X-API-KEY: ${TRUVITY_API_KEY}"
tip

By default, CredentialListV1 will return all credential descriptors. If you want to get their content, you should additionally provide the getBodies parameter.

In addition to listing all available credentials, you can specify several conditions:

By Credential state

During their lifecycle, credentials can be in several states:

  1. Draft — a regular credential without a proof. Can be updated as many times as needed.
  2. Issued — a verifiable credential with a proof. Can't be updated or deleted.
  3. Abandoned — a regular credential that was marked as deleted. Can't be updated or issued.

By using the state parameter, you can filter credentials by any of them. Use the following code to do so:

curl --request GET \
--url "https://api.truvity.com/api/wallet/v1/credentials?state=draft&entityDid=${ENTITY_DID}&walletDid=${WALLET_DID}" \
--header "X-API-KEY: ${TRUVITY_API_KEY}"

By Credential ownership

Sometimes it can be useful to filter credentials by their ownership, for example, when you want to list all credentials that were issued by you or were issued for you by other counterparties.

caution

This topic is subject to change in future releases.

Here is a list of available ownership presets in the API:

  • All (default) — no filtering.
  • Held — filters credentials whose holder is the owner of the wallet.
  • Presented — filters credentials whose holder is not the owner of the wallet.

Use the following code to list credentials by their holder:

curl --request GET \
--url "https://api.truvity.com/api/wallet/v1/credentials?queryMode=Held&entityDid=${ENTITY_DID}&walletDid=${WALLET_DID}" \
--header "X-API-KEY: ${TRUVITY_API_KEY}"

Working with Presentations

Get a Presentation

To retrieve the latest available version of a presentation, use the following code:

curl --request GET \
--url "https://api.truvity.com/api/wallet/v1/vp/${PRESENTATION_DID}?queryMode=Held&entityDid=${ENTITY_DID}&walletDid=${WALLET_DID}" \
--header "X-API-KEY: ${TRUVITY_API_KEY}"

List Presentations

To retrieve the latest available versions of presentations, use the following code:

curl --request GET \
--url "https://api.truvity.com/api/wallet/v1/vp?entityDid=${ENTITY_DID}&walletDid=${WALLET_DID}" \
--header "X-API-KEY: ${TRUVITY_API_KEY}"

In addition to listing all available credentials, you can specify several conditions:

By Presentation state

During their lifecycle, presentations can be in several states:

  1. Draft — a regular presentation without a proof. Can be updated as many times as needed.
  2. Issued — a verifiable presentation with a proof. Can't be updated or deleted.
  3. Abandoned — a regular presentation that was marked as deleted. Can't be updated or issued.

By using the state parameter, you can filter credentials by any of them. Use the following code to do so:

curl --request GET \
--url "https://api.truvity.com/api/wallet/v1/vp?state=draft&entityDid=${ENTITY_DID}&walletDid=${WALLET_DID}" \
--header "X-API-KEY: ${TRUVITY_API_KEY}"

Working with DIDComm messages

tip

In the current version of the API, we do not provide the ability to work with the DIDComm messages.

Please join our Discord server to get updates about future developments.

Further reading