LogoLogo
  • Platform Overview
  • 🗺️Guides
    • Getting Started
    • Users
      • Integrate the User SDK
      • Registration
      • Authentication
      • SDK Releases
      • API Reference
    • Entitlements
      • Administrative API
        • Integrating the Administrative API
        • Entitlement Definitions
        • Managing Entitlements Sets
        • Managing Entitlements Sequences
        • Managing User Entitlements
        • API Schema
      • End-user API
        • Integrate the Entitlements SDK
        • Redeeming Entitlements
        • Retrieving Entitlements
        • SDK Releases
        • API Reference
    • Sudos
      • Integrate the Sudo Profiles SDK
      • Sudo Entitlements
      • Manage Sudos
      • SDK Releases
      • API Reference
    • Telephony
      • Integrate the Telephony SDK
      • Manage Phone Numbers
      • Text Messaging
      • Voice Calling
      • Telephony Simulator
      • SDK Releases
      • API Reference
    • Email
      • Integrate the Email SDK
      • Email Entitlements
      • Manage Email Addresses
      • Sending & Receiving Email
      • Manage Email Folders
      • Draft Email Messages
      • Manage Email Address Blocklists
      • Email Address Public Information
      • Pagination
      • Caching
      • Configuration Data
      • Email Notifications
      • SDK Releases
      • API Reference
    • Decentralized Identity
      • Edge Agent
        • Relay SDK
          • Integrate the Relay SDK
          • Relay Entitlements
          • Manage Relay Postboxes
          • Manage Relay Messages
          • Receiving Messages
          • SDK Releases
        • Edge Agent SDK
          • Integrate the Edge Agent SDK
          • Agent Management
          • Manage Wallets
          • Establishing Connections
          • Manage Connections
          • Messaging
          • Manage DIDs
          • Accepting New Credentials
          • Manage Credentials
          • Present Credentials for Verification
          • Utilize Alternative Cryptography Providers
          • SDK Releases
          • Standards and Protocols
      • Cloud Agent
        • Cloud Agent Admin API
          • Integrate the Cloud Agent Admin API
          • Aries Interop Profile (AIP)
            • Connection Exchanges
            • Credential Exchanges
            • Proof Exchanges
          • Connections
          • Basic Messages
          • Credentials
            • Anoncreds Credentials
              • Schemas
              • Credential Definitions
            • W3C Credentials
          • Audit Logs
          • API Schema
          • Error Codes
          • Standards and Protocols
    • Virtual Cards
      • Integrate the Virtual Cards SDK
      • Virtual Cards Entitlements
      • Virtual Cards Transaction Velocity Constraints
      • Key Management
      • Manage Funding Sources
      • Manage Virtual Cards
      • Manage Transactions
      • Configuration Data
      • Pagination
      • Caching
      • SDK Releases
      • API Reference
    • Virtual Cards Simulator
      • Integrate the Virtual Cards Simulator SDK
      • Simulate Authorizations
      • Simulate Debits
      • Simulate Refunds
      • Simulate Reversals
      • Merchants and Currencies
      • SDK Releases
      • API Reference
    • Virtual Private Network
      • Integrate the VPN SDK
      • VPN Entitlements
      • Manage Servers
      • Manage Connection
      • Observe VPN Related Events
      • SDK Releases
      • API Reference
      • Frequently Asked Questions
    • Secure ID Verification
      • Integrate the Secure ID Verification SDK
      • List Supported Countries
      • Verify an Identity
      • Check Secure ID Verification Status
      • Use the Secure ID Verification Simulator
      • SDK Releases
      • API Reference
    • Password Manager
      • Integrate the Password Manager SDK
      • Accessing the Password Manager
      • Managing Password Vaults
      • Managing Password Vault Items
      • Vault Import and Export
      • Password Utilities
      • Password Manager Entitlements
      • Password Vault Security
      • SDK Releases
      • API Reference
    • Ad/Tracker Blocker
      • Integrate the Ad/Tracker Blocker SDK
      • Manage Rulesets
      • Blocking Ads and Trackers
      • Manage Exceptions
      • SDK Releases
      • API Reference
    • Site Reputation
      • Integrate the Site Reputation SDK
      • Use the Site Reputation SDK
      • SDK Releases
      • API Reference
  • 💡Concepts
    • Sudo Digital Identities
  • 🧱Development
    • Versioning
  • 🏢Administration
    • Admin Console Roles
  • ❓Get Help
    • Request a Demo
    • Report an Issue
Powered by GitBook
On this page
  • Get a Credential by ID
  • Credential Formats
  • Delete a Credential by ID
  • Updating the Metadata of a Credential
  • Listing Pending Credentials
  • Filtered Listing
  1. Guides
  2. Decentralized Identity
  3. Edge Agent
  4. Edge Agent SDK

Manage Credentials

Manage the set of verifiable credentials received and owned by the agent

PreviousAccepting New CredentialsNextPresent Credentials for Verification

Last updated 6 months ago

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.

Get a Credential by ID

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:

let id: String // ID of the credential to get ([Credential.credentialId])

do {
    let credential = try await agent.credentials.getById(credentialId: id)
} catch {
    // handle error
}
val id: String // ID of the credential to get ([Credential.credentialId])

launch {
    try {
        val credential = agent.credentials.getById(id)
    } catch (e: CredentialsModule.GetException) {
        // Handle exception
    }
}

Credential Formats

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.

Delete a Credential by ID

Similarly, a Credential in the wallet can be easily deleted via the deleteById API:

let id: String // ID of the credential to delete ([Credential.credentialId])

do {
    try await agent.credentials.deleteById(credentialId: id)
} catch {
    // handle error
}
val id: String // ID of the credential to delete ([Credential.credentialId])

launch {
    try {
        agent.credentials.deleteById(id)
    } catch (e: CredentialsModule.DeleteException) {
        // Handle exception
    }
}

Updating the Metadata of a Credential

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:

let id: String // ID of the credential to update ([Credential.credentialId])

// add a 'category' of 'work' to this credential, and a 'priority' of '1'
let update = CredentialUpdate(tags: [
    RecordTag(name: "category", value: "work"),
    RecordTag(name: "~priority", value: "1")
])

do {
    try await agent.credentials.updateCredential(credentialId: id, credentialUpdate: update)
} catch {
    // handle error
}
val id: String // ID of the credential to update ([Credential.credentialId])

// add a 'category' of 'work' to this credential, and a 'priority' of '1'
val update = CredentialUpdate(
    tags = listOf(
         RecordTag("category", "work"),
         RecordTag("~priority", "1")   
    )
)

launch {
    try {
        agent.credentials.updateCredential(id, update)
    } catch (e: CredentialsModule.UpdateException) {
        // Handle exception
    }
}

Listing Pending Credentials

To list all credentials in the agent's wallet, the listAll API can be used:

do {
    let creds = try await agent.credentials.listAll(options: nil)
} catch {
    // handle error
}
launch {
    try {
        val creds: List<Credential> = agent.credentials.listAll(null)
    } catch (e: CredentialsModule.ListException) {
        // Handle exception
    }
}

Filtered Listing

More complicated Credential list queries can also be achieved by utilizing the ListCredentialsFilters.

// WQL Query, filter for 'category' == 'work'
let wqlQuery = "{ \"category\": \"work\" }"
let filters = ListCredentialsFilters(tagFilter: wqlQuery)
let options = ListCredentialsOptions(filters: filters)
do {
    let workCredentials = try await agent.credentials.listAll(options: options)
} catch {
    // handle error
}
// WQL Query, filter for priority < 2 (e.g. 'high' priority items)
let wqlQuery = "{ \"~priority\": { \"$lt\": \"2\" } }"
let filters = ListCredentialsFilters(tagFilter: wqlQuery)
let options = ListCredentialsOptions(filters: filters)

do {
    let highPriorityCredentials = try await agent.credentials.listAll(options: options)
} catch {
    // Handle error
}
// WQL Query, filter for 'category' == 'work'
val wqlQuery = """{ "category": "work" }"""
val filters = ListCredentialsFilters(tagFilter = wqlQuery)
val options = ListCredentialsOptions(filters)

launch {
    try {
        val workCredentials = agent.credentials.listAll(options)
    } catch (e: CredentialsModule.ListException) {
        // Handle exception
    }
}
// WQL Query, filter for priority < 2 (e.g. 'high' priority items)
val wqlQuery = """{ "~priority": { "${"$"}lt": "2" } }"""
val filters = ListCredentialsFilters(tagFilter = wqlQuery)
val options = ListCredentialsOptions(filters)

launch {
    try {
        val highPriorityCredentials = agent.credentials.listAll(options)
    } catch (e: CredentialsModule.ListException) {
        // Handle exception
    }
}

Credentials 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 :

🗺️
listing functionality
see below
Wallet Query Langauge (WQL)
via the update API
Update section
accepting and storing a credential
when presenting credential proofs
Anoncreds Credential
W3C Verifiable Credential
W3C specification
IETF SD-JWT VC
Credential Exchanges