prysm-pulse/shared/bls/bls.go
Nishant Das 353229d50a
Add New Secure Batch Signature Verification Method (#6479)
* add more tests
* gaz
* Merge refs/heads/master into addBLSMethods
* Merge refs/heads/master into addBLSMethods
* Merge refs/heads/master into addBLSMethods
* Merge refs/heads/master into addBLSMethods
2020-07-03 07:38:13 +00:00

45 lines
1.6 KiB
Go

// Package bls implements a go-wrapper around a library implementing the
// the BLS12-381 curve and signature scheme. This package exposes a public API for
// verifying and aggregating BLS signatures used by Ethereum 2.0.
package bls
import (
"github.com/prysmaticlabs/prysm/shared/bls/herumi"
"github.com/prysmaticlabs/prysm/shared/bls/iface"
)
// SecretKeyFromBytes creates a BLS private key from a BigEndian byte slice.
func SecretKeyFromBytes(privKey []byte) (SecretKey, error) {
return herumi.SecretKeyFromBytes(privKey)
}
// PublicKeyFromBytes creates a BLS public key from a BigEndian byte slice.
func PublicKeyFromBytes(pubKey []byte) (PublicKey, error) {
return herumi.PublicKeyFromBytes(pubKey)
}
// SignatureFromBytes creates a BLS signature from a LittleEndian byte slice.
func SignatureFromBytes(sig []byte) (Signature, error) {
return herumi.SignatureFromBytes(sig)
}
// AggregateSignatures converts a list of signatures into a single, aggregated sig.
func AggregateSignatures(sigs []iface.Signature) iface.Signature {
return herumi.AggregateSignatures(sigs)
}
// VerifyMultipleSignatures verifies multiple signatures for distinct messages securely.
func VerifyMultipleSignatures(sigs []iface.Signature, msgs [][32]byte, pubKeys []iface.PublicKey) (bool, error) {
return herumi.VerifyMultipleSignatures(sigs, msgs, pubKeys)
}
// NewAggregateSignature creates a blank aggregate signature.
func NewAggregateSignature() iface.Signature {
return herumi.NewAggregateSignature()
}
// RandKey creates a new private key using a random input.
func RandKey() iface.SecretKey {
return herumi.RandKey()
}