csrf

package
v0.0.0-...-5cd70b9 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRFInputString

func CSRFInputString(ctx context.Context) string

func CSRFInputTempl

func CSRFInputTempl(ctx context.Context) templ.Component

func GenerateHMACCsrfToken

func GenerateHMACCsrfToken(
	sid, secret string,
) string

func GetCSRFToken

func GetCSRFToken(ctx context.Context) string

func VerifyHMACCsrfToken

func VerifyHMACCsrfToken(
	csrfToken, sid, secret string,
) bool

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(secret string) *Handler

func (*Handler) Middleware

func (h *Handler) Middleware(next http.Handler) http.Handler

func (*Handler) Verify

func (h *Handler) Verify(r *http.Request) error

func (*Handler) WriteAnonymousCSRFToken

func (h *Handler) WriteAnonymousCSRFToken(
	w http.ResponseWriter,
)

func (*Handler) WriteCSRFFromSID

func (h *Handler) WriteCSRFFromSID(r *http.Request, w http.ResponseWriter) string

func (*Handler) WriteCSRFToken

func (h *Handler) WriteCSRFToken(
	w http.ResponseWriter, sid string,
) string

Jump to

Keyboard shortcuts

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