mirror of
https://github.com/luxfi/crypto.git
synced 2026-07-27 01:54:50 +00:00
style: fix gofmt formatting issues in threshold and aggregated packages
This commit is contained in:
@@ -91,14 +91,14 @@ type SignatureConfig struct {
|
||||
|
||||
// AggregatedSignature represents an aggregated signature with metadata
|
||||
type AggregatedSignature struct {
|
||||
Type SignatureType `json:"type"`
|
||||
Signature []byte `json:"signature"`
|
||||
SignerIDs []ids.NodeID `json:"signerIds,omitempty"`
|
||||
SignerCount int `json:"signerCount"`
|
||||
ThresholdPubKeys []*ThresholdPublicKey `json:"thresholdPubKeys,omitempty"` // For Corona threshold
|
||||
AggregateKey []byte `json:"aggregateKey,omitempty"` // For BLS
|
||||
ThresholdRequired int `json:"threshold,omitempty"` // For threshold schemes
|
||||
TotalFee uint64 `json:"totalFee"`
|
||||
Type SignatureType `json:"type"`
|
||||
Signature []byte `json:"signature"`
|
||||
SignerIDs []ids.NodeID `json:"signerIds,omitempty"`
|
||||
SignerCount int `json:"signerCount"`
|
||||
ThresholdPubKeys []*ThresholdPublicKey `json:"thresholdPubKeys,omitempty"` // For Corona threshold
|
||||
AggregateKey []byte `json:"aggregateKey,omitempty"` // For BLS
|
||||
ThresholdRequired int `json:"threshold,omitempty"` // For threshold schemes
|
||||
TotalFee uint64 `json:"totalFee"`
|
||||
}
|
||||
|
||||
// SignatureAggregator manages network-wide signature aggregation
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
// SchemeAdapter provides a simplified interface for using threshold schemes.
|
||||
// It wraps the full scheme interfaces for common use cases.
|
||||
type SchemeAdapter struct {
|
||||
scheme Scheme
|
||||
keyShare KeyShare
|
||||
signer Signer
|
||||
verifier Verifier
|
||||
scheme Scheme
|
||||
keyShare KeyShare
|
||||
signer Signer
|
||||
verifier Verifier
|
||||
aggregator Aggregator
|
||||
}
|
||||
|
||||
|
||||
+15
-15
@@ -207,12 +207,12 @@ func (pk *PublicKey) SchemeID() threshold.SchemeID {
|
||||
|
||||
// KeyShare represents a party's BLS key share.
|
||||
type KeyShare struct {
|
||||
index int
|
||||
threshold int
|
||||
index int
|
||||
threshold int
|
||||
totalParties int
|
||||
secretShare *bls.SecretKey
|
||||
publicShare *bls.PublicKey
|
||||
groupKey *PublicKey
|
||||
secretShare *bls.SecretKey
|
||||
publicShare *bls.PublicKey
|
||||
groupKey *PublicKey
|
||||
}
|
||||
|
||||
// Index returns the party index.
|
||||
@@ -868,17 +868,17 @@ func (v *Verifier) GroupKey() threshold.PublicKey {
|
||||
|
||||
// Ensure interfaces are implemented
|
||||
var (
|
||||
_ threshold.Scheme = (*Scheme)(nil)
|
||||
_ threshold.PublicKey = (*PublicKey)(nil)
|
||||
_ threshold.KeyShare = (*KeyShare)(nil)
|
||||
_ threshold.Scheme = (*Scheme)(nil)
|
||||
_ threshold.PublicKey = (*PublicKey)(nil)
|
||||
_ threshold.KeyShare = (*KeyShare)(nil)
|
||||
_ threshold.SignatureShare = (*SignatureShare)(nil)
|
||||
_ threshold.Signature = (*Signature)(nil)
|
||||
_ threshold.TrustedDealer = (*TrustedDealer)(nil)
|
||||
_ threshold.DKG = (*DKG)(nil)
|
||||
_ threshold.DKGMessage = (*DKGMessage)(nil)
|
||||
_ threshold.Signer = (*Signer)(nil)
|
||||
_ threshold.Aggregator = (*Aggregator)(nil)
|
||||
_ threshold.Verifier = (*Verifier)(nil)
|
||||
_ threshold.Signature = (*Signature)(nil)
|
||||
_ threshold.TrustedDealer = (*TrustedDealer)(nil)
|
||||
_ threshold.DKG = (*DKG)(nil)
|
||||
_ threshold.DKGMessage = (*DKGMessage)(nil)
|
||||
_ threshold.Signer = (*Signer)(nil)
|
||||
_ threshold.Aggregator = (*Aggregator)(nil)
|
||||
_ threshold.Verifier = (*Verifier)(nil)
|
||||
)
|
||||
|
||||
// Compilation check for unused variables
|
||||
|
||||
+20
-20
@@ -8,29 +8,29 @@ import "errors"
|
||||
// Sentinel errors for threshold signature operations.
|
||||
var (
|
||||
// Configuration errors
|
||||
ErrInvalidThreshold = errors.New("threshold: invalid threshold value")
|
||||
ErrInvalidPartyCount = errors.New("threshold: invalid party count")
|
||||
ErrThresholdTooHigh = errors.New("threshold: threshold must be less than total parties")
|
||||
ErrInvalidPartyIndex = errors.New("threshold: party index out of range")
|
||||
ErrInvalidConfig = errors.New("threshold: invalid configuration")
|
||||
ErrInvalidThreshold = errors.New("threshold: invalid threshold value")
|
||||
ErrInvalidPartyCount = errors.New("threshold: invalid party count")
|
||||
ErrThresholdTooHigh = errors.New("threshold: threshold must be less than total parties")
|
||||
ErrInvalidPartyIndex = errors.New("threshold: party index out of range")
|
||||
ErrInvalidConfig = errors.New("threshold: invalid configuration")
|
||||
|
||||
// Scheme errors
|
||||
ErrSchemeNotFound = errors.New("threshold: scheme not registered")
|
||||
ErrSchemeNotSupported = errors.New("threshold: operation not supported by scheme")
|
||||
|
||||
// Key errors
|
||||
ErrInvalidKeyShare = errors.New("threshold: invalid key share")
|
||||
ErrInvalidPublicKey = errors.New("threshold: invalid public key")
|
||||
ErrKeyShareMismatch = errors.New("threshold: key share does not match group key")
|
||||
ErrDuplicateKeyShare = errors.New("threshold: duplicate key share index")
|
||||
ErrInsufficientShares = errors.New("threshold: insufficient shares for threshold")
|
||||
ErrKeyShareCorrupted = errors.New("threshold: key share data corrupted")
|
||||
ErrInvalidKeyShare = errors.New("threshold: invalid key share")
|
||||
ErrInvalidPublicKey = errors.New("threshold: invalid public key")
|
||||
ErrKeyShareMismatch = errors.New("threshold: key share does not match group key")
|
||||
ErrDuplicateKeyShare = errors.New("threshold: duplicate key share index")
|
||||
ErrInsufficientShares = errors.New("threshold: insufficient shares for threshold")
|
||||
ErrKeyShareCorrupted = errors.New("threshold: key share data corrupted")
|
||||
|
||||
// Signature errors
|
||||
ErrInvalidSignatureShare = errors.New("threshold: invalid signature share")
|
||||
ErrInvalidSignature = errors.New("threshold: invalid signature")
|
||||
ErrSignatureShareMismatch = errors.New("threshold: signature share does not match")
|
||||
ErrDuplicateSignatureShare = errors.New("threshold: duplicate signature share index")
|
||||
ErrInvalidSignatureShare = errors.New("threshold: invalid signature share")
|
||||
ErrInvalidSignature = errors.New("threshold: invalid signature")
|
||||
ErrSignatureShareMismatch = errors.New("threshold: signature share does not match")
|
||||
ErrDuplicateSignatureShare = errors.New("threshold: duplicate signature share index")
|
||||
ErrSignatureVerificationFailed = errors.New("threshold: signature verification failed")
|
||||
|
||||
// Protocol errors
|
||||
@@ -42,15 +42,15 @@ var (
|
||||
ErrMessageFromSelf = errors.New("threshold: cannot process own message")
|
||||
|
||||
// Nonce errors
|
||||
ErrNonceReused = errors.New("threshold: nonce already used")
|
||||
ErrNonceMissing = errors.New("threshold: nonce state required")
|
||||
ErrInvalidNonce = errors.New("threshold: invalid nonce")
|
||||
ErrNonceReused = errors.New("threshold: nonce already used")
|
||||
ErrNonceMissing = errors.New("threshold: nonce state required")
|
||||
ErrInvalidNonce = errors.New("threshold: invalid nonce")
|
||||
ErrNonceCommitmentMismatch = errors.New("threshold: nonce commitment mismatch")
|
||||
|
||||
// State errors
|
||||
ErrNotInitialized = errors.New("threshold: not initialized")
|
||||
ErrNotInitialized = errors.New("threshold: not initialized")
|
||||
ErrAlreadyComplete = errors.New("threshold: operation already complete")
|
||||
ErrInvalidState = errors.New("threshold: invalid state for operation")
|
||||
ErrInvalidState = errors.New("threshold: invalid state for operation")
|
||||
|
||||
// Serialization errors
|
||||
ErrInvalidEncoding = errors.New("threshold: invalid encoding")
|
||||
|
||||
@@ -71,15 +71,15 @@ func MustGetScheme(id SchemeID) Scheme {
|
||||
|
||||
// SchemeInfo provides metadata about a threshold scheme.
|
||||
type SchemeInfo struct {
|
||||
ID SchemeID
|
||||
Name string
|
||||
Description string
|
||||
PostQuantum bool
|
||||
NonInteractive bool
|
||||
KeyShareSize int
|
||||
SignatureSize int
|
||||
DKGRounds int
|
||||
SigningRounds int
|
||||
ID SchemeID
|
||||
Name string
|
||||
Description string
|
||||
PostQuantum bool
|
||||
NonInteractive bool
|
||||
KeyShareSize int
|
||||
SignatureSize int
|
||||
DKGRounds int
|
||||
SigningRounds int
|
||||
}
|
||||
|
||||
// GetSchemeInfo returns information about a registered scheme.
|
||||
|
||||
Reference in New Issue
Block a user