mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
353229d50a
* 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
45 lines
1.6 KiB
Go
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()
|
|
}
|