Documentation ¶
Overview ¶
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.
Index ¶
- Constants
- func HashWithDomain(messageHash [32]byte, domain [8]byte) []byte
- type PublicKey
- type SecretKey
- type Signature
- func (s *Signature) AggregateVerify(pubKeys []*PublicKey, msgs [][32]byte) bool
- func (s *Signature) FastAggregateVerify(pubKeys []*PublicKey, msg [32]byte) bool
- func (s *Signature) Marshal() []byte
- func (s *Signature) Verify(msg []byte, pub *PublicKey) bool
- func (s *Signature) VerifyAggregate(pubKeys []*PublicKey, msg [][32]byte) bool
Constants ¶
const CurveOrder = "52435875175126190479447740508185965837690552500527637822603658699938581184513"
CurveOrder for the BLS12-381 curve.
const DomainByteLength = 4
DomainByteLength length of domain byte array.
Variables ¶
This section is empty.
Functions ¶
func HashWithDomain ¶
HashWithDomain hashes 32 byte message and uint64 domain parameters a Fp2 element
Types ¶
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey used in the BLS signature scheme.
func NewAggregatePubkey ¶
func NewAggregatePubkey() *PublicKey
NewAggregatePubkey creates a blank public key.
func PublicKeyFromBytes ¶
PublicKeyFromBytes creates a BLS public key from a BigEndian byte slice.
type SecretKey ¶
type SecretKey struct {
// contains filtered or unexported fields
}
SecretKey used in the BLS signature scheme.
func RandKey ¶
func RandKey() *SecretKey
RandKey creates a new private key using a random method provided as an io.Reader.
func SecretKeyFromBytes ¶
SecretKeyFromBytes creates a BLS private key from a BigEndian byte slice.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature used in the BLS signature scheme.
func AggregateSignatures ¶
AggregateSignatures converts a list of signatures into a single, aggregated sig.
func NewAggregateSignature ¶
func NewAggregateSignature() *Signature
NewAggregateSignature creates a blank aggregate signature.
func SignatureFromBytes ¶
SignatureFromBytes creates a BLS signature from a LittleEndian byte slice.
func (*Signature) AggregateVerify ¶
AggregateVerify verifies each public key against its respective message. This is vulnerable to rogue public-key attack. Each user must provide a proof-of-knowledge of the public key.
func (*Signature) FastAggregateVerify ¶
FastAggregateVerify verifies all the provided pubkeys with their aggregated signature.