util

package
v0.0.0-...-5e2eff2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreValidUUIDs

func AreValidUUIDs(candidates ...string) bool

func BindAndValidate

func BindAndValidate[DTO interface{}](c echo.Context) (DTO, error)

func CheckAPIKey

func CheckAPIKey(keyStr string, hashStr string) bool

func CheckAgentKey

func CheckAgentKey(keyStr string, hashStr string) bool

func CleanPath

func CleanPath(filePath string) string

func GenAPIKeyAndHash

func GenAPIKeyAndHash() (keyStr string, hashStr string, err error)

func GenAgentKeyAndHash

func GenAgentKeyAndHash() (keyStr string, hashStr string, err error)

Note: because we're using a large, random key, there's no need to salt. Plus, we get more efficient lookups as we can deterministically hash the incoming key... ...when we do an auth lookup.

func GenericServerError

func GenericServerError(internal error) *echo.HTTPError

func HashAPIKey

func HashAPIKey(keyStr string) string

All just the same as the Agent Key stuff, but duplicating the code to keep it uncoupled

func HashAgentKey

func HashAgentKey(keyStr string) string

func ServerError

func ServerError(message string, internal error) *echo.HTTPError

func UnmarshalJSON

func UnmarshalJSON[T interface{}](jsonBlob string) (out T, err error)

func ValidatePasswordStrength

func ValidatePasswordStrength(password string) (ok bool, feedback string)

Types

type RequestValidator

type RequestValidator struct {
	Validator *validator.Validate
}

func (*RequestValidator) Init

func (v *RequestValidator) Init()

func (*RequestValidator) Validate

func (v *RequestValidator) Validate(i interface{}) error

Validate Data

type WrappedServerError

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

func (WrappedServerError) Error

func (e WrappedServerError) Error() string

func (WrappedServerError) ID

func (e WrappedServerError) ID() string

func (WrappedServerError) Unwrap

func (e WrappedServerError) Unwrap() error

Jump to

Keyboard shortcuts

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