utils

package
v0.8.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password string, hash string) bool

func CreateDirIfNotExists

func CreateDirIfNotExists(dir string) error

func GetOrFile

func GetOrFile(envVar string) (string, error)

GetOrFile attempts to resolve 'key' as an environment variable. Failing that, it will check to see if '<key>_FILE' exists. If so, it will attempt to read from the referenced file to populate a value.

func HashPassword

func HashPassword(password string) (string, error)

func MustGet

func MustGet(k string) string

MustGet will return the env or panic if it is not present

func MustGetBool

func MustGetBool(k string) bool

MustGetBool will return the env as boolean or panic if it is not present

func MustGetInt32

func MustGetInt32(k string) int32

MustGetInt32 will return the env as int32 or panic if it is not present

func MustGetInt64

func MustGetInt64(k string) int64

MustGetInt64 will return the env as int64 or panic if it is not present

func MustGetOrFile added in v0.8.0

func MustGetOrFile(envVar string) string

MustGetOrFile attempts to resolve 'key' as an environment variable. Failing that, it will check to see if '<key>_FILE' exists. If so, it will attempt to read from the referenced file to populate a value. If that fails, it will panic.

Types

type CustomClaims

type CustomClaims struct {
	UserID uuid.UUID `json:"user_id"`
	jwt.RegisteredClaims
}

type JWTKeyStore

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

func InitJWTKeyStore

func InitJWTKeyStore(jwtConfig *JWTKeyStoreConfig) (*JWTKeyStore, error)

func (*JWTKeyStore) GenerateJWT

func (ks *JWTKeyStore) GenerateJWT(userID uuid.UUID) (string, error)

GenerateJWT generates JWT with the provided data

func (*JWTKeyStore) ParseJWT

func (ks *JWTKeyStore) ParseJWT(tokenString string) (uuid.UUID, error)

ParseJWT parses the JWT

type JWTKeyStoreConfig

type JWTKeyStoreConfig struct {
	PrivateKeyPath string
	PublicKeyPath  string
	Algorithm      string
	TimeoutSec     int32
}

JWTKeyStoreConfig defines the options for JWTKeyStore

type VCSBuildInfo

type VCSBuildInfo struct {
	CommitTime string
	Commit     string
	Modified   string
}

func GetVscBuildInfo

func GetVscBuildInfo() (*VCSBuildInfo, error)

Jump to

Keyboard shortcuts

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