mypaste

package
v0.0.0-...-0599bf5 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEventHandler

func AddEventHandler(streamService StreamService) echo.HandlerFunc

func ApiNotFoundHandler

func ApiNotFoundHandler(c echo.Context) error

func AuthenticateHandler

func AuthenticateHandler(jwtSignKey string) echo.HandlerFunc

func DeleteEventsHandler

func DeleteEventsHandler(streamService StreamService) echo.HandlerFunc

func GetDevicesHandler

func GetDevicesHandler(streamService StreamService) echo.HandlerFunc

func GetEnvVerbose

func GetEnvVerbose(name string, sensitive bool) string

func LoginCallbackHandler

func LoginCallbackHandler(validator IdTokenValidator, jwtSignKey string) echo.HandlerFunc

func LoginPageHandler

func LoginPageHandler(gClientId, callbackUri string) echo.HandlerFunc

func LogoutHandler

func LogoutHandler() echo.HandlerFunc

func NewAuthMiddleware

func NewAuthMiddleware(jwtSignKey string) echo.MiddlewareFunc

func NewWebappServerMiddleware

func NewWebappServerMiddleware(bundleDir string) echo.MiddlewareFunc

func ReadEventsHandler

func ReadEventsHandler(streamService StreamService) echo.HandlerFunc

func ResetStreamHandler

func ResetStreamHandler(streamService StreamService) echo.HandlerFunc

func RootHandler

func RootHandler(c echo.Context) error

func Start

func Start()

Types

type Device

type Device struct {
	Id          string
	Description string
}

type Event

type Event struct {
	Id          string `json:",omitempty"`
	Payload     string
	Timestamp   int64
	Kind        string
	IsSensitive bool
}

type IdTokenValidator

type IdTokenValidator interface {
	Validate(ctx context.Context, idToken string) (*idtoken.Payload, error)
}

func NewIdTokenValidator

func NewIdTokenValidator(gClientId string) IdTokenValidator

type RedisStreamConfig

type RedisStreamConfig struct {
	MaxLen    int64
	ReadCount int64
	ReadBlock time.Duration
}

type Renderer

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

func NewRenderer

func NewRenderer() *Renderer

func (*Renderer) Render

func (t *Renderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error

type StreamService

type StreamService interface {
	Add(ctx context.Context, stream string, event Event) (Event, error)
	Read(ctx context.Context, stream, lastId string) ([]Event, error)
	Delete(ctx context.Context, stream string, ids ...string) (int64, error)
	Reset(ctx context.Context, stream string) error
	AddDevice(ctx context.Context, stream string, device Device) (Device, error)
	AddFirstDevice(ctx context.Context, stream string, device Device) (Device, error)
	GetDevices(ctx context.Context, stream string) ([]Device, error)
}

func NewRedisStreamService

func NewRedisStreamService(client *redis.Client, config RedisStreamConfig) StreamService

type TokenClaims

type TokenClaims struct {
	User
	jwt.RegisteredClaims
}

type User

type User struct {
	Name  string
	Email string
}

func GetAuthorizedUser

func GetAuthorizedUser(c echo.Context) User

Jump to

Keyboard shortcuts

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