github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/core/handlers/endorsement/api/endorsement.go (about) 1 /* 2 Copyright hechain. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package endorsement 8 9 import ( 10 "github.com/hyperledger/fabric-protos-go/peer" 11 ) 12 13 // Argument defines the argument for endorsement 14 type Argument interface { 15 Dependency 16 // Arg returns the bytes of the argument 17 Arg() []byte 18 } 19 20 // Dependency marks a dependency passed to the Init() method 21 type Dependency interface{} 22 23 // Plugin endorses a proposal response 24 type Plugin interface { 25 // Endorse signs the given payload(ProposalResponsePayload bytes), and optionally mutates it. 26 // Returns: 27 // The Endorsement: A signature over the payload, and an identity that is used to verify the signature 28 // The payload that was given as input (could be modified within this function) 29 // Or error on failure 30 Endorse(payload []byte, sp *peer.SignedProposal) (*peer.Endorsement, []byte, error) 31 32 // Init injects dependencies into the instance of the Plugin 33 Init(dependencies ...Dependency) error 34 } 35 36 // PluginFactory creates a new instance of a Plugin 37 type PluginFactory interface { 38 New() Plugin 39 }