bls

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DomainProposal is a signature for proposing a block.
	DomainProposal = iota

	// DomainAttestation is a signature for an attestation.
	DomainAttestation

	// DomainDeposit is a signature for validating a deposit.
	DomainDeposit

	// DomainExit is a signature for a validator exit.
	DomainExit

	// DomainRandao is for the randao signature.
	DomainRandao
)

Variables

View Source
var EmptySignature, _ = DeserializeSignature([48]byte{
	0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
})

EmptySignature is an empty signature.

Functions

func VerifyAggregate

func VerifyAggregate(pubkeys []*PublicKey, msgs [][]byte, signature *Signature, domain uint64) bool

VerifyAggregate verifies a signature over many messages.

func VerifyAggregateCommon

func VerifyAggregateCommon(pubkeys []*PublicKey, msg []byte, signature *Signature, domain uint64) bool

VerifyAggregateCommon verifies a signature over a common message.

func VerifySig

func VerifySig(pub *PublicKey, msg []byte, sig *Signature, domain uint64) (bool, error)

VerifySig against a public key.

Types

type PublicKey

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

PublicKey corresponding to secret key used in the BLS scheme.

func AggregatePubKeys

func AggregatePubKeys(pubkeys []*PublicKey) *PublicKey

AggregatePubKeys aggregates some public keys into one.

func DeserializePublicKey

func DeserializePublicKey(b [96]byte) (*PublicKey, error)

DeserializePublicKey deserialies a public key from the provided bytes.

func NewAggregatePublicKey

func NewAggregatePublicKey() *PublicKey

NewAggregatePublicKey creates a blank public key.

func (*PublicKey) AggregatePubKey

func (p *PublicKey) AggregatePubKey(other *PublicKey)

AggregatePubKey adds another public key to this one.

func (PublicKey) Copy

func (p PublicKey) Copy() PublicKey

Copy returns a copy of the public key

func (PublicKey) Equals

func (p PublicKey) Equals(other PublicKey) bool

Equals checks if two public keys are equal.

func (PublicKey) Serialize

func (p PublicKey) Serialize() [96]byte

Serialize serializes a public key to bytes.

func (PublicKey) String

func (p PublicKey) String() string

type SecretKey

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

SecretKey used in the BLS scheme.

func DeserializeSecretKey

func DeserializeSecretKey(b [32]byte) SecretKey

DeserializeSecretKey deserializes a secret key from bytes.

func RandSecretKey

func RandSecretKey(r io.Reader) (*SecretKey, error)

RandSecretKey generates a random key given a byte reader.

func (SecretKey) DerivePublicKey

func (s SecretKey) DerivePublicKey() *PublicKey

DerivePublicKey derives a public key from a secret key.

func (SecretKey) Serialize

func (s SecretKey) Serialize() [32]byte

Serialize serializes a secret key to bytes.

type Signature

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

Signature used in the BLS signature scheme.

func AggregateSigs

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

AggregateSigs puts multiple signatures into one using the underlying BLS sum functions.

func DeserializeSignature

func DeserializeSignature(b [48]byte) (*Signature, error)

DeserializeSignature deserializes a binary signature into the actual signature.

func NewAggregateSignature

func NewAggregateSignature() *Signature

NewAggregateSignature creates a blank signature key.

func Sign

func Sign(sec *SecretKey, msg []byte, domain uint64) (*Signature, error)

Sign a message using a secret key - in a beacon/validator client, this key will come from and be unlocked from the account keystore.

func (*Signature) AggregateSig

func (s *Signature) AggregateSig(other *Signature)

AggregateSig adds another signature to this one.

func (Signature) Copy

func (s Signature) Copy() *Signature

Copy returns a copy of the signature.

func (Signature) Serialize

func (s Signature) Serialize() [48]byte

Serialize gets the binary representation of the signature.

Jump to

Keyboard shortcuts

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