Documentation ¶
Index ¶
Constants ¶
const ( DomainValidatorSetString = "DOMAIN_CHILD_VALIDATOR_SET" DomainCheckpointManagerString = "DOMAIN_CHECKPOINT_MANAGER" DomainCommonSigningString = "DOMAIN_COMMON_SIGNING" DomainStateReceiverString = "DOMAIN_STATE_RECEIVER" )
Variables ¶
var ( // domain used to map hash to G1 used by (child) validator set DomainValidatorSet = pcrypto.Keccak256([]byte(DomainValidatorSetString)) // domain used to map hash to G1 used by child checkpoint manager DomainCheckpointManager = pcrypto.Keccak256([]byte(DomainCheckpointManagerString)) DomainCommonSigning = pcrypto.Keccak256([]byte(DomainCommonSigningString)) DomainStateReceiver = pcrypto.Keccak256([]byte(DomainStateReceiverString)) )
Functions ¶
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 and its corresponding public keys
func UnmarshalPrivateKey ¶
func UnmarshalPrivateKey(data []byte) (*PrivateKey, error)
UnmarshalPrivateKey unmarshals the private key from the given byte slice
func (*PrivateKey) Marshal ¶
func (p *PrivateKey) Marshal() ([]byte, error)
Marshal marshals private key to 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 MakeKOSKSignature ¶
func MakeKOSKSignature(privateKey *PrivateKey, address types.Address, chainID int64, domain []byte, supernetManagerAddr types.Address) (*Signature, error)
MakeKOSKSignature creates KOSK signature which prevents rogue attack
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