utils

package
v0.0.0-...-f97eb1b Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionIdKey = "session_id"
)

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(hashedPassword string, password string) error

func HashPassword

func HashPassword(password string) (string, error)

func InvalidateSession

func InvalidateSession(session sessions.Session)

func InvalidateSessionAndCache

func InvalidateSessionAndCache(redisClient *redis.Client, ctx context.Context, session sessions.Session)

func RandomEmail

func RandomEmail() string

func RandomString

func RandomString(length int) string

Generates a random string of a given length using a specific character set

Types

type Config

type Config struct {
	DBSource             string        `mapstructure:"BINDER_DB_SOURCE"`
	DBDriver             string        `mapstructure:"BINDER_DB_DRIVER"`
	ServerAddress        string        `mapstructure:"BINDER_API_SERVER_ADDRESS"`
	TokenSymmetricKey    string        `mapstructure:"BINDER_TOKEN_SYMMETRIC_KEY"`
	AccessTokenDuration  time.Duration `mapstructure:"BINDER_ACCESS_TOKEN_DURATION"`
	RefreshTokenDuration time.Duration `mapstructure:"BINDER_REFRESH_TOKEN_DURATION"`
}

func LoadConfig

func LoadConfig(path string) (Config, error)

type UIConfig

type UIConfig struct {
	RedisUri         string `mapstructure:"REDIS_URI"`
	RedisSecret      string `mapstructure:"REDIS_SECRET"`
	ServerAddress    string `mapstructure:"BINDER_UI_SERVER_ADDRESS"`
	BinderApiBaseUrl string `mapstructure:"BINDER_API_BASE_URL"`
}

func LoadUiConfig

func LoadUiConfig(path string) (UIConfig, error)

Jump to

Keyboard shortcuts

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