mediator

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Access token errors
	ErrAccessTokenInvalid = "Invalid access token."
	// Refresh token errors
	ErrInvalidRefreshToken = "Invalid refresh token."
	ErrExpiredRefreshToken = "Refresh token has expired."
	ErrRefreshTokenRevoked = "Refresh token has been revoked."
	// Actor account header: user must be an account member
	ErrActorAccountRequiresMember = "" /* 133-byte string literal not displayed */
)

Variables

This section is empty.

Functions

func NewAPIKeyMed

func NewAPIKeyMed(config *APIKeyMedConfig) domain.APIKeyMed

func NewDocAPIKeyMed

func NewDocAPIKeyMed(config *DocAPIKeyMedConfig) domain.DocAPIKeyMed

func NewIdempotencyMed

func NewIdempotencyMed(config *IdempotencyMedConfig) domain.IdempotencyMed

func NewMediatorFactory

func NewMediatorFactory(config *MediatorFactoryConfig) domain.MediatorFactory

NewMediatorFactory creates a mediator factory that mirrors the repository factory style: inject shared dependencies once, then build mediators bound to a specific repository factory (e.g., per transaction).

func NewPasswordMed

func NewPasswordMed(config *PasswordMedConfig) domain.PasswordMed

func NewRefreshTokenMed

func NewRefreshTokenMed(config *RefreshTokenMedConfig) domain.RefreshTokenMed

func NewRegistrationMed

func NewRegistrationMed(config *RegistrationMedConfig) domain.RegistrationMed

func NewUserMed

func NewUserMed(config *UserMedConfig) domain.UserMed

Types

type APIKeyMedConfig

type APIKeyMedConfig struct {
	// Repos (required) is the repository factory for API key persistence.
	Repos domain.RepoFactory

	// Pepper (required) is the pepper mixed into API key hashes.
	Pepper []byte

	// CoreClient (required) is the core-service client used to resolve accounts.
	CoreClient domain.AuthCoreClient
}

type DocAPIKeyMedConfig

type DocAPIKeyMedConfig struct {
	// Repos (required) is the repository factory for doc API key persistence.
	Repos domain.RepoFactory

	// EncryptionKey (required) encrypts doc API keys at rest.
	EncryptionKey []byte

	// CoreClient (required) is the core-service client used to resolve accounts.
	CoreClient domain.AuthCoreClient

	// APIKeyMed (required) manages the underlying API keys.
	APIKeyMed domain.APIKeyMed
}

type IdempotencyMedConfig

type IdempotencyMedConfig struct {
	// Repos (required) is the repository factory for idempotency persistence.
	Repos domain.RepoFactory
}

type MediatorFactoryConfig

type MediatorFactoryConfig struct {
	// JWTSecret (required) signs and verifies JWT access tokens.
	JWTSecret string // #nosec G117 - Struct field, not a hardcoded credential

	// APIKeyPepper (required) is the pepper mixed into API key hashes.
	APIKeyPepper []byte

	// NotificationPublisher (required) publishes notification messages to the outbox.
	NotificationPublisher domain.NotificationPublisher

	// FrontendURL (required) is the dashboard base URL used in emails and redirects.
	FrontendURL string

	// CoreClient (required) is the core-service client used by the mediators.
	CoreClient domain.AuthCoreClient

	// DocAPIKeyEncryptionKey (optional; default: nil) encrypts doc API keys at rest. When empty, the doc API key mediator is not constructed.
	DocAPIKeyEncryptionKey []byte
}

MediatorFactoryConfig declares the dependencies needed to build mediators.

type PasswordMedConfig

type PasswordMedConfig struct {
	// Repos (required) is the repository factory for credential persistence.
	Repos domain.RepoFactory

	// RefreshTokenMed (required) revokes refresh tokens on password changes.
	RefreshTokenMed domain.RefreshTokenMed

	// JWTSecret (required) signs and verifies password-flow JWTs.
	JWTSecret string // #nosec G117 - Struct field, not a hardcoded credential

	// NotificationPublisher (required) publishes notification messages to the outbox.
	NotificationPublisher domain.NotificationPublisher

	// FrontendURL (required) is the dashboard base URL used in password emails.
	FrontendURL string
}

type RefreshTokenMedConfig

type RefreshTokenMedConfig struct {
	// Repos (required) is the repository factory for refresh token persistence.
	Repos domain.RepoFactory
}

type RegistrationMedConfig

type RegistrationMedConfig struct {
	// Repos (required) is the repository factory for registration persistence.
	Repos domain.RepoFactory

	// NotificationPublisher (required) publishes notification messages to the outbox.
	NotificationPublisher domain.NotificationPublisher

	// FrontendURL (required) is the dashboard base URL used in registration emails.
	FrontendURL string

	// UserMed (required) creates and manages users during registration.
	UserMed domain.UserMed

	// RefreshTokenMed (required) issues refresh tokens on successful registration.
	RefreshTokenMed domain.RefreshTokenMed
}

type UserMedConfig

type UserMedConfig struct {
	// Repos (required) is the repository factory for user persistence.
	Repos domain.RepoFactory

	// JWTSecret (required) signs and verifies user-flow JWTs.
	JWTSecret string // #nosec G117 - Struct field, not a hardcoded credential

	// FrontendURL (required) is the dashboard base URL used in user emails.
	FrontendURL string

	// RefreshTokenMed (required) manages refresh tokens for user sessions.
	RefreshTokenMed domain.RefreshTokenMed

	// APIKeyMed (required) manages the user's API keys.
	APIKeyMed domain.APIKeyMed

	// CoreClient (required) is the core-service client used to resolve accounts.
	CoreClient domain.AuthCoreClient

	// NotificationPublisher (required) publishes notification messages to the outbox.
	NotificationPublisher domain.NotificationPublisher
}

Jump to

Keyboard shortcuts

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