repository

package
v0.0.0-...-9cb5758 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound       = errors.New("not found")
	ErrFailedDBWrite  = errors.New("failed to write entry")
	ErrFailedDBDelete = errors.New("failed to remove entry")
)

Functions

func WithCleanupSchedule

func WithCleanupSchedule(cron string) cfg.Option[Config]

func WithCleanupTimeout

func WithCleanupTimeout(dur time.Duration) cfg.Option[Config]

func WithLogger

func WithLogger(logger *slog.Logger) cfg.Option[Config]

func WithMetrics

func WithMetrics(m Metrics) cfg.Option[Config]

func WithTrace

func WithTrace(tracer trace.Tracer) cfg.Option[Config]

Types

type Certificate

type Certificate struct {
	Raw    []byte
	Expiry time.Time
}

type Challenge

type Challenge struct {
	Raw    []byte
	Expiry time.Time
}

type Config

type Config struct {
	// contains filtered or unexported fields
}

type Metrics

type Metrics interface {
	IncSchedulerNextCalls()
	IncExecutorExecCalls(id string)
	IncExecutorExecErrors(id string)
	ObserveExecLatency(ctx context.Context, id string, dur time.Duration)
	IncExecutorNextCalls(id string)
	IncSelectorSelectCalls()
	IncSelectorSelectErrors()
}

type Services

type Services struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(db *sql.DB, opts ...cfg.Option[Config]) (*Services, error)

func (*Services) CreateCertificate

func (r *Services) CreateCertificate(ctx context.Context, service string, cert []byte, expiry time.Time) error

func (*Services) CreateService

func (r *Services) CreateService(ctx context.Context, service string, pubKey []byte) (err error)

func (*Services) DeleteCertificate

func (r *Services) DeleteCertificate(ctx context.Context, service string, cert []byte) error

func (*Services) DeleteService

func (r *Services) DeleteService(ctx context.Context, service string) error

func (*Services) GetService

func (r *Services) GetService(ctx context.Context, service string) (pubKey []byte, err error)

func (*Services) ListCertificates

func (r *Services) ListCertificates(ctx context.Context, service string) (certs []*pb.CertificateResponse, err error)

func (*Services) Shutdown

func (r *Services) Shutdown(_ context.Context) error

type Token

type Token struct {
	Raw    []byte
	Expiry time.Time
}

type Tokens

type Tokens struct {
	// contains filtered or unexported fields
}

func NewToken

func NewToken(db *sql.DB, opts ...cfg.Option[Config]) (*Tokens, error)

func (*Tokens) CreateChallenge

func (r *Tokens) CreateChallenge(
	ctx context.Context, service string, challenge []byte, expiry time.Time) error

func (*Tokens) CreateToken

func (r *Tokens) CreateToken(ctx context.Context, service string, token []byte, expiry time.Time) error

func (*Tokens) DeleteChallenge

func (r *Tokens) DeleteChallenge(ctx context.Context, service string, challenge []byte) error

func (*Tokens) DeleteToken

func (r *Tokens) DeleteToken(ctx context.Context, service string, token []byte) error

func (*Tokens) ListChallenges

func (r *Tokens) ListChallenges(ctx context.Context, service string) (challenges []*pb.LoginResponse, err error)

func (*Tokens) ListTokens

func (r *Tokens) ListTokens(ctx context.Context, service string) (tokens []*pb.TokenResponse, err error)

func (*Tokens) Shutdown

func (r *Tokens) Shutdown(_ context.Context) error

Jump to

Keyboard shortcuts

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