notificationBot

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comms

type Comms struct {
	*connect.ProtoComms

	*pb.UnimplementedNotificationBotServer
	*messages.UnimplementedGenericServer
	// contains filtered or unexported fields
}

NotificationBot object used to implement endpoints and top-level comms functionality

func StartNotificationBot

func StartNotificationBot(id *id.ID, localServer string, handler Handler,
	certPEMblock, keyPEMblock []byte) *Comms

Starts a new server on the address:port specified by localServer and a callback interface for server operations with given path to public and private key for TLS connection

func (*Comms) AuthenticateToken

func (nb *Comms) AuthenticateToken(_ context.Context,
	msg *messages.AuthenticatedMessage) (*messages.Ack, error)

Handles validation of reverse-authentication tokens

func (*Comms) PollNdf

func (nb *Comms) PollNdf(host *connect.Host, ndfHash []byte) (*pb.NDF, error)

PollNdf gets the NDF from the permissioning server

func (*Comms) ReceiveNotificationBatch

func (nb *Comms) ReceiveNotificationBatch(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)

func (*Comms) RegisterForNotifications

func (nb *Comms) RegisterForNotifications(_ context.Context, msg *pb.NotificationRegisterRequest) (*messages.Ack, error)

RegisterForNotifications event handler which registers a client with the notification bot

func (*Comms) RegisterToken

func (nb *Comms) RegisterToken(ctx context.Context, msg *pb.RegisterTokenRequest) (*messages.Ack, error)

func (*Comms) RegisterTrackedID

func (nb *Comms) RegisterTrackedID(ctx context.Context, msg *pb.RegisterTrackedIdRequest) (*messages.Ack, error)

func (*Comms) RequestNdf

func (nb *Comms) RequestNdf(host *connect.Host, message *pb.NDFHash) (*pb.NDF, error)

NotificationBot -> Permissioning Fixme: figure out what to do with notification bot and unified polling

func (*Comms) RequestToken

func (nb *Comms) RequestToken(context.Context, *messages.Ping) (*messages.AssignToken, error)

Handles reception of reverse-authentication token requests

func (*Comms) UnregisterForNotifications

func (nb *Comms) UnregisterForNotifications(_ context.Context, msg *pb.NotificationUnregisterRequest) (*messages.Ack, error)

UnregisterForNotifications event handler which unregisters a client with the notification bot

func (*Comms) UnregisterToken

func (nb *Comms) UnregisterToken(ctx context.Context, msg *pb.UnregisterTokenRequest) (*messages.Ack, error)

func (*Comms) UnregisterTrackedID

func (nb *Comms) UnregisterTrackedID(ctx context.Context, msg *pb.UnregisterTrackedIdRequest) (*messages.Ack, error)

type Handler

type Handler interface {
	// RegisterForNotifications event handler which registers a client with the notification bot
	RegisterForNotifications(msg *pb.NotificationRegisterRequest) error
	// UnregisterForNotifications event handler which unregisters a client with the notification bot
	UnregisterForNotifications(msg *pb.NotificationUnregisterRequest) error
	// ReceiveNotificationBatch receives the batch of notification data from gateway.
	ReceiveNotificationBatch(notifBatch *pb.NotificationBatch, auth *connect.Auth) error
	RegisterTrackedID(msg *pb.RegisterTrackedIdRequest) error
	UnregisterTrackedID(msg *pb.UnregisterTrackedIdRequest) error
	RegisterToken(msg *pb.RegisterTokenRequest) error
	UnregisterToken(msg *pb.UnregisterTokenRequest) error
}

Handler interface for the Notification Bot

type Implementation

type Implementation struct {
	Functions implementationFunctions
}

Implementation allows users of the client library to set the functions that implement the node functions

func NewImplementation

func NewImplementation() *Implementation

NewImplementation returns a Implementation struct with all of the function pointers returning nothing and printing an error.

func (*Implementation) ReceiveNotificationBatch

func (s *Implementation) ReceiveNotificationBatch(notifBatch *pb.NotificationBatch,
	auth *connect.Auth) error

ReceiveNotificationBatch receives the batch of notification data from gateway.

func (*Implementation) RegisterForNotifications

func (s *Implementation) RegisterForNotifications(request *pb.NotificationRegisterRequest) error

RegisterForNotifications event handler which registers a client with the notification bot

func (*Implementation) RegisterToken

func (s *Implementation) RegisterToken(msg *pb.RegisterTokenRequest) error

func (*Implementation) RegisterTrackedID

func (s *Implementation) RegisterTrackedID(msg *pb.RegisterTrackedIdRequest) error

func (*Implementation) UnregisterForNotifications

func (s *Implementation) UnregisterForNotifications(request *pb.NotificationUnregisterRequest) error

UnregisterForNotifications event handler which unregisters a client with the notification bot

func (*Implementation) UnregisterToken

func (s *Implementation) UnregisterToken(msg *pb.UnregisterTokenRequest) error

func (*Implementation) UnregisterTrackedID

func (s *Implementation) UnregisterTrackedID(msg *pb.UnregisterTrackedIdRequest) error

Jump to

Keyboard shortcuts

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