telegram

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func SetUser

func SetUser(ctx context.Context, user User) context.Context

Types

type Auth

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

func (Auth) Middleware

func (a Auth) Middleware(next http.Handler) http.Handler

func (Auth) UnaryServerInterceptor

func (a Auth) UnaryServerInterceptor(
	ctx context.Context,
	in any,
	_ *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
) (any, error)

func (Auth) Validate

func (obj Auth) Validate() error

type AuthConfig

type AuthConfig struct {
	BotTokens        map[string]string `yaml:"bot_tokens" validate:"required,dive,keys,required,endkeys,required"` //nolint:lll
	NoSignatureCheck bool              `yaml:"no_signature_check"`
}

type AuthOption

type AuthOption c.Option[Auth]

func WithAuthBotTokens

func WithAuthBotTokens(botTokens map[string]string) AuthOption

func WithAuthLogger

func WithAuthLogger(logger *zap.Logger) AuthOption

func WithAuthNoBotAllowed added in v0.7.7

func WithAuthNoBotAllowed() AuthOption

func WithAuthNoSignatureCheck added in v0.7.7

func WithAuthNoSignatureCheck(noSignatureCheck bool) AuthOption

type Config

type Config struct {
	WebApp WebAppConfig `yaml:"webapp"`
}

type User

type User struct {
	Username     string `validate:"required"`
	FirstName    string `validate:"required"`
	LastName     string `validate:"required"`
	AuthorityBot string `validate:"required"`
	ID           int64  `validate:"required"`
	IsBot        bool
}

func GetUser

func GetUser(ctx context.Context) (User, error)

type WebAppConfig

type WebAppConfig struct {
	Auth AuthConfig
}

Jump to

Keyboard shortcuts

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