Documentation
¶
Index ¶
Constants ¶
const ( // PublicKeyLen is the length of a serialized public key PublicKeyLen = 48 // PrivateKeyLen is the length of a serialized private key PrivateKeyLen = 32 // SignatureLen is the length of a serialized signature SignatureLen = 96 )
Variables ¶
var ( // ErrInvalidPublicKey is returned when a public key is invalid ErrInvalidPublicKey = errors.New("invalid public key") // ErrInvalidPrivateKey is returned when a private key is invalid ErrInvalidPrivateKey = errors.New("invalid private key") // ErrInvalidSignature is returned when a signature is invalid ErrInvalidSignature = errors.New("invalid signature") )
Functions ¶
func PublicKeyToBytes ¶
PublicKeyToBytes serializes a public key to bytes
func SignatureToBytes ¶
SignatureToBytes serializes a signature to bytes
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey represents a BLS private key
func GeneratePrivateKey ¶
func GeneratePrivateKey() (*PrivateKey, error)
GeneratePrivateKey generates a new random private key
func PrivateKeyFromBytes ¶
func PrivateKeyFromBytes(b []byte) (*PrivateKey, error)
PrivateKeyFromBytes deserializes a private key from bytes
func (*PrivateKey) Bytes ¶
func (sk *PrivateKey) Bytes() []byte
Bytes returns the byte representation of the private key
func (*PrivateKey) PublicKey ¶
func (sk *PrivateKey) PublicKey() *PublicKey
PublicKey returns the public key corresponding to the private key
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey represents a BLS public key
func AggregatePublicKeys ¶
AggregatePublicKeys aggregates multiple public keys This is a simplified implementation - in production use proper BLS12-381
func PublicFromPrivateKey ¶
func PublicFromPrivateKey(sk *PrivateKey) *PublicKey
PublicFromPrivateKey derives the public key from a private key This is a simplified implementation - in production use proper BLS12-381
func PublicKeyFromBytes ¶
PublicKeyFromBytes deserializes a public key from bytes
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature represents a BLS signature
func AggregateSignatures ¶
AggregateSignatures aggregates multiple signatures This is a simplified implementation - in production use proper BLS12-381
func Sign ¶
func Sign(sk *PrivateKey, msg []byte) (*Signature, error)
Sign creates a signature for a message This is a simplified implementation - in production use proper BLS12-381
func SignatureFromBytes ¶
SignatureFromBytes deserializes a signature from bytes