Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultThreshold(n int) int
- func Delete(path string) error
- func Load(path string, t Tomler) error
- func PointToString(p kyber.Point) string
- func Save(path string, t Tomler, secure bool) error
- func ScalarToString(s kyber.Scalar) string
- func StringToPoint(g kyber.Group, s string) (kyber.Point, error)
- func StringToScalar(g kyber.Group, s string) (kyber.Scalar, error)
- type BeaconSignature
- type ByKey
- type DistPublic
- type DistPublicTOML
- type Group
- func (g *Group) Contains(pub *Identity) bool
- func (g *Group) FromTOML(i interface{}) (err error)
- func (g *Group) Hash() (string, error)
- func (g *Group) Identities() []*Identity
- func (g *Group) Index(pub *Identity) (int, bool)
- func (g *Group) Len() int
- func (g *Group) MergeGroup(list []*Identity) *Group
- func (g *Group) Points() []kyber.Point
- func (g *Group) Public(i int) *Identity
- func (g *Group) String() string
- func (g *Group) TOML() interface{}
- func (g *Group) TOMLValue() interface{}
- type GroupTOML
- type Identity
- type Pair
- type PairTOML
- type PublicTOML
- type ResetOption
- type Share
- type ShareTOML
- type Store
- type Tomler
Constants ¶
const ConfigFolderFlag = "homedir"
ConfigFolderFlag holds the name of the flag to set using the CLI to change the default configuration folder of drand. It mimicks the gpg flag option.
const GroupFolderName = "groups"
GroupFolderName is the name of the folder where drand keeps its group files
const KeyFolderName = "key"
KeyFolderName is the name of the folder where drand keeps its keys
Variables ¶
var ErrAbsent = errors.New("store can't find requested object")
ErrAbsent returns
var ErrStoreFile = errors.New("store file issues")
ErrStoreFile returns an error in case the store can not save the requested file
var KeyGroup = Pairing.G1()
KeyGroup is the group used to create the keys
var Pairing = bls.NewBLS12381Suite()
Pairing is the main pairing suite used by drand. New interesting curves should be allowed by drand, such as BLS12-381.
var Scheme = tbls.NewThresholdSchemeOnG2(Pairing)
Scheme is the signature scheme used, defining over which curve the signature and keys respectively are.
var SigGroup = Pairing.G2()
SigGroup is the group used to create the signatures; it must always be different than KeyGroup: G1 key group and G2 sig group or G1 sig group and G2 keygroup.
Functions ¶
func Delete ¶ added in v0.5.0
Delete the resource denoted by the given path. If it is a file, it deletes the file; if it is a folder it delete the folder and all its content.
func PointToString ¶ added in v0.4.0
PointToString returns a hex-encoded string representation of the given point.
func Save ¶
Save the given Tomler interface to the given path. If secure is true, the file will have a 0700 security.
func ScalarToString ¶ added in v0.4.0
ScalarToString returns a hex-encoded string representation of the given scalar.
func StringToPoint ¶ added in v0.4.0
StringToPoint unmarshals a point in the given group from the given string.
Types ¶
type BeaconSignature ¶
BeaconSignature is the final reconstructed BLS signature that is saved in the filesystem.
func NewBeaconSignature ¶
func NewBeaconSignature(timestamp int64, previousSig, signature []byte) *BeaconSignature
NewBeaconSignature initializes a beacon signature from - a timestamp - a previous sig. Can be nil if there is no previous signature - a signature of the timestamp and the previous sig
func (*BeaconSignature) FromTOML ¶
func (b *BeaconSignature) FromTOML(i interface{}) error
FromTOML initializes b from a TOML-compatible version of a beacon signature
func (*BeaconSignature) RawSig ¶
func (b *BeaconSignature) RawSig() []byte
RawSig returns the signature
func (*BeaconSignature) TOML ¶
func (b *BeaconSignature) TOML() interface{}
TOML returns a TOML-compatible version of this beacon signature
func (*BeaconSignature) TOMLValue ¶
func (b *BeaconSignature) TOMLValue() interface{}
TOMLValue returns an empty TOML-compatible version of a beacon signature
type DistPublic ¶
DistPublic represents the distributed public key generated during a DKG. This is the information that can be safely exported to end users verifying a drand signature. It is the list of all commitments of the coefficients of the private distributed polynomial.
func (*DistPublic) Equal ¶ added in v0.5.0
func (d *DistPublic) Equal(d2 *DistPublic) bool
Equal returns if all coefficients of the public key d are equal to those of d2
func (*DistPublic) FromTOML ¶
func (d *DistPublic) FromTOML(i interface{}) error
FromTOML initializes d from the TOML-compatible version of a DistPublic
func (*DistPublic) Key ¶
func (d *DistPublic) Key() kyber.Point
Key returns the first coefficient as representing the public key to be used to verify signatures issued by the distributed key.
func (*DistPublic) TOML ¶
func (d *DistPublic) TOML() interface{}
TOML returns a TOML-compatible version of d
func (*DistPublic) TOMLValue ¶
func (d *DistPublic) TOMLValue() interface{}
TOMLValue returns an empty TOML-compatible dist public interface
type DistPublicTOML ¶
type DistPublicTOML struct {
Coefficients []string
}
DistPublicTOML is a TOML compatible value of a DistPublic
type Group ¶
type Group struct { // Threshold to setup during the DKG or resharing protocol. Threshold int // Period to use for the beacon randomness generation Period time.Duration // List of identities forming this group Nodes []*Identity // The distributed public key of this group. It is nil if the group has not // ran a DKG protocol yet. PublicKey *DistPublic }
Group holds all information about a group of drand nodes.
func LoadGroup ¶ added in v0.4.0
func LoadGroup(list []*Identity, public *DistPublic, threshold int) *Group
LoadGroup returns a group associated with a given public key
func (*Group) Hash ¶ added in v0.4.0
Hash returns an unique short representation of this group. NOTE: It currently does NOT take into account the distributed public key when set for simplicity (we want old nodes and new nodes to easily refer to the same group for example). This may cause trouble in the future and may require more thoughts.
func (*Group) Identities ¶
Identities return the underlying slice of identities
func (*Group) Index ¶
Index returns the index of the given public key with a boolean indicating whether the public has been found or not.
func (*Group) MergeGroup ¶ added in v0.4.0
MergeGroup returns a NEW group with both list of identities combined, the maximum between the default threshold and the group's threshold, and with the same period as the group.
func (*Group) Public ¶
Public returns the public associated to that index or panic otherwise. XXX Change that to return error
type GroupTOML ¶
type GroupTOML struct { Threshold int Period string Nodes []*PublicTOML PublicKey *DistPublicTOML }
GroupTOML is the representation of a Group TOML compatible
type Identity ¶
Identity holds the corresponding public key of a Private. It also includes a valid internet facing ipv4 address where to this reach the node holding the public / private key pair.
type Pair ¶ added in v0.3.6
Pair is a wrapper around a random scalar and the corresponding public key in G2
func NewKeyPair ¶
NewKeyPair returns a freshly created private / public key pair. The group is decided by the group variable by default. Currently, drand only supports bn256.
func NewTLSKeyPair ¶ added in v0.3.7
NewTLSKeyPair returns a fresh keypair associated with the given address reachable over TLS.
func (*Pair) FromTOML ¶ added in v0.3.6
FromTOML constructs the private key from an unmarshalled structure from TOML
type PairTOML ¶ added in v0.3.6
type PairTOML struct {
Key string
}
PairTOML is the TOML-able version of a private key
type PublicTOML ¶
PublicTOML is the TOML-able version of a public key
type ResetOption ¶ added in v0.5.0
type ResetOption int
ResetOption is an option to allow for fine-grained reset operations
type Share ¶
type Share dkg.DistKeyShare
Share represents the private information that a node holds after a successful DKG. This information MUST stay private !
func (*Share) FromTOML ¶
FromTOML initializes the share from the given TOML-compatible share interface
func (*Share) PrivateShare ¶ added in v0.5.1
PrivateShare returns the private share used to produce a partial signature
func (*Share) PubPoly ¶ added in v0.5.1
PubPoly returns the public polynomial that can be used to verify any individual patial signature
func (*Share) Public ¶
func (s *Share) Public() *DistPublic
Public returns the distributed public key associated with the distributed key share
type ShareTOML ¶
type ShareTOML struct { int Share string Commits []string // at the given index. PrivatePoly []string }Index
ShareTOML is the TOML representation of a dkg.DistKeyShare
type Store ¶
type Store interface { // SaveKeyPair saves the private key generated by drand as well as the // public identity key associated SaveKeyPair(p *Pair) error // LoadKeyPair loads the private/public key pair associated with the drand // operator LoadKeyPair() (*Pair, error) SaveGroup(*Group) error LoadGroup() (*Group, error) SaveDistPublic(d *DistPublic) error LoadDistPublic() (*DistPublic, error) Reset(...ResetOption) error }
Store abstracts the loading and saving of any private/public cryptographic material to be used by drand. For the moment, only a file based store is implemented.
func NewFileStore ¶
NewFileStore is used to create the config folder and all the subfolders. If a folder alredy exists, we simply check the rights