package api import ( "log" "git.freecumextremist.com/grumbulon/pomme/internal" "github.com/go-chi/jwtauth/v5" ) var tokenAuth *jwtauth.JWTAuth func init() { if config, err := internal.ReadConfig(); err == nil { tokenAuth = jwtauth.New("HS256", []byte(config.HashingSecret), nil) } } func makeToken(username string) string { _, tokenString, err := tokenAuth.Encode(map[string]interface{}{"username": username, "admin": "false"}) if err != nil { log.Fatalln(err) } return tokenString }