event

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeygenBrokerStream   = "mpc-keygen"
	KeygenConsumerStream = "mpc-keygen-consumer"
	KeygenRequestTopic   = "mpc.keygen_request.*"
)
View Source
const (
	SigningPublisherStream     = "mpc-signing"
	SigningConsumerStream      = "mpc-signing-consumer"
	SigningRequestTopic        = "mpc.signing_request.*"
	SigningResultTopic         = "mpc.mpc_signing_result.*"
	SigningResultCompleteTopic = "mpc.mpc_signing_result.complete"
)
View Source
const ClientIDHeader = "ClientID"

Variables

This section is empty.

Functions

func KeygenResultSubject added in v0.4.0

func KeygenResultSubject(clientID, walletID string) string

func KeygenResultSubscriptionSubject added in v0.4.0

func KeygenResultSubscriptionSubject(clientID string) string

func ReshareResultSubject added in v0.4.0

func ReshareResultSubject(clientID, sessionID string) string

func ReshareResultSubscriptionSubject added in v0.4.0

func ReshareResultSubscriptionSubject(clientID string) string

func ResultConsumerName added in v0.4.0

func ResultConsumerName(base, clientID string) string

func ResultStreamSubjects added in v0.4.0

func ResultStreamSubjects() []string

func ScopedOperationID added in v0.4.0

func ScopedOperationID(clientID, operationID string) string

func SigningResultSubject added in v0.4.0

func SigningResultSubject(clientID string) string

func SigningResultSubscriptionSubject added in v0.4.0

func SigningResultSubscriptionSubject(clientID string) string

Types

type ErrorCode added in v0.3.0

type ErrorCode string

ErrorCode defines specific error types that can occur in MPC operations

const (
	// Generic/Unknown errors
	ErrorCodeUnknown ErrorCode = "ERROR_UNKNOWN"

	// Network and connectivity errors
	ErrorCodeNetworkTimeout      ErrorCode = "ERROR_NETWORK_TIMEOUT"
	ErrorCodeNetworkConnection   ErrorCode = "ERROR_NETWORK_CONNECTION"
	ErrorCodeNetworkSubscription ErrorCode = "ERROR_NETWORK_SUBSCRIPTION"
	ErrorCodeMessageRouting      ErrorCode = "ERROR_MESSAGE_ROUTING"
	ErrorCodeDirectMessaging     ErrorCode = "ERROR_DIRECT_MESSAGING"

	// Session errors
	ErrorCodeSessionTimeout        ErrorCode = "ERROR_SESSION_TIMEOUT"
	ErrorCodeSessionCreation       ErrorCode = "ERROR_SESSION_CREATION"
	ErrorCodeSessionInitialization ErrorCode = "ERROR_SESSION_INITIALIZATION"
	ErrorCodeSessionCleanup        ErrorCode = "ERROR_SESSION_CLEANUP"
	ErrorCodeSessionDuplicate      ErrorCode = "ERROR_SESSION_DUPLICATE"
	ErrorCodeSessionStale          ErrorCode = "ERROR_SESSION_STALE"

	// Participant and peer errors
	ErrorCodeInsufficientParticipants ErrorCode = "ERROR_INSUFFICIENT_PARTICIPANTS"
	ErrorCodeIncompatiblePeerIDs      ErrorCode = "ERROR_INCOMPATIBLE_PEER_IDS"
	ErrorCodePeerNotReady             ErrorCode = "ERROR_PEER_NOT_READY"
	ErrorCodePeerUnavailable          ErrorCode = "ERROR_PEER_UNAVAILABLE"
	ErrorCodeParticipantNotFound      ErrorCode = "ERROR_PARTICIPANT_NOT_FOUND"

	// Key management errors
	ErrorCodeKeyNotFound      ErrorCode = "ERROR_KEY_NOT_FOUND"
	ErrorCodeKeyAlreadyExists ErrorCode = "ERROR_KEY_ALREADY_EXISTS"
	ErrorCodeKeyGeneration    ErrorCode = "ERROR_KEY_GENERATION"
	ErrorCodeKeySave          ErrorCode = "ERROR_KEY_SAVE"
	ErrorCodeKeyLoad          ErrorCode = "ERROR_KEY_LOAD"
	ErrorCodeKeyInfoSave      ErrorCode = "ERROR_KEY_INFO_SAVE"
	ErrorCodeKeyInfoLoad      ErrorCode = "ERROR_KEY_INFO_LOAD"
	ErrorCodeKeyEncoding      ErrorCode = "ERROR_KEY_ENCODING"
	ErrorCodeKeyDecoding      ErrorCode = "ERROR_KEY_DECODING"
	ErrorCodeMsgValidation    ErrorCode = "ERROR_MSG_VALIDATION"

	// Cryptographic operation errors
	ErrorCodeSignatureGeneration       ErrorCode = "ERROR_SIGNATURE_GENERATION"
	ErrorCodeSignatureVerification     ErrorCode = "ERROR_SIGNATURE_VERIFICATION"
	ErrorCodeInvalidInitiatorSignature ErrorCode = "ERROR_INVALID_INITIATOR_SIGNATURE"
	ErrorCodePreParamsGeneration       ErrorCode = "ERROR_PRE_PARAMS_GENERATION"
	ErrorCodeTSSPartyCreation          ErrorCode = "ERROR_TSS_PARTY_CREATION"

	// Authorization errors
	ErrorCodeMissingAuthorizerSignature ErrorCode = "ERROR_MISSING_AUTHORIZER_SIGNATURE"
	ErrorCodeInvalidAuthorizerSignature ErrorCode = "ERROR_INVALID_AUTHORIZER_SIGNATURE"

	// Data serialization errors
	ErrorCodeMarshalFailure   ErrorCode = "ERROR_MARSHAL_FAILURE"
	ErrorCodeUnmarshalFailure ErrorCode = "ERROR_UNMARSHAL_FAILURE"
	ErrorCodeDataCorruption   ErrorCode = "ERROR_DATA_CORRUPTION"

	// Storage errors
	ErrorCodeStorageRead  ErrorCode = "ERROR_STORAGE_READ"
	ErrorCodeStorageWrite ErrorCode = "ERROR_STORAGE_WRITE"
	ErrorCodeStorageInit  ErrorCode = "ERROR_STORAGE_INIT"

	// Message and verification errors
	ErrorCodeMessageVerification ErrorCode = "ERROR_MESSAGE_VERIFICATION"
	ErrorCodeMessageFormat       ErrorCode = "ERROR_MESSAGE_FORMAT"
	ErrorCodeMessageDelivery     ErrorCode = "ERROR_MESSAGE_DELIVERY"
	ErrorCodeMaxDeliveryAttempts ErrorCode = "ERROR_MAX_DELIVERY_ATTEMPTS"

	// Configuration errors
	ErrorCodeInvalidConfiguration ErrorCode = "ERROR_INVALID_CONFIGURATION"
	ErrorCodeInvalidThreshold     ErrorCode = "ERROR_INVALID_THRESHOLD"
	ErrorCodeInvalidSessionType   ErrorCode = "ERROR_INVALID_SESSION_TYPE"

	// Resource errors
	ErrorCodeResourceExhausted ErrorCode = "ERROR_RESOURCE_EXHAUSTED"
	ErrorCodeMemoryAllocation  ErrorCode = "ERROR_MEMORY_ALLOCATION"
	ErrorCodeConcurrencyLimit  ErrorCode = "ERROR_CONCURRENCY_LIMIT"

	// Operation-specific errors
	ErrorCodeKeygenFailure  ErrorCode = "ERROR_KEYGEN_FAILURE"
	ErrorCodeSigningFailure ErrorCode = "ERROR_SIGNING_FAILURE"
	ErrorCodeReshareFailure ErrorCode = "ERROR_RESHARE_FAILURE"

	// Context and cancellation errors
	ErrorCodeContextCancelled ErrorCode = "ERROR_CONTEXT_CANCELLED"
	ErrorCodeOperationAborted ErrorCode = "ERROR_OPERATION_ABORTED"
	ErrorCodeNotMajority      ErrorCode = "ERROR_NOT_MAJORITY"
	ErrorCodeClusterNotReady  ErrorCode = "ERROR_CLUSTER_NOT_READY"
)

func GetErrorCodeFromError added in v0.3.0

func GetErrorCodeFromError(err error) ErrorCode

GetErrorCodeFromError attempts to categorize a generic error into a specific error code

type KeygenResultEvent added in v0.3.0

type KeygenResultEvent struct {
	WalletID    string `json:"wallet_id"`
	ECDSAPubKey []byte `json:"ecdsa_pub_key"`
	EDDSAPubKey []byte `json:"eddsa_pub_key"`

	ResultType  ResultType `json:"result_type"`
	ErrorReason string     `json:"error_reason"`
	ErrorCode   string     `json:"error_code"`
}

type ResharingResultEvent added in v0.3.0

type ResharingResultEvent struct {
	WalletID     string        `json:"wallet_id"`
	NewThreshold int           `json:"new_threshold"`
	KeyType      types.KeyType `json:"key_type"`
	PubKey       []byte        `json:"pub_key"`

	ResultType  ResultType `json:"result_type"`
	ErrorReason string     `json:"error_reason"`
	ErrorCode   string     `json:"error_code"`
}

type ResultType added in v0.3.0

type ResultType string
const (
	ResultTypeSuccess ResultType = "success"
	ResultTypeError   ResultType = "error"
)

type SigningResultErrorEvent

type SigningResultErrorEvent struct {
	NetworkInternalCode string    `json:"network_internal_code"`
	WalletID            string    `json:"wallet_id"`
	TxID                string    `json:"tx_id"`
	ErrorCode           ErrorCode `json:"error_code"`
	ErrorReason         string    `json:"error_reason"`
	IsTimeout           bool      `json:"is_timeout"`
}

type SigningResultEvent

type SigningResultEvent struct {
	ResultType          ResultType `json:"result_type"`
	ErrorCode           ErrorCode  `json:"error_code"`
	ErrorReason         string     `json:"error_reason"`
	IsTimeout           bool       `json:"is_timeout"`
	NetworkInternalCode string     `json:"network_internal_code"`
	WalletID            string     `json:"wallet_id"`
	TxID                string     `json:"tx_id"`
	R                   []byte     `json:"r"`
	S                   []byte     `json:"s"`
	SignatureRecovery   []byte     `json:"signature_recovery"`

	// TODO: define two separate events for eddsa and ecdsa
	Signature []byte `json:"signature"`
}

type SigningResultSuccessEvent

type SigningResultSuccessEvent struct {
	NetworkInternalCode string `json:"network_internal_code"`
	WalletID            string `json:"wallet_id"`
	TxID                string `json:"tx_id"`
	R                   []byte `json:"r"`
	S                   []byte `json:"s"`
	SignatureRecovery   []byte `json:"signature_recovery"`

	// TODO: define two separate events for eddsa and ecdsa
	Signature []byte `json:"signature"`
}

Jump to

Keyboard shortcuts

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