Documentation ¶
Index ¶
- Constants
- func NewMessagingClientAndServer(data code_data.Provider, rpcSignatureVerifier *auth.RPCSignatureVerifier, ...) *server
- type ClientRejectedLoginMessageHandler
- type ClientRejectedPaymentMessageHandler
- type CodeScannedMessageHandler
- type ConfigProvider
- type InternalMessageClient
- type MessageAuthenticationError
- type MessageAuthorizationError
- type MessageHandler
- func NewClientRejectedLoginMessageHandler() MessageHandler
- func NewClientRejectedPaymentMessageHandler() MessageHandler
- func NewCodeScannedMessageHandler() MessageHandler
- func NewRequestToGrabBillMessageHandler(data code_data.Provider) MessageHandler
- func NewRequestToLoginMessageHandler(data code_data.Provider, rpcSignatureVerifier *auth.RPCSignatureVerifier, ...) MessageHandler
- func NewRequestToReceiveBillMessageHandler(conf *conf, data code_data.Provider, ...) MessageHandler
- type MessageValidationError
- type RequestToGrabBillMessageHandler
- type RequestToLoginMessageHandler
- type RequestToReceiveBillMessageHandler
Constants ¶
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 (h *ClientRejectedLoginMessageHandler) OnSuccess(ctx context.Context) error
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 (h *ClientRejectedPaymentMessageHandler) OnSuccess(ctx context.Context) error
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 ¶
func (e MessageAuthenticationError) Error() string
type MessageAuthorizationError ¶
type MessageAuthorizationError struct {
// contains filtered or unexported fields
}
func (MessageAuthorizationError) Error ¶
func (e MessageAuthorizationError) Error() string
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 (h *RequestToGrabBillMessageHandler) OnSuccess(ctx context.Context) error
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 (h *RequestToLoginMessageHandler) OnSuccess(ctx context.Context) error
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 (h *RequestToReceiveBillMessageHandler) OnSuccess(ctx context.Context) error
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