csrf

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithValidity

func WithValidity(t time.Duration) option

WithValidity configures how long the csrf tokens are valid for.

Types

type KeyStore

type KeyStore interface {
	LoadPrivateKey(string) ([]byte, *rsa.PrivateKey, error)
	LoadPublicKey(string) ([]byte, error)
}

KeyStore interface for retrieving keys (used for encrypting session cookie)

type Module

type Module struct {
	Logger *logger.Module

	KeyFile string
	// contains filtered or unexported fields
}

func (*Module) Configure

func (m *Module) Configure(opts ...option)

Configure this module with given options

func (*Module) Decode

func (m *Module) Decode(token string) (*csrfPayload, error)

Decode an encrypted token

func (*Module) Init

func (m *Module) Init(c *service.Config)

Init implements module.Init

func (*Module) New

func (m *Module) New(state string) (string, error)

New creates a new encrypted token for the given UserSession

func (*Module) Verify

func (m *Module) Verify(state, token string) (bool, error)

Verify an encrypted token

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳