Asset or VC Claim
The assetOrVC claim provides a flexible way to request that a user present proof of ownership of either an on-chain asset (like an NFT) or a Verifiable Credential (VC) that meets a specified set of criteria. This is particularly useful for scenarios requiring flexible access control, where multiple forms of qualification are acceptable.
For more specific requests, you can refer to the Asset Claim or Verifiable Credential Claim documentation.
How It Works#
The core of the assetOrVC claim is the filters array. This array allows you to define one or more sets of conditions. The logic for evaluating these filters is as follows:
- OR Logic between Filters: The wallet evaluates each filter object in the
filtersarray independently. The user only needs to present an asset or VC that satisfies the conditions of at least one of these filter objects. - AND Logic within a Filter: Within a single filter object, all specified properties (e.g.,
trustedIssuers,tag) must be met by the presented asset or VC. - OR Logic for Array Values: For properties that accept an array of values (like
typeortrustedIssuers), the presented item only needs to match one of the values in the array.
Parameters#
The assetOrVC claim object is configured with the following parameters:
Parameter | Type | Description | Default |
|---|---|---|---|
|
| The type of the claim. Must be |
|
|
| A message displayed to the user in their wallet, explaining what is being requested. |
|
|
| If |
|
|
| Required. An array of filter objects defining the acceptable criteria for the asset or VC. |
|
Filter Object Parameters#
Each object within the filters array can contain the following properties to specify the required criteria:
Parameter | Type | Description |
|---|---|---|
|
| VC Only. An array of acceptable VC type names (e.g., |
|
| The DID address of a specific asset or VC. |
|
| A list of trusted issuer DIDs for the asset or VC. |
|
| Asset Only. A list of trusted parent DIDs (e.g., an NFT collection address). |
|
| A specific tag that must be present on the asset or VC. |
|
| An array of DIDs. The wallet must prove it controls one of these DIDs and owns the asset/VC. Defaults to the connected user's DID. |
|
| Asset Only. Specifies whether the asset must be in a |
|
| VC Only. A URL where the wallet can find more information about the required credential. |
|
| Asset Only. A URL where the user can go to acquire the asset if they don't already have it. |
Example#
Imagine you want to grant access to a premium event. Access is granted to users who either hold a "VIP Ticket" NFT or a "VerifiedMember" credential. You can construct an assetOrVC claim like this:
DID Connect Claim Request
const claims = {
assetOrVC: {
description: 'Please present your VIP Ticket or Membership Credential to enter.',
filters: [
// Condition 1: User has a VIP Ticket NFT from our official collection
{
trustedParents: ['zNKoA8Y4m1a3b5C7E9F1G3H5J7K9L1M3N5'], // The DID of the NFT collection
tag: 'VIP_TICKET_2024',
acquireUrl: 'https://example.com/buy-ticket'
},
// Condition 2: User has a VerifiedMember credential from a trusted partner
{
type: ['VerifiedMember'],
trustedIssuers: ['zNKjDm4Xsoaffb19UE6QxVeevuaTaLCS1n1S'] // The DID of the trusted partner
}
]
}
};In this example:
- The user's wallet will first look for an asset that belongs to the
trustedParentscollection AND has the tagVIP_TICKET_2024. - If no such asset is found, it will then look for a Verifiable Credential of type
VerifiedMemberissued by the specifiedtrustedIssuers. - If the user has an item that matches either condition, they can present it to satisfy the claim. If they have neither, the wallet might show them the
acquireUrlto get a ticket.
This flexible claim is a powerful tool for building sophisticated access control systems. To see it in a practical application, check out the NFT Gated Access example.