store

package
v0.8.14 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultCodeTimeout  = 10 * time.Second
	DefaultStateTimeout = 2 * time.Minute
)

Functions

func Decode

func Decode[T any](encoded string) (T, error)

func Encode

func Encode[T any](state T) (string, error)

Types

type Code

type Code struct {
	Alias string   `json:"alias"`
	Scope []string `json:"scope"`
	Nonce string   `json:"nonce"`
}

type State

type State struct {
	RedirectURI string   `json:"redirect_uri"`
	State       string   `json:"state"`
	OrgState    string   `json:"org_state"`
	Scope       []string `json:"scope"`
	Nonce       string   `json:"nonce"`
}

type Store

type Store struct {
	// Active store type empty mean memory or could be redis.
	Active string           `cfg:"active"`
	Redis  connredis.Config `cfg:"redis"`
}

func (*Store) Init

func (m *Store) Init(ctx context.Context) (*StoreCache, error)

type StoreCache

type StoreCache struct {
	Code  cache.Cacher[string, string]
	State cache.Cacher[string, string]
	// contains filtered or unexported fields
}

func (*StoreCache) Close

func (m *StoreCache) Close() error

func (*StoreCache) CodeGen

func (m *StoreCache) CodeGen(ctx context.Context, alias string, scope []string) (string, error)

Jump to

Keyboard shortcuts

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