github.com/MetalBlockchain/subnet-evm@v0.4.9/plugin/evm/message/signature_request.go (about)

     1  // (c) 2023, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package message
     5  
     6  import (
     7  	"context"
     8  	"fmt"
     9  
    10  	"github.com/MetalBlockchain/metalgo/ids"
    11  	"github.com/MetalBlockchain/metalgo/utils/crypto/bls"
    12  )
    13  
    14  var _ Request = SignatureRequest{}
    15  
    16  // SignatureRequest is used to request a warp message's signature.
    17  type SignatureRequest struct {
    18  	MessageID ids.ID `serialize:"true"`
    19  }
    20  
    21  func (s SignatureRequest) String() string {
    22  	return fmt.Sprintf("SignatureRequest(MessageID=%s)", s.MessageID.String())
    23  }
    24  
    25  func (s SignatureRequest) Handle(ctx context.Context, nodeID ids.NodeID, requestID uint32, handler RequestHandler) ([]byte, error) {
    26  	return handler.HandleSignatureRequest(ctx, nodeID, requestID, s)
    27  }
    28  
    29  // SignatureResponse is the response to a SignatureRequest.
    30  // The response contains a BLS signature of the requested message, signed by the responding node's BLS private key.
    31  type SignatureResponse struct {
    32  	Signature [bls.SignatureLen]byte `serialize:"true"`
    33  }