Documentation ¶
Index ¶
- Variables
- func Decode[T any](ctx context.Context, cipher aead.Cipher, encoded string, opts ...CodecOption) (*T, error)
- func Encode(ctx context.Context, cipher aead.Cipher, val any, opts ...CodecOption) (s string, err error)
- func FromCookie[T any](ctx context.Context, r *http.Request, cipher aead.Cipher, cookieName string, ...) (*T, error)
- func LoginSessionCookie(suffix CookieSuffixer) string
- func SetCookie(ctx context.Context, w http.ResponseWriter, reg interface{ ... }, ...) error
- type CodecOption
- type CookieSuffixer
- type StaticSuffix
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
Click to show internal directories.
Click to hide internal directories.