Documentation ¶
Index ¶
- func AggregateMasks(a, b []byte) ([]byte, error)
- func AggregateSig(sigs []*bls.Sign) *bls.Sign
- func BytesToBlsPublicKey(bytes []byte) (*bls.PublicKey, error)
- func RandPrivateKey() *bls.SecretKey
- type CompletePolicy
- type Mask
- func (m *Mask) CountEnabled() int
- func (m *Mask) CountTotal() int
- func (m *Mask) GetPubKeyFromMask(flag bool) []*bls.PublicKey
- func (m *Mask) IndexEnabled(i int) (bool, error)
- func (m *Mask) KeyEnabled(public *bls.PublicKey) (bool, error)
- func (m *Mask) Len() int
- func (m *Mask) Mask() []byte
- func (m *Mask) SetBit(i int, enable bool) error
- func (m *Mask) SetKey(public *bls.PublicKey, enable bool) error
- func (m *Mask) SetMask(mask []byte) error
- type Policy
- type ThresholdPolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AggregateMasks ¶
AggregateMasks computes the bitwise OR of the two given participation masks.
func AggregateSig ¶
AggregateSig aggregates all the BLS signature into a single multi-signature.
func BytesToBlsPublicKey ¶
BytesToBlsPublicKey converts bytes into bls.PublicKey pointer.
func RandPrivateKey ¶
RandPrivateKey returns a random private key.
Types ¶
type CompletePolicy ¶
type CompletePolicy struct { }
CompletePolicy is the default policy requiring that all participants have cosigned to make a collective signature valid.
func (CompletePolicy) Check ¶
func (p CompletePolicy) Check(m *Mask) bool
Check verifies that all participants have contributed to a collective signature.
type Mask ¶
type Mask struct { Bitmap []byte AggregatePublic *bls.PublicKey // contains filtered or unexported fields }
Mask represents a cosigning participation bitmask.
func NewMask ¶
NewMask returns a new participation bitmask for cosigning where all cosigners are disabled by default. If a public key is given it verifies that it is present in the list of keys and sets the corresponding index in the bitmask to 1 (enabled).
func (*Mask) CountEnabled ¶
CountEnabled returns the number of enabled nodes in the CoSi participation Bitmap.
func (*Mask) CountTotal ¶
CountTotal returns the total number of nodes this CoSi instance knows.
func (*Mask) GetPubKeyFromMask ¶
GetPubKeyFromMask will return pubkeys which masked either zero or one depending on the flag it is used to show which signers are signed or not in the cosign message
func (*Mask) IndexEnabled ¶
IndexEnabled checks whether the given index is enabled in the Bitmap or not.
func (*Mask) KeyEnabled ¶
KeyEnabled checks whether the index, corresponding to the given key, is enabled in the Bitmap or not.
func (*Mask) SetBit ¶
SetBit enables (enable: true) or disables (enable: false) the bit in the participation Bitmap of the given cosigner.
type Policy ¶
Policy represents a fully customizable cosigning policy deciding what cosigner sets are and aren't sufficient for a collective signature to be considered acceptable to a verifier. The Check method may inspect the set of participants that cosigned by invoking cosi.Mask and/or cosi.MaskBit, and may use any other relevant contextual information (e.g., how security-critical the operation relying on the collective signature is) in determining whether the collective signature was produced by an acceptable set of cosigners.
type ThresholdPolicy ¶
type ThresholdPolicy struct {
// contains filtered or unexported fields
}
ThresholdPolicy allows to specify a simple t-of-n policy requring that at least the given threshold number of participants t have cosigned to make a collective signature valid.
func NewThresholdPolicy ¶
func NewThresholdPolicy(thold int) *ThresholdPolicy
NewThresholdPolicy returns a new ThresholdPolicy with the given threshold.
func (ThresholdPolicy) Check ¶
func (p ThresholdPolicy) Check(m *Mask) bool
Check verifies that at least a threshold number of participants have contributed to a collective signature.