tss

package
v0.0.0-...-de91b87 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrJoinPartyTimeout = errors.New("fail to join party, timeout")
	ErrLeaderNotReady   = errors.New("leader not reachable")
	ErrSignReceived     = errors.New("signature received")
	ErrNotActiveSigner  = errors.New("not active signer")
	ErrSigGenerated     = errors.New("signature generated")
)

Functions

This section is empty.

Types

type BulkWireMsg

type BulkWireMsg struct {
	WiredBulkMsgs []byte
	MsgIdentifier string
	Routing       *btss.MessageRouting
}

The TaskMessage body content

func NewBulkWireMsg

func NewBulkWireMsg(msg []byte, id string, r *btss.MessageRouting) BulkWireMsg

type Tss

type Tss interface {
	Keygen(req keygen.Request) (*keygen.Response, error)

	Keysign(req keysign.Request) (*keysign.Response, error)

	PutTssMsg(msg *pb.Message)
}

type TssConfig

type TssConfig struct {
	EnableTSS bool `mapstructure:"enable_tss" json:"enable_tss"`
	//PartyTimeout    time.Duration `mapstructure:"party_timeout" json:"party_timeout"`
	KeyGenTimeout   time.Duration `mapstructure:"key_gen_timeout" json:"key_gen_timeout"`
	KeySignTimeout  time.Duration `mapstructure:"key_sign_timeout" json:"key_sign_timeout"`
	PreParamTimeout time.Duration `mapstructure:"pre_param_timeout" json:"pre_param_timeout"`
	TssConfPath     string        `mapstructure:"tss_conf_path" json:"tss_conf_path"`
}

type TssInstance

type TssInstance struct {

	// receive task Messages
	TssMsgChan chan *pb.Message
	// contains filtered or unexported fields
}

TssInstance is the structure that can provide all Keygen and Keysign features

func NewTssInstance

func NewTssInstance(
	conf TssConfig,
	privKey crypto.PrivKey,
	preParams *bkg.LocalPreParams,
	keygenLocalState *storage.KeygenLocalState,
	peerMgr peer_mgr.OrderPeerManager,
	logger logrus.FieldLogger,
) (tssInstance *TssInstance, err error)

NewTss creates a new instance of Tss

func (*TssInstance) InitTssInfo

func (t *TssInstance) InitTssInfo(
	msgId string,
	msgNum int,
	privKey crypto.PrivKey,
	threshold uint64,
	conf TssConfig,
	preParams *bkg.LocalPreParams,
	keygenLocalState *storage.KeygenLocalState,
	peerMgr peer_mgr.OrderPeerManager,
	logger logrus.FieldLogger,
) (err error)

The current instance may be reused. Need to clear some information before using it

func (*TssInstance) Keygen

func (t *TssInstance) Keygen(req keygen.Request) (*keygen.Response, error)

Keygen generates the key share of the participants of the threshold signature

func (*TssInstance) Keysign

func (t *TssInstance) Keysign(req keysign.Request) (*keysign.Response, error)

func (*TssInstance) NotifyTaskDone

func (t *TssInstance) NotifyTaskDone() error

NotifyTaskDone broadcasts a message, the current task is over ======================================================

func (*TssInstance) ProcessInboundMessages

func (t *TssInstance) ProcessInboundMessages(wg *sync.WaitGroup)

ProcessInboundMessages process the different types of p2p msgs received==============================================

func (*TssInstance) ProcessOneMessage

func (t *TssInstance) ProcessOneMessage(msg *pb.Message) error

ProcessOneMessage process one p2p msgs received======================================================================

func (*TssInstance) ProcessOutCh

func (t *TssInstance) ProcessOutCh(tssMsg btss.Message, msgType message.TssMsgType) error

ProcessOutCh sends msg out ========================================================================================== add msgType to the library message, send it as requested or broadcast

func (*TssInstance) PutTssMsg

func (t *TssInstance) PutTssMsg(msg *pb.Message)

func (*TssInstance) SignMessage

func (t *TssInstance) SignMessage(msgsToSign [][]byte, localStateItem *storage.KeygenLocalState, signers []crypto.PubKey) ([]*bcommon.SignatureData, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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