helper

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package helper provides helper functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogAndExit

func LogAndExit(message string, code int)

func StrPtr2Str

func StrPtr2Str(str *string) string

Types

type JwtClaims

type JwtClaims struct {
	UserId      int32  `json:"user_id"`
	Username    string `json:"username"`
	RefreshUUID string `json:"refresh_uuid"` // If 2FA is enabled, this will be false until the user has authenticated with TOTP
	jwt.RegisteredClaims
}

func GetClaimsFromContext

func GetClaimsFromContext(c echo.Context) *JwtClaims

type TokenDetails

type TokenDetails struct {
	AccessToken  string
	RefreshToken string
	RefreshUUID  string
	AtExpires    *jwt.NumericDate
	RtExpires    *jwt.NumericDate
}

func GenerateToken

func GenerateToken(claims *JwtClaims) (*TokenDetails, error)

type Validator added in v0.0.2

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

Validator is a wrapper around the validator package

func NewValidator added in v0.0.2

func NewValidator() *Validator

NewValidator returns a new Validator

func (*Validator) Validate added in v0.0.2

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

Validate validates a struct based on the tags

Jump to

Keyboard shortcuts

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