Present a Verifiable Credential
Last updated
Was this helpful?
Last updated
Was this helpful?
Using the /present-proof-2.0
API endpoints, it is possible to present Verifiable Credentials, signed by a cheqd DID, in a few clicks or lines of code. This process enables secure and trustworthy sharing of verifiable credentials within the ACA-Py framework and cheqd ecosystem.
Use any supported method to create a connection with the Holder. Automated out-of-band protocol is recommended. You can follow the same steps as described in Issue a Verifiable Credential.
After connection is established, the Verifier can send a proof request to the Holder.
The request body will depend on the credential, but here is a sample.
{
"connection_id": "<verifier-to-holder-conn-id>",
"auto_verify": false,
"auto_remove": false,
"comment": "Presentation request from Issuer",
"presentation_request": {
"anoncreds": {
"name": "proof",
"version": "1.0",
"requested_predicates": {
"additionalProp1": {
"name": "score",
"p_value": 40,
"p_type": ">",
"restrictions": [{"cred_def_id": "<cred-def-id>"}]
}
},
"requested_attributes": {},
"non_revoked": {"to": <some-time-in-future>}
}
},
"trace": false
}
Holder can get the stored credentials from own wallet and format a proof to send to the Verifier.
Verifier receives the presentation via the connection, and can use the following API to verify. The response must have verified: true
.
/present-proof-2.0/send-request
Whether to remove the presentation exchange record on completion (overrides --preserve-exchange-records configuration setting)
Verifier choice to auto-verify proof presentation
Connection identifier
Whether to trace event (default false)
curl -L \
--request POST \
--url '/present-proof-2.0/send-request' \
--header 'Content-Type: application/json' \
--data '{
"auto_remove": true,
"comment": "text",
"presentation_request": {
"anoncreds": {
"non_revoked": {
"from": 1640995199,
"to": 1640995199
},
"name": "Proof request",
"nonce": "1",
"version": "1.0",
"requested_attributes": {
"ANY_ADDITIONAL_PROPERTY": {
"non_revoked": {
"from": 1640995199,
"to": 1640995199
},
"name": "favouriteDrink",
"names": [
"age"
],
"restrictions": [
{
"ANY_ADDITIONAL_PROPERTY": "did:(method):3:CL:20:tag"
}
]
}
},
"requested_predicates": {
"ANY_ADDITIONAL_PROPERTY": {
"non_revoked": {
"from": 1640995199,
"to": 1640995199
},
"p_value": 1,
"name": "index",
"p_type": ">=",
"restrictions": [
{
"ANY_ADDITIONAL_PROPERTY": "did:(method):3:CL:20:tag"
}
]
}
}
},
"dif": "[Circular Reference]",
"indy": {
"non_revoked": {
"from": 1640995199,
"to": 1640995199
},
"name": "Proof request",
"nonce": "1",
"version": "1.0",
"requested_attributes": {
"ANY_ADDITIONAL_PROPERTY": {
"non_revoked": {
"from": 1640995199,
"to": 1640995199
},
"name": "favouriteDrink",
"names": [
"age"
],
"restrictions": [
{
"ANY_ADDITIONAL_PROPERTY": "WgWxqztrNooG92RXvxSTWv:3:CL:20:tag"
}
]
}
},
"requested_predicates": {
"ANY_ADDITIONAL_PROPERTY": {
"non_revoked": {
"from": 1640995199,
"to": 1640995199
},
"p_value": 1,
"name": "index",
"p_type": ">=",
"restrictions": [
{
"ANY_ADDITIONAL_PROPERTY": "WgWxqztrNooG92RXvxSTWv:3:CL:20:tag"
}
]
}
}
}
},
"auto_verify": false,
"connection_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"trace": false
}'
{
"auto_verify": true,
"trace": true,
"auto_present": false,
"auto_remove": false,
"connection_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created_at": "2021-12-31T23:59:59Z",
"error_msg": "Invalid structure",
"initiator": "self",
"pres_ex_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"role": "prover",
"state": "proposal-sent",
"thread_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"updated_at": "2021-12-31T23:59:59Z",
"verified": "true",
"verified_msgs": [
"text"
],
"by_format": {
"pres": {},
"pres_proposal": {},
"pres_request": {}
},
"pres": {
"comment": "text",
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"@type": "https://didcomm.org/my-family/1.0/my-message-type",
"formats": [
{
"attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"format": "dif/presentation-exchange/submission@v1.0"
}
],
"presentations~attach": [
{
"data": {
"base64": "ey4uLn0=",
"json": "{\"sample\": \"content\"}",
"sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb",
"jws": {
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0",
"signatures": [
{
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0"
}
]
},
"links": [
"https://link.to/data"
]
},
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"byte_count": 1234,
"description": "view from doorway, facing east, with lights off",
"filename": "IMG1092348.png",
"lastmod_time": "2021-12-31T23:59:59Z",
"mime-type": "image/png"
}
]
},
"pres_proposal": {
"comment": "text",
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"@type": "https://didcomm.org/my-family/1.0/my-message-type",
"formats": [
{
"attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"format": "dif/presentation-exchange/submission@v1.0"
}
],
"proposals~attach": [
{
"data": {
"base64": "ey4uLn0=",
"json": "{\"sample\": \"content\"}",
"sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb",
"jws": {
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0",
"signatures": [
{
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0"
}
]
},
"links": [
"https://link.to/data"
]
},
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"byte_count": 1234,
"description": "view from doorway, facing east, with lights off",
"filename": "IMG1092348.png",
"lastmod_time": "2021-12-31T23:59:59Z",
"mime-type": "image/png"
}
]
},
"pres_request": {
"comment": "text",
"will_confirm": true,
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"@type": "https://didcomm.org/my-family/1.0/my-message-type",
"formats": [
{
"attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"format": "dif/presentation-exchange/submission@v1.0"
}
],
"request_presentations~attach": [
{
"data": {
"base64": "ey4uLn0=",
"json": "{\"sample\": \"content\"}",
"sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb",
"jws": {
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0",
"signatures": [
{
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0"
}
]
},
"links": [
"https://link.to/data"
]
},
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"byte_count": 1234,
"description": "view from doorway, facing east, with lights off",
"filename": "IMG1092348.png",
"lastmod_time": "2021-12-31T23:59:59Z",
"mime-type": "image/png"
}
]
}
}
/present-proof-2.0/records/{pres_ex_id}/send-presentation
Presentation exchange identifier
{"value":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}
Whether to remove the presentation exchange record on completion (overrides --preserve-exchange-records configuration setting)
Record trace information, based on agent configuration
Presentation specification for anoncreds
Optional Presentation specification for DIF, overrides the PresentationExchange record's PresRequest
Presentation specification for indy
curl -L \
--request POST \
--url '/present-proof-2.0/records/{pres_ex_id}/send-presentation' \
--header 'Content-Type: application/json' \
--data '{
"auto_remove": true,
"trace": true,
"anoncreds": {
"trace": false,
"requested_attributes": {
"ANY_ADDITIONAL_PROPERTY": {
"revealed": true,
"cred_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
},
"requested_predicates": {
"ANY_ADDITIONAL_PROPERTY": {
"cred_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"timestamp": 1640995199
}
},
"self_attested_attributes": {
"ANY_ADDITIONAL_PROPERTY": "self_attested_value"
}
},
"dif": {
"issuer_id": "text",
"presentation_definition": "[Circular Reference]",
"record_ids": {
"<input descriptor id_1>": [
"<record id_1>",
"<record id_2>"
],
"<input descriptor id_2>": [
"<record id>"
]
},
"reveal_doc": {
"@explicit": true,
"@requireAll": true,
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/security/bbs/v1"
],
"type": [
"VerifiableCredential",
"LabReport"
],
"issuanceDate": {},
"issuer": {},
"credentialSubject": {
"@explicit": true,
"@requireAll": true,
"Observation": [
{
"@explicit": true,
"@requireAll": true,
"effectiveDateTime": {}
}
]
}
}
},
"indy": {
"trace": false,
"requested_attributes": {
"ANY_ADDITIONAL_PROPERTY": {
"revealed": true,
"cred_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
},
"requested_predicates": {
"ANY_ADDITIONAL_PROPERTY": {
"cred_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"timestamp": 1640995199
}
},
"self_attested_attributes": {
"ANY_ADDITIONAL_PROPERTY": "self_attested_value"
}
}
}'
{
"auto_verify": true,
"trace": true,
"auto_present": false,
"auto_remove": false,
"connection_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created_at": "2021-12-31T23:59:59Z",
"error_msg": "Invalid structure",
"initiator": "self",
"pres_ex_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"role": "prover",
"state": "proposal-sent",
"thread_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"updated_at": "2021-12-31T23:59:59Z",
"verified": "true",
"verified_msgs": [
"text"
],
"by_format": {
"pres": {},
"pres_proposal": {},
"pres_request": {}
},
"pres": {
"comment": "text",
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"@type": "https://didcomm.org/my-family/1.0/my-message-type",
"formats": [
{
"attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"format": "dif/presentation-exchange/submission@v1.0"
}
],
"presentations~attach": [
{
"data": {
"base64": "ey4uLn0=",
"json": "{\"sample\": \"content\"}",
"sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb",
"jws": {
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0",
"signatures": [
{
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0"
}
]
},
"links": [
"https://link.to/data"
]
},
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"byte_count": 1234,
"description": "view from doorway, facing east, with lights off",
"filename": "IMG1092348.png",
"lastmod_time": "2021-12-31T23:59:59Z",
"mime-type": "image/png"
}
]
},
"pres_proposal": {
"comment": "text",
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"@type": "https://didcomm.org/my-family/1.0/my-message-type",
"formats": [
{
"attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"format": "dif/presentation-exchange/submission@v1.0"
}
],
"proposals~attach": [
{
"data": {
"base64": "ey4uLn0=",
"json": "{\"sample\": \"content\"}",
"sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb",
"jws": {
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0",
"signatures": [
{
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0"
}
]
},
"links": [
"https://link.to/data"
]
},
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"byte_count": 1234,
"description": "view from doorway, facing east, with lights off",
"filename": "IMG1092348.png",
"lastmod_time": "2021-12-31T23:59:59Z",
"mime-type": "image/png"
}
]
},
"pres_request": {
"comment": "text",
"will_confirm": true,
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"@type": "https://didcomm.org/my-family/1.0/my-message-type",
"formats": [
{
"attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"format": "dif/presentation-exchange/submission@v1.0"
}
],
"request_presentations~attach": [
{
"data": {
"base64": "ey4uLn0=",
"json": "{\"sample\": \"content\"}",
"sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb",
"jws": {
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0",
"signatures": [
{
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0"
}
]
},
"links": [
"https://link.to/data"
]
},
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"byte_count": 1234,
"description": "view from doorway, facing east, with lights off",
"filename": "IMG1092348.png",
"lastmod_time": "2021-12-31T23:59:59Z",
"mime-type": "image/png"
}
]
}
}
/present-proof-2.0/records/{pres_ex_id}/verify-presentation
Presentation exchange identifier
{"value":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}
curl -L \
--request POST \
--url '/present-proof-2.0/records/{pres_ex_id}/verify-presentation'
{
"auto_verify": true,
"trace": true,
"auto_present": false,
"auto_remove": false,
"connection_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created_at": "2021-12-31T23:59:59Z",
"error_msg": "Invalid structure",
"initiator": "self",
"pres_ex_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"role": "prover",
"state": "proposal-sent",
"thread_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"updated_at": "2021-12-31T23:59:59Z",
"verified": "true",
"verified_msgs": [
"text"
],
"by_format": {
"pres": {},
"pres_proposal": {},
"pres_request": {}
},
"pres": {
"comment": "text",
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"@type": "https://didcomm.org/my-family/1.0/my-message-type",
"formats": [
{
"attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"format": "dif/presentation-exchange/submission@v1.0"
}
],
"presentations~attach": [
{
"data": {
"base64": "ey4uLn0=",
"json": "{\"sample\": \"content\"}",
"sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb",
"jws": {
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0",
"signatures": [
{
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0"
}
]
},
"links": [
"https://link.to/data"
]
},
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"byte_count": 1234,
"description": "view from doorway, facing east, with lights off",
"filename": "IMG1092348.png",
"lastmod_time": "2021-12-31T23:59:59Z",
"mime-type": "image/png"
}
]
},
"pres_proposal": {
"comment": "text",
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"@type": "https://didcomm.org/my-family/1.0/my-message-type",
"formats": [
{
"attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"format": "dif/presentation-exchange/submission@v1.0"
}
],
"proposals~attach": [
{
"data": {
"base64": "ey4uLn0=",
"json": "{\"sample\": \"content\"}",
"sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb",
"jws": {
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0",
"signatures": [
{
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0"
}
]
},
"links": [
"https://link.to/data"
]
},
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"byte_count": 1234,
"description": "view from doorway, facing east, with lights off",
"filename": "IMG1092348.png",
"lastmod_time": "2021-12-31T23:59:59Z",
"mime-type": "image/png"
}
]
},
"pres_request": {
"comment": "text",
"will_confirm": true,
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"@type": "https://didcomm.org/my-family/1.0/my-message-type",
"formats": [
{
"attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"format": "dif/presentation-exchange/submission@v1.0"
}
],
"request_presentations~attach": [
{
"data": {
"base64": "ey4uLn0=",
"json": "{\"sample\": \"content\"}",
"sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb",
"jws": {
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0",
"signatures": [
{
"header": {
"kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
},
"protected": "ey4uLn0",
"signature": "ey4uLn0"
}
]
},
"links": [
"https://link.to/data"
]
},
"@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"byte_count": 1234,
"description": "view from doorway, facing east, with lights off",
"filename": "IMG1092348.png",
"lastmod_time": "2021-12-31T23:59:59Z",
"mime-type": "image/png"
}
]
}
}