Documentation ¶
Index ¶
- Variables
- func GetAllSigStatsNewPriv(onlyVrf, onlyMulti bool, newBitIDFunc []bitid.FromIntFunc) (ret []func() (sig.Priv, error), retStats []sig.SigStats)
- func NewBLSPriv(i sig.PubKeyIndex, newBitIDFunc bitid.FromIntFunc) (sig.Priv, error)
- func NewCoinDualPriv(i sig.PubKeyIndex, to types.TestOptions) (sig.Priv, error)
- func NewCoinSleepPriv(n, t int, i sig.PubKeyIndex, stats *sig.SigStats) sig.Priv
- func NewECPriv(i sig.PubKeyIndex) (sig.Priv, error)
- func NewEDCoinPriv(i sig.PubKeyIndex, to types.TestOptions) (sig.Priv, error)
- func NewEDPriv(i sig.PubKeyIndex) (sig.Priv, error)
- func NewQsafePriv(i sig.PubKeyIndex) (sig.Priv, error)
- func NewSchnorrPriv(i sig.PubKeyIndex) (sig.Priv, error)
- func NewSleepMultiPriv(priv sig.Priv, newBitIDFunc bitid.FromIntFunc, stats *sig.SigStats) (sig.Priv, error)
- func NewSleepPriv(stats *sig.SigStats, i sig.PubKeyIndex) (sig.Priv, error)
- func NewSleepThrshPriv(n, t int, priv sig.Priv, stats *sig.SigStats) (sig.Priv, error)
- func NewSleepVrfPriv(priv sig.Priv, stats *sig.SigStats) (sig.Priv, error)
- func NewTBLSDualPriv(i sig.PubKeyIndex, to types.TestOptions) (sig.Priv, error)
- func NewTBLSPriv(n, t int, i sig.PubKeyIndex) (sig.Priv, error)
- type MultiPriv
- type Priv
- func (p *Priv) Clean()
- func (p *Priv) ComputeSharedSecret(pub sig.Pub) (ret [32]byte)
- func (p *Priv) GenerateSig(header sig.SignedMessage, vrfProof sig.VRFProof, signType types.SignType) (*sig.SigItem, error)
- func (p *Priv) GetBaseKey() sig.Priv
- func (p *Priv) GetPrivForSignType(signType types.SignType) (sig.Priv, error)
- func (p *Priv) GetPub() sig.Pub
- func (p *Priv) IsSleepPriv()
- func (p *Priv) NewSig() sig.Sig
- func (p *Priv) SetIndex(index sig.PubKeyIndex)
- func (p *Priv) ShallowCopy() sig.Priv
- func (p *Priv) Sign(msg sig.SignedMessage) (sig.Sig, error)
- type Pub
- func (pub *Pub) CheckSignature(msg *sig.MultipleSignedMessage, sigItem *sig.SigItem) error
- func (pub *Pub) Decode(reader io.Reader) (n int, err error)
- func (pub *Pub) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)
- func (pub *Pub) DeserializeSig(m *messages.Message, signType types.SignType) (*sig.SigItem, int, error)
- func (pub *Pub) Encode(writer io.Writer) (n int, err error)
- func (pub *Pub) FromPubBytes(b sig.PubKeyBytes) (sig.Pub, error)
- func (pub *Pub) GetBytes(m *messages.Message) ([]byte, error)
- func (pub *Pub) GetID() messages.HeaderID
- func (pub *Pub) GetIndex() sig.PubKeyIndex
- func (pub *Pub) GetMsgID() messages.MsgID
- func (pub *Pub) GetPubBytes() (sig.PubKeyBytes, error)
- func (pub *Pub) GetPubID() (sig.PubKeyID, error)
- func (pub *Pub) GetPubString() (sig.PubKeyStr, error)
- func (pub *Pub) GetRealPubBytes() (sig.PubKeyBytes, error)
- func (pub *Pub) GetSigMemberNumber() int
- func (pub *Pub) New() sig.Pub
- func (pub *Pub) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
- func (pub *Pub) Serialize(m *messages.Message) (int, error)
- func (pub *Pub) SetIndex(index sig.PubKeyIndex)
- func (pub *Pub) ShallowCopy() sig.Pub
- func (pub *Pub) VerifySig(msg sig.SignedMessage, aSig sig.Sig) (bool, error)
- type Sig
- func (sig *Sig) Decode(reader io.Reader) (n int, err error)
- func (sig *Sig) Deserialize(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (int, error)
- func (sig *Sig) Encode(writer io.Writer) (n int, err error)
- func (sig *Sig) GetBytes(m *messages.Message) ([]byte, error)
- func (sig *Sig) GetID() messages.HeaderID
- func (sig *Sig) GetMsgID() messages.MsgID
- func (sig *Sig) GetRand() types.BinVal
- func (s *Sig) New() sig.Sig
- func (*Sig) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
- func (sig *Sig) Serialize(m *messages.Message) (int, error)
- type SleepPriv
- type Thrsh
- func (bt *Thrsh) CombinePartialSigs(ps []sig.Sig) (*sig.SigItem, error)
- func (bt *Thrsh) GetN() int
- func (bt *Thrsh) GetPartialPub() sig.Pub
- func (bt *Thrsh) GetPrivForSignType(signType types.SignType) (sig.Priv, error)
- func (bt *Thrsh) GetSharedPub() sig.Pub
- func (bt *Thrsh) GetT() int
- func (bt *Thrsh) PartialSign(msg sig.SignedMessage) (sig.Sig, error)
- func (bt *Thrsh) ShallowCopy() sig.Priv
- type VRFProof
- type VrfPriv
- type VrfPub
- func (pub *VrfPub) DeserializeSig(m *messages.Message, signType types.SignType) (*sig.SigItem, int, error)
- func (pub *VrfPub) FromPubBytes(b sig.PubKeyBytes) (sig.Pub, error)
- func (p *VrfPub) New() sig.Pub
- func (vrfPub *VrfPub) NewVRFProof() sig.VRFProof
- func (pub *VrfPub) ProofToHash(msg sig.SignedMessage, proof sig.VRFProof) (index [32]byte, err error)
- func (pub *VrfPub) ShallowCopy() sig.Pub
Constants ¶
This section is empty.
Variables ¶
var AllSigStats = []sig.SigStats{ec.Stats, ed.EDDSAStats, ed.SchnorrStats, bls.Stats}
Functions ¶
func GetAllSigStatsNewPriv ¶
func NewBLSPriv ¶
func NewBLSPriv(i sig.PubKeyIndex, newBitIDFunc bitid.FromIntFunc) (sig.Priv, error)
func NewCoinDualPriv ¶
func NewCoinDualPriv(i sig.PubKeyIndex, to types.TestOptions) (sig.Priv, error)
func NewCoinSleepPriv ¶
func NewEDCoinPriv ¶
func NewEDCoinPriv(i sig.PubKeyIndex, to types.TestOptions) (sig.Priv, error)
func NewQsafePriv ¶
func NewQsafePriv(i sig.PubKeyIndex) (sig.Priv, error)
func NewSchnorrPriv ¶
func NewSchnorrPriv(i sig.PubKeyIndex) (sig.Priv, error)
func NewSleepMultiPriv ¶
func NewSleepPriv ¶
NewSleepPriv creates a new random sleep private key object
func NewSleepThrshPriv ¶
func NewTBLSDualPriv ¶
func NewTBLSDualPriv(i sig.PubKeyIndex, to types.TestOptions) (sig.Priv, error)
func NewTBLSPriv ¶
Types ¶
type MultiPriv ¶
type MultiPriv struct {
VrfPriv
}
func (*MultiPriv) Evaluate ¶
func (p *MultiPriv) Evaluate(m sig.SignedMessage) (index [32]byte, proof sig.VRFProof)
Evaluate generates a vrf. The index and thee first 32 bytes are the same. They are the hash of the key index and the message.
func (*MultiPriv) GetPrivForSignType ¶
Returns key that is used for signing the sign type.
func (*MultiPriv) ShallowCopy ¶
type Priv ¶
type Priv struct {
// contains filtered or unexported fields
}
Priv represents the sleep private key object
func (*Priv) ComputeSharedSecret ¶
ComputeSharedSecret returns the hash of Diffie-Hellman.
func (*Priv) GenerateSig ¶
func (p *Priv) GenerateSig(header sig.SignedMessage, vrfProof sig.VRFProof, signType types.SignType) (*sig.SigItem, error)
GenerateSig signs a message and returns the SigItem object containing the signature
func (*Priv) GetPrivForSignType ¶
Returns key that is used for signing the sign type.
func (*Priv) IsSleepPriv ¶
func (p *Priv) IsSleepPriv()
func (*Priv) SetIndex ¶
func (p *Priv) SetIndex(index sig.PubKeyIndex)
SetIndex sets the index of the node represented by this key in the consensus participants
func (*Priv) ShallowCopy ¶
Shallow copy makes a copy of the object without following pointers.
type Pub ¶
type Pub struct {
// contains filtered or unexported fields
}
func (*Pub) CheckSignature ¶
CheckSignature will should check what kind of message and signature to verify. It will call CheckCoinProof or VerfiySig depending on the message type.
func (*Pub) Deserialize ¶
Deserialize deserialzes a header into the object, returning the number of bytes read
func (*Pub) DeserializeSig ¶
func (pub *Pub) DeserializeSig(m *messages.Message, signType types.SignType) (*sig.SigItem, int, error)
DeserializeSig deserializes a public key and signature object from m, size is the number of bytes read
func (*Pub) FromPubBytes ¶
FromPubBytes creates a public key object from the public key bytes
func (*Pub) GetIndex ¶
func (pub *Pub) GetIndex() sig.PubKeyIndex
GetIndex gets the index of the node represented by this key in the consensus participants
func (*Pub) GetMsgID ¶
GetMsgID returns the MsgID for this specific header (see MsgID definition for more details)
func (*Pub) GetPubBytes ¶
func (pub *Pub) GetPubBytes() (sig.PubKeyBytes, error)
GetPubBytes returns the key we use to sign/verify
func (*Pub) GetPubID ¶
GetPubID returns the id of the public key (see type definition for PubKeyID).
func (*Pub) GetPubString ¶
GetPubString is the same as GetPubBytes, except returns a string, this is used to sort the keys
func (*Pub) GetRealPubBytes ¶
func (pub *Pub) GetRealPubBytes() (sig.PubKeyBytes, error)
GetRealPubBytes is the same as GetPubBytes
func (*Pub) GetSigMemberNumber ¶
GetSigMemberNumber returns the number of members this sig counts for (can be > 1 for multisigs and threshold sigs)
func (*Pub) PeekHeaders ¶
func (pub *Pub) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
PeekHeaders returns nil
func (*Pub) Serialize ¶
Serialize appends a serialized header to the message m, and returns the size of bytes written
func (*Pub) SetIndex ¶
func (pub *Pub) SetIndex(index sig.PubKeyIndex)
SetIndex should be called after sorting all if the benchmark is using the index as the key id (see SetUsePubIndex)
func (*Pub) ShallowCopy ¶
type Sig ¶
type Sig struct {
// contains filtered or unexported fields
}
func (*Sig) Deserialize ¶
Derserialize updates the fields of the ECDSA signature object from m, and returns the number of bytes read
func (*Sig) PeekHeaders ¶
func (*Sig) PeekHeaders(m *messages.Message, unmarFunc types.ConsensusIndexFuncs) (index types.ConsensusIndex, err error)
PeekHeader returns the indices related to the messages without impacting m.
type Thrsh ¶
type Thrsh struct { SleepPriv // the partial public key for this node // contains filtered or unexported fields }
func (*Thrsh) CombinePartialSigs ¶
CombinePartialSigs generates a shared signature from the list of partial signatures.
func (*Thrsh) GetPartialPub ¶
func (*Thrsh) GetPrivForSignType ¶
Returns key that is used for signing the sign type.
func (*Thrsh) GetSharedPub ¶
func (*Thrsh) PartialSign ¶
PartialSign creates a signature on the message that can also be used to create a shared signature.
func (*Thrsh) ShallowCopy ¶
Shallow copy makes a copy of the object without following pointers.
type VrfPriv ¶
type VrfPriv struct { SleepPriv // contains filtered or unexported fields }
func (*VrfPriv) Evaluate ¶
func (p *VrfPriv) Evaluate(m sig.SignedMessage) (index [32]byte, proof sig.VRFProof)
Evaluate generates a vrf. The index and thee first 32 bytes are the same. They are the hash of the key index and the message.
func (*VrfPriv) GetPrivForSignType ¶
Returns key that is used for signing the sign type.
func (*VrfPriv) ShallowCopy ¶
type VrfPub ¶
type VrfPub struct {
// contains filtered or unexported fields
}
func (*VrfPub) DeserializeSig ¶
func (pub *VrfPub) DeserializeSig(m *messages.Message, signType types.SignType) (*sig.SigItem, int, error)
DeserializeSig deserializes a public key and signature object from m, size is the number of bytes read
func (*VrfPub) FromPubBytes ¶
FromPubBytes creates a public key object from the public key bytes
func (*VrfPub) NewVRFProof ¶
NewVRFProof returns an empty VRFProof object
func (*VrfPub) ProofToHash ¶
func (pub *VrfPub) ProofToHash(msg sig.SignedMessage, proof sig.VRFProof) (index [32]byte, err error)
ProofToHash checks the VRF for the message and returns the random bytes if valid