utils

package
v0.0.0-...-087a31b Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JWT_METHOD = jwt.SigningMethodHS512
	JWT_SECRET = make([]byte, 64)
)

Functions

func And

func And(bs []bool) bool

func Any

func Any[X any](xs []X, f func(x X) bool) bool

func ClearCookie

func ClearCookie(name string) *http.Cookie

func EmptyOrAny

func EmptyOrAny[X any](xs []X, f func(x X) bool) bool

func Filter

func Filter[X any](xs []X, f func(x X) bool) []X

func HashPassword

func HashPassword(pass string) (string, error)

func MakeCookie

func MakeCookie(name, value string) *http.Cookie

func Map

func Map[X, Y any](xs []X, f func(x X) Y) []Y

func Or

func Or(bs []bool) bool

func SignCookie

func SignCookie[X any](data X) (*http.Cookie, error)

func VerifyCookie

func VerifyCookie[X any](cookie *http.Cookie) (*X, error)

func VerifyPassword

func VerifyPassword(pass, hash string) (bool, error)

Types

type CookieData

type CookieData[X any] struct {
	jwt.RegisteredClaims
	Data X
}

Jump to

Keyboard shortcuts

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