bls

package
v0.0.0-...-7a2e46d Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLSPublicKeyLength int = 48
	BLSSecretKeyLength int = 32
	BLSSignatureLength int = 96
)

Variables

View Source
var (
	ErrDeserializeSecretKey   = errors.New("could not deserialize secret key from bytes")
	ErrInvalidPubkey          = errors.New("invalid pubkey")
	ErrInvalidPubkeyLength    = errors.New("invalid pubkey length")
	ErrInvalidSecretKeyLength = errors.New("invalid secret key length")
	ErrInvalidSignature       = errors.New("invalid signature")
	ErrInvalidSignatureLength = errors.New("invalid signature length")
	ErrUncompressPubkey       = errors.New("could not uncompress public key from bytes")
	ErrUncompressSignature    = errors.New("could not uncompress signature from bytes")
)

Functions

func GenerateNewKeypair

func GenerateNewKeypair() (*SecretKey, *PublicKey, error)

func RelayBLSPubKey

func RelayBLSPubKey(blsPubKey PublicKey) (ret phase0.BLSPubKey, err error)

func VerifySignature

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

func VerifySignatureBytes

func VerifySignatureBytes(msg, sigBytes, pkBytes []byte) (bool, error)

Types

type PublicKey

type PublicKey = blst.P1Affine

func PublicKeyFromBytes

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

func PublicKeyFromSecretKey

func PublicKeyFromSecretKey(sk *SecretKey) *PublicKey

type SecretKey

type SecretKey = blst.SecretKey

func GenerateRandomSecretKey

func GenerateRandomSecretKey() (*SecretKey, error)

func SecretKeyFromBytes

func SecretKeyFromBytes(skBytes []byte) (*SecretKey, error)

type Signature

type Signature = blst.P2Affine

func Sign

func Sign(sk *SecretKey, msg []byte) *Signature

func SignatureFromBytes

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

Jump to

Keyboard shortcuts

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