Help us shape the future of Go! Take the 2026 Go Developer Survey

bls

package
v0.15.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const PublicKeyLen = blst.BLST_P1_COMPRESS_BYTES
View Source
const SignatureLen = blst.BLST_P2_COMPRESS_BYTES

Variables

View Source
var (
	ErrNoPublicKeys              = errors.New("no public keys")
	ErrFailedPublicKeyDecompress = errors.New("couldn't decompress public key")
)
View Source
var (
	ErrFailedSignatureDecompress  = errors.New("couldn't decompress signature")
	ErrInvalidSignature           = errors.New("invalid signature")
	ErrNoSignatures               = errors.New("no signatures")
	ErrFailedSignatureAggregation = errors.New("couldn't aggregate signatures")
)

Functions

func PublicKeyToCompressedBytes

func PublicKeyToCompressedBytes(pk *PublicKey) []byte

PublicKeyToCompressedBytes returns the compressed big-endian format of the public key.

func PublicKeyToUncompressedBytes

func PublicKeyToUncompressedBytes(key *PublicKey) []byte

PublicKeyToUncompressedBytes returns the uncompressed big-endian format of the public key.

func SignatureToBytes

func SignatureToBytes(sig *Signature) []byte

SignatureToBytes returns the compressed big-endian format of the signature.

func Verify

func Verify(pk *PublicKey, sig *Signature, msg []byte) bool

Verify the [sig] of [msg] against the [pk]. The [sig] and [pk] may have been an aggregation of other signatures and keys. Invariant: [pk] and [sig] have both been validated.

func VerifyProofOfPossession

func VerifyProofOfPossession(pk *PublicKey, sig *Signature, msg []byte) bool

Verify the possession of the secret pre-image of [sk] by verifying a [sig] of [msg] against the [pk]. The [sig] and [pk] may have been an aggregation of other signatures and keys. Invariant: [pk] and [sig] have both been validated.

Types

type AggregatePublicKey

type AggregatePublicKey = blst.P1Aggregate

type AggregateSignature

type AggregateSignature = blst.P2Aggregate

type Ciphersuite

type Ciphersuite int
const (
	CiphersuiteSignature Ciphersuite = iota
	CiphersuiteProofOfPossession
)

func (Ciphersuite) Bytes

func (c Ciphersuite) Bytes() []byte

func (Ciphersuite) String

func (c Ciphersuite) String() string

type PublicKey

type PublicKey = blst.P1Affine

func AggregatePublicKeys

func AggregatePublicKeys(pks []*PublicKey) (*PublicKey, error)

AggregatePublicKeys aggregates a non-zero number of public keys into a single aggregated public key. Invariant: all [pks] have been validated.

func PublicKeyFromCompressedBytes

func PublicKeyFromCompressedBytes(pkBytes []byte) (*PublicKey, error)

PublicKeyFromCompressedBytes parses the compressed big-endian format of the public key into a public key.

func PublicKeyFromValidUncompressedBytes

func PublicKeyFromValidUncompressedBytes(pkBytes []byte) *PublicKey

PublicKeyFromValidUncompressedBytes parses the uncompressed big-endian format of the public key into a public key. It is assumed that the provided bytes are valid.

type Signature

type Signature = blst.P2Affine

func AggregateSignatures

func AggregateSignatures(sigs []*Signature) (*Signature, error)

AggregateSignatures aggregates a non-zero number of signatures into a single aggregated signature. Invariant: all [sigs] have been validated.

func SignatureFromBytes

func SignatureFromBytes(sigBytes []byte) (*Signature, error)

SignatureFromBytes parses the compressed big-endian format of the signature into a signature.

type Signer

type Signer interface {
	PublicKey() *PublicKey
	Sign(msg []byte) (*Signature, error)
	SignProofOfPossession(msg []byte) (*Signature, error)
}

Directories

Path Synopsis
signer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL