utils

package
v0.0.0-...-0064678 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ViperJWTTTLKey    = "service.jwt_ttl"
	ViperJWTSecretKey = "service.jwt_secret"
)

Variables

This section is empty.

Functions

func CreateCookie

func CreateCookie(name, value string, ttl int64) *http.Cookie

func CreateHTTPOnlyCookie

func CreateHTTPOnlyCookie(name, value string, ttl int64) *http.Cookie

func GenerateAuthToken

func GenerateAuthToken(atw *AuthTokenWrapper) (string, error)

func GenerateCSRFToken

func GenerateCSRFToken(userID string) (string, error)

func GetLimitArray

func GetLimitArray(array *[]string, limit, page int64) ([]string, int64, int64)

func GetLimitMessage

func GetLimitMessage(array *[]core.Message, limit, page int64) ([]core.Message, int64, int64)

func IsLarge

func IsLarge(res bool) int64

func RefreshIfNeededCSRFToken

func RefreshIfNeededCSRFToken(token string, userID string) (string, error)

Types

type AuthTokenWrapper

type AuthTokenWrapper struct {
	UserID string `json:"user_id"`
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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