blst

package
v0.0.0-...-2ae2f20 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package blst implements a go-wrapper around a library implementing the BLS12-381 curve and signature scheme. This package exposes a public API for verifying and aggregating BLS signatures used by Ethereum.

This implementation uses the library written by Supranational, blst.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsZero

func IsZero(sKey []byte) bool

IsZero checks if the secret key is a zero key.

func PublicKeyFromBytes

func PublicKeyFromBytes(pubKey []byte) (bls.PubKey, error)

PublicKeyFromBytes creates a BLS public key from a BigEndian byte slice.

func RandKey

func RandKey() (bls.SecretKey, error)

RandKey creates a new private key using a random method provided as an io.Reader.

func SecretKeyFromBytes

func SecretKeyFromBytes(privKey []byte) (bls.SecretKey, error)

SecretKeyFromBytes creates a BLS private key from a BigEndian byte slice.

func SignatureFromBytes

func SignatureFromBytes(sig []byte) (bls.Signature, error)

SignatureFromBytes creates a BLS signature from a LittleEndian byte slice.

func SignatureFromBytesNoValidation

func SignatureFromBytesNoValidation(sig []byte) (bls.Signature, error)

SignatureFromBytesNoValidation creates a BLS signature from a LittleEndian byte slice. It does not validate that the signature is in the BLS group

func VerifySignature

func VerifySignature(sig []byte, msg [32]byte, pubKey bls.PubKey) (bool, error)

VerifySignature verifies a single signature using public key and message.

func VerifySignaturePubkeyBytes

func VerifySignaturePubkeyBytes(
	pubKey []byte,
	msg []byte,
	signature []byte,
) bool

VerifySignaturePubkeyBytes checks if a given signature is valid for a message and public key. It returns true if the signature is valid, otherwise it panics if an error occurs during the verification process.

Types

type PublicKey

type PublicKey struct {
	// contains filtered or unexported fields
}

PublicKey used in the BLS signature scheme.

func (*PublicKey) Copy

func (p *PublicKey) Copy() bls.PubKey

Copy the public key to a new pointer reference.

func (*PublicKey) Equals

func (p *PublicKey) Equals(p2 bls.PubKey) bool

Equals checks if the provided public key is equal to the current one.

func (*PublicKey) Marshal

func (p *PublicKey) Marshal() []byte

Marshal a public key into a LittleEndian byte slice.

type Signature

type Signature struct {
	// contains filtered or unexported fields
}

Signature used in the BLS signature scheme.

func (*Signature) Copy

func (s *Signature) Copy() bls.Signature

Copy returns a full deep copy of a signature.

func (*Signature) Marshal

func (s *Signature) Marshal() []byte

Marshal a signature into a LittleEndian byte slice.

func (*Signature) Verify

func (s *Signature) Verify(pubKey bls.PubKey, msg []byte) bool

Verify a signature using a public key and message.

Jump to

Keyboard shortcuts

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