apikeyssvc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAPIKeyNotFound      = apikeys.ErrNotFound
	ErrAPIKeyAlreadyExists = apikeys.ErrSlugAlreadyExists
	ErrInvalidInput        = xerror.ValidationFailed()
	ErrInvalidToken        = xerror.InvalidCredentials()
	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,
		update model.UpdateAPIKey,
	) (*model.APIKey, error)
	RevokeAPIKey(ctx context.Context, orgSlug, apiKeySlug slug.Slug, actor model.EventActor) error
	DeleteRevokedAPIKey(ctx context.Context, orgSlug, apiKeySlug slug.Slug, actor model.EventActor) error
	RotateAPIKey(
		ctx context.Context,
		orgSlug, apiKeySlug slug.Slug,
		actor model.EventActor,
	) (*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