bls

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package bls provides threshold BLS signature functionality using proper Shamir secret sharing and Lagrange interpolation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateSignatures

func AggregateSignatures(shares []*SignatureShare, threshold int) (*bls.Signature, error)

AggregateSignatures combines threshold signature shares using Lagrange interpolation. This produces a valid signature that verifies against the group public key.

func GetVerificationKeys added in v1.1.1

func GetVerificationKeys(shares map[party.ID]*bls.SecretKey) map[party.ID]*bls.PublicKey

GetVerificationKeys computes public keys for each share (for verification).

Types

type Config

type Config struct {
	// ID is this party's identifier
	ID party.ID

	// Threshold is the minimum number of parties needed to sign (t in t-of-n)
	Threshold int

	// TotalParties is the total number of parties
	TotalParties int

	// PublicKey is the aggregate public key
	PublicKey *bls.PublicKey

	// SecretShare is this party's secret key share
	SecretShare *bls.SecretKey

	// VerificationKeys are the public keys for each party's share
	VerificationKeys map[party.ID]*bls.PublicKey
}

Config holds BLS threshold signing configuration

func NewConfig added in v1.1.1

func NewConfig(id party.ID, threshold, totalParties int, secretShare *bls.SecretKey, groupPK *bls.PublicKey, verificationKeys map[party.ID]*bls.PublicKey) *Config

NewConfig creates a Config from generated shares.

func (*Config) Sign

func (c *Config) Sign(message []byte) (*SignatureShare, error)

Sign creates a partial BLS signature with this party's share

func (*Config) VerifyAggregateSignature

func (c *Config) VerifyAggregateSignature(message []byte, sig *bls.Signature) bool

VerifyAggregateSignature verifies the final aggregated signature

func (*Config) VerifyPartialSignature

func (c *Config) VerifyPartialSignature(share *SignatureShare, message []byte) bool

VerifyPartialSignature verifies a signature share from a specific party

type SignatureShare added in v1.1.1

type SignatureShare struct {
	PartyID   party.ID
	Signature *bls.Signature
}

SignatureShare represents a party's contribution to a threshold signature

type TrustedDealer added in v1.1.1

type TrustedDealer struct {
	Threshold    int
	TotalParties int
}

TrustedDealer generates key shares using a trusted dealer. This uses Shamir's secret sharing to distribute the master key.

func (*TrustedDealer) GenerateShares added in v1.1.1

func (d *TrustedDealer) GenerateShares(ctx context.Context, partyIDs []party.ID) (map[party.ID]*bls.SecretKey, *bls.PublicKey, error)

GenerateShares creates key shares for all parties. Returns the shares and the group public key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL