github.com/prysmaticlabs/prysm@v1.4.4/shared/bls/signature_set.go (about)

     1  package bls
     2  
     3  // SignatureSet refers to the defined set of
     4  // signatures and its respective public keys and
     5  // messages required to verify it.
     6  type SignatureSet struct {
     7  	Signatures [][]byte
     8  	PublicKeys []PublicKey
     9  	Messages   [][32]byte
    10  }
    11  
    12  // NewSet constructs an empty signature set object.
    13  func NewSet() *SignatureSet {
    14  	return &SignatureSet{
    15  		Signatures: [][]byte{},
    16  		PublicKeys: []PublicKey{},
    17  		Messages:   [][32]byte{},
    18  	}
    19  }
    20  
    21  // Join merges the provided signature set to out current one.
    22  func (s *SignatureSet) Join(set *SignatureSet) *SignatureSet {
    23  	s.Signatures = append(s.Signatures, set.Signatures...)
    24  	s.PublicKeys = append(s.PublicKeys, set.PublicKeys...)
    25  	s.Messages = append(s.Messages, set.Messages...)
    26  	return s
    27  }
    28  
    29  // Verify the current signature set using the batch verify algorithm.
    30  func (s *SignatureSet) Verify() (bool, error) {
    31  	return VerifyMultipleSignatures(s.Signatures, s.Messages, s.PublicKeys)
    32  }