utils

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthStateCookieName = "auth_state"
)
View Source
const (
	SessionCookieName = "rank_guessr_session"
)

Variables

View Source
var (
	ErrNotEnoughGuesses = errors.New("not enough guesses available")
	ErrRoomClosed       = errors.New("room is already closed")
	ErrLimitExceeded    = errors.New("limit exceeded")
)

Functions

func GetSession

func GetSession(ctx *echo.Context) (domain.SessionExtended, error)

func GetSessionCookie

func GetSessionCookie(ctx *echo.Context) (string, error)

func NewID

func NewID() string

func ParseScoreURL

func ParseScoreURL(scoreURL string) (int, error)

func ReadAuthStateCookie

func ReadAuthStateCookie(ctx *echo.Context) (string, error)

func SetAuthStateCookie

func SetAuthStateCookie(ctx *echo.Context, domain, value string)

func SetSession

func SetSession(ctx *echo.Context, session domain.SessionExtended)

func SetSessionCookie

func SetSessionCookie(ctx *echo.Context, domain, sessionId string)

func UnsetAuthStateCookie

func UnsetAuthStateCookie(ctx *echo.Context, domain string)

func UnsetSessionCookie

func UnsetSessionCookie(ctx *echo.Context, domain string)

func ValidateTurnstile

func ValidateTurnstile(token, secret string) error

Types

type Map

type Map = map[string]any

type TurnstileError

type TurnstileError struct {
	Code string
}

func (*TurnstileError) Error

func (e *TurnstileError) Error() string

type TurnstileRequest

type TurnstileRequest struct {
	Token  string `json:"response"`
	Secret string `json:"secret"`
}

type TurnstileResponse

type TurnstileResponse struct {
	Success    bool     `json:"success"`
	ErrorCodes []string `json:"error-codes"`
}

Jump to

Keyboard shortcuts

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