Documentation
¶
Overview ¶
Package bls12381 provides high-performance BLS12-381 operations using BLST. This implementation uses the supranational/blst library for optimal performance.
Index ¶
- Constants
- Variables
- func AggregateVerify(pubkeys []*PublicKey, messages [][]byte, signature *Signature, dst []byte) bool
- func BatchVerify(pubkeys []*PublicKey, messages [][]byte, signatures []*Signature, dst []byte) bool
- func FastAggregateVerify(pubkeys []*PublicKey, message []byte, signature *Signature, dst []byte) bool
- type AggregatePublicKey
- type AggregateSignature
- type PublicKey
- type SecretKey
- type Signature
Constants ¶
const DefaultDST = "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_"
DefaultDST is the default domain separation tag for signatures
Variables ¶
var ( // ErrInvalidPoint is returned when a point is invalid ErrInvalidPoint = errors.New("invalid point") // ErrInvalidScalar is returned when a scalar is invalid ErrInvalidScalar = errors.New("invalid scalar") // ErrInvalidPublicKey is returned when a public key is invalid ErrInvalidPublicKey = errors.New("invalid public key") // ErrInvalidSignature is returned when a signature is invalid ErrInvalidSignature = errors.New("invalid signature") // ErrEmptyInput is returned when input is empty ErrEmptyInput = errors.New("empty input") )
Common errors
Functions ¶
func AggregateVerify ¶
func AggregateVerify(pubkeys []*PublicKey, messages [][]byte, signature *Signature, dst []byte) bool
AggregateVerify verifies an aggregated signature for different messages
func BatchVerify ¶
BatchVerify verifies multiple signatures in a batch
Types ¶
type AggregatePublicKey ¶
type AggregatePublicKey struct {
// contains filtered or unexported fields
}
AggregatePublicKey represents an aggregated public key
func AggregatePubKeys ¶
func AggregatePubKeys(pubkeys []*PublicKey) (*AggregatePublicKey, error)
AggregatePubKeys aggregates multiple public keys
type AggregateSignature ¶
type AggregateSignature struct {
// contains filtered or unexported fields
}
AggregateSignature represents an aggregated signature
func AggregateSignatures ¶
func AggregateSignatures(signatures []*Signature) (*AggregateSignature, error)
AggregateSignatures aggregates multiple signatures
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey represents a BLS public key (G1 point)
func NewPublicKey ¶
NewPublicKey creates a new public key from bytes
func (*PublicKey) Deserialize ¶
Deserialize deserializes a public key from compressed format
type SecretKey ¶
type SecretKey struct {
// contains filtered or unexported fields
}
SecretKey represents a BLS secret key
func GenerateKey ¶
GenerateKey generates a new random secret key
func GenerateKeyFromSeed ¶
GenerateKeyFromSeed generates a secret key from a seed
func NewSecretKey ¶
NewSecretKey creates a new secret key from bytes
func (*SecretKey) Deserialize ¶
Deserialize deserializes a secret key
func (*SecretKey) GetPublicKey ¶
GetPublicKey derives the public key from a secret key
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature represents a BLS signature (G2 point)
func NewSignature ¶
NewSignature creates a new signature from bytes
func (*Signature) Deserialize ¶
Deserialize deserializes a signature from compressed format