bls

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0, BSD-2-Clause Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// PublicKeySize represents the length in bytes of a BLS public key.
	PublicKeySize = 128

	// SignatureSize represents the length in bytes of a BLS signature.
	SignatureSize = 64

	// PrivateKeySize represents the length in bytes of a BLS private key.
	PrivateKeySize = 32
)

Variables

View Source
var (
	// ErrBase58DecodeFailed is returned if a base58 encoded string can not be decoded.
	ErrBase58DecodeFailed = errors.New("failed to decode base58 encoded string")

	// ErrParseBytesFailed is returned if information can not be parsed from a sequence of bytes.
	ErrParseBytesFailed = errors.New("failed to parse bytes")

	// ErrBLSFailed is returned if any low level BLS method calls fail.
	ErrBLSFailed = errors.New("failed to execute BLS function")

	// ErrInvalidArgument is returned if a function gets called with an illegal argument.
	ErrInvalidArgument = errors.New("invalid argument")
)

Functions

This section is empty.

Types

type PrivateKey

type PrivateKey struct {
	Scalar kyber.Scalar
}

PrivateKey is the type of BLS private keys.

func PrivateKeyFromBase58EncodedString

func PrivateKeyFromBase58EncodedString(base58String string) (privateKey PrivateKey, err error)

PrivateKeyFromBase58EncodedString creates a PrivateKey from a base58 encoded string.

func PrivateKeyFromBytes

func PrivateKeyFromBytes(bytes []byte) (privateKey PrivateKey, consumedBytes int, err error)

PrivateKeyFromBytes creates a PrivateKey from the given bytes.

func PrivateKeyFromMarshalUtil

func PrivateKeyFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (privateKey PrivateKey, err error)

PrivateKeyFromMarshalUtil unmarshals a PrivateKey using a MarshalUtil (for easier unmarshaling).

func PrivateKeyFromRandomness

func PrivateKeyFromRandomness() (privateKey PrivateKey)

PrivateKeyFromRandomness generates a new random PrivateKey.

func (PrivateKey) Base58

func (p PrivateKey) Base58() string

Base58 returns a base58 encoded version of the PrivateKey.

func (PrivateKey) Bytes

func (p PrivateKey) Bytes() (bytes []byte)

Bytes returns a marshaled version of the PrivateKey.

func (PrivateKey) PublicKey

func (p PrivateKey) PublicKey() PublicKey

PublicKey returns the PublicKey corresponding to the PrivateKey.

func (PrivateKey) Sign

func (p PrivateKey) Sign(data []byte) (signatureWithPublicKey SignatureWithPublicKey, err error)

Sign signs the message and returns a SignatureWithPublicKey.

func (PrivateKey) String

func (p PrivateKey) String() string

String returns a human readable version of the PrivateKey (base58 encoded).

type PublicKey

type PublicKey struct {
	Point kyber.Point
}

PublicKey is the type of BLS public keys.

func PublicKeyFromBase58EncodedString

func PublicKeyFromBase58EncodedString(base58String string) (publicKey PublicKey, err error)

PublicKeyFromBase58EncodedString creates a PublicKey from a base58 encoded string.

func PublicKeyFromBytes

func PublicKeyFromBytes(bytes []byte) (publicKey PublicKey, consumedBytes int, err error)

PublicKeyFromBytes creates a PublicKey from the given bytes.

func PublicKeyFromMarshalUtil

func PublicKeyFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (publicKey PublicKey, err error)

PublicKeyFromMarshalUtil unmarshals a PublicKey using a MarshalUtil (for easier unmarshaling).

func (PublicKey) Base58

func (p PublicKey) Base58() string

Base58 returns a base58 encoded version of the PublicKey.

func (PublicKey) Bytes

func (p PublicKey) Bytes() []byte

Bytes returns a marshaled version of the PublicKey.

func (PublicKey) SignatureValid

func (p PublicKey) SignatureValid(data []byte, signature Signature) bool

SignatureValid reports whether the signature is valid for the given data.

func (PublicKey) String

func (p PublicKey) String() string

String returns a human readable version of the PublicKey (base58 encoded).

type Signature

type Signature [SignatureSize]byte

Signature is the type of a raw BLS signature.

func SignatureFromBase58EncodedString

func SignatureFromBase58EncodedString(base58EncodedString string) (signature Signature, err error)

SignatureFromBase58EncodedString creates a Signature from a base58 encoded string.

func SignatureFromBytes

func SignatureFromBytes(bytes []byte) (signature Signature, consumedBytes int, err error)

SignatureFromBytes unmarshals a Signature from a sequence of bytes.

func SignatureFromMarshalUtil

func SignatureFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (signature Signature, err error)

SignatureFromMarshalUtil unmarshals a Signature using a MarshalUtil (for easier unmarshaling).

func (Signature) Base58

func (s Signature) Base58() string

Base58 returns a base58 encoded version of the Signature.

func (Signature) Bytes

func (s Signature) Bytes() []byte

Bytes returns a marshaled version of the Signature.

func (Signature) String

func (s Signature) String() string

String returns a human readable version of the signature.

type SignatureWithPublicKey

type SignatureWithPublicKey struct {
	PublicKey PublicKey
	Signature Signature
}

SignatureWithPublicKey is a combination of a PublicKey and a Signature that is required to perform operations like Signature- and PublicKey-aggregations.

func AggregateSignatures

func AggregateSignatures(signaturesWithPublicKey ...SignatureWithPublicKey) (SignatureWithPublicKey, error)

AggregateSignatures aggregates multiple SignatureWithPublicKey objects into a single SignatureWithPublicKey.

func NewSignatureWithPublicKey

func NewSignatureWithPublicKey(publicKey PublicKey, signature Signature) SignatureWithPublicKey

NewSignatureWithPublicKey is the constructor for SignatureWithPublicKey objects.

func SignatureWithPublicKeyFromBase58EncodedString

func SignatureWithPublicKeyFromBase58EncodedString(base58EncodedString string) (signatureWithPublicKey SignatureWithPublicKey, err error)

SignatureWithPublicKeyFromBase58EncodedString creates a SignatureWithPublicKey from a base58 encoded string.

func SignatureWithPublicKeyFromBytes

func SignatureWithPublicKeyFromBytes(bytes []byte) (signatureWithPublicKey SignatureWithPublicKey, consumedBytes int, err error)

SignatureWithPublicKeyFromBytes unmarshals a SignatureWithPublicKey from a sequence of bytes.

func SignatureWithPublicKeyFromMarshalUtil

func SignatureWithPublicKeyFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (signatureWithPublicKey SignatureWithPublicKey, err error)

SignatureWithPublicKeyFromMarshalUtil unmarshals a SignatureWithPublicKey using a MarshalUtil (for easier unmarshaling).

func (SignatureWithPublicKey) Base58

func (s SignatureWithPublicKey) Base58() string

Base58 returns a base58 encoded version of the SignatureWithPublicKey.

func (SignatureWithPublicKey) Bytes

func (s SignatureWithPublicKey) Bytes() []byte

Bytes returns the signature in bytes.

func (*SignatureWithPublicKey) Decode

func (s *SignatureWithPublicKey) Decode(b []byte) (int, error)

Encode returns the signature in bytes.

func (SignatureWithPublicKey) Encode

func (s SignatureWithPublicKey) Encode() ([]byte, error)

Encode returns the signature in bytes.

func (SignatureWithPublicKey) IsValid

func (s SignatureWithPublicKey) IsValid(data []byte) bool

IsValid returns true if the signature is correct for the given data.

func (SignatureWithPublicKey) String

func (s SignatureWithPublicKey) String() string

String returns a human-readable version of the SignatureWithPublicKey (base58 encoded).

Jump to

Keyboard shortcuts

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