bls

package
v0.0.0-...-8ad0a2a Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLSfpByteSize = 48
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateSignature

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

AggregateSignature is a bls12-381 aggregate signature. The participants field contains the IDs of the replicas that participated in signature creation. This allows us to build an aggregated public key to verify the signature.

func Combine

func Combine(sigs ...*PartialSignature) (*AggregateSignature, error)

Combine aggregates some partial signatures into a single aggregate signature.

func (*AggregateSignature) Clone

Clone returns a copy of the aggregate signature.

func (*AggregateSignature) FromBytes

func (s *AggregateSignature) FromBytes(data []byte) (err error)

FromBytes unmarshals the aggregate signature from a byte slice.

func (*AggregateSignature) ToBytes

func (s *AggregateSignature) ToBytes() ([]byte, error)

ToBytes marshals the aggregate signature to a byte slice.

func (*AggregateSignature) Verify

func (s *AggregateSignature) Verify(qr quorum, msg []byte) error

AggregateVerify verifys if the aggregate signature is valid for the message.

type PartialSignature

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

PartialSignature is a bls12-381 partial signature. it contains the ID of the replicas that signs this signature.

func (*PartialSignature) FromBytes

func (s *PartialSignature) FromBytes(data []byte) (err error)

FromBytes unmarshals the partial signature from a byte slice.

func (*PartialSignature) ID

func (s *PartialSignature) ID() common.ID

ID returns the id of signer.

func (*PartialSignature) ToBytes

func (s *PartialSignature) ToBytes() ([]byte, error)

ToBytes marshals the partial signature to a byte slice.

func (*PartialSignature) Verify

func (s *PartialSignature) Verify(qr quorum, msg []byte) error

Verify verifys if the partial signature is valid for the message.

type PartialSignatureSet

type PartialSignatureSet []*PartialSignature

func (PartialSignatureSet) Len

func (set PartialSignatureSet) Len() int

func (PartialSignatureSet) Less

func (set PartialSignatureSet) Less(i, j int) bool

func (PartialSignatureSet) Swap

func (set PartialSignatureSet) Swap(i, j int)

type PrivateKey

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

PrivateKey is a bls12-381 private key.

func GeneratePrivateKey

func GeneratePrivateKey() *PrivateKey

GeneratePrivateKey generates a random private key.

func (*PrivateKey) FromBytes

func (k *PrivateKey) FromBytes(b []byte)

FromBytes unmarshals the private key from a byte slice.

func (*PrivateKey) Public

func (k *PrivateKey) Public() *PublicKey

Public returns the public key associated with this private key.

func (*PrivateKey) SignWithId

func (k *PrivateKey) SignWithId(msg []byte, id common.ID) (*PartialSignature, error)

SignWithId signs the message and generates a partial signature based on the ID.

func (PrivateKey) ToBytes

func (k PrivateKey) ToBytes() []byte

ToBytes marshals the private key to a byte slice.

type PublicKey

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

PublicKey is a bls12-381 public key.

func (*PublicKey) FromBytes

func (k *PublicKey) FromBytes(b []byte) (err error)

FromBytes unmarshals the public key from a byte slice.

func (*PublicKey) MarshalJSON

func (k *PublicKey) MarshalJSON() ([]byte, error)

func (PublicKey) ToBytes

func (k PublicKey) ToBytes() []byte

ToBytes marshals the public key to a byte slice.

func (*PublicKey) UnmarshalJSON

func (k *PublicKey) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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