runtime

package
v0.2.26 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlowfishEnsureKey

func BlowfishEnsureKey(salt string) []byte

BlowfishEnsureKey derives a stable 32-byte key from the given salt/passphrase. It uses the same derivation as other blowfish helpers for consistency.

func NewTokenStore

func NewTokenStore(refreshDir string, key tokens.KeyProvider, policy tokens.StoragePolicy) (*tokens.Store, error)

NewTokenStore constructs a tokens.Store with an encrypted file-backed refresh store. - refreshDir: directory for encrypted refresh blobs (created with 0700 perms) - key: key provider for encrypting refresh tokens - policy: storage policy for access/id and refresh tokens

Types

type Option

type Option func(*Runtime)

Option configures Runtime.

func WithMetrics

func WithMetrics(m obs.Metrics) Option

WithMetrics sets a metrics recorder.

func WithMinTTL

func WithMinTTL(ttl resolver.MinTTL) Option

WithMinTTL sets proactive refresh thresholds.

func WithTracer

func WithTracer(t obs.Tracer) Option

WithTracer sets a tracer for debug events.

type RawKeyProvider

type RawKeyProvider struct{ K []byte }

RawKeyProvider implements tokens.KeyProvider using provided key bytes. Use BlowfishEnsureKey to derive a 32-byte key from a passphrase when needed.

func (RawKeyProvider) Key

func (r RawKeyProvider) Key() ([]byte, error)

type Runtime

type Runtime struct {
	CookieJars *cookiejar.Manager
	Store      *tokens.Store
	Broker     resolver.Broker
	MinTTL     resolver.MinTTL
	Tracer     obs.Tracer
	Metrics    obs.Metrics
}

Runtime bundles auth-related dependencies for dependency injection. It avoids global singletons and lets services share a single resolver and cookie jar manager for the application lifetime.

func New

func New(cj *cookiejar.Manager, st *tokens.Store, br resolver.Broker, opts ...Option) *Runtime

New constructs a Runtime. Callers should provide a shared cookie manager, token store and a broker implementation.

func (*Runtime) ClearCookieJar

func (r *Runtime) ClearCookieJar(originKey string)

ClearCookieJar removes a cookie jar identified by its origin key.

func (*Runtime) CookieJarForAuthority

func (r *Runtime) CookieJarForAuthority(a authority.AuthAuthority) (http.CookieJar, string, error)

CookieJarForAuthority returns a per-authority cookie jar and its origin key.

func (*Runtime) NewResolver

func (r *Runtime) NewResolver() (*resolver.Resolver, error)

NewResolver creates a resolver bound to this runtime's store and broker.

func (*Runtime) OriginKey

func (r *Runtime) OriginKey(a authority.AuthAuthority) string

OriginKey returns a normalized origin key for the provided authority.

Jump to

Keyboard shortcuts

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