csrf

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenEmpty        = errors.New("CSRF token empty")
	ErrTokenMalformed    = errors.New("CSRF token malformed")
	ErrTokenInvalid      = errors.New("CSRF token invalid")
	ErrTokenExpired      = errors.New("CSRF token expired")
	ErrNonceInsufficient = fmt.Errorf("CSRF nonce must be >= %d bytes", min)
)

Functions

This section is empty.

Types

type CSRF

type CSRF struct {
	Nonce   string    `json:"nonce"`
	Expires time.Time `json:"expires"`
}

func Verify

func Verify(key []byte, token Token, now time.Time) (CSRF, error)

type Token

type Token string

func New

func New(key []byte, expires time.Time) (Token, error)

func Sign

func Sign(key []byte, csrf CSRF) (Token, error)

Jump to

Keyboard shortcuts

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