apikeyssvc

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAPIKeyNotFound      = apikeys.ErrNotFound
	ErrAPIKeyAlreadyExists = apikeys.ErrSlugAlreadyExists
	ErrInvalidInput        = xerror.ValidationFailed()
	ErrInvalidToken        = xerror.InvalidCredentials()
	ErrAPIKeyRoleMismatch  = xerror.Forbidden(xerror.APIKey)
	ErrAPIKeyNotRevoked    = xerror.InvalidInput(xerror.APIKey).
							WithPublicDetail("API key must be revoked before deletion.")
)

Functions

This section is empty.

Types

type Service

type Service interface {
	ListAPIKeys(
		ctx context.Context,
		orgSlug slug.Slug,
		roleFilter *slug.Slug,
		req model.ListRequest,
	) (model.ListResponse[model.APIKey], error)
	CreateAPIKey(
		ctx context.Context,
		orgSlug slug.Slug,
		actor model.EventActor,
		newAPIKey model.NewAPIKey,
	) (*model.APIKeyWithToken, error)
	GetAPIKey(ctx context.Context, orgSlug, apiKeySlug slug.Slug) (*model.APIKey, error)
	UpdateAPIKey(
		ctx context.Context,
		orgSlug, apiKeySlug slug.Slug,
		actor model.EventActor,
		callerRole *slug.Slug,
		update model.UpdateAPIKey,
	) (*model.APIKey, error)
	RevokeAPIKey(ctx context.Context, orgSlug, apiKeySlug slug.Slug, actor model.EventActor, callerRole *slug.Slug) error
	DeleteRevokedAPIKey(ctx context.Context, orgSlug, apiKeySlug slug.Slug, actor model.EventActor) error
	RotateAPIKey(
		ctx context.Context,
		orgSlug, apiKeySlug slug.Slug,
		actor model.EventActor,
		callerRole *slug.Slug,
	) (*model.APIKeyWithToken, error)
	Authenticate(ctx context.Context, token string) (*model.APIKeyPrincipal, error)
}

func New

func New(
	txm postgres.TransactionManager,
	apiKeysRepo apikeys.Repository,
	rolesSvc rolessvc.Service,
	eventProducer workerproducer.EventProducer,
) Service

Jump to

Keyboard shortcuts

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