Documentation
¶
Index ¶
- Variables
- func CompareHashPass(hashedPass, pass string) error
- func CompareTokenHash(storedHash, token string) bool
- func CopyContext(ctx context.Context) context.Context
- func ElapsedTime(ctx context.Context) (time.Duration, bool)
- func GenerateAndSetKeys()
- func GetContextValue(ctx context.Context, key ContextKey) (interface{}, bool)
- func GetEdDSAKeysFromEnv() (ed25519.PrivateKey, ed25519.PublicKey, error)
- func GetMethod(ctx context.Context) (string, bool)
- func GetPath(ctx context.Context) (string, bool)
- func GetQueryParam[T string | int](r *http.Request, key string, defaultVal T) T
- func GetRequestBody(ctx context.Context) any
- func GetRequestID(ctx context.Context) (string, bool)
- func GetUser(ctx context.Context) *models.User
- func HashPass(pass string) (string, error)
- func HashToken(token string) string
- func Ptr[T any](v T) *T
- func SetRequestBody(ctx context.Context, body any) context.Context
- func SetUser(ctx context.Context, user *models.User) context.Context
- type ContextKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ContextKeys = map[ContextKey]struct{}{ UserCtxKey: {}, RequestBodyKey: {}, RequestIDKey: {}, TimeKey: {}, PathKey: {}, MethodKey: {}, }
Functions ¶
func CompareHashPass ¶
func CompareTokenHash ¶
func GenerateAndSetKeys ¶
func GenerateAndSetKeys()
func GetContextValue ¶
func GetContextValue(ctx context.Context, key ContextKey) (interface{}, bool)
func GetEdDSAKeysFromEnv ¶
func GetEdDSAKeysFromEnv() (ed25519.PrivateKey, ed25519.PublicKey, error)
func GetQueryParam ¶
func GetRequestBody ¶
Types ¶
type ContextKey ¶
type ContextKey string
const ( UserCtxKey ContextKey = "user" RequestBodyKey ContextKey = "request-body" RequestIDKey ContextKey = "request-id" TimeKey ContextKey = "time" PathKey ContextKey = "path" MethodKey ContextKey = "method" )
Click to show internal directories.
Click to hide internal directories.