flowctx

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AsLoginChallenge   = withPurpose(loginChallenge)
	AsLoginVerifier    = withPurpose(loginVerifier)
	AsConsentChallenge = withPurpose(consentChallenge)
	AsConsentVerifier  = withPurpose(consentVerifier)
)

Functions

func Decode

func Decode[T any](ctx context.Context, cipher aead.Cipher, encoded string, opts ...CodecOption) (*T, error)

Decode decodes the given string to a value.

func Encode

func Encode(ctx context.Context, cipher aead.Cipher, val any, opts ...CodecOption) (s string, err error)

Encode encodes the given value to a string.

func FromCookie

func FromCookie[T any](ctx context.Context, r *http.Request, cipher aead.Cipher, cookieName string, opts ...CodecOption) (*T, error)

FromCookie looks up the value stored in the cookie and decodes it.

func LoginSessionCookie

func LoginSessionCookie(suffix CookieSuffixer) string

func SetCookie

func SetCookie(ctx context.Context, w http.ResponseWriter, reg interface {
	FlowCipher() *aead.XChaCha20Poly1305
	config.Provider
}, cookieName string, value any, opts ...CodecOption) error

SetCookie encrypts the given value and sets it in a cookie.

Types

type CodecOption

type CodecOption func(ad *data)

type CookieSuffixer

type CookieSuffixer interface {
	CookieSuffix() string
}

type StaticSuffix

type StaticSuffix string

func SuffixForClient

func SuffixForClient(c client.IDer) StaticSuffix

func SuffixFromStatic

func SuffixFromStatic(id string) StaticSuffix

func (StaticSuffix) CookieSuffix

func (s StaticSuffix) CookieSuffix() string

Jump to

Keyboard shortcuts

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