Documentation
¶
Overview ¶
Package bls implements BLS threshold signatures.
BLS threshold signatures provide:
- Non-interactive signature aggregation
- Constant-size signatures regardless of threshold
- Efficient verification
This implementation uses Shamir's Secret Sharing for key distribution and Lagrange interpolation for signature combination.
Index ¶
- Constants
- type Aggregator
- type DKG
- func (d *DKG) GroupKey() threshold.PublicKey
- func (d *DKG) NumRounds() int
- func (d *DKG) Round1(ctx context.Context) (threshold.DKGMessage, error)
- func (d *DKG) Round2(ctx context.Context, round1Messages map[int]threshold.DKGMessage) (threshold.DKGMessage, error)
- func (d *DKG) Round3(ctx context.Context, round2Messages map[int]threshold.DKGMessage) (threshold.KeyShare, error)
- type DKGMessage
- type KeyShare
- type PublicKey
- type Scheme
- func (s *Scheme) ID() threshold.SchemeID
- func (s *Scheme) KeyShareSize() int
- func (s *Scheme) Name() string
- func (s *Scheme) NewAggregator(groupKey threshold.PublicKey) (threshold.Aggregator, error)
- func (s *Scheme) NewDKG(config threshold.DKGConfig) (threshold.DKG, error)
- func (s *Scheme) NewSigner(share threshold.KeyShare) (threshold.Signer, error)
- func (s *Scheme) NewTrustedDealer(config threshold.DealerConfig) (threshold.TrustedDealer, error)
- func (s *Scheme) NewVerifier(groupKey threshold.PublicKey) (threshold.Verifier, error)
- func (s *Scheme) ParseKeyShare(data []byte) (threshold.KeyShare, error)
- func (s *Scheme) ParsePublicKey(data []byte) (threshold.PublicKey, error)
- func (s *Scheme) ParseSignature(data []byte) (threshold.Signature, error)
- func (s *Scheme) ParseSignatureShare(data []byte) (threshold.SignatureShare, error)
- func (s *Scheme) PublicKeySize() int
- func (s *Scheme) SignatureShareSize() int
- func (s *Scheme) SignatureSize() int
- type Signature
- type SignatureShare
- type Signer
- func (s *Signer) Index() int
- func (s *Signer) KeyShare() threshold.KeyShare
- func (s *Signer) NonceGen(ctx context.Context) (threshold.NonceCommitment, threshold.NonceState, error)
- func (s *Signer) PublicShare() []byte
- func (s *Signer) SignShare(ctx context.Context, message []byte, signers []int, nonce threshold.NonceState) (threshold.SignatureShare, error)
- type TrustedDealer
- type Verifier
Constants ¶
const ( // 32 bytes secret + 48 bytes public share + 48 bytes group key + 4 bytes metadata KeyShareSize = 132 // 96 bytes signature + 4 bytes index SignatureShareSize = 100 // SignatureSize is the serialized size of the final signature. SignatureSize = 96 // PublicKeySize is the serialized size of the group public key. PublicKeySize = 48 )
Constants for BLS threshold scheme.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
Aggregator combines BLS signature shares.
func (*Aggregator) Aggregate ¶
func (a *Aggregator) Aggregate(ctx context.Context, message []byte, shares []threshold.SignatureShare, commitments []threshold.NonceCommitment) (threshold.Signature, error)
Aggregate combines signature shares into a final signature using Lagrange interpolation. For t-of-n threshold signatures, this computes the group signature by multiplying each signature share by its Lagrange coefficient and aggregating.
func (*Aggregator) GroupKey ¶
func (a *Aggregator) GroupKey() threshold.PublicKey
GroupKey returns the group public key.
func (*Aggregator) VerifyShare ¶
func (a *Aggregator) VerifyShare(message []byte, share threshold.SignatureShare, publicShare []byte) error
VerifyShare verifies a single signature share.
type DKG ¶
type DKG struct {
// contains filtered or unexported fields
}
DKG implements distributed key generation for BLS threshold.
type DKGMessage ¶
type DKGMessage struct {
// contains filtered or unexported fields
}
DKGMessage represents a DKG protocol message.
func (*DKGMessage) FromParty ¶
func (m *DKGMessage) FromParty() int
FromParty returns the sender's party index.
type KeyShare ¶
type KeyShare struct {
// contains filtered or unexported fields
}
KeyShare represents a party's BLS key share.
func (*KeyShare) PublicShare ¶
PublicShare returns this party's public key share.
func (*KeyShare) TotalParties ¶
TotalParties returns the total number of parties.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey represents a BLS threshold group public key.
type Scheme ¶
type Scheme struct{}
Scheme implements the BLS threshold signature scheme.
func (*Scheme) KeyShareSize ¶
KeyShareSize returns the serialized key share size.
func (*Scheme) NewAggregator ¶
NewAggregator creates a signature aggregator for the given group key.
func (*Scheme) NewTrustedDealer ¶
func (s *Scheme) NewTrustedDealer(config threshold.DealerConfig) (threshold.TrustedDealer, error)
NewTrustedDealer creates a trusted dealer for centralized key generation.
func (*Scheme) NewVerifier ¶
NewVerifier creates a signature verifier for the given group key.
func (*Scheme) ParseKeyShare ¶
ParseKeyShare deserializes a key share from bytes.
func (*Scheme) ParsePublicKey ¶
ParsePublicKey deserializes a group public key from bytes.
func (*Scheme) ParseSignature ¶
ParseSignature deserializes a final signature from bytes.
func (*Scheme) ParseSignatureShare ¶
func (s *Scheme) ParseSignatureShare(data []byte) (threshold.SignatureShare, error)
ParseSignatureShare deserializes a signature share from bytes.
func (*Scheme) PublicKeySize ¶
PublicKeySize returns the serialized public key size.
func (*Scheme) SignatureShareSize ¶
SignatureShareSize returns the serialized signature share size.
func (*Scheme) SignatureSize ¶
SignatureSize returns the serialized final signature size.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature represents a final BLS threshold signature.
type SignatureShare ¶
type SignatureShare struct {
// contains filtered or unexported fields
}
SignatureShare represents a BLS signature share.
func (*SignatureShare) Bytes ¶
func (ss *SignatureShare) Bytes() []byte
Bytes serializes the signature share.
func (*SignatureShare) SchemeID ¶
func (ss *SignatureShare) SchemeID() threshold.SchemeID
SchemeID returns the scheme identifier.
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer creates BLS signature shares.
func (*Signer) NonceGen ¶
func (s *Signer) NonceGen(ctx context.Context) (threshold.NonceCommitment, threshold.NonceState, error)
NonceGen generates a nonce commitment. BLS threshold doesn't require nonces for aggregation.
func (*Signer) PublicShare ¶
PublicShare returns this party's public key share.
type TrustedDealer ¶
type TrustedDealer struct {
// contains filtered or unexported fields
}
TrustedDealer generates key shares using a trusted dealer.
func (*TrustedDealer) GenerateShares ¶
func (d *TrustedDealer) GenerateShares(ctx context.Context) ([]threshold.KeyShare, threshold.PublicKey, error)
GenerateShares creates all key shares and the group public key.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
Verifier verifies BLS threshold signatures.
func (*Verifier) VerifyBytes ¶
VerifyBytes verifies a serialized signature.