github.com/yimialmonte/fabric@v2.1.1+incompatible/core/handlers/endorsement/api/endorsement.go (about) 1 /* 2 Copyright IBM Corp. 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 24 // Plugin endorses a proposal response 25 type Plugin interface { 26 // Endorse signs the given payload(ProposalResponsePayload bytes), and optionally mutates it. 27 // Returns: 28 // The Endorsement: A signature over the payload, and an identity that is used to verify the signature 29 // The payload that was given as input (could be modified within this function) 30 // Or error on failure 31 Endorse(payload []byte, sp *peer.SignedProposal) (*peer.Endorsement, []byte, error) 32 33 // Init injects dependencies into the instance of the Plugin 34 Init(dependencies ...Dependency) error 35 } 36 37 // PluginFactory creates a new instance of a Plugin 38 type PluginFactory interface { 39 New() Plugin 40 }