Manage Credentials
Manage the set of verifiable credentials received and owned by the agent
Last updated
Manage the set of verifiable credentials received and owned by the agent
Last updated
After , credentials will be available for management under the agent's CredentialsModule
. Credentials available in this module are ready to be used in Decentralized Identity interactions, such as . The CredentialsModule
provides users with an easy way to fetch, edit and delete credentials in the agent's wallet.
The functionality of the CredentialsModule
is accessed via the agent
's fields: agent.credentials
. The functionality provided is described below.
Received verifiable credentials are represented by Credential
objects. To retrieve the current state of a specific Credential
in the agent's wallet, the getById
API can be used. If a credential cannot be found by the given identifier, then null
is returned:
Similar to , the Credential
object can represent different credential formats. Credential
contains a formatData
field, which is a CredentialFormatData
data structure with variants for the different supported formats. Currently these format variants include:
AnoncredV1
: Contains details of the this Credential
represents. Includes the credential attributes and Anoncreds specific metadata.
W3C
: Contains details of the this Credential
represents. Includes the complete W3cCredential
data structure as defined by the .
SdJwtVc
: Contains details of the this Credential
represents. Includes the complete raw SD-JWT and processed claims and metadata of the SD-JWT.
Similarly, a Credential
in the wallet can be easily deleted via the deleteById
API:
Each Credential
contains a list of RecordTag
(Credential.tags
) attached to it, where a RecordTag
is simply a name-value pair stored with the record. By default, some tags are attached to a new Credential
, this includes:
tag-name: ~created_timestamp
, tag-value: The UNIX epoch seconds which this credential was stored
The tags on a Credential
can be replaced or updated by using the updateCredential
API, and providing a new set to update. This will replace whatever the current set of tags is:
To list all credentials in the agent's wallet, the listAll
API can be used:
More complicated Credential
list queries can also be achieved by utilizing the ListCredentialsFilters
.
Credential
s contain metadata that can be controlled by SDK consumers, allowing custom information to be attached to each Credential
, and allowing custom to be leveraged.
Like most data in the wallet, RecordTag
will be stored encrypted. Unless, the tag name is prefixed with ~
, then the tag value will be stored unencrypted. Storing a tag value as unencrypted will allow some additional listing queries to be performed ().
To filter by tags
applied to the Credential
(i.e. applied ), the tagFilter
field of ListCredentialsFilters
should be used. This field takes a String
in compliance with a Query.
Continuing from the example in the :