mp_tss

package
v0.0.0-...-8cb8a38 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Curve = tss.S256()

Functions

func CreateParams

func CreateParams(
	partyIDs tss.UnSortedPartyIDs,
	localPartyID *tss.PartyID,
	threshold int,
) *tss.Parameters

CreateParams creates tss parameters for the given party IDs, local partyID, and threshold for tss.

func CreateReShareParams

func CreateReShareParams(
	oldPartyIDs tss.UnSortedPartyIDs,
	newPartyIDs tss.UnSortedPartyIDs,
	localPartyID *tss.PartyID,
	threshold int,
	newThreshold int,
) *tss.ReSharingParameters

func RunKeyGen

func RunKeyGen(
	ctx context.Context,
	preParams *keygen.LocalPreParams,
	params *tss.Parameters,
	transport Transporter,
) (chan keygen.LocalPartySaveData, chan *tss.Error)

RunKeyGen starts the local keygen party and handles incoming and outgoing messages to other parties.

func RunParty

func RunParty(
	ctx context.Context,
	party tss.Party,
	errCh chan<- *tss.Error,
	outCh <-chan tss.Message,
	transport Transporter,
	isReSharing bool,
)

RunParty starts the local party in the background and handles incoming and outgoing messages. Does **not** block.

func RunReshare

func RunReshare(
	ctx context.Context,
	params *tss.ReSharingParameters,
	key keygen.LocalPartySaveData,
	transport Transporter,
) (chan keygen.LocalPartySaveData, chan *tss.Error)

RunReshare starts the local reshare party and handles incoming and outgoing messages to other parties.

func RunSign

func RunSign(
	ctx context.Context,
	msg *big.Int,
	params *tss.Parameters,
	key keygen.LocalPartySaveData,
	transport Transporter,
) (chan common.SignatureData, chan *tss.Error)

RunSign starts the local signing party and handles incoming and outgoing messages to other parties.

Types

type MemoryTransporter

type MemoryTransporter struct {
	PartyID *tss.PartyID
	// contains filtered or unexported fields
}

func NewMemoryTransporter

func NewMemoryTransporter(partyID *tss.PartyID) *MemoryTransporter

func (*MemoryTransporter) AddNewCommitteeTarget

func (mt *MemoryTransporter) AddNewCommitteeTarget(partyID *tss.PartyID, ch chan ReceivedPartyState)

func (*MemoryTransporter) AddOldCommitteeTarget

func (mt *MemoryTransporter) AddOldCommitteeTarget(partyID *tss.PartyID, ch chan ReceivedPartyState)

func (*MemoryTransporter) AddTarget

func (mt *MemoryTransporter) AddTarget(partyID *tss.PartyID, ch chan ReceivedPartyState)

func (*MemoryTransporter) GetReceiver

func (mt *MemoryTransporter) GetReceiver() chan ReceivedPartyState

GetReceiver returns a channel for other peer to send messages to.

func (*MemoryTransporter) Receive

func (mt *MemoryTransporter) Receive() chan ReceivedPartyState

Receive returns a channel for the current peer to receive messages from other peers.

func (*MemoryTransporter) Send

func (mt *MemoryTransporter) Send(ctx context.Context, data []byte, routing *tss.MessageRouting, isResharing bool) error

type PartyIDStore

type PartyIDStore struct {
	// contains filtered or unexported fields
}

PartyIDStore keeps track of the party IDs of all libp2p peers.

func NewPartyIDStore

func NewPartyIDStore() *PartyIDStore

NewPartyIDStore creates a new PartyIDStore.

func (*PartyIDStore) AddPeers

func (s *PartyIDStore) AddPeers(
	peers []*PeerMetadata,
) error

AddPeers adds a list of peer.IDs and monikers to the store.

func (*PartyIDStore) GetPartyID

func (s *PartyIDStore) GetPartyID(peerID peer.ID) (*tss.PartyID, error)

func (*PartyIDStore) GetPartyIDs

func (s *PartyIDStore) GetPartyIDs(peerIDs peer.IDSlice) (tss.UnSortedPartyIDs, error)

GetPartyIDs returns a list of sorted partyIDs for the provided peer IDs.

func (*PartyIDStore) GetPeerID

func (s *PartyIDStore) GetPeerID(partyID *tss.PartyID) (peer.ID, bool)

func (*PartyIDStore) String

func (s *PartyIDStore) String() string

type PeerMetadata

type PeerMetadata struct {
	PeerID  peer.ID
	Moniker string
	// contains filtered or unexported fields
}

1. GetPartyID() from all parties 2. Sort party IDs 3. Update PartyID in each PeerMetadata to have the correct index

func NewPeerMetadata

func NewPeerMetadata(peerID peer.ID, moniker string) *PeerMetadata

func (*PeerMetadata) GetUnsortedPartyID

func (pm *PeerMetadata) GetUnsortedPartyID() (*tss.PartyID, error)

GetUnsortedPartyID get's the partyID of a with the partyID key set to the peerID's pubkey.

func (*PeerMetadata) SetSortedPartyID

func (pm *PeerMetadata) SetSortedPartyID(partyID *tss.PartyID) error

SetSortedPartyID sets the partyID of a with the partyID key set to the

type ReceivedPartyState

type ReceivedPartyState struct {
	WireBytes   []byte
	From        *tss.PartyID
	IsBroadcast bool
}

ReceivedPartyState is a message received from another party

func DataRoutingToMessage

func DataRoutingToMessage(data []byte, routing *tss.MessageRouting) ReceivedPartyState

func NewReceivedPartyState

func NewReceivedPartyState(
	wireBytes []byte,
	from *tss.PartyID,
	isBroadcast bool,
) ReceivedPartyState

NewReceivedPartyState returns a new ReceivedPartyState.

type Transporter

type Transporter interface {
	Send(context.Context, []byte, *tss.MessageRouting, bool) error
	// Receive returns a channel that will be read by the local tss party. This
	// consists of ReceivedPartyState messages received from other parties.
	Receive() chan ReceivedPartyState
}

Transporter is the interface that defines the Send and Receive methods to transfer lib-tss messages between parties.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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