Documentation ¶
Overview ¶
Package keys defines key material holding structures for secret sharing setups, like public key shares, private, and a registry to hold and manage a set of public key shares.
Index ¶
- type KeyShare
- func (k *KeyShare) Decode(data []byte) error
- func (k *KeyShare) DecodeHex(h string) error
- func (k *KeyShare) Encode() []byte
- func (k *KeyShare) Group() ecc.Group
- func (k *KeyShare) Hex() string
- func (k *KeyShare) Identifier() uint16
- func (k *KeyShare) Public() *PublicKeyShare
- func (k *KeyShare) SecretKey() *ecc.Scalar
- func (k *KeyShare) UnmarshalJSON(data []byte) error
- type PublicKeyShare
- type PublicKeyShareRegistry
- func (k *PublicKeyShareRegistry) Add(pks *PublicKeyShare) error
- func (k *PublicKeyShareRegistry) Decode(data []byte) error
- func (k *PublicKeyShareRegistry) DecodeHex(h string) error
- func (k *PublicKeyShareRegistry) Encode() []byte
- func (k *PublicKeyShareRegistry) Get(id uint16) *PublicKeyShare
- func (k *PublicKeyShareRegistry) Hex() string
- func (k *PublicKeyShareRegistry) UnmarshalJSON(data []byte) error
- func (k *PublicKeyShareRegistry) VerifyPublicKey(id uint16, pubKey *ecc.Element) error
- type Share
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyShare ¶
type KeyShare struct {}
KeyShare holds the secret and public key share for a given participant.
func (*KeyShare) Decode ¶
Decode deserializes the compact encoding obtained from Encode(), or returns an error.
func (*KeyShare) DecodeHex ¶
DecodeHex sets k to the decoding of the hex encoded representation returned by Hex().
func (*KeyShare) Hex ¶
Hex returns the hexadecimal representation of the byte encoding returned by Encode().
func (*KeyShare) Identifier ¶
Identifier returns the identity for this share.
func (*KeyShare) Public ¶
func (k *KeyShare) Public() *PublicKeyShare
Public returns the public key share and identifier corresponding to the secret key share.
func (*KeyShare) UnmarshalJSON ¶
UnmarshalJSON decodes data into k, or returns an error.
type PublicKeyShare ¶
type PublicKeyShare struct { ecc.Element `json:"publicKey"` VssCommitment []*ecc.Element `json:"vssCommitment,omitempty"` ID uint16 `json:"id"` Group ecc.Group `json:"group"` }PublicKey *
PublicKeyShare specifies the public key of a participant identified with ID. This can be useful to keep a registry of participants.
func (*PublicKeyShare) Decode ¶
func (p *PublicKeyShare) Decode(data []byte) error
Decode deserializes the compact encoding obtained from Encode(), or returns an error.
func (*PublicKeyShare) DecodeHex ¶
func (p *PublicKeyShare) DecodeHex(h string) error
DecodeHex sets p to the decoding of the hex encoded representation returned by Hex().
func (*PublicKeyShare) Encode ¶
func (p *PublicKeyShare) Encode() []byte
Encode serializes p into a compact byte string.
func (*PublicKeyShare) Hex ¶
func (p *PublicKeyShare) Hex() string
Hex returns the hexadecimal representation of the byte encoding returned by Encode().
func (*PublicKeyShare) UnmarshalJSON ¶
func (p *PublicKeyShare) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes data into p, or returns an error.
type PublicKeyShareRegistry ¶
type PublicKeyShareRegistry struct {}
PublicKeyShareRegistry regroups the final public information about key shares and participants, enabling a registry and public key verifications.
func NewPublicKeyShareRegistry ¶
func NewPublicKeyShareRegistry(g ecc.Group, threshold, total uint16) *PublicKeyShareRegistry
NewPublicKeyShareRegistry returns a populated PublicKeyShareRegistry.
func (*PublicKeyShareRegistry) Add ¶
func (k *PublicKeyShareRegistry) Add(pks *PublicKeyShare) error
Add adds the PublicKeyShare to the registry if it's not full or no key for the identifier is already set, in which case an error is returned.
func (*PublicKeyShareRegistry) Decode ¶
func (k *PublicKeyShareRegistry) Decode(data []byte) error
Decode deserializes the input data into the registry, expecting the same encoding as used in Encode(). It doesn't modify the receiver when encountering an error.
func (*PublicKeyShareRegistry) DecodeHex ¶
func (k *PublicKeyShareRegistry) DecodeHex(h string) error
DecodeHex sets k to the decoding of the hex encoded representation returned by Hex().
func (*PublicKeyShareRegistry) Encode ¶
func (k *PublicKeyShareRegistry) Encode() []byte
Encode serializes the registry into a compact byte encoding of the registry, suitable for storage or transmissions.
func (*PublicKeyShareRegistry) Get ¶
func (k *PublicKeyShareRegistry) Get(id uint16) *PublicKeyShare
Get returns the registered public key for id, or nil.
func (*PublicKeyShareRegistry) Hex ¶
func (k *PublicKeyShareRegistry) Hex() string
Hex returns the hexadecimal representation of the byte encoding returned by Encode().
func (*PublicKeyShareRegistry) UnmarshalJSON ¶
func (k *PublicKeyShareRegistry) UnmarshalJSON(data []byte) error
UnmarshalJSON reads the input data as JSON and deserializes it into the receiver. It doesn't modify the receiver when encountering an error.
func (*PublicKeyShareRegistry) VerifyPublicKey ¶
func (k *PublicKeyShareRegistry) VerifyPublicKey(id uint16, pubKey *ecc.Element) error
VerifyPublicKey returns nil if the id / pubKey pair is registered, and an error otherwise.