keysign

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockTxProofChecker

type MockTxProofChecker struct {
	mock.Mock
}

MockTxProofChecker a Mock of TxProofChecker

func (*MockTxProofChecker) CheckTxProof

CheckTxProof mock implementation of check tx proof

type MoneroKeySign

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

MoneroKeySign structure to process monero keysign

func NewMoneroKeySign

func NewMoneroKeySign(localP2PID string, conf common.TssConfig,
	broadcastChan chan *messages.BroadcastMsgChan,
	stopChan chan struct{},
	msgID string,
	privKey tcrypto.PrivKey,
	p2pComm *p2p.Communication,
	walletAccessor monero_multi_sig.WalletAccessor,
	walletName string) (*MoneroKeySign, error)

NewMoneroKeySign create a new instance of Monero Keysign

func (*MoneroKeySign) GetTssCommonStruct

func (tKeySign *MoneroKeySign) GetTssCommonStruct() *common.TssCommon

GetTssCommonStruct return the common struct used by keysign

func (*MoneroKeySign) GetTssKeySignChannels

func (tKeySign *MoneroKeySign) GetTssKeySignChannels() chan *p2p.Message

GetTssKeySignChannels return the tss message channel

func (*MoneroKeySign) OrderKeysignMembers

func (tKeySign *MoneroKeySign) OrderKeysignMembers(msgID string, parties []string) []string

OrderKeysignMembers sort keysign members, based on message id and member's node public key

func (*MoneroKeySign) SignMessage

func (tKeySign *MoneroKeySign) SignMessage(encodedTx string, parties []string, memo string) (*TxSendProof, error)

SignMessage use multisig to process the given encoded Tx parties represent all the members of the multisig wallet.

type Notifier

type Notifier struct {
	MessageID string
	// contains filtered or unexported fields
}

Notifier is design to receive keysign signature, success or failure

func NewNotifier

func NewNotifier(messageID string, encodedTx string, memo string, txProofChecker TxProofChecker, threshold int) (*Notifier, error)

NewNotifier create a new instance of Notifier

func (*Notifier) GetResponseChannel

func (n *Notifier) GetResponseChannel() <-chan *TxSendProof

GetResponseChannel the final signature gathered from keysign party will be returned from the channel

func (*Notifier) ProcessSignature

func (n *Notifier) ProcessSignature(data *TxSendProof) (bool, error)

ProcessSignature is to verify whether the signature is valid return value bool , true indicated we already gather all the signature from keysign party, and they are all match false means we are still waiting for more signature from keysign party

type Request

type Request struct {
	BlockHeight   int64  `json:"block_height"`        // BlockHeight that this tx out is generated
	Version       string `json:"version"`             // TSS Version, currently is not used , for future-proof
	WalletAddress string `json:"wallet_address"`      // pub key of the pool that we would like to send this message from
	EncodedTx     string `json:"encoded_transaction"` // Transaction
	Memo          string `json:"memo"`                // Memo for the outbound tx
}

Request request to sign a message

func NewRequest

func NewRequest(walletAddress string, blockHeight int64, version, encodedTx, memo string) Request

NewRequest create a new keysign request

type Response

type Response struct {
	TxID      string        `json:"tx_id"`
	Signature string        `json:"signature"` // signature that can be used to proof the outbound
	Status    common.Status `json:"status"`
	Blame     tb.Blame      `json:"blame"`
}

Response key sign response

func NewResponse

func NewResponse(txID, signature string, status common.Status, blame tb.Blame) Response

NewResponse create a new response

type SignatureNotifier

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

SignatureNotifier is design to notify all members when a keysign is success

func NewSignatureNotifier

func NewSignatureNotifier(h host.Host) *SignatureNotifier

NewSignatureNotifier create a new instance of SignatureNotifier

func (*SignatureNotifier) BroadcastFailed

func (s *SignatureNotifier) BroadcastFailed(messageID string, peers []peer.ID) error

BroadcastFailed will send keysign failed message to the nodes that are not in the keysign party

func (*SignatureNotifier) BroadcastSignature

func (s *SignatureNotifier) BroadcastSignature(messageID string, signedTxHex *TxSendProof, peers []peer.ID) error

BroadcastSignature sending the keysign signature to all other peers

func (*SignatureNotifier) ReleaseStream

func (s *SignatureNotifier) ReleaseStream(msgID string)

func (*SignatureNotifier) WaitForSignature

func (s *SignatureNotifier) WaitForSignature(messageID, encodedTx, memo string, txProofChecker TxProofChecker, timeout time.Duration, sigChan chan string, threshold int) (*TxSendProof, error)

WaitForSignature wait until keysign finished and signature is available

type TxProofChecker

type TxProofChecker interface {
	// CheckTxProof request wallet to check a given tx proof to see whether it is legitimate
	CheckTxProof(proof *wallet.RequestCheckTxProof) (*wallet.ResponseCheckTxProof, error)
}

type TxSendProof

type TxSendProof struct {
	TransactionID string
	Signature     string
}

TxSendProof information can be used to proof the network sent the outbound

func (TxSendProof) IsEmpty

func (t TxSendProof) IsEmpty() bool

IsEmpty check whether TxSendProof is empty

Jump to

Keyboard shortcuts

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