mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-15 22:48:19 +00:00
fb8be4d555
* refactor BLS to expose an interface rather than a single implementation * Split up tests, gofmt, goimports, docs * godoc for signature.Copy() * more godocs * revert gomod / deps changes * rm newline * revert proto changes * rename bls12 to herumi for clarity
40 lines
1.3 KiB
Go
40 lines
1.3 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)
|
|
}
|
|
|
|
// 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()
|
|
}
|