Documentation ¶
Index ¶
- Variables
- func NewPrivateKeyShares(t int) (*PrivateKeyShares, *PublicKeyShares)
- func RecoverSignature(sigs []PartialSignature, signerIDs IDs) (crypto.Signature, error)
- type ID
- type IDs
- type PartialSignature
- type PrivateKey
- func (prv *PrivateKey) Bytes() []byte
- func (prv *PrivateKey) DecodeRLP(s *rlp.Stream) error
- func (prv *PrivateKey) EncodeRLP(w io.Writer) error
- func (prv *PrivateKey) MarshalJSON() ([]byte, error)
- func (prv *PrivateKey) PublicKey() crypto.PublicKey
- func (prv *PrivateKey) SetBytes(bytes []byte) error
- func (prv *PrivateKey) Sign(hash common.Hash) (crypto.Signature, error)
- func (prv *PrivateKey) String() string
- func (prv *PrivateKey) UnmarshalJSON(data []byte) error
- type PrivateKeyShares
- func (prvs *PrivateKeyShares) AddShare(ID ID, share *PrivateKey) error
- func (prvs *PrivateKeyShares) DecodeRLP(s *rlp.Stream) error
- func (prvs *PrivateKeyShares) EncodeRLP(w io.Writer) error
- func (prvs *PrivateKeyShares) Equal(other *PrivateKeyShares) bool
- func (prvs *PrivateKeyShares) RecoverPrivateKey(qualifyIDs IDs) (*PrivateKey, error)
- func (prvs *PrivateKeyShares) RecoverPublicKey(qualifyIDs IDs) (*PublicKey, error)
- func (prvs *PrivateKeyShares) SetParticipants(IDs IDs)
- func (prvs *PrivateKeyShares) Share(ID ID) (*PrivateKey, bool)
- type PublicKey
- type PublicKeyShares
- func (pubs *PublicKeyShares) AddShare(shareID ID, share *PublicKey) error
- func (pubs *PublicKeyShares) Clone() *PublicKeyShares
- func (pubs *PublicKeyShares) DecodeRLP(s *rlp.Stream) error
- func (pubs *PublicKeyShares) EncodeRLP(w io.Writer) error
- func (pubs *PublicKeyShares) Equal(other *PublicKeyShares) bool
- func (pubs *PublicKeyShares) MarshalJSON() ([]byte, error)
- func (pubs *PublicKeyShares) MasterKeyBytes() []byte
- func (pubs *PublicKeyShares) Move() *PublicKeyShares
- func (pubs *PublicKeyShares) RecoverPublicKey(qualifyIDs IDs) (*PublicKey, error)
- func (pubs *PublicKeyShares) Share(ID ID) (*PublicKey, error)
- func (pubs *PublicKeyShares) UnmarshalJSON(data []byte) error
- func (pubs *PublicKeyShares) VerifyPrvShare(ID ID, share *PrivateKey) (bool, error)
- func (pubs *PublicKeyShares) VerifyPubShare(ID ID, share *PublicKey) (bool, error)
Constants ¶
This section is empty.
Variables ¶
var ( fmt.Errorf("invalid share") // ErrNoIDToRecover is reported when no id is provided for recovering private // key. ErrNoIDToRecover = fmt.Errorf("no id to recover private key") // when recovering private key. ErrShareNotFound = fmt.Errorf("share not found") )ErrDuplicatedShare =
var ( // ErrEmptySignature is reported if the signature is empty. ErrEmptySignature = fmt.Errorf("invalid empty signature") )
Functions ¶
func NewPrivateKeyShares ¶
func NewPrivateKeyShares(t int) (*PrivateKeyShares, *PublicKeyShares)
NewPrivateKeyShares creates a DKG private key shares of threshold t.
func RecoverSignature ¶
func RecoverSignature(sigs []PartialSignature, signerIDs IDs) ( crypto.Signature, error)
RecoverSignature recovers TSIG signature.
Types ¶
type ID ¶
ID is the id for DKG protocol.
type PartialSignature ¶
PartialSignature is a partial signature in DKG+TSIG protocol.
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey represents a private key structure implments Crypto.PrivateKey interface.
func NewPrivateKey ¶
func NewPrivateKey() *PrivateKey
NewPrivateKey creates a new PrivateKey structure.
func (*PrivateKey) Bytes ¶
func (prv *PrivateKey) Bytes() []byte
Bytes returns []byte representation of private key.
func (*PrivateKey) DecodeRLP ¶
func (prv *PrivateKey) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder
func (*PrivateKey) EncodeRLP ¶
func (prv *PrivateKey) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder
func (*PrivateKey) MarshalJSON ¶
func (prv *PrivateKey) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaller.
func (*PrivateKey) PublicKey ¶
func (prv *PrivateKey) PublicKey() crypto.PublicKey
PublicKey returns the public key associate this private key.
func (*PrivateKey) SetBytes ¶
func (prv *PrivateKey) SetBytes(bytes []byte) error
SetBytes sets the private key data to []byte.
func (*PrivateKey) String ¶
func (prv *PrivateKey) String() string
String returns string representation of privat key.
func (*PrivateKey) UnmarshalJSON ¶
func (prv *PrivateKey) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaller.
type PrivateKeyShares ¶
type PrivateKeyShares struct {
// contains filtered or unexported fields
}
PrivateKeyShares represents a private key shares for DKG protocol.
func NewEmptyPrivateKeyShares ¶
func NewEmptyPrivateKeyShares() *PrivateKeyShares
NewEmptyPrivateKeyShares creates an empty private key shares.
func NewRandomPrivateKeyShares ¶
func NewRandomPrivateKeyShares() *PrivateKeyShares
NewRandomPrivateKeyShares constructs a private key shares randomly.
func (*PrivateKeyShares) AddShare ¶
func (prvs *PrivateKeyShares) AddShare(ID ID, share *PrivateKey) error
AddShare adds a share.
func (*PrivateKeyShares) DecodeRLP ¶
func (prvs *PrivateKeyShares) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder
func (*PrivateKeyShares) EncodeRLP ¶
func (prvs *PrivateKeyShares) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder
func (*PrivateKeyShares) Equal ¶
func (prvs *PrivateKeyShares) Equal(other *PrivateKeyShares) bool
Equal check equality between two PrivateKeyShares instances.
func (*PrivateKeyShares) RecoverPrivateKey ¶
func (prvs *PrivateKeyShares) RecoverPrivateKey(qualifyIDs IDs) ( *PrivateKey, error)
RecoverPrivateKey recovers private key from the shares.
func (*PrivateKeyShares) RecoverPublicKey ¶
func (prvs *PrivateKeyShares) RecoverPublicKey(qualifyIDs IDs) ( *PublicKey, error)
RecoverPublicKey recovers public key from the shares.
func (*PrivateKeyShares) SetParticipants ¶
func (prvs *PrivateKeyShares) SetParticipants(IDs IDs)
SetParticipants sets the DKG participants.
func (*PrivateKeyShares) Share ¶
func (prvs *PrivateKeyShares) Share(ID ID) (*PrivateKey, bool)
Share returns the share for the ID.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey represents a public key structure implements Crypto.PublicKey interface.
func RecoverGroupPublicKey ¶
func RecoverGroupPublicKey(pubShares []*PublicKeyShares) *PublicKey
RecoverGroupPublicKey recovers group public key.
func (*PublicKey) Deserialize ¶
Deserialize parses bytes representation of public key.
type PublicKeyShares ¶
type PublicKeyShares struct {
// contains filtered or unexported fields
}
PublicKeyShares represents a public key shares for DKG protocol.
func NewEmptyPublicKeyShares ¶
func NewEmptyPublicKeyShares() *PublicKeyShares
NewEmptyPublicKeyShares creates an empty public key shares.
func (*PublicKeyShares) AddShare ¶
func (pubs *PublicKeyShares) AddShare(shareID ID, share *PublicKey) error
AddShare adds a share.
func (*PublicKeyShares) Clone ¶
func (pubs *PublicKeyShares) Clone() *PublicKeyShares
Clone clones every fields of PublicKeyShares. This method is mainly for testing purpose thus would panic when error.
func (*PublicKeyShares) DecodeRLP ¶
func (pubs *PublicKeyShares) DecodeRLP(s *rlp.Stream) error
DecodeRLP implements rlp.Decoder
func (*PublicKeyShares) EncodeRLP ¶
func (pubs *PublicKeyShares) EncodeRLP(w io.Writer) error
EncodeRLP implements rlp.Encoder
func (*PublicKeyShares) Equal ¶
func (pubs *PublicKeyShares) Equal(other *PublicKeyShares) bool
Equal checks equality of two PublicKeyShares instance.
func (*PublicKeyShares) MarshalJSON ¶
func (pubs *PublicKeyShares) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaller.
func (*PublicKeyShares) MasterKeyBytes ¶
func (pubs *PublicKeyShares) MasterKeyBytes() []byte
MasterKeyBytes returns []byte representation of master public key.
func (*PublicKeyShares) Move ¶
func (pubs *PublicKeyShares) Move() *PublicKeyShares
Move will invalidate itself. Do not access to original reference.
func (*PublicKeyShares) RecoverPublicKey ¶
func (pubs *PublicKeyShares) RecoverPublicKey(qualifyIDs IDs) ( *PublicKey, error)
RecoverPublicKey recovers private key from the shares.
func (*PublicKeyShares) Share ¶
func (pubs *PublicKeyShares) Share(ID ID) (*PublicKey, error)
Share returns the share for the ID.
func (*PublicKeyShares) UnmarshalJSON ¶
func (pubs *PublicKeyShares) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaller.
func (*PublicKeyShares) VerifyPrvShare ¶
func (pubs *PublicKeyShares) VerifyPrvShare(ID ID, share *PrivateKey) ( bool, error)
VerifyPrvShare verifies if the private key shares is valid.
func (*PublicKeyShares) VerifyPubShare ¶
func (pubs *PublicKeyShares) VerifyPubShare(ID ID, share *PublicKey) ( bool, error)
VerifyPubShare verifies if the public key shares is valid.