util

package
v0.0.0-...-32f65d2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AuthIdCtxKey = contextKey{"authId"}
)

Functions

func Authenticator

func Authenticator() func(http.Handler) http.Handler

func CreateAuthVerifier

func CreateAuthVerifier(pubKey ed25519.PublicKey) *jwtauth.JWTAuth

func GetFormattedWeek

func GetFormattedWeek(date time.Time) string

func GetLastNWeeks

func GetLastNWeeks(date time.Time, n int) []string

func GetRawPublicKey

func GetRawPublicKey() (ed25519.PublicKey, error)

func GetWeeksArray

func GetWeeksArray(weekStr string) []string

func JSONError

func JSONError(w http.ResponseWriter, err ErrorParam, code int)

func SanitizeString

func SanitizeString(s string) string

Sanitizes a string to conform to Turso database name requirements. https://docs.turso.tech/api-reference/databases/create#body-name

func SortISOWeeks

func SortISOWeeks(isoWeeks []string) []string

Types

type ErrorParam

type ErrorParam struct {
	Error string `json:"error"`
}

type ISOWeek

type ISOWeek struct {
	Year int
	Week int
}

func ParseISOWeek

func ParseISOWeek(iso string) (ISOWeek, error)

type JWKS

type JWKS struct {
	Keys []Key `json:"keys"`
}

type Key

type Key struct {
	Crv string `json:"crv"`
	X   string `json:"x"`
	Kty string `json:"kty"`
	Kid string `json:"kid"`
}

Jump to

Keyboard shortcuts

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