Verify Credentials
Requests for a presentation can be sent to a holder wallet over a connection based on a set of Credential Templates.
The Login with a Credential example workflow demonstrates all the steps needed to request a presentation from a holder wallet based on a specific credential template.
To understand how to work with actions in more depth, check out the section on working with actions.
Request Presentation
Name: didcomm/requestPresentation
Description: Request a presentation from a connection.
Version: v1
Input
The attributes key takes the following input:
Parameter | Type | Description | Required |
---|---|---|---|
connectionId | string | The identifier of the connection. | ✅ |
anoncreds | AnoncredsPresentationRequestInput | The Anoncreds presentation request. | ✅ |
comment | string | An optional comment sent with the exchange to provide context. This property may not be displayed by the receiving party. | ❌ |
Output
The DIDComm presentation exchange that has been completed and verified.
Parameter | Type | Description | Required |
---|---|---|---|
presentationExchange | DidcommPresentationExchange | The presentation exchange. | ✅ |
Usage
Currently only the anoncreds
format is supported (See standards and protocols).
actions:
- id: requestPresentation
name: didcomm/requestPresentation@v1
attributes:
connectionId: fc4d02e3-389f-4d1f-89f6-55952b084fcb
anoncreds:
name: Access Level Request
version: '1.0.0'
attributes:
- names:
- Name
- Access Level
restrictions:
- credentialDefinitionId: 'did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/9703ceb3-cda2-4315-8f7e-ebceaf351aa7'
Request Presentation with an Invitation
Name: didcomm/createPresentationRequestInvitation
Description: Request a presentation with an invitation.
Version: v1
Input
The attributes key takes the following input:
Parameter | Type | Description | Required |
---|---|---|---|
anoncreds | AnoncredsPresentationRequestInput | The Anoncreds presentation request. | ✅ |
invitation | InvitationInput | The invitation properties. | ❌ |
comment | string | An optional comment sent with the exchange to provide context. This property may not be displayed by the receiving party. | ❌ |
Output
The DIDComm presentation exchange that has been completed and verified.
Parameter | Type | Description | Required |
---|---|---|---|
presentationExchange | DidcommPresentationExchange | The presentation exchange. | ✅ |
invitation | Invitation | The invitation to request the presentation. | ✅ |
Types
Input
InvitationInput
Parameter | Type | Description | Required |
---|---|---|---|
alias | string | Alias for the connection | ❌ |
label | string | Label for the invitation. Will be shared with the other party. | ❌ Defaults to team name |
imageUrl | string | Image URL to be included in the invitation. | ❌ |
createConnection | boolean | Whether to create a connection as part of the exchange. This allows to directly send messages to this connection in the future, without needing to create an out of band invitation first (see for example didcomm/requestPresentation ). | ❌ Defaults to true |
goal | string | Human readable string that describes the goal for creating the invitation. | ❌ |
goalCode | string | Machine readable string that describes the goal for creating the invitation. Commonly used values for goalCode are issue-vc , request-proof , create-account , or p2p-messaging , however as this is a proof request invitation, the goal code of request-proof could be assumed. | ❌ |
invitationDid | did:web | Use a specific did for the invitation, allowing the receiver to recognize the did, or reuse an existing connection based on the DID. The connection will still use a 'did:peer' did for the connection, this is only for the invitation. | ❌ |
AnoncredsPresentationRequestInput
The AnoncredsPresentationRequestInput
type contains the required information to send an Anoncreds presentation request:
Parameter | Type | Description | Required |
---|---|---|---|
name | string | The name of the presentation request. | ✅ |
version | string | The version of the presentation request, must match a version (eg. 1 or 1.1 or 1.1.1). If this parameter is unspecified, version 1.0.0 will be used by default. | ❌ |
attributes | AnoncredsPresentationRequestRequestedAttributes[] | The requested attributes. | ❌ |
predicates | AnoncredsPresentationRequestRequestedPredicates[] | The requested predicates. | ❌ |
requireNonRevoked | boolean | Whether the credentials should be non-revoked. If a credential is not revocable, this property will not have an effect. Default to false . | ❌ |
Output
Invitation
Parameter | Type | Description | Required |
---|---|---|---|
invitationUrl | string | The invitation as a short URL. valid for 7 days | ✅ |
fullInvitationUrl | string | The invitation encoded as URL. | ✅ |
DidcommPresentationExchange
Parameter | Type | Description | Required |
---|---|---|---|
presentationExchangeId | string | The identifier of the presentation exchange. | ✅ |
status | string | The status of the presentation exchange. For completed presentation exchanges the states will always be presentationReceived . | ✅ |
threadId | string | The identifier of the thread. This identifier is shared between the holder and verifier, and allows to correlate the exchange. | ✅ |
createdAt | number | Timestamp at which the presentation exchange is initiated in milliseconds since epoch. | ✅ |
anoncreds | DidcommPresentationExchangeAnoncreds | The anoncreds presentation data from the presentation exchange. Currently only the request and presentation are included. | ✅ |
connectionId | string | The identifier of the connection associated with the presentation exchange. Will be undefined for presentation exchanges without a connection. | ❌ |
DidcommPresentationExchangeAnoncreds
Parameter | Type | Description | Required |
---|---|---|---|
request | AnoncredsPresentationRequest | Data associated with the Anoncreds presentation request | ✅ |
presentation | AnoncredsPresentation | Data associated with the Anoncreds presentation | ❌ |
AnoncredsPresentationRequest
Parameter | Type | Description | Required |
---|---|---|---|
name | string | The name of the presentation request. | ✅ |
version | string | The version of the presentation request. | ✅ |
requireNonRevoked | string | Whether the credentials should be non-revoked. If a credential is not revocable, this property will not have an effect. | ✅ |
attributes | AnoncredsPresentationRequestRequestedAttributes[] | The requested attributes. | ✅ |
predicates | AnoncredsPresentationRequestRequestedPredicates[] | The requested predicates. | ✅ |
AnoncredsPresentationRequestRequestedAttributes
Parameter | Type | Description | Required |
---|---|---|---|
names | string[] | The names of the attributes in the credential that a presentation is being requested for. The name must be present in the schema associated with the credential definition. | ✅ |
restrictions | AnoncredsPresentationRequestRestrictions[] | The restrictions for the requested attribute. | ✅ |
AnoncredsPresentationRequestRequestedPredicates
Parameter | Type | Description | Required |
---|---|---|---|
name | string | The name of the attribute in the credential that a predicate presentation is being requested for. The name must be present in the schema associated with the credential definition. | ✅ |
predicateType | "greaterThan" | "lessThan" | "greaterThanOrEqualTo" | "lessThanOrEqualTo" | The operator for the predicate. | ✅ |
predicateValue | number | The value of the predicate. | ✅ |
restrictions | AnoncredsPresentationRequestRestrictions[] | The restrictions for the requested predicate. | ❌ |
AnoncredsPresentationRequestRestrictions
As used in attributes
and predicates
.
Parameter | Type | Description | Required |
---|---|---|---|
credentialDefinitionId | string | The credential definition Id. | Either schemaId or credentialDefinitionId must be present. |
schemaId | string | The schema id. | Either schemaId or credentialDefinitionId must be present. |
AnoncredsPresentation
Parameter | Type | Description | Required |
---|---|---|---|
attributes | AnoncredsPresentationRevealedAttributes[] | The attributes requested with the presentation request. | ✅ |
predicates | AnoncredsPresentationRevealedPredicates[] | The predicates requested with the presentation request. | ✅ |
AnoncredsPresentationRevealedAttributes
Parameter | Type | Description | Required |
---|---|---|---|
value | object | Object containing key-value pairs mapping requested attributes by it's name to to the associated value. | ✅ |
schemaId | string | The schema Id. | ✅ |
credentialDefinitionId | string | The credential definition Id. | ✅ |
selfAttested | boolean | Whether the attribute is self attested. | ✅ |
AnoncredsPresentationRevealedPredicates
Parameter | Type | Description | Required |
---|---|---|---|
name | string | The name of the attribute in the credential that a predicate proof is being requested for. The name must be present in the schema associated with the credential definition. | ✅ |
predicateType | "greaterThan" | "lessThan" | "greaterThanOrEqualTo" | "lessThanOrEqualTo" | The operator for the predicate. | ✅ |
predicateValue | number | The value of the predicate. | ✅ |
schemaId | string | The schema Id. | ✅ |
credentialDefinitionId | string | The credential definition Id. | ✅ |
selfAttested | boolean | Whether the attribute is self attested. | ✅ |