bls

package
v1.0.0-rc-0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 16 Imported by: 3

Documentation

Index

Constants

View Source
const PrivateKeySize = 32
View Source
const PublicKeySize = 96
View Source
const SignatureSize = 48

Variables

This section is empty.

Functions

func VerifyAggregated

func VerifyAggregated(sig *Signature, pubs []*PublicKey, msg []byte) error

Types

type PrivateKey

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

func KeyGen

func KeyGen(ikm, keyInfo []byte) (*PrivateKey, error)

KeyGen generates a private key deterministically from a secret octet string IKM and an optional octet string keyInfo. Based on https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-bls-signature-04#section-2.3

func PrivateKeyFromBytes

func PrivateKeyFromBytes(data []byte) (*PrivateKey, error)

PrivateKeyFromBytes constructs a BLS private key from the raw bytes.

func PrivateKeyFromString

func PrivateKeyFromString(text string) (*PrivateKey, error)

PrivateKeyFromString decodes the string encoding of a BLS private key and returns the private key if text is a valid encoding for BLS private key.

func (*PrivateKey) Bytes

func (prv *PrivateKey) Bytes() []byte

Bytes return the raw bytes of the private key.

func (*PrivateKey) EqualsTo

func (prv *PrivateKey) EqualsTo(right crypto.PrivateKey) bool

func (*PrivateKey) PublicKey

func (prv *PrivateKey) PublicKey() crypto.PublicKey

func (*PrivateKey) PublicKeyNative added in v0.15.0

func (prv *PrivateKey) PublicKeyNative() *PublicKey

func (*PrivateKey) Sign

func (prv *PrivateKey) Sign(msg []byte) crypto.Signature

Sign calculates the signature from the private key and given message. It's defined in section 2.6 of the spec: CoreSign.

func (*PrivateKey) SignNative added in v0.15.0

func (prv *PrivateKey) SignNative(msg []byte) *Signature

func (*PrivateKey) String

func (prv *PrivateKey) String() string

String returns a human-readable string for the BLS private key.

type PublicKey

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

func PublicKeyAggregate added in v0.15.0

func PublicKeyAggregate(pubs ...*PublicKey) *PublicKey

func PublicKeyFromBytes

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

PublicKeyFromBytes constructs a BLS public key from the raw bytes.

func PublicKeyFromString

func PublicKeyFromString(text string) (*PublicKey, error)

PublicKeyFromString decodes the string encoding of a BLS public key and returns the public key if text is a valid encoding for BLS public key.

func (*PublicKey) AccountAddress added in v0.15.0

func (pub *PublicKey) AccountAddress() crypto.Address

func (*PublicKey) Bytes

func (pub *PublicKey) Bytes() []byte

func (*PublicKey) Decode

func (pub *PublicKey) Decode(r io.Reader) error

func (*PublicKey) Encode

func (pub *PublicKey) Encode(w io.Writer) error

func (*PublicKey) EqualsTo

func (pub *PublicKey) EqualsTo(right crypto.PublicKey) bool

func (*PublicKey) MarshalCBOR

func (pub *PublicKey) MarshalCBOR() ([]byte, error)

func (*PublicKey) String

func (pub *PublicKey) String() string

String returns a human-readable string for the BLS public key.

func (*PublicKey) UnmarshalCBOR

func (pub *PublicKey) UnmarshalCBOR(bs []byte) error

func (*PublicKey) ValidatorAddress added in v0.15.0

func (pub *PublicKey) ValidatorAddress() crypto.Address

func (*PublicKey) Verify

func (pub *PublicKey) Verify(msg []byte, sig crypto.Signature) error

The Verify checks that a signature is valid for the given message and public key. It's defined in section 2.6 of the spec: CoreVerify.

func (*PublicKey) VerifyAddress

func (pub *PublicKey) VerifyAddress(addr crypto.Address) error

type Signature

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

func SignatureAggregate added in v0.15.0

func SignatureAggregate(sigs ...*Signature) *Signature

func SignatureFromBytes

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

SignatureFromBytes constructs a BLS signature from the raw bytes.

func SignatureFromString

func SignatureFromString(text string) (*Signature, error)

func (*Signature) Bytes

func (sig *Signature) Bytes() []byte

func (*Signature) Decode

func (sig *Signature) Decode(r io.Reader) error

func (*Signature) Encode

func (sig *Signature) Encode(w io.Writer) error

func (*Signature) EqualsTo

func (sig *Signature) EqualsTo(right crypto.Signature) bool

func (*Signature) MarshalCBOR

func (sig *Signature) MarshalCBOR() ([]byte, error)

func (*Signature) String

func (sig *Signature) String() string

func (*Signature) UnmarshalCBOR

func (sig *Signature) UnmarshalCBOR(bs []byte) error

type ValidatorKey added in v0.15.0

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

ValidatorKey wraps a BLS private key, caching its public key and validator address.

func NewValidatorKey added in v0.15.0

func NewValidatorKey(prv *PrivateKey) *ValidatorKey

func (*ValidatorKey) Address added in v0.15.0

func (key *ValidatorKey) Address() crypto.Address

func (*ValidatorKey) PrivateKey added in v0.15.0

func (key *ValidatorKey) PrivateKey() *PrivateKey

func (*ValidatorKey) PublicKey added in v0.15.0

func (key *ValidatorKey) PublicKey() *PublicKey

func (*ValidatorKey) Sign added in v0.15.0

func (key *ValidatorKey) Sign(data []byte) *Signature

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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