messaging

package
v1.10.9 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DisableBlockchainChecksConfigEnvName = envConfigPrefix + "DISABLE_BLOCKCHAIN_CHECKS"

	MaxFeeBasisPointsConfigEnvName = envConfigPrefix + "MAX_FEE_BASIS_POINTS"
)

Variables

This section is empty.

Functions

func NewMessagingClientAndServer

func NewMessagingClientAndServer(
	data code_data.Provider,
	rpcSignatureVerifier *auth.RPCSignatureVerifier,
	broadcastAddress string,
	configProvider ConfigProvider,
) *server

NewMessagingClientAndServer returns a new messaging client and server bundle.

These are currently highly coupled atm due to need to detect an active stream on a local server and avoiding the network call.

Note: The multi-server implementation of this server is not perfect, and it doesn't need to be initially. We're mostly acting as a notification system where updates can be sent out-of-order. If we need stronger guarantees, resurrecting the Black Marlin KikX project might be necessary. Ideally we'd avoid this due to the step level increase in complexity.

todo: Proper separation of internal client and server

Types

type ClientRejectedLoginMessageHandler added in v1.2.0

type ClientRejectedLoginMessageHandler struct {
}

func (*ClientRejectedLoginMessageHandler) OnSuccess added in v1.2.0

func (*ClientRejectedLoginMessageHandler) RequiresActiveStream added in v1.2.0

func (h *ClientRejectedLoginMessageHandler) RequiresActiveStream() (bool, time.Duration)

func (*ClientRejectedLoginMessageHandler) Validate added in v1.2.0

func (h *ClientRejectedLoginMessageHandler) Validate(ctx context.Context, rendezvous *common.Account, untypedMessage *messagingpb.Message) error

type ClientRejectedPaymentMessageHandler

type ClientRejectedPaymentMessageHandler struct {
}

func (*ClientRejectedPaymentMessageHandler) OnSuccess

func (*ClientRejectedPaymentMessageHandler) RequiresActiveStream

func (h *ClientRejectedPaymentMessageHandler) RequiresActiveStream() (bool, time.Duration)

func (*ClientRejectedPaymentMessageHandler) Validate

func (h *ClientRejectedPaymentMessageHandler) Validate(ctx context.Context, rendezvous *common.Account, untypedMessage *messagingpb.Message) error

type CodeScannedMessageHandler

type CodeScannedMessageHandler struct {
}

func (*CodeScannedMessageHandler) OnSuccess

func (h *CodeScannedMessageHandler) OnSuccess(ctx context.Context) error

func (*CodeScannedMessageHandler) RequiresActiveStream

func (h *CodeScannedMessageHandler) RequiresActiveStream() (bool, time.Duration)

func (*CodeScannedMessageHandler) Validate

func (h *CodeScannedMessageHandler) Validate(ctx context.Context, rendezvous *common.Account, untypedMessage *messagingpb.Message) error

type ConfigProvider

type ConfigProvider func() *conf

ConfigProvider defines how config values are pulled

func WithEnvConfigs

func WithEnvConfigs() ConfigProvider

WithEnvConfigs returns configuration pulled from environment variables

type InternalMessageClient

type InternalMessageClient interface {
	// InternallyCreateMessage creates and forwards a message on a stream
	// identified by the rendezvous key
	InternallyCreateMessage(ctx context.Context, rendezvousKey *common.Account, message *messagingpb.Message) (uuid.UUID, error)
}

func NewMessagingClient

func NewMessagingClient(
	data code_data.Provider,
) InternalMessageClient

NewMessagingClient returns a new internal messaging client

todo: Proper separation of internal client and server

type MessageAuthenticationError

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

func (MessageAuthenticationError) Error

type MessageAuthorizationError

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

func (MessageAuthorizationError) Error

type MessageHandler

type MessageHandler interface {
	// Validate validates a message, which determines whether it should be
	// allowed to be sent and persisted
	Validate(ctx context.Context, rendezvous *common.Account, message *messagingpb.Message) error

	// RequiresActiveStream determines whether a message can only be sent if an
	// active stream is available. If true, then the message must also provide
	// the maximum time it expects the stream to be valid for, which is dependent
	// on the use case.
	RequiresActiveStream() (bool, time.Duration)

	// OnSuccess is called upon creating the message after validation
	OnSuccess(ctx context.Context) error
}

MessageHandler provides message-specific in addition to the generic message handling flows. Implementations are responsible for determining whether a message can be allowed to be retried.

func NewClientRejectedLoginMessageHandler added in v1.2.0

func NewClientRejectedLoginMessageHandler() MessageHandler

func NewClientRejectedPaymentMessageHandler

func NewClientRejectedPaymentMessageHandler() MessageHandler

func NewCodeScannedMessageHandler

func NewCodeScannedMessageHandler() MessageHandler

func NewRequestToGrabBillMessageHandler

func NewRequestToGrabBillMessageHandler(data code_data.Provider) MessageHandler

func NewRequestToLoginMessageHandler

func NewRequestToLoginMessageHandler(data code_data.Provider, rpcSignatureVerifier *auth.RPCSignatureVerifier, domainVerifier thirdparty.DomainVerifier) MessageHandler

func NewRequestToReceiveBillMessageHandler

func NewRequestToReceiveBillMessageHandler(
	conf *conf, data code_data.Provider,
	rpcSignatureVerifier *auth.RPCSignatureVerifier,
	domainVerifier thirdparty.DomainVerifier,
) MessageHandler

type MessageValidationError

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

func (MessageValidationError) Error

func (e MessageValidationError) Error() string

type RequestToGrabBillMessageHandler

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

func (*RequestToGrabBillMessageHandler) OnSuccess

func (*RequestToGrabBillMessageHandler) RequiresActiveStream

func (h *RequestToGrabBillMessageHandler) RequiresActiveStream() (bool, time.Duration)

func (*RequestToGrabBillMessageHandler) Validate

func (h *RequestToGrabBillMessageHandler) Validate(ctx context.Context, rendezvous *common.Account, untypedMessage *messagingpb.Message) error

type RequestToLoginMessageHandler

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

func (*RequestToLoginMessageHandler) OnSuccess

func (*RequestToLoginMessageHandler) RequiresActiveStream

func (h *RequestToLoginMessageHandler) RequiresActiveStream() (bool, time.Duration)

func (*RequestToLoginMessageHandler) Validate

func (h *RequestToLoginMessageHandler) Validate(ctx context.Context, rendezvous *common.Account, untypedMessage *messagingpb.Message) error

type RequestToReceiveBillMessageHandler

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

func (*RequestToReceiveBillMessageHandler) OnSuccess

func (*RequestToReceiveBillMessageHandler) RequiresActiveStream

func (h *RequestToReceiveBillMessageHandler) RequiresActiveStream() (bool, time.Duration)

func (*RequestToReceiveBillMessageHandler) Validate

func (h *RequestToReceiveBillMessageHandler) Validate(ctx context.Context, rendezvous *common.Account, untypedMessage *messagingpb.Message) error

Jump to

Keyboard shortcuts

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