package types
import "go.dedis.ch/dela/cosi/threshold/types"
Package types implements the threshold collective signature and its verifier.
It wraps a signature implementation in order to extract the correct aggregated public key.
The messages have been implemented in this isolated package so that it does not create cycle imports when importing the serde formats.
Documentation Last Review: 05.10.2020
Index ¶
- func NewThresholdVerifierFactory(fac crypto.VerifierFactory) crypto.VerifierFactory
- func RegisterSignatureFormat(c serde.Format, f serde.FormatEngine)
- type AggKey
- type Signature
- func NewSignature(agg crypto.Signature, mask []byte) *Signature
- func (s *Signature) Equal(o crypto.Signature) bool
- func (s *Signature) GetAggregate() crypto.Signature
- func (s *Signature) GetIndices() []int
- func (s *Signature) GetMask() []byte
- func (s *Signature) HasBit(index int) bool
- func (s *Signature) MarshalBinary() ([]byte, error)
- func (s *Signature) Merge(signer crypto.AggregateSigner, index int, sig crypto.Signature) error
- func (s *Signature) Serialize(ctx serde.Context) ([]byte, error)
- func (s *Signature) String() string
- type SignatureFactory
- func NewSignatureFactory(f crypto.SignatureFactory) SignatureFactory
- func (f SignatureFactory) Deserialize(ctx serde.Context, data []byte) (serde.Message, error)
- func (f SignatureFactory) SignatureOf(ctx serde.Context, data []byte) (crypto.Signature, error)
- type Verifier
Functions ¶
func NewThresholdVerifierFactory ¶
func NewThresholdVerifierFactory(fac crypto.VerifierFactory) crypto.VerifierFactory
NewThresholdVerifierFactory creates a new verifier factory from the underlying verifier factory.
func RegisterSignatureFormat ¶
func RegisterSignatureFormat(c serde.Format, f serde.FormatEngine)
RegisterSignatureFormat saves the format to be used when serializing/deserializing signature messages for the given codec.
Types ¶
type AggKey ¶
type AggKey struct{}
AggKey is the key for the aggregate signature factory.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature is a threshold signature which includes an aggregated signature and the mask of signers from the associated collective authority.
- implements crypto.Signature
func NewSignature ¶
NewSignature returns a new threshold signature.
func (*Signature) Equal ¶
Equal implements crypto.Signature.
func (*Signature) GetAggregate ¶
GetAggregate returns the aggregate of the signature which corresponds to the addition of the public keys enabled in the mask.
func (*Signature) GetIndices ¶
GetIndices returns the list of indices that have participated in the collective signature.
func (*Signature) GetMask ¶
GetMask returns a bit mask of which public key is enabled.
func (*Signature) HasBit ¶
HasBit returns true when the bit at the given index is set to 1.
func (*Signature) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler.
func (*Signature) Merge ¶
Merge adds the signature.
func (*Signature) Serialize ¶
Serialize implements serde.Message. It serializes the signature into JSON format.
func (*Signature) String ¶
String implements fmt.Stringer. It returns a string representation of the signature.
type SignatureFactory ¶
type SignatureFactory struct {
// contains filtered or unexported fields
}
SignatureFactory is the factory to deserialize collective signature.
- implements crypto.SignatureFactory - implements serde.Factory
func NewSignatureFactory ¶
func NewSignatureFactory(f crypto.SignatureFactory) SignatureFactory
NewSignatureFactory returns a new signature factory.
func (SignatureFactory) Deserialize ¶
Deserialize implements serde.Factory. It populates the signature from the data if appropriate, otherwise it returns an error.
func (SignatureFactory) SignatureOf ¶
SignatureOf implements crypto.SignatureFactory. It populates the signature from the data if appropriate, otherwise it returns an error.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier is a threshold verifier which can verify threshold signatures by aggregating public keys according to the mask.
- implements crypto.Verifier
func (Verifier) Verify ¶
Verify implements crypto.Verifier. It returns nil if the signature matches the aggregate public key for the mask associated to the signature.
Source Files ¶
types.go
- Version
- v0.1.0 (latest)
- Published
- Apr 10, 2024
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 1 month ago –
Tools for package owners.