github.com/hyperledger/aries-framework-go@v0.3.2/pkg/client/presentproof/doc.go (about) 1 /* 2 Copyright SecureKey Technologies Inc. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 // Package presentproof provides support for the Present Proof Protocol 2.0: 8 // https://github.com/hyperledger/aries-rfcs/blob/master/features/0454-present-proof-v2/README.md. 9 // 10 // A protocol supporting a general purpose verifiable presentation exchange regardless of the specifics of 11 // the underlying verifiable presentation request and verifiable presentation format. 12 // 13 // 1. Create your client: 14 // 15 // client, err := presentproof.New(ctx) 16 // if err != nil { 17 // panic(err) 18 // } 19 // 20 // 2. Register an action event channel. 21 // 22 // actions := make(chan service.DIDCommAction) 23 // client.RegisterActionEvent(actions) 24 // 25 // 3. Handle incoming actions. 26 // 27 // for { 28 // select { 29 // case event := <-actions: 30 // piid := e.Properties.All()["piid"].(string) 31 // 32 // if event.Message.Type() == presentproof.ProposePresentationMsgType { 33 // // If Verifier is willing to accept the proposal. 34 // client.AcceptProposePresentationV2(piid, &RequestPresentationV2{}) 35 // // If Verifier is not willing to accept the proposal. 36 // client.DeclineProposePresentation(piid, reason) 37 // } 38 // 39 // if event.Message.Type() == presentproof.RequestPresentationMsgType { 40 // // If Prover is willing to accept a request. 41 // client.AcceptRequestPresentationV2(piid, &PresentationV2{}) 42 // // If Prover wants to counter a request they received with a proposal. 43 // client.NegotiateRequestPresentationV2(piid, &ProposePresentationV2{}) 44 // // If Prover is not willing to accept a request. 45 // client.DeclineRequestPresentation(piid, reason) 46 // } 47 // 48 // if event.Message.Type() == presentproof.PresentationMsgType { 49 // // If Verifier is willing to accept the presentation. 50 // client.AcceptPresentation(piid, names) 51 // // If Verifier is not willing to accept the presentation. 52 // client.DeclinePresentation(piid, reason) 53 // } 54 // 55 // if event.Message.Type() == presentproof.ProblemReportMsgType { 56 // Problem report message is triggered to notify client about the error. 57 // In that case, there is only one option - accept it. 58 // client.AcceptProblemReport(piid) 59 // } 60 // } 61 // } 62 // 63 // How to initiate the protocol? 64 // The protocol can be initiated by the Verifier or by the Prover. 65 // Prover initiates the protocol. 66 // client.SendProposePresentationV2(&ProposePresentationV2{}, myDID, theirDID) 67 // Verifier initiates the protocol. 68 // client.SendRequestPresentationV2(&RequestPresentationV2{}, myDID, theirDID) 69 // 70 package presentproof