github.com/hyperledger/aries-framework-go@v0.3.2/pkg/doc/presexch/README.md (about) 1 # Presentation Exchange 2 3 This document shows how to use [Presentation Exchange](https://identity.foundation/presentation-exchange) by examples. 4 Code examples can be found [here](example_test.go). 5 6 1. This example demonstrates `predicate` and `limit_disclosure` usage. 7 The `presentation definition` below requires field `age` to be greater or equal to 18. 8 Also, we have `limit_disclosure=true` which requires that output data is limited to the entries specified in the `fields` property. 9 The `predicate` means that the result should be expressed as a boolean value. 10 ```json 11 { 12 "id": "31e2f0f1-6b70-411d-b239-56aed5321884", 13 "purpose": "To sell you a drink we need to know that you are an adult.", 14 "input_descriptors": [ 15 { 16 "id": "867bfe7a-5b91-46b2-9ba4-70028b8d9cc8", 17 "purpose": "Your age should be greater or equal to 18.", 18 "schema": [ 19 { 20 "uri": "https://www.w3.org/TR/vc-data-model/#types" 21 } 22 ], 23 "constraints": { 24 "limit_disclosure": true, 25 "fields": [ 26 { 27 "path": [ 28 "$.age" 29 ], 30 "filter": { 31 "type": "integer", 32 "minimum": 18 33 }, 34 "predicate": "required" 35 } 36 ] 37 } 38 } 39 ] 40 } 41 ``` 42 Let's say we have such a credential in our database. 43 ```json 44 { 45 "@context": [ 46 "https://www.w3.org/2018/credentials/v1" 47 ], 48 "age": 21, 49 "credentialSchema": [ 50 { 51 "id": "https://www.w3.org/TR/vc-data-model/#types" 52 } 53 ], 54 "first_name": "Jesse", 55 "id": "2dc74354-e965-4883-be5e-bfec48bf60c7", 56 "issuer": "", 57 "last_name": "Pinkman", 58 "type": "VerifiableCredential" 59 } 60 ``` 61 As a result, we will have the following `verifiable presentation`: 62 ```json 63 { 64 "@context": [ 65 "https://www.w3.org/2018/credentials/v1", 66 "https://identity.foundation/presentation-exchange/submission/v1" 67 ], 68 "presentation_submission": { 69 "id": "accd5adf-1dbf-4ed9-9ba2-d687476126cb", 70 "definition_id": "31e2f0f1-6b70-411d-b239-56aed5321884", 71 "descriptor_map": [ 72 { 73 "id": "867bfe7a-5b91-46b2-9ba4-70028b8d9cc8", 74 "format": "ldp_vp", 75 "path": "$.verifiableCredential[0]" 76 } 77 ] 78 }, 79 "type": [ 80 "VerifiablePresentation", 81 "PresentationSubmission" 82 ], 83 "verifiableCredential": [ 84 { 85 "@context": [ 86 "https://www.w3.org/2018/credentials/v1" 87 ], 88 "age": true, 89 "credentialSchema": [ 90 { 91 "id": "https://www.w3.org/TR/vc-data-model/#types" 92 } 93 ], 94 "credentialSubject": null, 95 "id": "2dc74354-e965-4883-be5e-bfec48bf60c7", 96 "issuer": "", 97 "type": "VerifiableCredential" 98 } 99 ] 100 } 101 ``` 102 103 As you can see the VP has a credential without `first_name` and `last_name` (because of `limit_disclosure`). 104 Also, instead of `age`, we have a boolean value (because of `predicate`).