Documentation ¶
Index ¶
- Constants
- Variables
- type PrivateKey
- func PrivateKeyFromBase58EncodedString(base58String string) (privateKey PrivateKey, err error)
- func PrivateKeyFromBytes(bytes []byte) (privateKey PrivateKey, consumedBytes int, err error)
- func PrivateKeyFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (privateKey PrivateKey, err error)
- func PrivateKeyFromRandomness() (privateKey PrivateKey)
- type PublicKey
- type Signature
- type SignatureWithPublicKey
- func AggregateSignatures(signaturesWithPublicKey ...SignatureWithPublicKey) (SignatureWithPublicKey, error)
- func NewSignatureWithPublicKey(publicKey PublicKey, signature Signature) SignatureWithPublicKey
- func SignatureWithPublicKeyFromBase58EncodedString(base58EncodedString string) (signatureWithPublicKey SignatureWithPublicKey, err error)
- func SignatureWithPublicKeyFromBytes(bytes []byte) (signatureWithPublicKey SignatureWithPublicKey, consumedBytes int, err error)
- func SignatureWithPublicKeyFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (signatureWithPublicKey SignatureWithPublicKey, err error)
- func (s SignatureWithPublicKey) Base58() string
- func (s SignatureWithPublicKey) Bytes() []byte
- func (s *SignatureWithPublicKey) Decode(b []byte) (int, error)
- func (s SignatureWithPublicKey) Encode() ([]byte, error)
- func (s SignatureWithPublicKey) IsValid(data []byte) bool
- func (s SignatureWithPublicKey) String() string
Constants ¶
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 ¶
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 ¶
PublicKeyFromBase58EncodedString creates a PublicKey from a base58 encoded string.
func PublicKeyFromBytes ¶
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) SignatureValid ¶
SignatureValid reports whether the signature is valid for the given data.
type Signature ¶
type Signature [SignatureSize]byte
Signature is the type of a raw BLS signature.
func SignatureFromBase58EncodedString ¶
SignatureFromBase58EncodedString creates a Signature from a base58 encoded string.
func SignatureFromBytes ¶
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).
type SignatureWithPublicKey ¶
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).