github.com/hyperledger/aries-framework-go@v0.3.2/pkg/didcomm/protocol/presentproof/middleware.go (about) 1 /* 2 Copyright SecureKey Technologies Inc. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package presentproof 8 9 import ( 10 "github.com/hyperledger/aries-framework-go/pkg/didcomm/common/service" 11 "github.com/hyperledger/aries-framework-go/pkg/doc/verifiable" 12 ) 13 14 // Handler describes middleware interface. 15 type Handler interface { 16 Handle(metadata Metadata) error 17 } 18 19 // Middleware function receives next handler and returns handler that needs to be executed. 20 type Middleware func(next Handler) Handler 21 22 // HandlerFunc is a helper type which implements the middleware Handler interface. 23 type HandlerFunc func(metadata Metadata) error 24 25 // Handle implements function to satisfy the Handler interface. 26 func (hf HandlerFunc) Handle(metadata Metadata) error { 27 return hf(metadata) 28 } 29 30 // Metadata provides helpful information for the processing. 31 type Metadata interface { 32 // Message contains the original inbound/outbound message 33 Message() service.DIDCommMsg 34 // Presentation is pointer to the message provided by the user through the Continue function. 35 Presentation() *PresentationV2 36 // ProposePresentation is pointer to the message provided by the user through the Continue function. 37 ProposePresentation() *ProposePresentationV2 38 // RequestPresentation is pointer to the message provided by the user through the Continue function. 39 RequestPresentation() *RequestPresentationV2 40 // PresentationV3 is pointer to the message provided by the user through the Continue function. 41 PresentationV3() *PresentationV3 42 // ProposePresentationV3 is pointer to the message provided by the user through the Continue function. 43 ProposePresentationV3() *ProposePresentationV3 44 // RequestPresentationV3 is pointer to the message provided by the user through the Continue function. 45 RequestPresentationV3() *RequestPresentationV3 46 // PresentationNames is a slice which contains presentation names provided by the user through the Continue function. 47 PresentationNames() []string 48 // StateName provides the state name 49 StateName() string 50 // Properties provides the possibility to set properties 51 Properties() map[string]interface{} 52 // GetAddProofFn provides function to sign the Presentation. 53 GetAddProofFn() func(presentation *verifiable.Presentation) error 54 }