Documentation ¶
Index ¶
Constants ¶
const (
PublicKeySize = 128
)
const (
SignatureSize = 64
)
Variables ¶
var (
ErrInvalidPublicKeySize = fmt.Errorf("public key must be %d bytes long", PublicKeySize)
)
var (
ErrInvalidSignatureSize = fmt.Errorf("signature must be %d bytes long", SignatureSize)
)
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey holds private key for bls implementation
func CreateRandomBlsKeys ¶
func CreateRandomBlsKeys(total int) ([]*PrivateKey, error)
CreateRandomBlsKeys creates an array of random private and their corresponding public keys
func GenerateBlsKey ¶
func GenerateBlsKey() (*PrivateKey, error)
GenerateBlsKey creates a random private key (and its corresponding public key)
func NewZeroPrivateKey ¶
func NewZeroPrivateKey() *PrivateKey
NewZeroPrivateKey is the constructor of an empty PrivateKey
func UnmarshalPrivateKey ¶
func UnmarshalPrivateKey(data []byte) (*PrivateKey, error)
UnmarshalPrivateKey unmarshals the private key from the given byte slice. This function supports both raw big int string and hex-encoded big int string.
func (*PrivateKey) Marshal ¶
func (p *PrivateKey) Marshal() ([]byte, error)
Marshal marshals private key hex (without 0x prefix) represented as a byte slice
func (*PrivateKey) PublicKey ¶
func (p *PrivateKey) PublicKey() *PublicKey
PublicKey returns the public key from the PrivateKey
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey represents bls public key
func UnmarshalPublicKey ¶
UnmarshalPublicKey unmarshals bytes to public key
func UnmarshalPublicKeyFromBigInt ¶
UnmarshalPublicKeyFromBigInt unmarshals public key from 4 big ints Order of coordinates is [A.Y, A.X, B.Y, B.X]
func (*PublicKey) MarshalText ¶
MarshalText implements the json.Marshaler interface.
func (*PublicKey) UnmarshalText ¶
UnmarshalText implements encoding.TextMarshaler interface
type PublicKeys ¶
type PublicKeys []*PublicKey
func (PublicKeys) Aggregate ¶
func (pks PublicKeys) Aggregate() *PublicKey
Aggregate aggregates all public keys into one
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature represents bls signature which is point on the curve
func UnmarshalSignature ¶
UnmarshalSignature reads the signature from the given byte array
func (Signature) ToBigInt ¶
ToBigInt marshalls signature (which is point) to 2 big ints - one for each coordinate
type Signatures ¶
type Signatures []*Signature
Signatures is a slice of signatures
func (Signatures) Aggregate ¶
func (sigs Signatures) Aggregate() *Signature
Aggregate aggregates all signatures into one