eventconsumer

package
v0.3.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MPCGenerateEvent = "mpc:generate"
	MPCSignEvent     = "mpc:sign"
	MPCReshareEvent  = "mpc:reshare"

	DefaultConcurrentKeygen   = 2
	DefaultConcurrentSigning  = 20
	DefaultSessionWarmUpDelay = 200

	KeyGenTimeOut = 30 * time.Second
)

Variables

This section is empty.

Functions

func NewTimeOutConsumer

func NewTimeOutConsumer(natsConn *nats.Conn, resultQueue messaging.MessageQueue) *timeOutConsumer

Types

type EventConsumer

type EventConsumer interface {
	Run()
	Close() error
}

func NewEventConsumer

func NewEventConsumer(
	node *mpc.Node,
	pubsub messaging.PubSub,
	genKeyResultQueue messaging.MessageQueue,
	signingResultQueue messaging.MessageQueue,
	reshareResultQueue messaging.MessageQueue,
	identityStore identity.Store,
) EventConsumer

type GenerateKeyMessage

type GenerateKeyMessage struct {
	WalletID  string `json:"wallet_id"`
	Signature []byte `json:"signature"`
}

func (*GenerateKeyMessage) InitiatorID

func (m *GenerateKeyMessage) InitiatorID() string

func (*GenerateKeyMessage) Raw

func (m *GenerateKeyMessage) Raw() ([]byte, error)

func (*GenerateKeyMessage) Sig

func (m *GenerateKeyMessage) Sig() []byte

type InitiatorMessage

type InitiatorMessage interface {
	// Raw returns the canonical byte‐slice that was signed.
	Raw() ([]byte, error)
	// Sig returns the signature over Raw().
	Sig() []byte
	// InitiatorID returns the ID whose public key we have to look up.
	InitiatorID() string
}

InitiatorMessage is anything that carries a payload to verify and its signature.

type KeyType

type KeyType string
const (
	KeyTypeSecp256k1 KeyType = "secp256k1"
	KeyTypeEd25519   KeyType = "ed25519"
)

type KeygenConsumer added in v0.3.0

type KeygenConsumer interface {
	// Run starts the consumer and blocks until the provided context is canceled.
	Run(ctx context.Context) error
	// Close performs a graceful shutdown of the consumer.
	Close() error
}

KeygenConsumer represents a consumer that processes signing events.

func NewKeygenConsumer added in v0.3.0

func NewKeygenConsumer(
	natsConn *nats.Conn,
	jsBroker messaging.MessageBroker,
	pubsub messaging.PubSub,
	peerRegistry mpc.PeerRegistry,
	keygenResultQueue messaging.MessageQueue,
) KeygenConsumer

NewKeygenConsumer returns a new instance of KeygenConsumer.

type SignTxMessage

type SignTxMessage struct {
	KeyType             KeyType `json:"key_type"`
	WalletID            string  `json:"wallet_id"`
	NetworkInternalCode string  `json:"network_internal_code"`
	TxID                string  `json:"tx_id"`
	Tx                  []byte  `json:"tx"`
	Signature           []byte  `json:"signature"`
}

func (*SignTxMessage) InitiatorID

func (m *SignTxMessage) InitiatorID() string

func (*SignTxMessage) Raw

func (m *SignTxMessage) Raw() ([]byte, error)

func (*SignTxMessage) Sig

func (m *SignTxMessage) Sig() []byte

type SigningConsumer

type SigningConsumer interface {
	// Run starts the consumer and blocks until the provided context is canceled.
	Run(ctx context.Context) error
	// Close performs a graceful shutdown of the consumer.
	Close() error
}

SigningConsumer represents a consumer that processes signing events.

func NewSigningConsumer

func NewSigningConsumer(natsConn *nats.Conn, jsBroker messaging.MessageBroker, pubsub messaging.PubSub, peerRegistry mpc.PeerRegistry, signingResultQueue messaging.MessageQueue) SigningConsumer

NewSigningConsumer returns a new instance of SigningConsumer.

Jump to

Keyboard shortcuts

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