Claims
In DID Connect, a 'claim' is a specific piece of information or an action you request from a user's wallet. Claims are the fundamental building blocks for any interaction. You can ask for profile information like a name and email, request a signature for a transaction, or verify ownership of a digital asset like an NFT.
Each authentication request your application makes is composed of one or more claims. The user sees these requests in their wallet, and they can approve or deny each one individually.
Available Claim Types#
DID Connect supports a range of claim types to cover common use cases. Here is a summary of the available claims:
Claim Type | Purpose |
|---|---|
| Asks the user to select a DID account to proceed. |
| Requests specific profile information like name or email. |
| Asks the user to sign a message or transaction. |
| Asks the user to complete and sign a partial transaction. |
| Requests the user to agree to terms, a policy, or a statement. |
| Asks the user to present a Verifiable Credential (VC). |
| Asks the user to present a digital asset (NFT). |
| A flexible claim that accepts either an asset or a VC. |
| Asks the wallet to generate a new key pair for the user. |
| Asks the wallet to derive a shared encryption key. |
How to Use Claims#
You define the claims your application needs in the claims object when you configure an authentication endpoint using walletHandlers.attach. The key is the claim type, and the value can be true for default settings or an object for specific configurations.
Here is an example of requesting a user's full name and asking them to sign a login message:
// In your Express.js route setup
walletHandlers.attach({
app,
action: 'login',
claims: {
// Request the user's full name from their profile
profile: {
items: ['fullName'],
},
// Request a signature on a simple text message
signature: {
typeUrl: 'mime:text/plain',
display: 'A simple login confirmation message.',
origin: 'Welcome to our application!',
},
},
onAuth: (req, res, claims) => {
// Handle the verified claims from the wallet
console.log('User profile:', claims.profile);
console.log('User signature:', claims.signature);
res.json({ status: 'ok', claims });
},
});In this setup, when a user scans the QR code, their wallet will prompt them to share their full name and sign the message "Welcome to our application!". If they approve, the onAuth callback will receive the verified data.
Claims are versatile and can be combined to create powerful user workflows. For a complete reference of every parameter for each claim type, see the Claim Types API Reference.
To see claims in action, explore our How-to Guides, such as how to request a Verifiable Credential or request a signature.